@mistriwork/mistri 1.0.0-rc.51 → 1.0.0-rc.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +1 -1
- package/dist/docs/status.md +3 -3
- package/dist/embed/react/headless.js +1 -1
- package/dist/embed/react/index.js +1 -1
- package/dist/server/tenant/tenantPostgresCatalog.d.ts +16 -1
- package/dist/server/tenant/tenantPostgresCatalog.js +93 -3
- package/dist/ssr/render.js +1 -1
- package/package.json +4 -4
package/dist/ssr/render.js
CHANGED
|
@@ -205,7 +205,7 @@ img.ProseMirror-separator {
|
|
|
205
205
|
`).length,u=e.split(`
|
|
206
206
|
`).slice(0,l).join(`
|
|
207
207
|
`);return{...c,raw:u}}},addCommands(){return{insertTable:({rows:e=3,cols:t=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:a})=>{let o=Ute(a.schema,e,t,n);if(i){let e=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(wd.near(r.doc.resolve(e)))}return!0},addColumnBefore:()=>({state:e,dispatch:t})=>Dte(e,t),addColumnAfter:()=>({state:e,dispatch:t})=>Ote(e,t),deleteColumn:()=>({state:e,dispatch:t})=>{let n=gv(e.selection.$from,e=>e.type.name===`table`);return Ate(e,t&&(e=>{n&&lA(e,n.pos),t(e)}))},addRowBefore:()=>({state:e,dispatch:t})=>Mte(e,t),addRowAfter:()=>({state:e,dispatch:t})=>Nte(e,t),deleteRow:()=>({state:e,dispatch:t})=>{let n=gv(e.selection.$from,e=>e.type.name===`table`);return Fte(e,t&&(e=>{n&&lA(e,n.pos),t(e)}))},deleteTable:()=>({state:e,dispatch:t})=>nk(e,t),mergeCells:()=>({state:e,dispatch:t})=>ZO(e,t),splitCell:()=>({state:e,dispatch:t})=>QO(e,t),toggleHeaderColumn:()=>({state:e,dispatch:t})=>ek(`column`)(e,t),toggleHeaderRow:()=>({state:e,dispatch:t})=>ek(`row`)(e,t),toggleHeaderCell:()=>({state:e,dispatch:t})=>Uk(e,t),mergeOrSplit:()=>({state:e,dispatch:t})=>ZO(e,t)?!0:QO(e,t),setCellAttribute:(e,t)=>({state:n,dispatch:r})=>Rte(e,t)(n,r),goToNextCell:()=>({state:e,dispatch:t})=>tk(1)(e,t),goToPreviousCell:()=>({state:e,dispatch:t})=>tk(-1)(e,t),fixTables:()=>({state:e,dispatch:t})=>(t&&GO(e),!0),setCellSelection:e=>({tr:t,dispatch:n})=>{if(n){let n=Bk.create(t.doc,e.anchorCell,e.headCell);t.setSelection(n)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:gA,"Mod-Backspace":gA,Delete:gA,"Mod-Delete":gA}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[Sk({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],Fk({allowTableNodeSelection:this.options.allowTableNodeSelection}),Zte()]},addNodeView(){let e=this.options.resizable&&this.editor.isEditable,t=this.options.View;return e||!t?null:({node:e,view:n,HTMLAttributes:r})=>{let i=Ov(this.options.HTMLAttributes,r);return new t(e,this.options.cellMinWidth,n,i)}},extendNodeSchema(e){return{tableRole:Sv(vv(e,`tableRole`,{name:e.name,options:e.options,storage:e.storage}))}}}),Fx.create({name:`tableKit`,addExtensions(){let e=[];return this.options.table!==!1&&e.push(vA.configure(this.options.table)),this.options.tableCell!==!1&&e.push(fA.configure(this.options.tableCell)),this.options.tableHeader!==!1&&e.push(pA.configure(this.options.tableHeader)),this.options.tableRow!==!1&&e.push(mA.configure(this.options.tableRow)),e}})}));function yA(e,t,n){return LA(e,IA(t,n))}function bA(e,t){return typeof e==`function`?e(t):e}function xA(e){return e.split(`-`)[0]}function SA(e){return e.split(`-`)[1]}function CA(e){return e===`x`?`y`:`x`}function wA(e){return e===`y`?`height`:`width`}function TA(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function EA(e){return CA(TA(e))}function DA(e,t,n){n===void 0&&(n=!1);let r=SA(e),i=EA(e),a=wA(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=MA(o)),[o,MA(o)]}function OA(e){let t=MA(e);return[kA(e),t,kA(t)]}function kA(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}function AA(e,t,n){switch(e){case`top`:case`bottom`:return n?t?UA:HA:t?HA:UA;case`left`:case`right`:return t?WA:GA;default:return[]}}function jA(e,t,n,r){let i=SA(e),a=AA(xA(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(kA)))),a}function MA(e){let t=xA(e);return VA[t]+e.slice(t.length)}function NA(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function PA(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:NA(e)}function FA(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}}var IA,LA,RA,zA,BA,VA,HA,UA,WA,GA,KA=s((()=>{IA=Math.min,LA=Math.max,RA=Math.round,zA=Math.floor,BA=e=>({x:e,y:e}),VA={left:`right`,right:`left`,bottom:`top`,top:`bottom`},HA=[`left`,`right`],UA=[`right`,`left`],WA=[`top`,`bottom`],GA=[`bottom`,`top`]}));function qA(e,t,n){let{reference:r,floating:i}=e,a=TA(t),o=EA(t),s=wA(o),c=xA(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=SA(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function JA(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}=bA(t,e),p=PA(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=FA(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=FA(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}}async function YA(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=xA(n),s=SA(n),c=TA(n)===`y`,l=$A.has(o)?-1:1,u=a&&c?-1:1,d=bA(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 XA,ZA,QA,$A,ej,tj,nj,rj,ij=s((()=>{KA(),XA=50,ZA=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:JA},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=qA(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<XA&&(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}=qA(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},QA=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}=bA(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=xA(r),_=TA(o),v=xA(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[MA(o)]:OA(o)),x=p!==`none`;!d&&x&&b.push(...jA(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=DA(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`||_===TA(t)||T.every(e=>TA(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=TA(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{}}}},$A=new Set([`left`,`top`]),ej=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 YA(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}}}}},tj=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}=bA(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=TA(i),p=CA(f),m=u[p],h=u[f],g=(e,t)=>yA(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}}}}}},nj=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}=bA(e,t),u={x:n,y:r},d=TA(i),f=CA(d),p=u[f],m=u[d],h=bA(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=$A.has(xA(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}}}},rj=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}=bA(e,t),c=await i.detectOverflow(t,s),l=xA(n),u=SA(n),d=TA(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=IA(p-c[m],g),y=IA(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*LA(c.left,c.right):S=p-2*LA(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 aj(){return typeof window<`u`}function oj(e){return lj(e)?(e.nodeName||``).toLowerCase():`#document`}function sj(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function cj(e){return((lj(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function lj(e){return aj()?e instanceof Node||e instanceof sj(e).Node:!1}function uj(e){return aj()?e instanceof Element||e instanceof sj(e).Element:!1}function dj(e){return aj()?e instanceof HTMLElement||e instanceof sj(e).HTMLElement:!1}function fj(e){return!aj()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof sj(e).ShadowRoot}function pj(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=bj(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function mj(e){return/^(table|td|th)$/.test(oj(e))}function hj(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}function gj(e){let t=uj(e)?bj(e):e;return Oj(t.transform)||Oj(t.translate)||Oj(t.scale)||Oj(t.rotate)||Oj(t.perspective)||!vj()&&(Oj(t.backdropFilter)||Oj(t.filter))||Ej.test(t.willChange||``)||Dj.test(t.contain||``)}function _j(e){let t=Sj(e);for(;dj(t)&&!yj(t);){if(gj(t))return t;if(hj(t))return null;t=Sj(t)}return null}function vj(){return kj??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),kj}function yj(e){return/^(html|body|#document)$/.test(oj(e))}function bj(e){return sj(e).getComputedStyle(e)}function xj(e){return uj(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Sj(e){if(oj(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||fj(e)&&e.host||cj(e);return fj(t)?t.host:t}function Cj(e){let t=Sj(e);return yj(t)?(e.ownerDocument||e).body:dj(t)&&pj(t)?t:Cj(t)}function wj(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Cj(e),i=r===e.ownerDocument?.body,a=sj(r);if(i){let e=Tj(a);return t.concat(a,a.visualViewport||[],pj(r)?r:[],e&&n?wj(e):[])}return t.concat(r,wj(r,[],n))}function Tj(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var Ej,Dj,Oj,kj,Aj=s((()=>{Ej=/transform|translate|scale|rotate|perspective|filter/,Dj=/paint|layout|strict|content/,Oj=e=>!!e&&e!==`none`}));function jj(e){let t=bj(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=dj(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=RA(n)!==a||RA(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Mj(e){return uj(e)?e:e.contextElement}function Nj(e){let t=Mj(e);if(!dj(t))return BA(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=jj(t),o=(a?RA(n.width):n.width)/r,s=(a?RA(n.height):n.height)/i;return o&&Number.isFinite(o)||(o=1),s&&Number.isFinite(s)||(s=1),{x:o,y:s}}function Pj(e){let t=sj(e);return!vj()||!t.visualViewport?nM:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Fj(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===sj(e)}function Ij(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Mj(e),o=BA(1);t&&(r?uj(r)&&(o=Nj(r)):o=Nj(e));let s=Fj(a,n,r)?Pj(a):BA(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=sj(a),t=uj(r)?sj(r):r,n=e,i=Tj(n);for(;i&&t!==n;){let e=Nj(i),t=i.getBoundingClientRect(),r=bj(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=sj(i),i=Tj(n)}}return FA({width:u,height:d,x:c,y:l})}function Lj(e,t){let n=xj(e).scrollLeft;return t?t.left+n:Ij(cj(e)).left+n}function Rj(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Lj(e,n),y:n.top+t.scrollTop}}function zj(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=cj(r),s=t?hj(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=BA(1),u=BA(0),d=dj(r);if((d||!a)&&((oj(r)!==`body`||pj(o))&&(c=xj(r)),d)){let e=Ij(r);l=Nj(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Rj(o,c):BA(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 Bj(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Vj(e){let t=xj(e),n=e.ownerDocument.body,r=LA(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=LA(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Lj(e),o=-t.scrollTop;return bj(n).direction===`rtl`&&(a+=LA(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}function Hj(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=sj(e),a=cj(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!vj()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Lj(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<=rM&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Uj(e,t){let n=Ij(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Nj(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Wj(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Hj(e,n,t);else if(t===`document`)r=Vj(cj(e));else if(uj(t))r=Uj(t,n);else{let n=Pj(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return FA(r)}function Gj(e,t){let n=t.get(e);if(n)return n;let r=wj(e,[],!1).filter(e=>uj(e)&&oj(e)!==`body`),i=null,a=bj(e).position===`fixed`,o=a?Sj(e):e;for(;uj(o)&&!yj(o);){let e=bj(o),t=gj(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Sj(o)}return t.set(e,r),r}function Kj(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?hj(t)?[]:Gj(t,this._c):[].concat(n),r],o=Wj(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=Wj(t,a[e],i);s=LA(n.top,s),c=IA(n.right,c),l=IA(n.bottom,l),u=LA(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function qj(e){let{width:t,height:n}=jj(e);return{width:t,height:n}}function Jj(e,t,n){let r=dj(t),i=cj(t),a=n===`fixed`,o=Ij(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=BA(0);if((r||!a)&&((oj(t)!==`body`||pj(i))&&(s=xj(t)),r)){let e=Ij(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Lj(i));let l=i&&!r&&!a?Rj(i,s):BA(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 Yj(e){return bj(e).position===`static`}function Xj(e,t){if(!dj(e)||bj(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return cj(e)===n&&(n=n.ownerDocument.body),n}function Zj(e,t){let n=sj(e);if(hj(e))return n;if(!dj(e)){let t=Sj(e);for(;t&&!yj(t);){if(uj(t)&&!Yj(t))return t;t=Sj(t)}return n}let r=Xj(e,t);for(;r&&mj(r)&&Yj(r);)r=Xj(r,t);return r&&yj(r)&&Yj(r)&&!gj(r)?n:r||_j(e)||n}function Qj(e){return bj(e).direction===`rtl`}function $j(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function eM(e,t,n){let r=null,i,a=cj(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=zA(d),h=zA(a.clientWidth-(u+f)),g=zA(a.clientHeight-(d+p)),_=zA(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:LA(0,IA(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!$j(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=sj(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function tM(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=Mj(e),u=i||a?[...l?wj(l):[],...t?wj(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?eM(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?Ij(e):null;c&&g();function g(){let t=Ij(e);h&&!$j(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 nM,rM,iM,aM,oM,sM,cM,lM,uM,dM,fM=s((()=>{ij(),KA(),Aj(),nM=BA(0),rM=25,iM=async function(e){let t=this.getOffsetParent||Zj,n=this.getDimensions,r=await n(e.floating);return{reference:Jj(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},aM={convertOffsetParentRelativeRectToViewportRelativeRect:zj,getDocumentElement:cj,getClippingRect:Kj,getOffsetParent:Zj,getElementRects:iM,getClientRects:Bj,getDimensions:qj,getScale:Nj,isElement:uj,isRTL:Qj},oM=ej,sM=tj,cM=QA,lM=rj,uM=nj,dM=(e,t,n)=>{let r=new Map,i=n??{},a={...aM,...i.platform,_c:r};return ZA(e,t,{...i,platform:a})}}));function pM(e){let{char:t,allowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,$position:o}=e,s=n&&!r,c=Sy(t),l=RegExp(`\\s${c}$`),u=a?`^`:``,d=r?``:c,f=RegExp(s?`${u}${c}.*?(?=\\s${d}|$)`:`${u}(?:^)?${c}[^\\s${d}]*`,`gm`),p=o.nodeBefore?.isText&&o.nodeBefore.text;if(!p)return null;let m=o.pos-p.length,h=Array.from(p.matchAll(f)).pop();if(!h||h.input===void 0||h.index===void 0)return null;let g=h.input.slice(Math.max(0,h.index-1),h.index),_=RegExp(`^[${i?.join(``)}\0]?$`).test(g);if(i!==null&&!_)return null;let v=m+h.index,y=v+h[0].length;return s&&l.test(p.slice(y-1,y+1))&&(h[0]+=` `,y+=1),v<o.pos&&y>=o.pos?{range:{from:v,to:y},query:h[0].slice(t.length),text:h[0]}:null}function mM(e){return e.docChanged?e.steps.some(e=>{let t=e.slice;if(!t?.content)return!1;let n=t.content.textBetween(0,t.content.size,`
|
|
208
|
-
`);return/\s/.test(n)}):!1}function hM(e){return()=>{let t=e.state.selection.$anchor.pos,{top:n,right:r,bottom:i,left:a}=e.view.coordsAtPos(t);try{return new DOMRect(a,n,r-a,i-n)}catch{return null}}}function gM(e,t,n,r){return n?()=>{let n=r.getState(e.state)?.decorationId;return t.dom.querySelector(`[data-decoration-id="${n}"]`)?.getBoundingClientRect()||null}:hM(e)}function _M({match:e,dismissedRange:t,state:n,transaction:r,editor:i,shouldResetDismissed:a,effectiveAllowSpaces:o}){return a?.({editor:i,state:n,range:t,match:e,transaction:r,allowSpaces:o})?!1:o?e.range.from===t.from:e.range.from===t.from&&!mM(r)}function vM({view:e,pluginKeyRef:t}){let n=e.state.tr.setMeta(t,{exit:!0});e.dispatch(n)}function yM({pluginKey:e,decorationTag:t,decorationClass:n,decorationContent:r,decorationEmptyClass:i,renderer:a,dispatchExit:o}){return{handleKeyDown(t,n){var r;let i=e.getState(t.state);if(!i.active)return!1;if(n.key===`Escape`||n.key===`Esc`){var s;return a==null||(s=a.onKeyDown)==null||s.call(a,{view:t,event:n,range:i.range}),o(t),!0}return(a==null||(r=a.onKeyDown)==null?void 0:r.call(a,{view:t,event:n,range:i.range}))||!1},decorations(a){let{active:o,range:s,decorationId:c,query:l}=e.getState(a);if(!o)return null;let u=!l?.length,d=[n];return u&&d.push(i),Wg.create(a.doc,[Vg.inline(s.from,s.to,{nodeName:t,class:d.join(` `),"data-decoration-id":c||void 0,"data-decoration-content":r})])}}}function bM({editor:e,char:t,effectiveAllowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,findSuggestionMatch:o,allow:s,shouldShow:c,shouldKeepDismissed:l,pluginKey:u}){return{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}},apply(d,f,p,m){let{isEditable:h}=e,{composing:g}=e.view,{selection:_}=d,{empty:v,from:y}=_,b={...f},x=d.getMeta(u);if(x&&x.exit)return b.active=!1,b.decorationId=null,b.range={from:0,to:0},b.query=null,b.text=null,b.dismissedRange=f.active?{...f.range}:f.dismissedRange,b;if(b.composing=g,d.docChanged&&b.dismissedRange!==null&&(b.dismissedRange={from:d.mapping.map(b.dismissedRange.from),to:d.mapping.map(b.dismissedRange.to)}),h&&(v||e.view.composing)){(y<f.range.from||y>f.range.to)&&!g&&!f.composing&&(b.active=!1);let u=o({char:t,allowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,$position:_.$from}),p=`id_${Math.floor(Math.random()*4294967295)}`;u&&s({editor:e,state:m,range:u.range,isActive:f.active})&&(!c||c({editor:e,range:u.range,query:u.query,text:u.text,transaction:d}))?(b.dismissedRange!==null&&!l({match:u,dismissedRange:b.dismissedRange,state:m,transaction:d})&&(b.dismissedRange=null),b.dismissedRange===null?(b.active=!0,b.decorationId=f.decorationId||p,b.range=u.range,b.query=u.query,b.text=u.text):b.active=!1):(u||(b.dismissedRange=null),b.active=!1)}else b.active=!1;return b.active||(b.decorationId=null,b.range={from:0,to:0},b.query=null,b.text=null),b}}}function xM({editor:e,items:t}){let n=null,r=null,i=null,a=()=>{r!==null&&(clearTimeout(r),r=null),i?.(),i=null},o=e=>new Promise(t=>{i=t,r=setTimeout(()=>{r=null;let e=i;i=null,e?.()},e)}),s=()=>{n?.abort(),a(),n=null};return{abort:s,fetch:async(r,i)=>{s(),n=new AbortController;let a=n;if(i>0&&await o(i),n!==a||a.signal.aborted)return{status:`aborted`};try{let i=await t({editor:e,query:r,signal:a.signal});return n!==a||a.signal.aborted?{status:`aborted`}:{status:`resolved`,items:i}}catch{return n!==a||a.signal.aborted?{status:`aborted`}:{status:`error`}}}}}function SM({placement:e,offset:t,flip:n,floatingUi:r}){var i;let a=[oM({mainAxis:t.mainAxis??4,crossAxis:t.crossAxis??0})];return n&&a.push(cM()),r!=null&&(i=r.middleware)!=null&&i.length&&a.push(...r.middleware),{placement:e,strategy:r?.strategy??`absolute`,middleware:a}}function CM(e){if(e instanceof HTMLElement)return e;if(typeof e==`string`)try{let t=document.querySelector(e);if(t)return t}catch{return document.body}return document.body}function wM({getReferenceRect:e,contextElement:t,config:n,container:r,dismissOnOutsideClick:i,dismiss:a}){return(o,s={})=>{let c={getBoundingClientRect:()=>e()??new DOMRect,contextElement:t},l=!1,u=!o.isConnected;u&&CM(r).appendChild(o),s.onPosition||(o.style.visibility=`hidden`,o.style.width=`max-content`);let d=tM(c,o,()=>{dM(c,o,{placement:n.placement,strategy:n.strategy,middleware:n.middleware}).then(({x:e,y:t,placement:n,strategy:r})=>{s.onPosition?s.onPosition({x:e,y:t,placement:n,strategy:r}):(Object.assign(o.style,{position:r,left:`${e}px`,top:`${t}px`}),l||(l=!0,o.style.visibility=``))})},s.autoUpdate),f;return i&&(f=e=>{let n=e.target;!(n instanceof Node)||o.contains(n)||t.contains(n)||a()},document.addEventListener(`pointerdown`,f,!0)),()=>{d(),f&&document.removeEventListener(`pointerdown`,f,!0),u&&o.remove()}}}function TM({editor:e,pluginKey:t,items:n,renderer:r,minQueryLength:i,debounce:a,initialItems:o,placement:s,offset:c,container:l,flip:u,floatingUi:d,dismissOnOutsideClick:f,command:p,clientRectFor:m,dispatchExit:h}){let g,_=xM({editor:e,items:n}),v=SM({placement:s,offset:c,flip:u,floatingUi:d});function y(e,t){switch(e){case`started`:var n;r==null||(n=r.onStart)==null||n.call(r,t);break;case`updated`:var i;r==null||(i=r.onUpdate)==null||i.call(r,t);break;case`stopped`:var a;r==null||(a=r.onExit)==null||a.call(r,t)}}return{update:async(n,d)=>{let b=t.getState(d),x=t.getState(n.state);if(!b||!x)return;let S=null,C=b.query!==x.query,w=b.text!==x.text,T=b.range.from!==x.range.from||b.range.to!==x.range.to,E=C||w||T;if(!b.active&&x.active)S=`started`;else if(b.active&&!x.active)S=`stopped`;else if(x.active&&E)S=`updated`;else return;let D=S===`stopped`?b:x,O=n.dom.querySelector(`[data-decoration-id="${D.decorationId}"]`),k=m(n,O),A=i===0||(D.query?D.query.length>=i:!1),j=(S===`started`||S===`updated`)&&A;if(g={editor:e,range:D.range,query:D.query||``,text:D.text||``,items:o??[],command:t=>p({editor:e,range:D.range,props:t}),decorationNode:O,clientRect:k,loading:j,placement:s,offset:{mainAxis:c.mainAxis??4,crossAxis:c.crossAxis??0},container:l,flip:u,floatingUi:v,mount:wM({getReferenceRect:k,contextElement:n.dom,config:v,container:l,dismissOnOutsideClick:f,dismiss:()=>h(e.view)})},S===`started`){var M;r==null||(M=r.onBeforeStart)==null||M.call(r,g)}if(S===`updated`){var N;r==null||(N=r.onBeforeUpdate)==null||N.call(r,g)}if(S===`started`&&y(S,g),S===`started`||S===`updated`){if(!j)_.abort(),g={...g,items:o??[],loading:!1};else{g={...g,items:o??[],loading:!0},S=`updated`,y(S,g);let e=await _.fetch(D.query||``,a);if(e.status===`aborted`)return;if(!t.getState(n.state)?.active){_.abort();return}g=e.status===`resolved`?{...g,items:e.items,loading:!1}:{...g,loading:!1}}}S===`stopped`?(_.abort(),y(S,g),g=void 0):S===`updated`&&y(S,g)},destroy:()=>{var e;_.abort(),g&&(r==null||(e=r.onExit)==null||e.call(r,g))}}}function EM({pluginKey:e=DM,editor:t,char:n=`@`,allowSpaces:r=!1,allowToIncludeChar:i=!1,allowedPrefixes:a=[` `],startOfLine:o=!1,decorationTag:s=`span`,decorationClass:c=`suggestion`,decorationContent:l=``,decorationEmptyClass:u=`is-empty`,command:d=()=>null,items:f=()=>[],minQueryLength:p=0,debounce:m=0,initialItems:h,placement:g=`bottom-start`,offset:_={},container:v,flip:y=!0,floatingUi:b,dismissOnOutsideClick:x=!0,render:S=()=>({}),allow:C=()=>!0,findSuggestionMatch:w=pM,shouldShow:T,shouldResetDismissed:E}){let D=S?.(),O=r&&!i,k=(n,r)=>gM(t,n,r,e);function A(e){return _M({...e,editor:t,shouldResetDismissed:E,effectiveAllowSpaces:O})}let j=t=>vM({view:t,pluginKeyRef:e});return new Rd({key:e,view:()=>TM({editor:t,pluginKey:e,items:f,renderer:D,minQueryLength:p,debounce:m,initialItems:h,placement:g,offset:_,container:v,flip:y,floatingUi:b,dismissOnOutsideClick:x,command:d,clientRectFor:k,dispatchExit:j}),state:bM({editor:t,char:n,effectiveAllowSpaces:O,allowToIncludeChar:i,allowedPrefixes:a,startOfLine:o,findSuggestionMatch:w,allow:C,shouldShow:T,shouldKeepDismissed:A,pluginKey:e}),props:yM({pluginKey:e,decorationTag:s,decorationClass:c,decorationContent:l,decorationEmptyClass:u,renderer:D,dispatchExit:j})})}var DM,OM=s((()=>{Hd(),eS(),r_(),fM(),DM=new Bd(`suggestion`)}));function kM({editor:e,overrideSuggestionOptions:t,extensionName:n,char:r=`@`}){return{editor:e,char:r,pluginKey:new Bd,command:({editor:e,range:t,props:i})=>{var a,o;let s=e.view.state.selection.$to.nodeAfter;s!=null&&(a=s.text)!=null&&a.startsWith(` `)&&(t.to+=1),e.chain().focus().insertContentAt(t,[{type:n,attrs:{...i,mentionSuggestionChar:r}},{type:`text`,text:` `}]).run(),(o=e.view.dom.ownerDocument.defaultView)==null||(o=o.getSelection())==null||o.collapseToEnd()},allow:({state:e,range:t})=>{let r=e.doc.resolve(t.from),i=e.schema.nodes[n];return!!r.parent.type.contentMatch.matchType(i)},...t}}function AM(e){return(e.options.suggestions.length?e.options.suggestions:[e.options.suggestion]).map(t=>kM({editor:e.editor,overrideSuggestionOptions:t,extensionName:e.name,char:t.char}))}function jM(e,t){let n=AM(e);return n.find(e=>e.char===t)||(n.length?n[0]:null)}var MM,NM,$te=s((()=>{eS(),Ff(),OM(),Hd(),MM=$x.create({name:`mention`,priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:e,suggestion:t}){return`${t?.char??`@`}${e.attrs.label??e.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:e,node:t,suggestion:n}){return[`span`,Ov(this.HTMLAttributes,e.HTMLAttributes),`${n?.char??`@`}${t.attrs.label??t.attrs.id}`]},suggestions:[],suggestion:{}}},group:`inline`,inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:e=>e.getAttribute(`data-id`),renderHTML:e=>e.id?{"data-id":e.id}:{}},label:{default:null,parseHTML:e=>e.getAttribute(`data-label`),renderHTML:e=>e.label?{"data-label":e.label}:{}},mentionSuggestionChar:{default:`@`,parseHTML:e=>e.getAttribute(`data-mention-suggestion-char`),renderHTML:e=>({"data-mention-suggestion-char":e.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:e,HTMLAttributes:t}){let n=jM(this,e.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn(`renderLabel is deprecated use renderText and renderHTML instead`),[`span`,Ov({"data-type":this.name},this.options.HTMLAttributes,t),this.options.renderLabel({options:this.options,node:e,suggestion:n})];let r={...this.options};r.HTMLAttributes=Ov({"data-type":this.name},this.options.HTMLAttributes,t);let i=this.options.renderHTML({options:r,node:e,suggestion:n});return typeof i==`string`?[`span`,Ov({"data-type":this.name},this.options.HTMLAttributes,t),i]:i},...jee({nodeName:`mention`,name:`@`,selfClosing:!0,allowedAttributes:[`id`,`label`,{name:`mentionSuggestionChar`,skipIfDefault:`@`}],parseAttributes:e=>{let t={},n=/(?:^|\s)(\w+)=(?:"([^"]*)"|'([^']*)')/g,r=n.exec(e);for(;r!==null;){let[,i,a,o]=r;t[i===`char`?`mentionSuggestionChar`:i]=a??o,r=n.exec(e)}return t},serializeAttributes:e=>Object.entries(e).filter(([,e])=>e!=null).map(([e,t])=>`${e===`mentionSuggestionChar`?`char`:e}="${t}"`).join(` `)}),renderText({node:e}){let t={options:this.options,node:e,suggestion:jM(this,e.attrs.mentionSuggestionChar)};return this.options.renderLabel===void 0?this.options.renderText(t):(console.warn(`renderLabel is deprecated use renderText and renderHTML instead`),this.options.renderLabel(t))},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:e,state:t})=>{let n=!1,{selection:r}=t,{empty:i,anchor:a}=r;if(!i)return!1;let o=new Nl,s=0;return t.doc.nodesBetween(a-1,a,(e,t)=>{if(e.type.name===this.name)return n=!0,o=e,s=t,!1}),n&&e.insertText(this.options.deleteTriggerWithBackspace?``:o.attrs.mentionSuggestionChar,s,s+o.nodeSize),n})}},addProseMirrorPlugins(){return AM(this).map(EM)}}),NM=MM})),PM,FM,IM,ene=s((()=>{eS(),PM=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,FM=$x.create({name:`image`,addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?`inline`:`block`},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?`img[src]`:`img[src]:not([src^="data:"])`}]},renderHTML({HTMLAttributes:e}){return[`img`,Ov(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode(`image`,{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{let t=e.attrs?.src??``,n=e.attrs?.alt??``,r=e.attrs?.title??``;return r?``:``},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>`u`)return null;let{directions:e,minWidth:t,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize,i=new Set([`src`,`width`,`height`]);return({node:a,getPos:o,HTMLAttributes:s,editor:c})=>{let l=document.createElement(`img`);l.draggable=!1;let u=Ov(this.options.HTMLAttributes,s);Object.entries(u).forEach(([e,t])=>{if(t!=null)switch(e){case`src`:case`width`:case`height`:break;default:l.setAttribute(e,t)}}),u.src!==null&&(l.src=u.src);let d={...s},f=e=>{typeof e==`string`&&e!==``?l.getAttribute(`src`)!==e&&(l.src=e):(l.hasAttribute(`src`)&&l.removeAttribute(`src`),l.src!==``&&(l.src=``))};f(s.src);let p=new Qx({element:l,editor:c,node:a,getPos:o,onResize:(e,t)=>{l.style.width=`${e}px`,l.style.height=`${t}px`},onCommit:(e,t)=>{let n=o();n!==void 0&&this.editor.chain().setNodeSelection(n).updateAttributes(this.name,{width:e,height:t}).run()},onUpdate:e=>{if(e.type!==a.type)return!1;let t=kv(e,c.extensionManager.attributes.filter(t=>t.type===e.type.name));return Object.keys(d).forEach(e=>{!i.has(e)&&!(e in t)&&l.removeAttribute(e)}),Object.entries(t).forEach(([e,t])=>{i.has(e)||(t==null?l.removeAttribute(e):l.setAttribute(e,t))}),f(t.src),d=t,!0},options:{directions:e,min:{width:t,height:n},preserveAspectRatio:r===!0}}),m=p.dom,h=()=>{m.style.visibility=``,m.style.pointerEvents=``};return m.style.visibility=`hidden`,m.style.pointerEvents=`none`,l.complete&&l.naturalWidth>0?h():(l.onload=h,l.onerror=h),p}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[Ky({find:PM,type:this.type,getAttributes:e=>{let[,,t,n,r]=e;return{src:n,alt:t,title:r}}})]}}),IM=FM}));function LM(e,t){let n=RM.useRef(zM);return n.current===zM&&(n.current=e(t)),n}var RM,zM,BM=s((()=>{RM=d(m(),1),zM={}}));function tne(){return GM}function nne(e){WM.push(e)}function VM(e){let t=(t,n)=>{let r=LM(rne).current,i;try{GM=r;for(let e of WM)e.before(r);i=e(t,n);for(let e of WM)e.after(r);r.didInitialize=!0}finally{GM=void 0}return i};return t.displayName=e.displayName||e.name,t}function HM(e){return UM.forwardRef(VM(e))}function rne(){return{didInitialize:!1}}var UM,WM,GM,KM=s((()=>{UM=d(m(),1),BM(),WM=[],GM=void 0}));function qM(){}var JM,YM,XM=s((()=>{JM=Object.freeze([]),YM=Object.freeze({})}));function ZM(e){QM.useEffect(e,JM)}var QM,$M=s((()=>{QM=d(m(),1),XM()}));function eN(){let e=LM(nN.create).current;return ZM(e.disposeEffect),e}var tN,nN,rN=s((()=>{BM(),$M(),tN=0,nN=class e{static create(){return new e}currentId=tN;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=tN,t()},e)}isStarted(){return this.currentId!==tN}clear=()=>{this.currentId!==tN&&(clearTimeout(this.currentId),this.currentId=tN)};disposeEffect=()=>this.clear}})),iN,aN,Q,oN=s((()=>{iN=d(m(),1),aN=()=>{},Q=typeof document<`u`?iN.useLayoutEffect:aN}));function ine(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var sN,cN,lN,uN,dN,fN=s((()=>{({userAgent:sN,platform:cN,maxTouchPoints:lN}=ine()),uN=sN.toLowerCase(),dN=cN.toLowerCase()})),pN,mN,hN,gN,_N,vN=s((()=>{fN(),pN=/^i(os$|p)/.test(dN)||dN===`macintel`&&lN>1,mN=`android`,hN=dN===mN||uN.includes(mN),gN=!pN&&dN.startsWith(`mac`),dN.startsWith(`win`),!hN&&/^(linux|chrome os)/.test(dN),_N=gN||pN})),yN,bN,xN=s((()=>{fN(),yN=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`),bN=!yN&&uN.includes(`firefox`),!yN&&uN.includes(`chrom`)})),SN,ane=s((()=>{vN(),SN=_N})),CN,one=s((()=>{fN(),CN=/jsdom|happydom/.test(uN)})),wN=s((()=>{vN(),xN(),ane(),one()})),TN=s((()=>{wN()}));function EN(e){e.preventDefault(),e.stopPropagation()}function DN(e){return`nativeEvent`in e}function ON(e){return e.pointerType===``&&e.isTrusted?!0:hN&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function kN(e){return CN?!1:!hN&&e.width===0&&e.height===0||hN&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function AN(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function sne(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}var jN=s((()=>{TN()}));function MN(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function NN(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&fj(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function PN(e){return`composedPath`in e?e.composedPath()[0]??e.target:e.target}var FN=s((()=>{Aj()})),IN,LN,RN,zN,BN,VN,HN=s((()=>{IN=`data-base-ui-focusable`,LN=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,RN=`ArrowLeft`,zN=`ArrowRight`,BN=`ArrowUp`,VN=`ArrowDown`})),UN,WN,GN=s((()=>{UN=`data-starting-style`,WN=`data-ending-style`})),KN,qN,JN,YN=s((()=>{GN(),KN={[UN]:``},qN={[WN]:``},JN={transitionStatus(e){return e===`starting`?KN:e===`ending`?qN:null}}})),XN,ZN,QN,$N=s((()=>{GN(),XN=`data-open`,ZN=`data-closed`,QN=`data-anchor-hidden`})),eP,tP,nP=s((()=>{eP=`data-popup-open`,tP=`data-pressed`})),rP,iP,aP,oP,sP,cP,lP,uP,dP,fP=s((()=>{YN(),$N(),nP(),rP={[eP]:``},iP={[eP]:``,[tP]:``},aP={[XN]:``},oP={[ZN]:``},sP={[QN]:``},cP={open(e){return e?rP:null}},lP={open(e){return e?iP:null}},uP={open(e){return e?aP:oP},anchorHidden(e){return e?sP:null}},dP={...uP,...JN}})),pP,mP=s((()=>{fP(),pP=`data-trigger-disabled`}));function hP(e,t){if(!uj(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(pP);for(let[,e]of t.entries())if(NN(e,n))return!e.hasAttribute(pP);return!1}function gP(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 _P(e){return e.matches(`html,body`)}function vP(e){return dj(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function yP(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${LN}`)!=null}function bP(e){return e?e.getAttribute(`role`)===`combobox`&&vP(e):!1}function xP(e){if(!e||CN)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function SP(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}var CP=s((()=>{Aj(),TN(),FN(),HN(),mP()}));function wP(e,t){return t!=null&&!AN(t)?0:typeof e==`function`?e():e}function TP(e,t,n){let r=wP(e,n);return typeof r==`number`?r:r?.[t]}function EP(e){return typeof e==`function`?e():e}function DP(e,t){return t||e===`click`||e===`mousedown`}function OP(e){return e?.includes(`mouse`)&&e!==`mousedown`}var kP=s((()=>{jN(),CP()})),AP,jP,MP,NP,PP,FP,IP,LP,RP,zP,BP,VP,HP,UP,WP,GP,KP,qP,JP,cne=s((()=>{AP=`none`,jP=`trigger-press`,MP=`trigger-hover`,NP=`trigger-focus`,PP=`outside-press`,FP=`item-press`,IP=`close-press`,LP=`input-change`,RP=`input-clear`,zP=`input-press`,BP=`focus-out`,VP=`escape-key`,HP=`list-navigation`,UP=`keyboard`,WP=`pointer`,GP=`cancel-open`,KP=`sibling-open`,qP=`imperative-action`,JP=`window-resize`})),YP=s((()=>{cne()}));function XP(e,t,n,r){let i=!1,a=!1,o=r??YM;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}}function lne(e,t,n){let r=n??YM;return{reason:e,event:t??new Event(`base-ui`),...r}}var ZP=s((()=>{XM()}));function QP(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}var $P=s((()=>{}));function eF(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}var tF=s((()=>{}));function nF(e,t,n,r){let i=LM(iF).current;return aF(i,e,t,n,r)&&sF(i,[e,t,n,r]),i.callback}function rF(e){let t=LM(iF).current;return oF(t,e)&&sF(t,e),t.callback}function iF(){return{callback:null,cleanup:null,refs:[]}}function aF(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function oF(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function sF(e,t){e.refs=t,e.callback=t.every(e=>e==null)?null: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}}}}}}var cF=s((()=>{BM()}));function lF(e){let t=LM(uF,e).current;return t.next=e,Q(t.effect),t}function uF(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var dF=s((()=>{oN(),BM()})),fF,pF,mF=s((()=>{fF=d(m(),1),pF={...fF}}));function $(e){let t=LM(hF).current;return t.next=e,vF(t.effect),t.trampoline}function hF(){let e={next:void 0,callback:gF,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function gF(){}var _F,vF,yF=s((()=>{mF(),BM(),_F=pF.useInsertionEffect,vF=_F&&_F!==pF.useLayoutEffect?_F:e=>e()}));function bF(){let e=LM(wF.create).current;return ZM(e.disposeEffect),e}var xF,SF,CF,wF,TF=s((()=>{BM(),$M(),xF=null,globalThis.requestAnimationFrame,SF=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)}},CF=new SF,wF=class e{static create(){return new e}static request(e){return CF.request(e)}static cancel(e){return CF.cancel(e)}currentId=xF;request(e){this.cancel(),this.currentId=CF.request(()=>{this.currentId=xF,e()})}cancel=()=>{this.currentId!==xF&&(CF.cancel(this.currentId),this.currentId=xF)};disposeEffect=()=>this.cancel}}));function EF(e){return e?.ownerDocument||document}var DF=s((()=>{Aj()})),OF,kF,AF,jF=s((()=>{OF={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},kF={...OF,position:`fixed`,top:0,left:0},AF={...OF,position:`absolute`}})),MF,NF,PF,FF=s((()=>{MF=d(m(),1),oN(),TN(),jF(),NF=d(O(),1),PF=MF.forwardRef(function(e,t){let[n,r]=MF.useState();Q(()=>{SN&&yN&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,NF.jsx)(`span`,{...e,ref:t,style:kF,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})})}));function IF(e,t,n){return Math.floor(e/t)!==n}function LF(e,t){return t<0||t>=e.length}function RF(e,t){return BF(e.current,{disabledIndices:t})}function zF(e,t){return BF(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function BF(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&VF(e,a,r));return a}function une(e,{event:t,orientation:n,loopFocus:r,onLoop:i,rtl:a,cols:o,disabledIndices:s,minIndex:c,maxIndex:l,prevIndex:u,stopEvent:d=!1}){let f=u,p;if(t.key===`ArrowUp`?p=`up`:t.key===`ArrowDown`&&(p=`down`),p){let n=[],a=[],m=!1,h=0;{let t=null,r=-1;e.forEach((e,i)=>{if(e==null)return;h+=1;let o=e.closest(`[role="row"]`);o&&(m=!0),(o!==t||r===-1)&&(t=o,r+=1,n[r]=[]),n[r].push(i),a[i]=r})}let g=!1,_=0;if(m)for(let e of n){let t=e.length;t>_&&(_=t),t!==o&&(g=!0)}let v=g&&h<e.length,y=_||o,b=o=>{if(!g||u===-1)return;let c=a[u];if(c==null)return;let l=n[c].indexOf(u),d=o===`up`?-1:1;for(let o=c+d,f=0;f<n.length;f+=1,o+=d){if(o<0||o>=n.length){if(!r||v)return;if(o=o<0?n.length-1:0,i){let e=Math.min(l,n[o].length-1),r=i(t,u,n[o][e]??n[o][0]);o=a[r]??o}}let c=n[o];for(let t=Math.min(l,c.length-1);t>=0;--t){let n=c[t];if(!VF(e,n,s))return n}}},x=t=>{if(!v||u===-1)return;let n=u%y,i=t===`up`?-y:y,a=l-l%y,o=zA(l/y)+1;for(let t=u-n+i,c=0;c<o;c+=1,t+=i){if(t<0||t>l){if(!r)return;t=t<0?a:0}let i=Math.min(t+y-1,l);for(let r=Math.min(t+n,i);r>=t;--r)if(!VF(e,r,s))return r}};d&&EN(t);let S=b(p)??x(p);if(S!==void 0)f=S;else if(u===-1)f=p===`up`?l:c;else if(f=BF(e,{startingIndex:u,amount:y,decrement:p===`up`,disabledIndices:s}),r){if(p===`up`&&(u-y<c||f<0)){let e=u%y,n=l%y,r=l-(n-e);f=n===e?l:n>e?r:r-y,i&&(f=i(t,u,f))}p===`down`&&u+y>l&&(f=BF(e,{startingIndex:u%y-y,amount:y,disabledIndices:s}),i&&(f=i(t,u,f)))}LF(e,f)&&(f=u)}if(n===`both`){let n=zA(u/o);t.key===(a?`ArrowLeft`:`ArrowRight`)&&(d&&EN(t),u%o===o-1?r&&(f=BF(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):(f=BF(e,{startingIndex:u,disabledIndices:s}),r&&IF(f,o,n)&&(f=BF(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f)))),IF(f,o,n)&&(f=u)),t.key===(a?`ArrowRight`:`ArrowLeft`)&&(d&&EN(t),u%o===0?r&&(f=BF(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f))):(f=BF(e,{startingIndex:u,decrement:!0,disabledIndices:s}),r&&IF(f,o,n)&&(f=BF(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f)))),IF(f,o,n)&&(f=u));let c=zA(l/o)===n;LF(e,f)&&(r&&c?(f=t.key===(a?`ArrowRight`:`ArrowLeft`)?l:BF(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):f=u)}return f}function VF(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?!HF(r)||r.matches(`:disabled`)?!0:!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!1}function dne(e){return e.visibility===`hidden`||e.visibility===`collapse`}function HF(e,t=e?bj(e):null){return!e||!e.isConnected||!t||dne(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var UF=s((()=>{KA(),Aj(),jN(),HN()}));function fne(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return fj(n)?n.host:null}function WF(e){for(let t of Array.from(e.children))if(oj(t)===`summary`)return t;return null}function pne(e,t){let n=WF(t);return!!n&&(e===n||NN(n,e))}function GF(e){let t=e?oj(e):``;return e!=null&&e.matches(sI)&&(t!==`summary`||e.parentElement!=null&&oj(e.parentElement)===`details`&&WF(e.parentElement)===e)&&(t!==`details`||WF(e)==null)&&(t!==`input`||e.type!==`hidden`)}function KF(e){if(!GF(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=fne(t)){let n=t!==e,r=oj(t)===`slot`;if(t.hasAttribute(`inert`)||n&&oj(t)===`details`&&!t.open&&!pne(e,t)||t.hasAttribute(`hidden`)||!r&&!mne(t,n))return!1}return!0}function mne(e,t){let n=bj(e);return t?n.display!==`none`:HF(e,n)}function qF(e){let t=e.tabIndex;if(t<0){let t=oj(e);if(t===`details`||t===`audio`||t===`video`||dj(e)&&e.isContentEditable)return 0}return t}function JF(e){if(oj(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function hne(e,t){let n=JF(e);if(!n)return!0;let r=t.find(e=>{let t=JF(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=JF(e);return t?.name===n.name&&t.form===n.form})===n}function YF(e){if(dj(e)&&oj(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return dj(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function XF(e,t){YF(e).forEach(e=>{GF(e)&&t.push(e),XF(e,t)})}function ZF(e,t,n){YF(e).forEach(e=>{dj(e)&&e.matches(t)&&n.push(e),ZF(e,t,n)})}function QF(e){return KF(e)&&qF(e)>=0}function $F(e){let t=[];return XF(e,t),t.filter(KF)}function eI(e){let t=$F(e);return t.filter(e=>qF(e)>=0&&hne(e,t))}function tI(e,t){let n=eI(e),r=n.length;if(r===0)return;let i=MN(EF(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function nI(e){return tI(EF(e).body,1)||e}function rI(e){return tI(EF(e).body,-1)||e}function iI(e,t){if(!e)return null;let n=eI(EF(e).body),r=n.length;if(r===0)return null;let i=n.indexOf(e);return i===-1?null:n[(i+t+r)%r]}function gne(e){return iI(e,1)}function _ne(e){return iI(e,-1)}function aI(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!NN(n,r)}function vne(e){eI(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function oI(e){let t=[];ZF(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}var sI,cI=s((()=>{Aj(),DF(),CP(),UF(),sI=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`}));function lI(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...lI(e,t.id,n)])}function uI(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}var dI=s((()=>{}));function fI(e){return`data-base-ui-${e}`}var pI=s((()=>{}));function mI(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(hI);function a(){(!i||i())&&e?.focus({preventScroll:n})}if(r)return a(),qM;let o=requestAnimationFrame(a);return hI=o,()=>{hI===o&&(cancelAnimationFrame(o),hI=0)}}var hI,gI=s((()=>{XM(),hI=0}));function _I(e){return CI[e]}function vI(e){return e?fj(e)?e.host:vI(e.parentNode):null}function yI(e,t,n,r,{mark:i=!0}){let a=null;r?a=`inert`:n&&(a=`aria-hidden`);let o=null,s=null,c=EI(t,e),l=i?OI(t,DI(c),new Set(c)):[],u=[],d=[];if(a){let e=xI[a],n=_I(a);s=n,o=e;let r=EI(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=c.concat(r);OI(t,DI(i),new Set(i)).forEach(t=>{let r=t.getAttribute(a),i=r!==null&&r!==`false`,o=(e.get(t)||0)+1;e.set(t,o),u.push(t),o===1&&i&&n.add(t),i||t.setAttribute(a,a===`inert`?``:`true`)})}return i&&l.forEach(e=>{let t=(wI.get(e)||0)+1;wI.set(e,t),d.push(e),t===1&&e.setAttribute(SI,``)}),TI+=1,()=>{o&&u.forEach(e=>{let t=(o.get(e)||0)-1;o.set(e,t),t||(!s?.has(e)&&a&&e.removeAttribute(a),s?.delete(e))}),i&&d.forEach(e=>{let t=(wI.get(e)||0)-1;wI.set(e,t),t||e.removeAttribute(SI)}),--TI,TI||(xI.inert=new WeakMap,xI[`aria-hidden`]=new WeakMap,CI.inert=new WeakSet,CI[`aria-hidden`]=new WeakSet,wI=new WeakMap)}}function bI(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0}=t,a=EF(e[0]).body;return yI(e,a,n,r,{mark:i})}var xI,SI,CI,wI,TI,EI,DI,OI,kI=s((()=>{Aj(),DF(),xI={inert:new WeakMap,"aria-hidden":new WeakMap},SI=`data-base-ui-inert`,CI={inert:new WeakSet,"aria-hidden":new WeakSet},wI=new WeakMap,TI=0,EI=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=vI(t);return e.contains(n)?n:null}).filter(e=>e!=null),DI=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},OI=(e,t,n)=>{let r=[],i=e=>{e&&!n.has(e)&&Array.from(e.children).forEach(e=>{oj(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r}}));function AI(e,t=`mui`){let[n,r]=MI.useState(e),i=e||n;return MI.useEffect(()=>{n??(NI+=1,r(`${t}-${NI}`))},[n,t]),i}function jI(e,t){if(PI!==void 0){let n=PI();return e??(t?`${t}-${n}`:n)}return AI(e,t)}var MI,NI,PI,FI=s((()=>{MI=d(m(),1),mF(),NI=0,PI=pF.useId}));function II(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 LI,RI=s((()=>{LI=II(`https://base-ui.com/production-error`,`Base UI`)}));function zI(e){return BI>=e}var BI,VI=s((()=>{m(),BI=19}));function HI(e){if(!UI.isValidElement(e))return null;let t=e,n=t.props;return(zI(19)?n?.ref:t.ref)??null}var UI,WI=s((()=>{UI=d(m(),1),VI()}));function GI(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}var KI=s((()=>{}));function qI(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)}else i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}var JI=s((()=>{}));function YI(e,t){return typeof e==`function`?e(t):e}var XI=s((()=>{}));function ZI(e,t){return typeof e==`function`?e(t):e}var QI=s((()=>{}));function $I(e,t,n,r,i){if(!n&&!r&&!i&&!e)return tL(t);let a=tL(e);return t&&(a=nL(a,t)),n&&(a=nL(a,n)),r&&(a=nL(a,r)),i&&(a=nL(a,i)),a}function eL(e){if(e.length===0)return pL;if(e.length===1)return tL(e[0]);let t=tL(e[0]);for(let n=1;n<e.length;n+=1)t=nL(t,e[n]);return t}function tL(e){return oL(e)?{...sL(e,pL)}:rL(e)}function nL(e,t){return oL(t)?sL(t,e):iL(e,t)}function rL(e){let t={...e};for(let e in t){let n=t[e];aL(e,n)&&(t[e]=lL(n))}return t}function iL(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=GI(e.style,r);break;case`className`:e[n]=dL(e.className,r);break;default:e[n]=aL(n,r)?cL(e[n],r):r}}return e}function aL(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 oL(e){return typeof e==`function`}function sL(e,t){return oL(e)?e(t):e??pL}function cL(e,t){return t?e?(...n)=>{let r=n[0];if(fL(r)){let i=r;uL(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:lL(t):e}function lL(e){return e&&((...t)=>{let n=t[0];return fL(n)&&uL(n),e(...t)})}function uL(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function dL(e,t){return t?e?t+` `+e:t:e}function fL(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}var pL,mL=s((()=>{KI(),pL={}})),hL=s((()=>{mL()}));function gL(e,t,n={}){let r=t.render;n.enabled!==!1&&(r=yL(r));let i=_L(t,n,r);if(n.enabled===!1)return null;let a=n.state??YM;return bL(e,r,i,a)}function _L(e,t,n){let{className:r,style:i}=e,{state:a=YM,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?YI(r,a):void 0,d=l?ZI(i,a):void 0,f=l?qI(a,c):YM,p=l&&s?vL(s):void 0,m=l?GI(f,p)??{}:YM;return typeof document<`u`&&(l?m.ref=Array.isArray(o)?rF([m.ref,HI(n),...o]):nF(m.ref,HI(n),o):nF(null,null)),l?(u!==void 0&&(m.className=dL(m.className,u)),d!==void 0&&(m.style=GI(m.style,d)),m):YM}function vL(e){return Array.isArray(e)?eL(e):$I(void 0,e)}function yL(e){if(e?.$$typeof!==wL)return e;let t=SL.Children.toArray(e)[0];return SL.isValidElement(t)?t:e}function bL(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=$I(n,t.props);return e.ref=n.ref,SL.cloneElement(t,e)}if(e&&typeof e==`string`)return xL(e,n);throw Error(LI(8))}function xL(e,t){return e===`button`?(0,CL.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,CL.createElement)(`img`,{alt:``,...t,key:t.key}):SL.createElement(e,t)}var SL,CL,wL,TL=s((()=>{RI(),SL=d(m(),1),cF(),WI(),KI(),XM(),JI(),XI(),QI(),hL(),CL=d(m(),1),wL=Symbol.for(`react.lazy`)})),EL,DL,OL,kL,AL,jL=s((()=>{EL={style:{transition:`none`}},DL=`data-base-ui-click-trigger`,OL={fallbackAxisSide:`none`},kL={fallbackAxisSide:`end`},AL={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0}}));function ML(e={}){let{ref:t,container:n,componentProps:r=YM,elementProps:i}=e,a=jI(),o=LL()?.portalNode,[s,c]=NL.useState(null),[l,u]=NL.useState(null),d=$(e=>{e!==null&&u(e)}),f=NL.useRef(null);Q(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}let e=(n&&(lj(n)?n:n.current))??o??document.body;e==null?f.current&&(f.current=null,u(null),c(null)):f.current!==e&&(f.current=e,u(null),c(e))},[n,o]);let p=gL(`div`,r,{ref:[t,d],props:[{id:a,[RL]:``},i]}),m=s&&p?PL.createPortal(p,s):null;return{node:l,nodeId:NL.isValidElement(p)?p.props.id:void 0,subtree:m}}var NL,PL,FL,IL,LL,RL,zL,BL=s((()=>{NL=d(m(),1),PL=d(g(),1),Aj(),$P(),tF(),FI(),oN(),yF(),XM(),FF(),cI(),ZP(),YP(),pI(),TL(),jL(),FL=d(O(),1),IL=NL.createContext(null),LL=()=>NL.useContext(IL),RL=fI(`portal`),zL=NL.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}=ML({container:o,ref:t,componentProps:e,elementProps:c}),f=NL.useRef(null),p=NL.useRef(null),m=NL.useRef(null),h=NL.useRef(null),[g,_]=NL.useState(null),v=NL.useRef(!1),y=g?.modal,b=g?.open,x=!!g&&!g.modal&&g.open&&!!l;NL.useEffect(()=>{if(!l||y)return;function e(e){l&&e.relatedTarget&&aI(e)&&(e.type===`focusin`?v.current&&=(oI(l),!1):(vne(l),v.current=!0))}return eF(QP(l,`focusin`,e,!0),QP(l,`focusout`,e,!0))},[l,y]),Q(()=>{l&&b===!0&&v.current&&(oI(l),v.current=!1)},[b,l]);let S=NL.useMemo(()=>({beforeOutsideRef:f,afterOutsideRef:p,beforeInsideRef:m,afterInsideRef:h,portalNode:l,setFocusManagerState:_}),[l]);return(0,FL.jsxs)(NL.Fragment,{children:[d,(0,FL.jsxs)(IL.Provider,{value:S,children:[x&&l&&(0,FL.jsx)(PF,{"data-type":`outside`,ref:f,onFocus:e=>{aI(e,l)?m.current?.focus():rI(g?g.domReference:null)?.focus()}}),x&&l&&(0,FL.jsx)(`span`,{role:s,"aria-owns":u,style:AL}),l&&PL.createPortal(a,l),x&&l&&(0,FL.jsx)(PF,{"data-type":`outside`,ref:p,onFocus:e=>{aI(e,l)?h.current?.focus():(nI(g?g.domReference:null)?.focus(),g?.closeOnFocusOut&&g?.onOpenChange(!1,XP(`focus-out`,e.nativeEvent)))}})]})]})})}));function VL(){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 HL=s((()=>{})),UL,WL=s((()=>{HL(),UL=class{nodesRef={current:[]};events=VL();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)}}}));function GL(e){let t=jI(),n=$L(e),r=QL();return Q(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function KL(e){let{children:t,id:n}=e,r=QL();return(0,YL.jsx)(XL.Provider,{value:JL.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function qL(e){let{children:t,externalTree:n}=e,r=LM(()=>n??new UL).current;return(0,YL.jsx)(ZL.Provider,{value:r,children:t})}var JL,YL,XL,ZL,QL,$L,eR=s((()=>{JL=d(m(),1),FI(),oN(),BM(),WL(),YL=d(O(),1),XL=JL.createContext(null),ZL=JL.createContext(null),QL=()=>JL.useContext(XL)?.id||null,$L=e=>{let t=JL.useContext(ZL);return e??t}}));function tR(e){return e==null?e:`current`in e?e.current:e}var nR=s((()=>{}));function yne(e,t){let n=sj(PN(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}function rR(){dR=dR.filter(e=>e.deref()?.isConnected)}function iR(e){rR(),e&&oj(e)!==`body`&&(dR.push(new WeakRef(e)),dR.length>uR&&(dR=dR.slice(-20)))}function aR(){return rR(),dR[dR.length-1]?.deref()}function bne(e){return e?QF(e)?e:eI(e)[0]||e:null}function oR(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=$F(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return QF(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 sR(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,restoreFocus:o=!1,modal:s=!0,closeOnFocusOut:c=!0,openInteractionType:l=``,nextFocusableElement:u,previousFocusableElement:d,beforeContentFocusGuardRef:f,externalTree:p,getInsideElements:m}=e,h=`rootStore`in t?t.rootStore:t,g=h.useState(`open`),_=h.useState(`domReferenceElement`),v=h.useState(`floatingElement`),{events:y,dataRef:b}=h.context,x=$(()=>b.current.floatingContext?.nodeId),S=i===!1,C=bP(_)&&S,w=lF(i),T=lF(a),E=lF(l),D=lF(g),O=$L(p),k=LL(),A=cR.useRef(!1),j=cR.useRef(!1),M=cR.useRef(!1),N=cR.useRef(null),P=cR.useRef(``),F=cR.useRef(``),I=cR.useRef(null),L=cR.useRef(null),R=nF(I,f,k?.beforeInsideRef),z=nF(L,k?.afterInsideRef),B=eN(),V=eN(),H=bF(),U=k!=null,W=SP(v),G=$((e=W)=>e?eI(e):[]),ee=$(()=>m?.().filter(e=>e!=null)??[]);cR.useEffect(()=>{if(r||!s)return;function e(e){e.key===`Tab`&&NN(W,MN(EF(W)))&&G().length===0&&!C&&EN(e)}return QP(EF(W),`keydown`,e)},[r,W,s,C,G]),cR.useEffect(()=>{if(r||!g)return;let e=EF(W);function t(){M.current=!1}function n(e){let t=PN(e),n=ee(),r=NN(v,t)||NN(_,t)||NN(k?.portalNode,t)||n.some(e=>e===t||NN(e,t));M.current=!r,F.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(j.current=!0,V.start(0,()=>{j.current=!1}))}function i(){F.current=`keyboard`}return eF(QP(e,`pointerdown`,n,!0),QP(e,`pointerup`,t,!0),QP(e,`pointercancel`,t,!0),QP(e,`keydown`,i,!0),t)},[r,v,_,W,g,k,V,ee]),cR.useEffect(()=>{if(r||!c)return;let e=EF(W);function t(){j.current=!0,V.start(0,()=>{j.current=!1})}function n(e){let t=PN(e);QF(t)&&(N.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=PN(t);s&&n==null&&i!=null&&NN(v,i)&&iR(i),queueMicrotask(()=>{let a=x(),c=h.context.triggerElements,l=ee(),f=n?.hasAttribute(fI(`focus-guard`))&&[I.current,L.current,k?.beforeInsideRef.current,k?.afterInsideRef.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,tR(d),tR(u)].includes(n),p=!(NN(_,n)||NN(v,n)||NN(n,v)||NN(k?.portalNode,n)||l.some(e=>e===n||NN(e,n))||c.hasMatchingElement(e=>NN(e,n))||f||O&&(lI(O.nodesRef.current,a).find(e=>NN(e.context?.elements.floating,n)||NN(e.context?.elements.domReference,n))||uI(O.nodesRef.current,a).find(e=>[e.context?.elements.floating,SP(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===_&&W&&oR(W),o&&r!==_&&!HF(i)&&MN(e)===e.body){if(dj(W)&&(W.focus(),o===`popup`)){H.request(()=>{W.focus()});return}let e=G(),t=N.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||W;dj(n)&&n.focus()}b.current.insideReactTree?b.current.insideReactTree=!1:(C||!s)&&n&&p&&!j.current&&(C||n!==aR())&&(A.current=!0,h.setOpen(!1,XP(BP,t)))})}function a(){M.current||(b.current.insideReactTree=!0,B.start(0,()=>{b.current.insideReactTree=!1}))}let l=dj(_)?_:null;if(v||l)return eF(l&&QP(l,`focusout`,i),l&&QP(l,`pointerdown`,t),v&&QP(v,`focusin`,n),v&&QP(v,`focusout`,i),v&&k&&QP(v,`focusout`,a,!0))},[r,_,v,W,s,O,k,h,c,o,G,C,x,b,B,V,H,u,d,ee]),cR.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(k?.portalNode?.querySelectorAll(`[${fI(`portal`)}]`)||[]),t=(O?uI(O.nodesRef.current,x()):[]).find(e=>bP(e.context?.elements.domReference||null))?.context?.elements.domReference,n=bI([v,...e,I.current,L.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,...ee(),t,tR(d),tR(u),C?_:null].filter(e=>e!=null),{ariaHidden:s||C,mark:!1}),i=bI([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,s,k,C,O,x,u,d,ee]),Q(()=>{if(!g||r||!dj(W))return;P.current=``,F.current=``;let e=EF(W),t=MN(e);queueMicrotask(()=>{let n=w.current,r=typeof n==`function`?n(E.current||``):n;if(r===void 0||r===!1||NN(W,t))return;let i=null,a=()=>(i??=G(W),i[0]||W),o;o=r===!0||r===null?a():tR(r),o||=a();let s=NN(W,MN(e));mI(o,{preventScroll:o===W,shouldFocus(){if(!D.current)return!1;if(s)return!0;let t=MN(e);return!(t!==o&&NN(W,t))}})})},[r,g,W,G,w,E,D]),Q(()=>{if(r||!W)return;let e=EF(W),t=MN(e),n=E.current==null;iR(t);function i(e){if(e.open||(P.current=yne(e.nativeEvent,F.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(A.current=!0),e.reason===`outside-press`){if(e.nested)A.current=!1;else if(ON(e.nativeEvent)||kN(e.nativeEvent))A.current=!1;else{let e=!1;EF(W).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?A.current=!1:A.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&&oj(t)!==`body`?t:null,s=n?o||a:a||o;return s||=aR()||null,typeof i==`boolean`?s:tR(i)||s||null}return()=>{y.off(`openchange`,i);let t=MN(e),n=ee(),r=NN(v,t)||n.some(e=>e===t||NN(e,t))||O&&lI(O.nodesRef.current,x(),!1).some(e=>NN(e.context?.elements.floating,t)),o=T.current,s=P.current,c=a(s);queueMicrotask(()=>{let n=bne(c),i=typeof o!=`boolean`;if(o&&!A.current&&dj(n)&&(i||n===t||t===e.body||r)){let e={preventScroll:!0};s===`keyboard`&&(e.focusVisible=!0),n.focus(e)}A.current=!1})}},[r,v,W,T,E,y,O,_,x,ee]),Q(()=>{if(!yN||g||!v)return;let e=MN(EF(v));dj(e)&&vP(e)&&NN(v,e)&&e.blur()},[g,v]),Q(()=>{if(!r&&k)return k.setFocusManagerState({modal:s,closeOnFocusOut:c,open:g,onOpenChange:h.setOpen,domReference:_}),()=>{k.setFocusManagerState(null)}},[r,k,s,g,h,c,_]),Q(()=>{if(!r&&W)return oR(W),()=>{queueMicrotask(rR)}},[r,W]);let te=!r&&(!s||!C)&&(U||s);return(0,lR.jsxs)(cR.Fragment,{children:[te&&(0,lR.jsx)(PF,{"data-type":`inside`,ref:R,onFocus:e=>{if(s){let e=G();mI(e[e.length-1])}else k?.portalNode&&(A.current=!1,aI(e,k.portalNode)?nI(_)?.focus():tR(d??k.beforeOutsideRef)?.focus())}}),n,te&&(0,lR.jsx)(PF,{"data-type":`inside`,ref:z,onFocus:e=>{s?mI(G()[0]):k?.portalNode&&(c&&(A.current=!0),aI(e,k.portalNode)?rI(_)?.focus():tR(u??k.afterOutsideRef)?.focus())}})]})}var cR,lR,uR,dR,xne=s((()=>{cR=d(m(),1),Aj(),$P(),tF(),cF(),dF(),yF(),oN(),rN(),TN(),TF(),DF(),FF(),CP(),jN(),cI(),dI(),UF(),ZP(),YP(),pI(),gI(),kI(),BL(),eR(),jL(),nR(),lR=d(O(),1),uR=20,dR=[]}));function fR(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=jP}=t,l=`rootStore`in e?e.rootStore:e,u=l.context.dataRef,d=pR.useRef(void 0),f=bF(),p=eN(),m=pR.useMemo(()=>{function e(e,t,n,r){let i=XP(c,t,n);e&&r===`touch`&&s>0?p.start(s,()=>{l.setOpen(!0,i)}):l.setOpen(e,i)}function t(e,t,n){let r=u.current.openEvent,a=l.select(`domReferenceElement`)!==t;return e&&a||!e||!i?!0:r&&o?!n(r.type):!1}return{onPointerDown(e){d.current=AN(e.pointerType,!0)&&kN(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(n){let i=d.current,o=n.nativeEvent,s=l.select(`open`);if(n.button!==0||r===`click`||AN(i,!0)&&a)return;let c=t(s,n.currentTarget,e=>e===`click`||e===`mousedown`),u=PN(o);if(vP(u)){e(c,o,u,i);return}let p=n.currentTarget;f.request(()=>{e(c,o,p,i)})},onClick(n){if(r===`mousedown-only`)return;let i=d.current;r===`mousedown`&&i?d.current=void 0:AN(i,!0)&&a||e(t(l.select(`open`),n.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),n.nativeEvent,n.currentTarget,i)},onKeyDown(){d.current=void 0}}},[u,r,a,c,l,o,i,f,p,s]);return pR.useMemo(()=>n?{reference:m}:YM,[n,m])}var pR,Sne=s((()=>{pR=d(m(),1),TF(),rN(),XM(),CP(),jN(),ZP(),YP()}));function Cne(){return!1}function wne(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function mR(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=Cne,bubbles:s,externalTree:c}=t,l=`rootStore`in e?e.rootStore:e,u=l.useState(`open`),d=l.useState(`floatingElement`),{dataRef:f,events:p}=l.context,m=$L(c),h=$(typeof i==`function`?i:()=>!1),g=typeof i==`function`?h:i,_=g!==!1,v=$(()=>a),{escapeKey:y,outsidePress:b}=wne(s),x=hR.useRef(!1),S=hR.useRef(!1),C=hR.useRef(!1),w=hR.useRef(!1),T=hR.useRef(!1),E=hR.useRef(``),D=hR.useRef(null),O=eN(),k=eN(),A=$(()=>{k.clear(),f.current.insideReactTree=!1}),j=$(e=>{let t=f.current.floatingContext?.nodeId;return(m?lI(m.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),M=$(e=>gP(e,l.select(`floatingElement`))||gP(e,l.select(`domReferenceElement`))),N=$(e=>{o()&&l.setOpen(!1,XP(jP,e.nativeEvent))}),P=$(e=>{if(!u||!n||!r||e.key!==`Escape`||T.current||!y&&j(`__escapeKeyBubbles`))return;let t=DN(e)?e.nativeEvent:e,i=XP(VP,t);l.setOpen(!1,i),i.isCanceled||e.preventDefault(),!y&&!i.isPropagationAllowed&&e.stopPropagation()}),F=$(()=>{f.current.insideReactTree=!0,k.start(0,A)}),I=$(e=>{if(!u||!n||e.button!==0)return;let t=PN(e.nativeEvent);NN(l.select(`floatingElement`),t)&&(x.current||(x.current=!0,S.current=!1))}),L=$(e=>{u&&n&&(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&x.current&&(S.current=!0)});hR.useEffect(()=>{function e(e){e.open||(w.current=!1)}return p.on(`openchange`,e),()=>{p.off(`openchange`,e)}},[p]),hR.useEffect(()=>{if(!u||!n)return u||(w.current=!1),A;f.current.__escapeKeyBubbles=y,f.current.__outsidePressBubbles=b;let e=new nN,t=new nN,i=EF(d);function a(){e.clear(),T.current=!0}function o(){e.start(yN?5:0,()=>{T.current=!1})}function s(){C.current=!0,t.start(0,()=>{C.current=!1})}function c(){x.current=!1,S.current=!1}function p(){let e=E.current,t=e===`pen`||!e?`mouse`:e,n=v(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function h(e){let t=p();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function k(e){let t=f.current.floatingContext?.nodeId,n=m&&lI(m.nodesRef.current,t).some(t=>gP(e,t.context?.elements.floating));return M(e)||n}function N(e){if(h(e)){e.type!==`click`&&!M(e)&&(t.clear(),C.current=!1),A();return}if(f.current.insideReactTree){A();return}let n=PN(e),r=`[${fI(`inert`)}]`,i=uj(n)?n.getRootNode():null,a=Array.from((fj(i)?i:EF(l.select(`floatingElement`))).querySelectorAll(r)),o=l.context.triggerElements;if(n&&(o.hasElement(n)||o.hasMatchingElement(e=>NN(e,n))))return;let s=uj(n)?n:null;for(;s&&!yj(s);){let e=Sj(s);if(yj(e)||!uj(e))break;s=e}if(!(a.length&&uj(n)&&!_P(n)&&!NN(n,l.select(`floatingElement`))&&a.every(e=>!NN(s,e)))){if(dj(n)&&!(`touches`in e)){let t=yj(n),r=bj(n),i=/auto|scroll/,a=t||i.test(r.overflowX),o=t||i.test(r.overflowY),s=a&&n.clientWidth>0&&n.scrollWidth>n.clientWidth,c=o&&n.clientHeight>0&&n.scrollHeight>n.clientHeight,l=r.direction===`rtl`,u=c&&(l?e.offsetX<=n.offsetWidth-n.clientWidth:e.offsetX>n.clientWidth),d=s&&e.offsetY>n.clientHeight;if(u||d)return}if(!k(e)){if(p()===`intentional`){if(e.detail!==0&&!ON(e)&&!w.current)return;if(C.current){t.clear(),C.current=!1;return}}typeof g==`function`&&!g(e)||j(`__outsidePressBubbles`)||(l.setOpen(!1,XP(PP,e)),A())}}}function F(e){p()===`sloppy`&&e.pointerType!==`touch`&&l.select(`open`)&&n&&!M(e)&&N(e)}function I(e){if(p()!==`sloppy`||!l.select(`open`)||!n||M(e))return;let t=e.touches[0];t&&(D.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},O.start(1e3,()=>{D.current&&(D.current.dismissOnTouchEnd=!1,D.current.dismissOnMouseDown=!1)}))}function L(e,t){let n=PN(e);if(!n)return;let r=QP(n,e.type,()=>{t(e),r()})}function R(e){E.current=`touch`,L(e,I)}function z(e){O.clear(),e.type===`pointerdown`&&(e.button===0&&(w.current=!0),E.current=e.pointerType),(e.type!==`mousedown`||!D.current||D.current.dismissOnMouseDown)&&L(e,e=>{e.type===`pointerdown`?F(e):N(e)})}function B(e){if(e.type===`pointercancel`&&(w.current=!1),!x.current)return;let n=S.current;c(),p()===`intentional`&&(e.type===`pointercancel`?n&&s():k(e)||(n?s():(typeof g!=`function`||g(e))&&(t.clear(),C.current=!0,A())))}function V(e){if(p()!==`sloppy`||!D.current||M(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-D.current.startX),r=Math.abs(t.clientY-D.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(D.current.dismissOnTouchEnd=!0),i>10&&(N(e),O.clear(),D.current=null)}function H(e){L(e,V)}function U(e){p()===`sloppy`&&D.current&&!M(e)&&(D.current.dismissOnTouchEnd&&N(e),O.clear(),D.current=null)}function W(e){L(e,U)}let G=eF(r&&eF(QP(i,`keydown`,P),QP(i,`compositionstart`,a),QP(i,`compositionend`,o)),_&&eF(QP(i,`click`,z,!0),QP(i,`pointerdown`,z,!0),QP(i,`pointerup`,B,!0),QP(i,`pointercancel`,B,!0),QP(i,`mousedown`,z,!0),QP(i,`mouseup`,B,!0),QP(i,`touchstart`,R,{capture:!0,passive:!0}),QP(i,`touchmove`,H,{capture:!0,passive:!0}),QP(i,`touchend`,W,{capture:!0,passive:!0})));return()=>{G(),e.clear(),t.clear(),c(),C.current=!1,A()}},[f,d,r,_,g,u,n,y,b,P,A,v,j,M,m,l,O]);let R=hR.useMemo(()=>({onKeyDown:P,onPointerDown:N,onClick:N}),[P,N]),z=hR.useMemo(()=>({onKeyDown:P,onPointerDown:L,onMouseDown:L,onClickCapture:F,onMouseDownCapture(e){F(),I(e)},onPointerDownCapture(e){F(),I(e)},onMouseUpCapture:F,onTouchEndCapture:F,onTouchMoveCapture:F}),[P,F,I,L]);return hR.useMemo(()=>n?{reference:R,floating:z,trigger:R}:{},[n,R,z])}var hR,Tne=s((()=>{hR=d(m(),1),$P(),tF(),DF(),yF(),rN(),Aj(),TN(),eR(),ZP(),YP(),pI(),CP(),jN(),dI()}));function gR(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(!gR(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)&&!gR(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function _R(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function vR(e,t){let n=_R(e);return Math.round(t*n)/n}function yR(e){let t=bR.useRef(e);return CR(()=>{t.current=e}),t}function Ene(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]=bR.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=bR.useState(r);gR(f,r)||p(r);let[m,h]=bR.useState(null),[g,_]=bR.useState(null),v=bR.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=bR.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=bR.useRef(null),C=bR.useRef(null),w=bR.useRef(u),T=c!=null,E=yR(c),D=yR(i),O=yR(l),k=bR.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),dM(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!gR(w.current,t)&&(w.current=t,SR.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);CR(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=bR.useRef(!1);CR(()=>(A.current=!0,()=>{A.current=!1}),[]),CR(()=>{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=bR.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=bR.useMemo(()=>({reference:b,floating:x}),[b,x]),N=bR.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=vR(M.floating,u.x),r=vR(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,..._R(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return bR.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var bR,xR,SR,CR,wR,TR,ER,DR,OR,kR=s((()=>{fM(),bR=d(m(),1),xR=d(m(),1),SR=d(g(),1),CR=typeof document<`u`?xR.useLayoutEffect:function(){},wR=(e,t)=>{let n=oM(e);return{name:n.name,fn:n.fn,options:[e,t]}},TR=(e,t)=>{let n=sM(e);return{name:n.name,fn:n.fn,options:[e,t]}},ER=(e,t)=>({fn:uM(e).fn,options:[e,t]}),DR=(e,t)=>{let n=cM(e);return{name:n.name,fn:n.fn,options:[e,t]}},OR=(e,t)=>{let n=lM(e);return{name:n.name,fn:n.fn,options:[e,t]}}})),AR=s((()=>{})),jR=s((()=>{})),MR=s((()=>{})),NR=s((()=>{}));function PR(e,t,n,r,i){return VR(e,t,n,r,i)}function FR(e,t,n,r,i){let a=RR.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,zR.useSyncExternalStore)(e.subscribe,a,a)}function IR(e,t,n,r,i){let a=tne();if(!a)return FR(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 LR(e,t,n,r,i){return(0,BR.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var RR,zR,BR,VR,HR=s((()=>{RR=d(m(),1),zR=Wd(),BR=rC(),VI(),KM(),VR=zI(19)?IR:LR,nne({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,zR.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}})})),UR,WR=s((()=>{HR(),UR=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 PR(this,e,t,n,r)}}})),GR,KR,qR=s((()=>{GR=d(m(),1),WR(),HR(),yF(),oN(),XM(),KR=class extends UR{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){GR.useDebugValue(e);let n=this;Q(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;Q(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this,n=Object.values(e);Q(()=>{t.update(e)},[t,...n])}useControlledProp(e,t){GR.useDebugValue(e);let n=this,r=t!==void 0;Q(()=>{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 GR.useDebugValue(e),PR(this,this.selectors[e],t,n,r)}useContextCallback(e,t){GR.useDebugValue(e);let n=$(t??qM);this.context[e]=n}useStateSetter(e){let t=GR.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)}})}}})),JR=s((()=>{m(),g(),Wd(),O()})),YR=s((()=>{MR(),NR(),HR(),WR(),qR(),JR()})),XR=s((()=>{CP(),dI(),jN(),UF(),cI()})),ZR,QR,$R=s((()=>{YR(),HL(),XR(),ZR={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},QR=class extends KR{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:VL(),nested:n,triggerElements:i},ZR),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&sne(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)=>{this.syncOnly||this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}}}));function ez(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=t.context.triggerElements,d=o,f=tz.useRef(null);r===void 0&&f.current===null&&(f.current=new QR({open:s,transitionStatus:void 0,referenceElement:c,floatingElement:l,triggerElements:u,onOpenChange:d,floatingId:i,syncOnly:!0,nested:a}));let p=r??f.current;return t.useSyncedValue(`floatingId`,i),Q(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};uj(c)&&(e.domReferenceElement=c),p.state.positionReference===p.state.referenceElement&&(e.positionReference=c),p.update(e)},[s,i,c,l,p]),p.context.onOpenChange=d,p.context.nested=a,p}var tz,nz=s((()=>{tz=d(m(),1),oN(),Aj(),$R()}));function rz(e,t=!1,n=!1,r=!1){let[i,a]=iz.useState(e&&t?`idle`:void 0),[o,s]=iz.useState(e&&!r);return e&&!o&&(s(!0),a(`starting`)),!e&&o&&i!==`ending`&&!n&&a(`ending`),!e&&!o&&i===`ending`&&a(void 0),Q(()=>{if(!e&&o&&i!==`ending`&&n){let e=wF.request(()=>{a(`ending`)});return()=>{wF.cancel(e)}}},[e,o,i,n]),Q(()=>{if(!e||t)return;let n=wF.request(()=>{a(void 0)});return()=>{wF.cancel(n)}},[t,e]),Q(()=>{if(!e||!t)return;e&&o&&i!==`idle`&&a(`starting`);let n=wF.request(()=>{a(`idle`)});return()=>{wF.cancel(n)}},[t,e,o,i]),{mounted:o,setMounted:s,transitionStatus:i}}var iz,az=s((()=>{iz=d(m(),1),oN(),TF()}));function oz(e){if(!lz){let e=[];lz=e,queueMicrotask(()=>{lz=null,cz.flushSync(()=>{for(let t of e)t()})})}lz.push(e)}function sz(e,t=!1,n=!1){let r=bF();return $((i,a=null)=>{r.cancel();let o=tR(e);if(o==null)return;let s=o,c=()=>{n?oz(()=>{a?.aborted||i()}):cz.flushSync(i)};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(s.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||c()},()=>{a?.aborted||(s.getAnimations().some(e=>e.pending||e.playState!==`finished`)?l():c())})}if(t){let e=UN;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})}else r.request(l)})}var cz,lz,uz=s((()=>{cz=d(g(),1),TF(),yF(),nR(),GN(),lz=null}));function dz(e){let{enabled:t=!0,open:n,ref:r,batch:i=!1,onComplete:a}=e,o=$(a),s=sz(r,n,i);fz.useEffect(()=>{if(!t)return;let e=new AbortController;return s(o,e.signal),()=>{e.abort()}},[t,n,o,s])}var fz,pz=s((()=>{fz=d(m(),1),yF(),uz()}));function mz(e){return t=>t!==`touch`||e.current}function hz(e,t=!1){let n=jI(),r=QL()!=null,i=LM(()=>e(n,r)).current;return ez({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:i.setOpen}),i}function gz({handle:e,store:t}){return Q(()=>e.attachStore(t),[e,t]),null}function _z(e){let t=e.context.triggerElements.size;e.select(`open`)&&e.state.triggerCount!==t&&e.set(`triggerCount`,t)}function vz(e,t){let n=Ez.useRef(null);return $(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),_z(a))}r!==null&&e!==void 0&&(n.current={store:t,id:e,element:r},t.context.triggerElements.add(e,r),_z(t))})}function yz(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}}function bz(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function xz(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=vz(e,n),o=$(t=>{let i=n.select(`open`),a=n.select(`activeTriggerId`);if(a===e){let e={activeTriggerElement:t,...i?r:null};n.update(e)}else if(a==null&&i){let i={activeTriggerId:e??null,activeTriggerElement:t,...r};n.update(i)}}),s=$(e=>{a(e),e&&o(e)});return Q(()=>(s(t.current),()=>s(null)),[s,t,n,e]),Q(()=>{if(i){let e={activeTriggerElement:t.current,...r};n.update(e)}},[i,n,t,...Object.values(r)]),{registerTrigger:s,isMountedByThisTrigger:i}}function Sz(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=Ez.useRef(null),i=e.useState(`open`),a=e.useState(`triggerCount`),o=e.useState(`activeTriggerId`),s=e.useState(`activeTriggerElement`);Q(()=>{if(!i){r.current=null,e.state.triggerCount!==0&&e.set(`triggerCount`,0);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&&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=XP(AP);e.setOpen(!1,t),t.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[i,e,a,o,s,n])}function Cz(e,t,n,r){let{mounted:i,setMounted:a,transitionStatus:o}=rz(e,!1,!1,r),s=t.useState(`preventUnmountingOnClose`),c=!e&&s;t.useSyncedValues({mounted:i,transitionStatus:o,preventUnmountingOnClose:c});let l=$(()=>{a(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return dz({enabled:i&&!e&&!c,open:e,ref:t.context.popupRef,onComplete(){e||l()}}),{forceUnmount:l,transitionStatus:o}}function wz(e,t){e.useSyncedValues(t),Q(()=>()=>{e.update({activeTriggerProps:YM,inactiveTriggerProps:YM,popupProps:YM})},[e])}function Tz(e,t){Q(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),Q(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var Ez,Dz,Oz=s((()=>{Ez=d(m(),1),g(),XM(),FI(),yF(),oN(),BM(),HN(),eR(),nz(),az(),pz(),ZP(),YP(),Dz={tabIndex:-1,[IN]:``}})),kz,Az=s((()=>{kz=class{constructor(){this.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}}}));function jz(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new QR({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,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:YM,inactiveTriggerProps:YM,popupProps:YM}}function Mz(e,t){return t!==void 0&&Fz(e)&&Pz(e)===t}function Nz(e,t){return Mz(e,t)?!0:t!==void 0&&Fz(e)&&Pz(e)==null&&e.triggerCount===1}var Pz,Fz,Iz,Lz,Rz=s((()=>{XM(),$R(),Pz=e=>e.triggerIdProp??e.activeTriggerId,Fz=e=>e.openProp??e.open,Iz=e=>(e.popupElement?.id??e.floatingId)||void 0,Lz={open:Fz,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:Pz,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:Iz,isTriggerActive:(e,t)=>t!==void 0&&Pz(e)===t,isOpenedByTrigger:(e,t)=>Mz(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&Pz(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>Nz(e,t)?Iz(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement}}));function zz(e){let t=Bz.useCallback(t=>e===void 0?qM:e.subscribeStore(t),[e]),n=Bz.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,Vz.useSyncExternalStore)(t,n,()=>e?.serverStore)}var Bz,Vz,Hz=s((()=>{Bz=d(m(),1),Vz=Wd(),XM()})),Uz=s((()=>{AR(),jR(),Oz(),Az(),Rz(),Hz()}));function Wz(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=jI(),a=QL()!=null,o=LM(()=>new QR({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new kz,floatingId:i,syncOnly:!1,nested:a})).current;return Q(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=uj(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}var Gz=s((()=>{Aj(),FI(),oN(),BM(),Uz(),eR(),$R()}));function Kz(e){return qz(e,e.rootContext)}function qz(e,t){let{nodeId:n,externalTree:r}=e,i=t.useState(`referenceElement`),a=t.useState(`floatingElement`),o=t.useState(`domReferenceElement`),s=t.useState(`open`),c=t.useState(`floatingId`),[l,u]=Jz.useState(null),[d,f]=Jz.useState(void 0),[p,m]=Jz.useState(void 0),h=Jz.useRef(null),g=$L(r),_=Jz.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),v=Ene({...e,elements:{..._,...l&&{reference:l}}}),y=uj(d)?d:null,b=p===void 0?t.state.floatingElement:p;t.useSyncedValue(`referenceElement`,d??null),t.useSyncedValue(`domReferenceElement`,d===void 0?o:y),t.useSyncedValue(`floatingElement`,b);let x=Jz.useCallback(e=>{let t=uj(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),v.refs.setReference(t)},[v.refs]),S=Jz.useCallback(e=>{(uj(e)||e===null)&&(h.current=e,f(e)),(uj(v.refs.reference.current)||v.refs.reference.current===null||e!==null&&!uj(e))&&v.refs.setReference(e)},[v.refs,f]),C=Jz.useCallback(e=>{m(e),v.refs.setFloating(e)},[v.refs]),w=Jz.useMemo(()=>({...v.refs,setReference:S,setFloating:C,setPositionReference:x,domReference:h}),[v.refs,S,C,x]),T=Jz.useMemo(()=>({...v.elements,domReference:o}),[v.elements,o]),E=Jz.useMemo(()=>({...v,dataRef:t.context.dataRef,open:s,onOpenChange:t.setOpen,events:t.context.events,floatingId:c,refs:w,elements:T,nodeId:n,rootStore:t}),[v,w,T,n,t,s,c]);return Q(()=>{o&&(h.current=o)},[o]),Q(()=>{t.context.dataRef.current.floatingContext=E;let e=g?.nodesRef.current.find(e=>e.id===n);e&&(e.context=E)}),Jz.useMemo(()=>({...v,context:E,refs:w,elements:T,rootStore:t}),[v,w,T,E,t])}var Jz,Yz=s((()=>{Jz=d(m(),1),oN(),kR(),Aj(),eR()}));function Xz(e,t={}){let{enabled:n=!0,delay:r}=t,i=`rootStore`in e?e.rootStore:e,{events:a,dataRef:o}=i.context,s=Zz.useRef(!1),c=Zz.useRef(null),l=Zz.useRef(!0),u=eN();Zz.useEffect(()=>{let e=i.select(`domReferenceElement`);if(!n)return;let t=sj(e);function r(){let e=i.select(`domReferenceElement`);!i.select(`open`)&&dj(e)&&e===MN(EF(e))&&(s.current=!0,c.current=e)}function a(){l.current=!0}function o(){l.current=!1}return eF(QP(t,`blur`,r),Qz&&QP(t,`keydown`,a,!0),Qz&&QP(t,`pointerdown`,o,!0))},[i,n]),Zz.useEffect(()=>{if(!n)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=i.select(`domReferenceElement`);uj(e)&&(c.current=e,s.current=!0)}}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[a,n,i]);let d=Zz.useMemo(()=>{function e(){s.current=!1,c.current=null}return{onMouseLeave(){e()},onFocus(t){let n=t.currentTarget;if(s.current){if(c.current===n)return;e()}let a=PN(t.nativeEvent);if(uj(a)){if(Qz&&!t.relatedTarget){if(!l.current&&!vP(a))return}else if(!xP(a))return}let o=hP(t.relatedTarget,i.context.triggerElements),{nativeEvent:d,currentTarget:f}=t,p=typeof r==`function`?r():r;i.select(`open`)&&o||p===0||p===void 0?i.setOpen(!0,XP(NP,d,f)):u.start(p,()=>{s.current||i.setOpen(!0,XP(NP,d,f))})},onBlur(t){e();let n=t.relatedTarget,r=t.nativeEvent,a=uj(n)&&n.hasAttribute(fI(`focus-guard`))&&n.getAttribute(`data-type`)===`outside`;u.start(0,()=>{let e=i.select(`domReferenceElement`),t=MN(EF(e));!n&&t===e||NN(o.current.floatingContext?.refs.floating.current,t)||NN(e,t)||a||hP(n??t,i.context.triggerElements)||i.setOpen(!1,XP(NP,r))})}}},[o,r,i,u]);return Zz.useMemo(()=>n?{reference:d,trigger:d}:{},[n,d])}var Zz,Qz,$z=s((()=>{Zz=d(m(),1),$P(),TN(),tF(),DF(),rN(),Aj(),pI(),CP(),ZP(),YP(),Qz=gN&&yN}));function eB(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&iB.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),iB.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function tB(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=iB.get(n);a&&a!==e&&eB(a),eB(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,iB.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function nB(e){let t=e.context.dataRef.current,n=LM(()=>t.hoverInteractionState??rB.create()).current;return t.hoverInteractionState||=n,ZM(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}var rB,iB,aB=s((()=>{$M(),BM(),rN(),XR(),rB=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new nN,this.restTimeout=new nN,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},iB=new WeakMap}));function oB(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=`rootStore`in e?e.rootStore:e,o=a.useState(`open`),s=a.useState(`floatingElement`),c=a.useState(`domReferenceElement`),{dataRef:l}=a.context,u=$L(),d=QL(),f=nB(a),p=eN(),m=$(()=>DP(l.current.openEvent?.type,f.interactedInside)),h=$(()=>OP(l.current.openEvent?.type)),g=$(()=>{eB(f)});Q(()=>{o||(f.pointerType=void 0,f.restTimeoutPending=!1,f.interactedInside=!1,g())},[o,f,g]),sB.useEffect(()=>g,[g]),Q(()=>{if(n&&o&&f.handleCloseOptions?.blockPointerEvents&&h()&&uj(c)&&s){let e=c,t=s,n=EF(s),r=u?.nodesRef.current.find(e=>e.id===d)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=f.pointerEventsScopeElement===t?null:f.pointerEventsScopeElement,a=r===t?null:r,o=f.handleCloseOptions?.getScope?.()??i??a??e.closest(`[data-rootownerid]`)??n.body;return tB(f,{scopeElement:o,referenceElement:e,floatingElement:t}),()=>{g()}}},[n,o,c,s,f,h,u,d,g]),sB.useEffect(()=>{if(!n)return;function e(){return!!(u&&d&&lI(u.nodesRef.current,d).length>0)}function t(e){let t=TP(r,`close`,f.pointerType),n=()=>{a.setOpen(!1,XP(MP,e)),u?.events.emit(`floating.closed`,e)};t?f.openChangeTimeout.start(t,n):(f.openChangeTimeout.clear(),n())}function o(e){let t=PN(e);yP(t)?f.interactedInside=t?.closest(`[aria-haspopup]`)!=null:f.interactedInside=!1}function c(){f.openChangeTimeout.clear(),p.clear(),u?.events.off(`floating.closed`,v),g()}function _(n){if(e()&&u){u.events.on(`floating.closed`,v);return}if(hP(n.relatedTarget,a.context.triggerElements))return;let r=l.current.floatingContext?.nodeId??i,o=n.relatedTarget;u&&r&&uj(o)&&lI(u.nodesRef.current,r,!1).some(e=>NN(e.context?.elements.floating,o))||(f.handler?f.handler(n):(g(),h()&&!m()&&t(n)))}function v(t){u&&d&&!e()&&p.start(0,()=>{u.events.off(`floating.closed`,v),a.setOpen(!1,XP(MP,t)),u.events.emit(`floating.closed`,t)})}let y=s;return eF(y&&QP(y,`mouseenter`,c),y&&QP(y,`mouseleave`,_),y&&QP(y,`pointerdown`,o,!0),()=>{u?.events.off(`floating.closed`,v)})},[n,s,a,l,r,i,h,m,g,f,u,d,p])}var sB,cB=s((()=>{sB=d(m(),1),$P(),tF(),oN(),DF(),yF(),rN(),Aj(),ZP(),YP(),eR(),CP(),dI(),aB(),kP()}));function lB(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=fB,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p,guardStaleOpen:m=!1}=t,h=`rootStore`in e?e.rootStore:e,{dataRef:g,events:_}=h.context,v=$L(l),y=nB(h),b=uB.useRef(!1),x=lF(i),S=lF(r),C=lF(o),w=lF(n),T=lF(p),E=lF(f),D=$(()=>DP(g.current.openEvent?.type,y.interactedInside)),O=$(()=>T.current?.()!==!1),k=$((e,t,n)=>{let r=h.context.triggerElements;if(r.hasElement(t))return!e||!NN(e,t);if(!uj(n))return!1;let i=n;return r.hasMatchingElement(e=>NN(e,i))&&(!e||!NN(e,i))}),A=$(()=>{y.handler&&=(EF(h.select(`domReferenceElement`)).removeEventListener(`mousemove`,y.handler),void 0)}),j=$(()=>{eB(y)});return u&&(y.handleCloseOptions=i?.__options),uB.useEffect(()=>A,[A]),uB.useEffect(()=>{if(!n)return;function e(e){e.open?b.current=!1:(b.current=e.reason===MP,A(),y.openChangeTimeout.clear(),y.restTimeout.clear(),y.blockMouseMove=!0,y.restTimeoutPending=!1)}return _.on(`openchange`,e),()=>{_.off(`openchange`,e)}},[n,_,y,A]),uB.useEffect(()=>{if(!n)return;function e(e,t=!0){let n=TP(S.current,`close`,y.pointerType);n?y.openChangeTimeout.start(n,()=>{h.setOpen(!1,XP(MP,e)),v?.events.emit(`floating.closed`,e)}):t&&(y.openChangeTimeout.clear(),h.setOpen(!1,XP(MP,e)),v?.events.emit(`floating.closed`,e))}let t=c.current??(u?h.select(`domReferenceElement`):null);if(!uj(t))return;function r(e){if(y.openChangeTimeout.clear(),y.blockMouseMove=!1,a&&!AN(y.pointerType))return;let t=EP(C.current),n=TP(S.current,`open`,y.pointerType),r=PN(e),i=e.currentTarget??null,o=h.select(`domReferenceElement`),s=i;if(uj(r)&&!h.context.triggerElements.hasElement(r)){for(let e of h.context.triggerElements.elements())if(NN(e,r)){s=e;break}}uj(i)&&uj(o)&&!h.context.triggerElements.hasElement(i)&&NN(i,o)&&(s=o);let c=s!=null&&k(o,s,r),l=h.select(`open`),u=E.current?.()??h.select(`transitionStatus`)===`ending`,d=!l&&u&&b.current,f=!c&&uj(s)&&uj(o)&&NN(o,s)&&d,p=t>0&&!n,m=c&&(l||d)||f,g=!l||c;m?O()&&h.setOpen(!0,XP(MP,e,s)):p||(n?y.openChangeTimeout.start(n,()=>{g&&O()&&h.setOpen(!0,XP(MP,e,s))}):g&&O()&&h.setOpen(!0,XP(MP,e,s)))}function i(t){if(D()){j();return}A();let n=EF(h.select(`domReferenceElement`));y.restTimeout.clear(),y.restTimeoutPending=!1;let r=g.current.floatingContext??d?.();if(!hP(t.relatedTarget,h.context.triggerElements)){if(x.current&&r){h.select(`open`)||y.openChangeTimeout.clear();let i=c.current;y.handler=x.current({...r,tree:v,x:t.clientX,y:t.clientY,onClose(){j(),A(),w.current&&!D()&&i===h.select(`domReferenceElement`)&&e(t,!0)}}),n.addEventListener(`mousemove`,y.handler),y.handler(t)}else y.pointerType===`touch`&&NN(h.select(`floatingElement`),t.relatedTarget)||e(t)}}function o(e){NN(t,e.relatedTarget)||(y.openChangeTimeout.clear(),y.restTimeout.clear(),y.restTimeoutPending=!1)}let l=m?QP(t,`mouseout`,o):void 0;return s?eF(QP(t,`mousemove`,r,{once:!0}),QP(t,`mouseenter`,r),QP(t,`mouseleave`,i),l):eF(QP(t,`mouseenter`,r),QP(t,`mouseleave`,i),l)},[A,j,g,S,h,n,x,y,u,k,D,a,s,C,c,v,w,d,E,O,m]),uB.useMemo(()=>{if(!n)return;function e(e){y.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,n=e.currentTarget,r=h.select(`domReferenceElement`),i=h.select(`open`),o=k(r,n,e.target);if(a&&!AN(y.pointerType))return;if(i&&o&&y.handleCloseOptions?.blockPointerEvents){let e=h.select(`floatingElement`);if(e){let t=y.handleCloseOptions?.getScope?.()??n.ownerDocument.body;tB(y,{scopeElement:t,referenceElement:n,floatingElement:e})}}let s=EP(C.current);if(i&&!o||s===0||!o&&y.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;y.restTimeout.clear();function c(){if(y.restTimeoutPending=!1,D())return;let e=h.select(`open`);!y.blockMouseMove&&(!e||o)&&O()&&h.setOpen(!0,XP(MP,t,n))}y.pointerType===`touch`?dB.flushSync(()=>{c()}):o&&i?c():(y.restTimeoutPending=!0,y.restTimeout.start(s,c))}}},[n,y,D,k,a,h,C,O])}var uB,dB,fB,pB=s((()=>{uB=d(m(),1),dB=d(g(),1),$P(),tF(),DF(),yF(),dF(),Aj(),ZP(),YP(),eR(),CP(),jN(),aB(),kP(),fB={current:null}}));function mB(e){return yN&&e.movementX===0&&e.movementY===0}function hB(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function gB(e,t){return hB(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function _B(e,t,n){return hB(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function vB(e,t,n){return hB(t,n?e===RN:e===zN,e===VN)}function yB(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===SB:hB(t,n?e===zN:e===RN,e===BN)}function bB(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:a=!0,selectedIndex:o=null,allowEscape:s=!1,loopFocus:c=!1,nested:l=!1,rtl:u=!1,virtual:d=!1,focusItemOnOpen:f=`auto`,focusItemOnHover:p=!0,openOnArrowKeyDown:m=!0,disabledIndices:h=void 0,orientation:g=`vertical`,parentOrientation:_,id:v,resetOnPointerLeave:y=!0,externalTree:b,grid:x}=t,S=x!=null,C=`rootStore`in e?e.rootStore:e,w=C.useState(`open`),T=C.useState(`floatingElement`),E=C.useState(`domReferenceElement`),D=C.context.dataRef,O=SP(T),k=bP(E),A=lF(O),j=QL(),M=$L(b),N=xB.useRef(f),P=xB.useRef(o??-1),F=xB.useRef(null),I=xB.useRef(!0),L=$(e=>{i(P.current===-1?null:P.current,e)}),R=xB.useRef(!!T),z=xB.useRef(w),B=xB.useRef(!1),V=xB.useRef(!1),H=xB.useRef(null),U=lF(h),W=lF(w),G=lF(o),ee=lF(y),te=bF(),ne=bF(),K=$(()=>{function e(e){d?M?.events.emit(`virtualfocus`,e):H.current=mI(e,{sync:B.current,preventScroll:!0})}let t=n.current[P.current],r=V.current;t&&e(t),(B.current?e=>e():e=>te.request(e))(()=>{let i=n.current[P.current]||t;i&&(t||e(i),se&&(r||!I.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});Q(()=>{D.current.orientation=g},[D,g]),Q(()=>{a&&(w&&T?(P.current=o??-1,N.current&&o!=null&&(V.current=!0,L())):R.current&&(P.current=-1,L()))},[a,w,T,o,L]),Q(()=>{if(a){if(!w)B.current=!1;else if(T){if(r==null){if(B.current=!1,G.current!=null)return;if(R.current&&(P.current=-1,K()),(!z.current||!R.current)&&N.current&&(F.current!=null||N.current===!0&&F.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>ne.request(e):queueMicrotask)(t),e+=1):(P.current=F.current==null||_B(F.current,g,u)||l?RF(n):zF(n),F.current=null,L())};t()}}else LF(n.current,r)||(P.current=r,K(),V.current=!1)}}},[a,w,T,r,G,l,n,g,u,L,K,ne]),Q(()=>{if(!a||T||!M||d||!R.current)return;let e=M.nodesRef.current,t=e.find(e=>e.id===j)?.context?.elements.floating,n=MN(EF(E??t??null)),r=e.some(e=>e.context&&NN(e.context.elements.floating,n));t&&!r&&I.current&&t.focus({preventScroll:!0})},[a,T,E,M,j,d]),Q(()=>{z.current=w,R.current=!!T}),Q(()=>{w||(F.current=null,N.current=f)},[w,f]);let re=r!=null,q=$(e=>{if(!W.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(P.current!==t||r!==t)&&(P.current=t,L(e))}),ie=$(()=>_??M?.nodesRef.current.find(e=>e.id===j)?.context?.dataRef?.current.orientation),ae=$(()=>RF(n,U.current)),oe=$(e=>{if(I.current=!1,B.current=!0,e.which===229||!W.current&&e.currentTarget===A.current)return;if(l&&yB(e.key,g,u,S)){gB(e.key,ie())||EN(e),C.setOpen(!1,XP(HP,e.nativeEvent)),dj(E)&&(d?M?.events.emit(`virtualfocus`,E):E.focus());return}let t=P.current,r=RF(n,h),i=zF(n,h);if(k||(e.key===`Home`&&(EN(e),P.current=r,L(e)),e.key===`End`&&(EN(e),P.current=i,L(e))),x!=null){let t=x(e,P.current,n,g,c,u,h,r,i);if(t!=null&&(P.current=t,L(e)),g===`both`)return}if(gB(e.key,g)){if(EN(e),w&&!d&&MN(e.currentTarget.ownerDocument)===e.currentTarget){P.current=_B(e.key,g,u)?r:i,L(e);return}_B(e.key,g,u)?c?t>=i?s&&t!==n.current.length?P.current=-1:(B.current=!1,P.current=r):P.current=BF(n.current,{startingIndex:t,disabledIndices:h}):P.current=Math.min(i,BF(n.current,{startingIndex:t,disabledIndices:h})):c?t<=r?s&&t!==-1?P.current=n.current.length:(B.current=!1,P.current=i):P.current=BF(n.current,{startingIndex:t,decrement:!0,disabledIndices:h}):P.current=Math.max(r,BF(n.current,{startingIndex:t,decrement:!0,disabledIndices:h})),LF(n.current,P.current)&&(P.current=-1),L(e)}}),se=xB.useMemo(()=>({onFocus(e){B.current=!0,q(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){mB(e)||(B.current=!0,V.current=!1,p&&q(e))},onPointerLeave(e){if(!W.current||!I.current||e.pointerType===`touch`)return;B.current=!0;let t=e.relatedTarget;if(p&&!n.current.includes(t)&&ee.current&&(H.current?.(),H.current=null,P.current=-1,L(e),!d)){let e=A.current,t=MN(EF(e));e&&NN(e,t)&&e.focus({preventScroll:!0})}}}),[q,W,A,p,n,L,ee,d]),ce=xB.useMemo(()=>d&&w&&re&&{"aria-activedescendant":`${v}-${r}`},[d,w,re,v,r]),le=xB.useMemo(()=>({...k?{}:ce,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&w&&!d){let t=PN(e.nativeEvent);if(t&&!NN(A.current,t))return;EN(e),C.setOpen(!1,XP(BP,e.nativeEvent)),dj(E)&&E.focus()}else oe(e)},onPointerMove(e){mB(e)||(I.current=!0)}}),[ce,oe,A,k,C,w,d,E]),ue=xB.useMemo(()=>{function e(e){C.setOpen(!0,XP(HP,e.nativeEvent,e.currentTarget))}function t(e){f===`auto`&&ON(e.nativeEvent)&&(N.current=!d)}function n(e){N.current=f,f===`auto`&&kN(e.nativeEvent)&&(N.current=!0)}return{onKeyDown(t){let n=C.select(`open`);I.current=!1;let r=t.key.startsWith(`Arrow`),i=vB(t.key,ie(),u),a=gB(t.key,g),o=(l?i:a)||t.key===`Enter`||t.key.trim()===``;if(d&&n)return oe(t);if(n||m||!r){if(o){let e=gB(t.key,ie());F.current=l&&e?null:t.key}l?i&&(EN(t),n?(P.current=ae(),L(t)):e(t)):a&&(G.current!=null&&(P.current=G.current),EN(t),!n&&m?e(t):oe(t),n&&L(t))}},onFocus(e){C.select(`open`)&&!d&&(P.current=-1,L(e))},onPointerDown:n,onPointerEnter:n,onMouseDown:t,onClick:t}},[oe,f,ae,l,L,C,m,g,ie,u,G,d]),de=xB.useMemo(()=>({...ce,...ue}),[ce,ue]);return xB.useMemo(()=>a?{reference:de,floating:le,item:se,trigger:ue}:{},[a,de,le,ue,se])}var xB,SB,CB=s((()=>{xB=d(m(),1),TF(),oN(),DF(),yF(),dF(),TN(),Aj(),ZP(),YP(),eR(),UF(),HN(),CP(),gI(),jN(),SB=`Escape`}));function wB(e,t){let{listRef:n,elementsRef:r,activeIndex:i,onMatch:a,disabledIndices:o,onTyping:s,enabled:c=!0,resetMs:l=750,selectedIndex:u=null}=t,d=`rootStore`in e?e.rootStore:e,f=d.useState(`open`),p=eN(),m=TB.useRef(``),h=TB.useRef(u??i??-1),g=TB.useRef(null),_=$(e=>{function t(e){return r?.current[e]}function c(e){let n=t(e);return n&&!HF(n)||n?.matches(`:disabled`)?!1:o==null||!VF(JM,e,o)}function d(e,t,n=0){if(e.length===0)return-1;let r=(n%e.length+e.length)%e.length,i=t.toLowerCase();for(let t=0;t<e.length;t+=1){let n=(r+t)%e.length;if(e[n]?.toLowerCase().startsWith(i)&&c(n))return n}return-1}let _=n.current;if(m.current.length>0&&e.key===` `&&(EN(e),s?.(!0)),m.current.length>0&&m.current[0]!==` `&&d(_,m.current)===-1&&e.key!==` `&&s?.(!1),_==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;f&&e.key!==` `&&(EN(e),s?.(!0));let v=m.current===``;v&&(h.current=u??i??-1),_.every((e,t)=>e&&c(t)?e[0]?.toLowerCase()!==e[1]?.toLowerCase():!0)&&m.current===e.key&&(m.current=``,h.current=g.current),m.current+=e.key,p.start(l,()=>{m.current=``,h.current=g.current,s?.(!1)});let y=((v?u??i??-1:h.current)??0)+1,b=d(_,m.current,y);b===-1?e.key!==` `&&(m.current=``,s?.(!1)):(a?.(b),g.current=b)}),v=$(e=>{let t=e.relatedTarget,n=d.select(`domReferenceElement`),r=d.select(`floatingElement`);NN(n,t)||NN(r,t)||(p.clear(),m.current=``,h.current=g.current,s?.(!1))});Q(()=>{(f||u===null)&&(p.clear(),g.current=null,m.current!==``&&(m.current=``))},[f,u,p]);let y=TB.useMemo(()=>({onKeyDown:_,onBlur:v}),[_,v]);return TB.useMemo(()=>c?{reference:y,floating:y}:{},[c,y])}var TB,EB=s((()=>{TB=d(m(),1),oN(),yF(),rN(),XM(),UF(),CP(),jN()}));function DB(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function OB(e,t,n,r,i,a,o,s,c,l){let u=!1;return DB(e,t,n,r,i,a)&&(u=!u),DB(e,t,i,a,o,s)&&(u=!u),DB(e,t,o,s,c,l)&&(u=!u),DB(e,t,c,l,n,r)&&(u=!u),u}function kB(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function AB(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 jB(e={}){let{blockPointerEvents:t=!1}=e,n=new nN,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*NB;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=PN(r),g=r.type===`mouseleave`,_=NN(u,h),v=NN(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&uj(r.relatedTarget)&&NN(u,r.relatedTarget))return;function y(){return!!(s&&lI(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=AB(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=AB(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=AB(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=AB(d,f,x.right-1,A,S.left+1,k)}if(j)return;if(l&&!kB(d,f,x)||!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?PB/2:PB*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+PB+1,o=C||T?S.bottom-PB:S.top,s=C?T?S.bottom-PB:S.top:S.bottom-PB;M=OB(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?PB/2:PB*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-PB,o=C||T?S.top+PB:S.bottom,s=C?T?S.top+PB:S.bottom:S.top+PB;M=OB(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?PB/2:PB*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+PB+1,o=w||E?S.right-PB:S.left,s=w?E?S.right-PB:S.left:S.right-PB;M=OB(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?PB/2:PB*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-PB,o=w||E?S.left+PB:S.right,s=w?E?S.left+PB:S.right:S.left+PB;M=OB(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}var MB,NB,PB,FB=s((()=>{Aj(),rN(),CP(),dI(),MB=.1,NB=MB*MB,PB=.5})),IB=s((()=>{rN(),oN(),kP(),ZP(),YP(),xne(),BL(),eR(),WL(),Sne(),yF(),Aj(),CP(),jN(),Tne(),Yz(),Gz(),nz(),$z(),cB(),pB(),DF(),dF(),CB(),EB(),FB(),kR()}));function LB(e){let t=RB.useContext(zB);if(t===void 0&&!e)throw Error(LI(47));return t}var RB,zB,BB=s((()=>{RI(),RB=d(m(),1),zB=RB.createContext(void 0)}));function VB(e,t,n,r=!1){let i={...jz(t,n,r),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return i.open&&e?.mounted===void 0&&(i.mounted=!0),i}function HB(e){return{popupRef:UB.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:UB.createRef(),beforeContentFocusGuardRef:UB.createRef(),stickIfOpenTimeout:new nN,triggerElements:e}}var UB,WB,GB,KB,qB=s((()=>{UB=d(m(),1),WB=d(g(),1),YR(),rN(),YP(),Uz(),jL(),GB={...Lz,disabled:e=>e.disabled,instantType:e=>e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,modal:e=>e.modal,focusManagerModal:e=>e.focusManagerModal,stickIfOpen:e=>e.stickIfOpen,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},KB=class extends KR{constructor(e,t,n){let r=new kz;super(VB(e,r,t,n),HB(r),GB)}setOpen=(e,t)=>{let n=t.reason===MP,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=bz(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=yz(this.state,e,t.trigger,a());n.openChangeReason=t.reason,this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),WB.flushSync(s)):s();let c;r?c=`click`:i?c=`dismiss`:t.reason===`focus-out`&&(c=`focus`),this.set(`instantType`,c)}}}));function JB(e){return LB(!0)?(0,QB.jsx)($B,{props:e}):(0,QB.jsx)(qL,{children:(0,QB.jsx)($B,{props:e})})}function YB(e,t){let n=hz((e,n)=>new KB(t,e,n));return ZB.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function XB({store:e,modal:t}){let n=mR(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),r=n.reference,i=n.floating;return wz(e,{activeTriggerProps:r,inactiveTriggerProps:r,popupProps:i}),null}var ZB,QB,$B,eV=s((()=>{ZB=d(m(),1),KM(),IB(),BB(),qB(),ZP(),YP(),Uz(),QB=d(O(),1),$B=VM(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=YB(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),Tz(u,d),Sz(u);let{forceUnmount:m}=Cz(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});u.useSyncedValues({modal:o}),ZB.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]),ZB.useImperativeHandle(e.actionsRef,()=>({unmount:m,close:()=>u.setOpen(!1,XP(qP))}),[m,u]);let h=d||f;return(0,QB.jsxs)(zB.Provider,{value:u,children:[s&&(0,QB.jsx)(gz,{handle:s,store:u}),h&&(0,QB.jsx)(XB,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})})}));function tV(e=!1){let t=nV.useContext(rV);if(t===void 0&&!e)throw Error(LI(16));return t}var nV,rV,iV=s((()=>{RI(),nV=d(m(),1),rV=nV.createContext(void 0)}));function aV(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:oV.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])}}var oV,sV=s((()=>{oV=d(m(),1)}));function cV(e,t,{detail:n=0}={}){e.dispatchEvent(new(sj(e)).PointerEvent(`click`,{bubbles:!0,cancelable:!0,composed:!0,detail:n,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}var lV=s((()=>{DF()}));function uV(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=pV.useRef(null),s=tV(!0),c=a??s!==void 0,{props:l}=aV({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=pV.useCallback(()=>{let e=o.current;dV(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return Q(u,[u]),{getButtonProps:pV.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return $I({onClick(e){t?e.preventDefault():n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(uL(e),o?.(e),e.baseUIHandlerPrevented))return;let n=e.target===e.currentTarget,r=e.currentTarget,a=dV(r),s=!i&&fV(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(),cV(r,e))}else!l||i||!d&&!u?n&&s&&d&&e.preventDefault():e.defaultPrevented||(e.preventDefault(),u&&(e.preventBaseUIHandler(),cV(r,e)))},onKeyUp(e){t||(uL(e),a?.(e),e.target===e.currentTarget&&i&&c&&dV(e.currentTarget)&&e.key===` `?e.preventDefault():e.baseUIHandlerPrevented||e.target!==e.currentTarget||i||c||e.defaultPrevented||e.key!==` `||(e.preventBaseUIHandler(),cV(e.currentTarget,e)))},onPointerDown(e){t?e.preventDefault():s?.(e)}},i?{type:`button`}:{role:`button`},l,u)},[t,l,c,i]),buttonRef:$(e=>{o.current=e,u()})}}function dV(e){return dj(e)&&e.tagName===`BUTTON`}function fV(e){return dj(e)&&e.tagName===`A`&&!!e.href}var pV,mV=s((()=>{pV=d(m(),1),Aj(),yF(),oN(),hL(),iV(),sV(),lV()})),hV=s((()=>{}));function gV(e){return jI(e,`base-ui`)}var _V=s((()=>{FI()}));function vV(e,t){let n=yV.useRef(null);function r(t){bV.flushSync(()=>{e.setOpen(!1,XP(BP,t.nativeEvent,t.currentTarget))}),_ne(n.current)?.focus()}function i(n){let r=e.select(`positionerElement`);if(r&&aI(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{bV.flushSync(()=>{e.setOpen(!1,XP(BP,n.nativeEvent,n.currentTarget))});let i=gne(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&NN(r,i);){let e=i;if(i=nI(i),i===e)break}i?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}var yV,bV,xV=s((()=>{yV=d(m(),1),bV=d(g(),1),XR(),ZP(),YP()}));function SV(e){let t=CV.useRef(``),n=CV.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:CV.useCallback(n=>{n.detail===0?e(n,`keyboard`):(`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``)},[e]),onPointerDown:n}}var CV,wV=s((()=>{CV=d(m(),1)}));function TV(e,t){let n=EV.useRef(e),r=$(t);Q(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}var EV,DV=s((()=>{EV=d(m(),1),oN(),yF()}));function OV(e,t){let{onClick:n,onPointerDown:r}=SV($((n,r)=>{(typeof e==`function`?e():e)||t(r||(pN?`touch`:``))}));return AV.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function kV(e){let[t,n]=AV.useState(null),r=OV(e,n);return TV(e,t=>{t&&!e&&n(null)}),AV.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}var AV,jV=s((()=>{AV=d(m(),1),yF(),wV(),TN(),DV()})),MV,NV,PV,FV=s((()=>{RI(),MV=d(m(),1),KM(),BB(),mV(),fP(),TL(),jL(),IB(),hV(),_V(),FF(),YP(),Uz(),xV(),jV(),NV=d(O(),1),PV=HM(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=LB(!0),h=zz(s)??m;if(!h)throw Error(LI(74));let g=gV(f),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=MV.useRef(null),{registerTrigger:S,isMountedByThisTrigger:C}=xz(g,x,h,{payload:c,disabled:a,openOnHover:l,closeDelay:d}),w=h.useState(`openChangeReason`),T=h.useState(`stickIfOpen`),E=h.useState(`openMethod`),D=h.useState(`focusManagerModal`),O=lB(v,{enabled:!a&&l&&(E!==`touch`||w!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:jB(),restMs:u,delay:{close:d},triggerElementRef:x,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),k=fR(v,{stickIfOpen:T}),A=OV(()=>h.select(`open`),e=>{h.set(`openMethod`,e)}),j=h.useState(`triggerProps`,C),{getButtonProps:M,buttonRef:N}=uV({disabled:a,native:o}),P={open(e){return e&&w===`trigger-press`?lP.open(e):cP.open(e)}},{preFocusGuardRef:F,handlePreFocusGuardFocus:I,handleFocusTargetFocus:L}=vV(h,x),R=gL(`button`,e,{state:{disabled:a,open:y},ref:[N,t,S,x],props:[k.reference,O,j,A,{[DL]:``,id:g,"aria-haspopup":`dialog`,"aria-expanded":y,"aria-controls":b},p,M],stateAttributesMapping:P}),z=(0,NV.jsx)(MV.Fragment,{children:R},g);return C&&!D?(0,NV.jsxs)(MV.Fragment,{children:[(0,NV.jsx)(PF,{ref:F,onFocus:I}),z,(0,NV.jsx)(PF,{ref:h.context.triggerFocusTargetRef,onFocus:L})]}):z})}));function IV(){let e=LV.useContext(RV);if(e===void 0)throw Error(LI(45));return e}var LV,RV,zV=s((()=>{RI(),LV=d(m(),1),RV=LV.createContext(void 0)})),BV,VV,HV,Dne=s((()=>{BV=d(m(),1),IB(),BB(),zV(),VV=d(O(),1),HV=BV.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return LB().useState(`mounted`)||n?(0,VV.jsx)(RV.Provider,{value:n,children:(0,VV.jsx)(zL,{ref:t,...r})}):null})}));function UV(e){return zI(19)?e:e?`true`:void 0}var WV=s((()=>{VI()}));function One(){let e=GV.useContext(KV);if(!e)throw Error(LI(46));return e}var GV,KV,qV=s((()=>{RI(),GV=d(m(),1),KV=GV.createContext(void 0)}));function JV(){return YV.useContext(XV)?.direction??`ltr`}var YV,XV,ZV=s((()=>{YV=d(m(),1),XV=YV.createContext(void 0)})),QV,$V,kne=s((()=>{KA(),QV=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,offsetParent:d=`real`}=bA(e,t)||{};if(l==null)return{};let f=PA(u),p={x:n,y:r},m=EA(i),h=wA(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];w&&await o.isElement?.(C)||(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=yA(k,j,A),N=!c.arrow&&SA(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),$V=(e,t)=>{let{name:n,fn:r}=QV(e);return{name:n,fn:r,options:[e,t]}}})),eH,Ane=s((()=>{eH={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}}}}})),tH,nH=s((()=>{tH={sideX:`left`,sideY:`top`}})),rH,iH,aH,oH,sH,cH=s((()=>{rH=`--available-width`,iH=`--available-height`,aH=`--anchor-width`,oH=`--anchor-height`,sH=`--transform-origin`}));function lH(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 uH(e,t,n){let{rects:r,placement:i}=e;return{side:lH(t,xA(i),n),align:SA(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function dH(e){return jne(e,Kz)}function jne(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,w]=pH.useState(null);!g&&C!==null&&w(null);let T=_.side||`flip`,E=_.align||`flip`,D=_.fallbackAxisSide||`end`,O=v?.crossAxis??!1,k=v?.rootBoundary,A=typeof n==`function`?n:void 0,j=$(A),M=A?j:n,N=lF(n),P=lF(g),F=JV()===`rtl`,I=C||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":F?`left`:`right`,"inline-start":F?`right`:`left`}[i],L=o===`center`?I:`${I}-${o}`,R=l;typeof R==`number`?R={top:R,right:R,bottom:R,left:R}:R&&={top:R.top||0,right:R.right||0,bottom:R.bottom||0,left:R.left||0};let z=+(i===`bottom`),B=+(i===`top`),V=+(i===`right`),H=+(i===`left`),U={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:R},W=pH.useRef(null),G=lF(a),ee=lF(s),te=typeof a==`function`?0:a,ne=typeof s==`function`?0:s,K=[];p&&K.push(p),K.push(wR(e=>{let t=uH(e,i,F),n=typeof G.current==`function`?G.current(t):G.current,r=typeof ee.current==`function`?ee.current(t):ee.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[te,ne,F,i]));let re=E===`none`&&T!==`shift`,q=!re&&(u||O||T===`shift`),ie=T===`none`?null:DR({...U,padding:{top:R.top+1+z,right:R.right+1+H,bottom:R.bottom+1+B,left:R.left+1+V},mainAxis:!O&&T===`flip`,crossAxis:E===`flip`&&`alignment`,fallbackAxisSideDirection:D}),ae=re?null:TR({...U,rootBoundary:k,mainAxis:E!==`none`,crossAxis:q,limiter:u||O?void 0:ER(e=>{if(!W.current)return{};let{width:t,height:n}=W.current.getBoundingClientRect(),r=TA(xA(e.placement)),i=r===`y`?t:n,a=r===`y`?R.left+R.right:R.top+R.bottom;return{offset:i/2+a/2}})},[U,u,O,k,R,E]);T===`shift`||E===`shift`||o===`center`?K.push(ae,ie):K.push(ie,ae),K.push(OR({...U,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!P.current)return;let i=e.style;i.setProperty(mH,`${t}px`),i.setProperty(hH,`${n}px`);let a=sj(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(aH,`${u}px`),i.setProperty(oH,`${d}px`)}}),$V(e=>({element:W.current||EF(e.elements.floating).createElement(`div`),padding:W.current?d:0,offsetParent:`floating`}),[d]),{name:`transformOrigin`,fn(e){let{elements:{floating:t},middlewareData:n,placement:r,platform:o,rects:s,y:c}=e,l=xA(r),u=SA(r),d=TA(l)===`y`,f=W.current,p=typeof a==`function`?a(uH(e,i,F)):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 q&&d&&Math.abs(n.shift?.y||0)>p&&(h=`${s.reference.y+s.reference.height/2-c}px`),t.style.setProperty(sH,d?`${m} ${h}`:`${h} ${m}`),{}}},eH,b),Q(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let oe=pH.useMemo(()=>({ancestorScroll:!f,elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:se,elements:ce,x:le,y:ue,middlewareData:de,update:fe,placement:pe,context:me,isPositioned:J,floatingStyles:he}=t({rootContext:h,open:m?g:void 0,placement:L,middleware:K,strategy:r,whileElementsMounted:m?void 0:(...e)=>tM(...e,oe),nodeId:y,externalTree:S}),{sideX:ge,sideY:_e}=de.adaptiveOrigin||tH,ve=J?r:`fixed`,ye=pH.useMemo(()=>{let e;return e=J?b?{position:ve,[ge]:le,[_e]:ue}:{...he,position:ve}:{position:ve,top:0,left:0},e[mH]=`100vw`,e[hH]=`100vh`,J||(e.opacity=0),e},[b,ve,ge,le,_e,ue,he,J]),be=pH.useRef(null);Q(()=>{if(!g)return;let e=N.current,t=typeof e==`function`?e():e,n=(fH(t)?t.current:t)||null;n!==be.current&&(se.setPositionReference(n),be.current=n)},[g,se,M,N]),pH.useEffect(()=>{if(!g)return;let e=N.current;typeof e!=`function`&&fH(e)&&e.current!==be.current&&(se.setPositionReference(e.current),be.current=e.current)},[g,se,M,N]),pH.useEffect(()=>{if(m&&g&&ce.reference&&ce.floating)return tM(ce.reference,ce.floating,fe,oe)},[m,g,ce,fe,oe]);let xe=xA(pe),Se=lH(i,xe,F),Ce=SA(pe)||`center`,we=!!de.hide?.referenceHidden;Q(()=>{x&&g&&J&&xe!==I&&w(xe)},[x,g,J,xe,I]);let Te=pH.useMemo(()=>({position:`absolute`,top:de.arrow?.y,left:de.arrow?.x}),[de.arrow]),Ee=de.arrow?.centerOffset!==0;return pH.useMemo(()=>({positionerStyles:ye,arrowStyles:Te,arrowRef:W,arrowUncentered:Ee,side:Se,align:Ce,physicalSide:xe,anchorHidden:we,refs:se,context:me,isPositioned:J,update:fe}),[ye,Te,W,Ee,Se,Ce,xe,we,se,me,J,fe])}function fH(e){return e!=null&&`current`in e}var pH,mH,hH,gH=s((()=>{pH=d(m(),1),KA(),DF(),oN(),dF(),yF(),IB(),Yz(),ZV(),kne(),Ane(),nH(),cH(),mH=rH,hH=iH})),_H,vH,yH,bH=s((()=>{_H=d(m(),1),vH=d(O(),1),yH=_H.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,vH.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})})}));function xH(e){return e===`starting`?EL:YM}var SH=s((()=>{XM(),jL()}));function CH(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),gL(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},xH(r),i],stateAttributesMapping:uP})}var wH=s((()=>{fP(),TL(),SH()}));function TH(e,t){return pj(e)?e:t}function EH(e,t,n){return/hidden|clip/.test(e.getComputedStyle(TH(t,n)).overflowY)}function Mne(e){if(typeof document>`u`)return!1;let t=EF(e);return sj(t).innerWidth-t.documentElement.clientWidth>0}function Nne(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=EF(e),n=t.documentElement,r=t.body,i=TH(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 Pne(e){let t=EF(e),n=t.documentElement,r=t.body,i=TH(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 Fne(e){let t=EF(e),n=t.documentElement,r=t.body,i=sj(n),a=0,o=0,s=!1,c=wF.create();if(yN&&(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,OH={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},AH=n.style.scrollBehavior,kH={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=TH(n,r);s=Nne(e),s?(n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`):(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,OH),Object.assign(r.style,kH),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=AH)}function d(){u(),c.request(l)}l();let f=QP(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}function DH(e=!0,t=null){Q(()=>{if(e)return MH.acquire(t)},[e,t])}var OH,kH,AH,jH,MH,NH=s((()=>{Aj(),$P(),TN(),DF(),oN(),rN(),TF(),OH={},kH={},AH=``,jH=class{lockCount=0;restore=null;timeoutLock=nN.create();timeoutUnlock=nN.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=EF(e),n=t.documentElement,r=t.body,i=sj(n);if(EH(i,n,r)){let t=new i.MutationObserver(()=>{EH(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=pN||!Mne(e);this.restore=a?Pne(e):Fne(e)}},MH=new jH}));function PH(e,t,n,r){let[i,a]=FH.useState(!1);Q(()=>{if(!e||!t||n==null){a(!1);return}let r=EF(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-IH)},[e,t,n]),DH(e&&(!t||i),r)}var FH,IH,LH=s((()=>{FH=d(m(),1),DF(),NH(),oN(),IH=20})),RH,zH,BH,Ine=s((()=>{RH=d(m(),1),WV(),oN(),IB(),BB(),qV(),gH(),zV(),bH(),YP(),jL(),uz(),wH(),LH(),zH=d(O(),1),BH=RH.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=kL,..._}=e,v=LB(),y=IV(),b=GL(),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=v.useState(`adaptiveOrigin`),M=RH.useRef(null),N=sz(O),P=dH({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:j}),F=x.useState(`domReferenceElement`);Q(()=>{let e=F,t=M.current;if(e&&(M.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return N(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[F,N,v]);let I=E===!0&&w!==`trigger-hover`;PH(C&&I,D===`touch`,O,T);let L=v.useStateSetter(`positionerElement`),R=CH(e,{open:C,side:P.side,align:P.align,anchorHidden:P.anchorHidden,instant:k},{styles:P.positionerStyles,transitionStatus:A,props:_,refs:[t,L],hidden:!S,inert:!C});return(0,zH.jsxs)(KV.Provider,{value:P,children:[S&&I&&(0,zH.jsx)(yH,{inert:UV(!C),cutout:T}),(0,zH.jsx)(KL,{id:b,children:R})]})})})),VH,HH,UH,WH,GH,KH,qH=s((()=>{XR(),VH=`ArrowUp`,HH=`ArrowDown`,UH=`ArrowLeft`,WH=`ArrowRight`,GH=`Home`,KH=new Set([VH,HH,UH,WH,GH,`End`])}));function JH(e){let t=YH.useContext(XH);if(t===void 0&&!e)throw Error(LI(69));return t}var YH,XH,ZH=s((()=>{RI(),YH=d(m(),1),XH=YH.createContext(void 0)}));function Lne(){let[e,t]=QH.useState(0),n=$(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:QH.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}var QH,$H,eU=s((()=>{QH=d(m(),1),yF(),$H=QH.createContext(void 0)})),tU,nU,rU,Rne=s((()=>{tU=d(m(),1),Aj(),IB(),BB(),qV(),fP(),pz(),TL(),YP(),qH(),ZH(),SH(),eU(),Uz(),nU=d(O(),1),rU=tU.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=LB(),l=One(),u=JH(!0)!=null,{context:d,hasClosePart:f}=Lne(),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`);dz({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}}),oB(w,{enabled:D&&!E,closeDelay:O});let k=a===void 0?mz(c.context.popupRef):a,A=b!==!1&&f;c.useSyncedValue(`focusManagerModal`,A);let j=c.useStateSetter(`popupElement`),M=gL(`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`,...Dz,"aria-labelledby":v,"aria-describedby":y,onKeyDown(e){u&&KH.has(e.key)&&e.stopPropagation()}},xH(g),s],stateAttributesMapping:dP});return(0,nU.jsx)(sR,{context:w,openInteractionType:m,modal:A,disabled:!x||S===`trigger-hover`,initialFocus:k,returnFocus:o,restoreFocus:`popup`,previousFocusableElement:dj(C)?C:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,nU.jsx)($H.Provider,{value:d,children:M})})})})),iU=s((()=>{mV()}));function zne(e){let[t,n]=aU.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}var aU,oU=s((()=>{aU=d(m(),1)})),Bne=s((()=>{eV(),FV(),Dne(),Ine(),Rne(),qV(),BB(),fP(),TL(),YP(),_V(),iU(),ZP(),eU(),WV(),TF(),oU(),oN(),yF(),DF(),uz(),XM(),KA(),Aj(),cH(),ZV(),nH(),qB(),jR()})),sU=s((()=>{Bne()}));function cU(e){return{contextElement:e,getBoundingClientRect:()=>{let t=ws(e);return{x:t.left,y:t.top,top:t.top,left:t.left,right:t.right,bottom:t.bottom,width:t.width,height:t.height,toJSON:()=>t}}}}function lU(){return{x:0,y:0,get width(){return Ts().width},get height(){return Ts().height}}}var uU=s((()=>{Os()}));function dU(e){let t=fU.useContext(pU);if(t===void 0&&!e)throw Error(LI(33));return t}var fU,pU,mU=s((()=>{RI(),fU=d(m(),1),pU=fU.createContext(void 0)}));function hU(e){let t=gU.useContext(_U);if(t===void 0&&!e)throw Error(LI(36));return t}var gU,_U,vU=s((()=>{RI(),gU=d(m(),1),_U=gU.createContext(void 0)}));function yU(e=!0){let t=bU.useContext(xU);if(t===void 0&&!e)throw Error(LI(25));return t}var bU,xU,SU=s((()=>{RI(),bU=d(m(),1),xU=bU.createContext(void 0)}));function CU({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=wU.useRef(e!==void 0),[a,o]=wU.useState(t);return[i&&e!==void 0?e:a,wU.useCallback(e=>{i||o(e)},[])]}var wU,TU=s((()=>{wU=d(m(),1)}));function EU(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,{events:l}=a.useState(`floatingTreeRoot`),u=a.useState(`open`),d=yU(!0),f=d!==void 0;return DU.useMemo(()=>({id:r,role:`menuitem`,tabIndex:u&&n?0:-1,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&l.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&l.emit(`close`,{domEvent:e,reason:FP})},onMouseUp(e){if(d){let t=d.initialCursorPointRef.current;if(d.initialCursorPointRef.current=null,f&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||f&&!gN&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!f||e.button===2)&&c.type===`regular-item`&&cV(s.current,e,{detail:1})}}),[t,n,r,l,i,u,a,o,s,d,f,c])}var DU,OU=s((()=>{DU=d(m(),1),TN(),YP(),SU(),lV()}));function kU(e){let{closeOnClick:t,disabled:n,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:s,itemMetadata:c,nodeId:l}=e,u=AU.useRef(null),{getButtonProps:d,buttonRef:f}=uV({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=EU({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=AU.useCallback(e=>$I(p,{onMouseEnter(){c.type===`submenu-trigger`&&c.setActive()}},e,d),[p,d,c]),h=nF(u,f);return AU.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var AU,jU,MU=s((()=>{AU=d(m(),1),cF(),iU(),hL(),OU(),jU={type:`regular-item`}}));function NU(){return PU.useContext(FU)}var PU,FU,IU=s((()=>{PU=d(m(),1),FU=PU.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}})}));function LU(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=NU(),u=RU.useRef(-1),[d,f]=RU.useState(a==null&&t?()=>{if(u.current===-1){let e=l.current;l.current+=1,u.current=e}return u.current}:-1),p=a??d,m=RU.useRef(null),h=RU.useCallback(e=>{let t=m.current;t&&s(t),m.current=e,e&&o(e,{metadata:r??null,index:a??null,label:n,textRef:i})},[a,o,s,r,n,i]);return Q(()=>{if(a==null)return c(e=>{let t=m.current?e.get(m.current)?.index:null;t!=null&&f(t)})},[a,c]),{ref:h,index:p}}var RU,zU=s((()=>{RU=d(m(),1),oN(),IU()}));function BU(){let e=VU.useContext(HU);if(e===void 0)throw Error(LI(31));return e}var VU,HU,UU=s((()=>{RI(),VU=d(m(),1),HU=VU.createContext(void 0)})),WU,GU,KU,qU=s((()=>{WU=d(m(),1),TL(),UU(),GU=d(O(),1),KU=WU.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=WU.useState(void 0),c=gL(`div`,e,{ref:t,props:{role:`group`,"aria-labelledby":o,...a}});return(0,GU.jsx)(HU.Provider,{value:s,children:c})})})),JU,YU,XU=s((()=>{JU=d(m(),1),oN(),TL(),_V(),UU(),YU=JU.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=gV(a),c=BU();return Q(()=>(c(s),()=>{c(e=>e===s?void 0:e)}),[c,s]),gL(`div`,e,{ref:t,props:{id:s,"aria-hidden":!0,...o}})})})),ZU,QU,$U=s((()=>{ZU=d(m(),1),MU(),vU(),TL(),_V(),zU(),mU(),QU=ZU.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,style:l,...u}=e,d=LU({guess:!0,label:a}),f=dU(!0),p=gV(i),{store:m}=hU(),h=m.useState(`disabled`),g=s||h,_=m.useState(`isActive`,d.index),v=m.useState(`itemProps`),{getItemProps:y,itemRef:b}=kU({closeOnClick:c,disabled:g,highlighted:_,id:p,store:m,nativeButton:o,nodeId:f?.context.nodeId,itemMetadata:jU});return gL(`div`,e,{state:{disabled:g,highlighted:_},props:[v,u,y],ref:[b,t,d.ref]})})})),eW,tW,nW,rW=s((()=>{eW=d(m(),1),IB(),vU(),mU(),TL(),fP(),pz(),ZP(),YP(),ZH(),qH(),SH(),tW=d(O(),1),nW=eW.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s}=hU(),{side:c,align:l}=dU(),u=JH(!0)!=null,d=s.useState(`open`),f=s.useState(`transitionStatus`),p=s.useState(`popupProps`),m=s.useState(`mounted`),h=s.useState(`instantType`),g=s.useState(`activeTriggerElement`),_=s.useState(`parent`),v=s.useState(`lastOpenChangeReason`),y=s.useState(`rootId`),b=s.useState(`floatingRootContext`),x=s.useState(`floatingTreeRoot`),S=s.useState(`closeDelay`),C=s.useState(`hoverEnabled`),w=s.useState(`disabled`),T=s.useState(`openMethod`),E=_.type===`context-menu`;dz({open:d,ref:s.context.popupRef,onComplete(){d&&s.context.onOpenChangeComplete?.(!0)}}),eW.useEffect(()=>{function e(e){s.setOpen(!1,XP(e.reason,e.domEvent))}return x.events.on(`close`,e),()=>{x.events.off(`close`,e)}},[x.events,s]),oB(b,{enabled:C&&!w&&!E&&_.type!==`menubar`,closeDelay:S});let D=s.useStateSetter(`popupElement`),O=gL(`div`,e,{state:{transitionStatus:f,side:c,align:l,open:d,nested:_.type===`menu`,instant:h},ref:[t,s.context.popupRef,D],stateAttributesMapping:dP,props:[p,{onKeyDown(e){u&&KH.has(e.key)&&e.stopPropagation()}},xH(f),o,{"data-rootownerid":y}]}),k=_.type===void 0||E;return(g||_.type===`menubar`&&v!==`outside-press`)&&(k=!0),(0,tW.jsx)(sR,{context:b,openInteractionType:T,modal:E,disabled:!m,returnFocus:a===void 0?k:a,initialFocus:_.type!==`menu`,restoreFocus:!0,externalTree:_.type===`menubar`?void 0:x,previousFocusableElement:g,nextFocusableElement:_.type===void 0?s.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:_.type===void 0?s.context.beforeContentFocusGuardRef:void 0,children:O})})}));function iW(){let e=aW.useContext(oW);if(e===void 0)throw Error(LI(32));return e}var aW,oW,sW=s((()=>{RI(),aW=d(m(),1),oW=aW.createContext(void 0)})),cW,lW,uW,dW=s((()=>{cW=d(m(),1),IB(),vU(),sW(),lW=d(O(),1),uW=cW.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i,parent:a}=hU();if(!(i.useState(`mounted`)||n))return null;let o=a.type===`menu`||a.type===`menubar`?`group`:void 0;return(0,lW.jsx)(oW.Provider,{value:n,children:(0,lW.jsx)(zL,{ref:t,...r,portalOwnerRole:o})})})}));function fW(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=$(i),[,o]=yW.useState(!1),s=LM(mW).current,c=LM(pW).current,l=yW.useRef(0),u=yW.useRef(!0),d=yW.useRef(null),f=yW.useRef(null),p=$(()=>{u.current||(u.current=!0,o(e=>!e))}),m=$((e,t)=>{c.set(e,t),p()}),h=$(e=>{c.delete(e),p()}),g=$(e=>{let t=new Map;return n.current.length=0,r&&(r.current.length=0),e.forEach(e=>{t.set(e.element,{...e.registration.metadata??{},index:e.index}),n.current[e.index]=e.element,r&&(r.current[e.index]=e.registration.label===void 0?e.registration.textRef?.current?.textContent??e.element.textContent:e.registration.label)}),l.current=n.current.length,t});function _(e){if(f.current?.disconnect(),f.current=null,typeof MutationObserver!=`function`||e.length<2)return;let t=new MutationObserver(n=>{if(!_W(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&vW(r,n)>0){t.disconnect(),p();return}r=n}});f.current=t;let n=new Set;for(let t=1;t<e.length;t+=1){let r=gW(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let v=$(()=>{let[e,t]=hW(c),n=g(e),r=d.current,i=!r||r.length!==e.length||e.some((e,t)=>{let n=r[t];return e.index!==n.index||e.element!==n.element||e.registration.index!==n.registration.index||e.registration.metadata!==n.registration.metadata});_(t),d.current=e,u.current=!1,i&&(s.forEach(e=>e(n)),a(n))});Q(()=>(!u.current&&d.current&&g(d.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,g]),Q(()=>{u.current&&v()}),Q(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let y=$(e=>(s.add(e),()=>{s.delete(e)})),b=yW.useMemo(()=>({register:m,unregister:h,subscribeMapChange:y,nextIndexRef:l}),[m,h,y,l]);return(0,bW.jsx)(FU.Provider,{value:b,children:t})}function pW(){return new Map}function mW(){return new Set}function hW(e){let t=new Set,n=[],r=[];e.forEach((e,i)=>{if(!i.isConnected)return;let a=e.index,o={index:a??-1,element:i,registration:e};a===null?r.push(o):a>=0&&(t.add(a),n.push(o))});let i=0;return r.sort((e,t)=>vW(e.element,t.element)),r.forEach(e=>{for(;t.has(i);)i+=1;e.index=i,n.push(e),i+=1}),t.size>0&&n.sort((e,t)=>e.index-t.index),[n,r.map(e=>e.element)]}function gW(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function _W(e){for(let t of e)for(let e=0;e<t.removedNodes.length;e+=1)if(t.removedNodes[e].isConnected)return!0;return!1}function vW(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}var yW,bW,xW=s((()=>{yW=d(m(),1),BM(),yF(),oN(),IU(),bW=d(O(),1)})),SW,CW,wW,TW=s((()=>{SW=d(m(),1),WV(),oN(),rN(),IB(),mU(),vU(),gH(),xW(),bH(),sW(),jL(),SU(),ZP(),YP(),uz(),wH(),LH(),CW=d(O(),1),wW=SW.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=OL,style:g,..._}=e,{store:v}=hU(),y=iW(),b=yU(!0),x=v.useState(`parent`),S=v.useState(`floatingRootContext`),C=v.useState(`floatingTreeRoot`),w=v.useState(`mounted`),T=v.useState(`open`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`activeTriggerElement`),k=v.useState(`transitionStatus`),A=v.useState(`positionerElement`),j=v.useState(`instantType`),M=v.useState(`adaptiveOrigin`),N=v.useState(`lastOpenChangeReason`),P=v.useState(`floatingNodeId`),F=v.useState(`floatingParentNodeId`),I=S.useState(`domReferenceElement`),L=SW.useRef(null),R=sz(A),z=n,B=c,V=l,H=s,U=h;x.type===`context-menu`&&(z=n??x.context?.anchor,H??=`start`,!o&&H!==`center`&&(V=e.alignOffset??2,B=e.sideOffset??-5));let W=o,G=H;x.type===`menu`?(W??=`inline-end`,G??=`start`,U=e.collisionAvoidance??kL):x.type===`menubar`&&(W??=x.context.orientation===`vertical`?`inline-end`:`bottom`,G??=`start`);let ee=x.type===`context-menu`,te=dH({anchor:z,floatingRootContext:S,positionMethod:b?`fixed`:r,mounted:w,side:W,sideOffset:B,align:G,alignOffset:V,arrowPadding:ee?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:P,keepMounted:y,disableAnchorTracking:m,collisionAvoidance:U,shift:ee?{crossAxis:!(`side`in U&&U.side===`flip`),rootBoundary:`layoutViewport`}:void 0,externalTree:C,adaptiveOrigin:M});SW.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===P&&v.set(`hoverEnabled`,!1),e.nodeId!==P&&e.parentNodeId===v.select(`floatingParentNodeId`)&&v.setOpen(!1,XP(KP)))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[v,C.events,P]),SW.useEffect(()=>{if(v.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==v.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;v.setOpen(!1,XP(t))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[C.events,v]);let ne=eN();SW.useEffect(()=>{T||ne.clear()},[T,ne]),SW.useEffect(()=>{function e(e){if(T&&e.nodeId===v.select(`floatingParentNodeId`)){if(e.target&&O&&O!==e.target){let e=v.select(`closeDelay`);e>0?ne.isStarted()||ne.start(e,()=>{v.setOpen(!1,XP(KP))}):v.setOpen(!1,XP(KP))}else ne.clear()}}return C.events.on(`itemhover`,e),()=>{C.events.off(`itemhover`,e)}},[C.events,T,O,v,ne]),SW.useEffect(()=>{let e={open:T,nodeId:P,parentNodeId:F,reason:v.select(`lastOpenChangeReason`)};C.events.emit(`menuopenchange`,e)},[C.events,T,v,P,F]),Q(()=>{let e=I,t=L.current;if(e&&(L.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return R(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[I,R,v]);let K={open:T,side:te.side,align:te.align,anchorHidden:te.anchorHidden,nested:x.type===`menu`,instant:j},re=x.type===`menubar`&&x.context.modal;PH(T&&(re||E&&N!==`trigger-hover`),D===`touch`,A,O);let q=CH(e,K,{styles:te.positionerStyles,transitionStatus:k,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!w,inert:!T}),ie=w&&x.type!==`menu`&&(x.type!==`menubar`&&E&&N!==`trigger-hover`||x.type===`menubar`&&x.context.modal),ae=null;return x.type===`menubar`?ae=x.context.contentElement:x.type===void 0&&(ae=O),(0,CW.jsxs)(pU.Provider,{value:te,children:[ie&&(0,CW.jsx)(yH,{ref:x.type===`context-menu`||x.type===`nested-context-menu`?x.context.internalBackdropRef:null,inert:UV(!T),cutout:ae}),(0,CW.jsx)(KL,{id:P,children:(0,CW.jsx)(fW,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:q})})]})})}));function EW(e){let t=DW.useContext(OW);if(t===null&&!e)throw Error(LI(5));return t}var DW,OW,kW=s((()=>{RI(),DW=d(m(),1),OW=DW.createContext(null)}));function AW(e){return{positionerRef:MW.createRef(),popupRef:MW.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:MW.createRef(),beforeContentFocusGuardRef:MW.createRef(),onOpenChangeComplete:void 0,triggerElements:e}}function jW(e,t,n=!1,r){return{...jz(e,t,n),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new UL,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:YM,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...r}}var MW,NW,PW,FW=s((()=>{MW=d(m(),1),YR(),XM(),WL(),Uz(),NW={...Lz,disabled:e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled,modal:e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0),openMethod:e=>e.openMethod,allowMouseEnter:e=>e.allowMouseEnter,highlightItemOnHover:e=>e.highlightItemOnHover,parent:e=>e.parent,rootId:e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId,activeIndex:e=>e.activeIndex,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType,lastOpenChangeReason:e=>e.openChangeReason,floatingTreeRoot:e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot,floatingNodeId:e=>e.floatingNodeId,floatingParentNodeId:e=>e.floatingParentNodeId,itemProps:e=>e.itemProps,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin,keyboardEventRelay:e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)}},PW=class extends KR{constructor(e,t,n=!1){let r=new kz,i=jW(r,t,n,e);super(i,AW(r),NW),this.unsubscribeParentListener=this.observe(`parent`,e=>{if(this.unsubscribeParentListener?.(),e.type===`menu`){let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);this.unsubscribeParentListener=e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);(t!==i||n!==a||r!==o)&&(t=i,n=a,r=o,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef}else e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}unsubscribeParentListener=null}}));function IW(){return LW.useContext(RW)}var LW,RW,zW=s((()=>{LW=d(m(),1),RW=LW.createContext(void 0)}));function BW(e,t,n){return LM(()=>new PW(e,t,n)).current}var VW,HW,UW,WW=s((()=>{VW=d(m(),1),rN(),yF(),FI(),oN(),BM(),XM(),KM(),IB(),vU(),kW(),jL(),ZV(),jV(),ZP(),YP(),SU(),hL(),uz(),FW(),Uz(),zW(),HW=d(O(),1),UW=VM(function(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:a=!1,disabled:o=!1,modal:s,loopFocus:c=!0,orientation:l=`vertical`,actionsRef:u,closeParentOnEsc:d=!1,handle:f,triggerId:p,defaultTriggerId:m=null,highlightItemOnHover:h=!0}=e,g=yU(!0),_=hU(!0),v=EW(!0),y=IW(),b=VW.useMemo(()=>y&&_?{type:`menu`,store:_.store}:v?{type:`menubar`,context:v}:g&&!_?{type:`context-menu`,context:g}:{type:void 0},[g,_,v,y]),x=jI(),S=jI(),C=QL(),w=b.type===`menu`?b.store:void 0,T=(n??a)&&w?.state.transitionStatus===`starting`,E=LM(()=>T?w?.state.instantType:void 0).current,D=BW({open:a,openProp:n,activeTriggerId:m,triggerIdProp:p,parent:b,disabled:o,highlightItemOnHover:h,modal:b.type===void 0?s:void 0,rootId:x,instantType:E},S,C!=null);D.useControlledProp(`openProp`,n),D.useControlledProp(`triggerIdProp`,p),D.useContextCallback(`onOpenChangeComplete`,i);let O=D.useState(`floatingTreeRoot`),k=GL(O),A=D.useState(`open`),j=D.useState(`activeTriggerElement`),M=D.useState(`positionerElement`),N=D.useState(`hoverEnabled`),P=D.useState(`disabled`),F=D.useState(`lastOpenChangeReason`),I=D.useState(`parent`),L=D.useState(`activeIndex`),R=D.useState(`payload`),z=D.useState(`floatingParentNodeId`),B=VW.useRef(null),V=VW.useRef(I.type!==`context-menu`),H=eN(),U=VW.useRef(!0),W=eN(),G=z!=null,{openMethod:ee,triggerProps:te}=kV(A);D.useSyncedValues({disabled:o,highlightItemOnHover:h,modal:I.type===void 0?s:void 0,openMethod:ee,rootId:x}),Sz(D);let{forceUnmount:ne,transitionStatus:K}=Cz(A,D,()=>{D.set(`allowMouseEnter`,!1)},T),re=sz(D.context.popupRef);VW.useEffect(()=>{if(E===void 0)return;let e=()=>{D.state.instantType===E&&D.set(`instantType`,void 0)};if(!A){e();return}if(K!==void 0)return;if(D.context.popupRef.current==null){e();return}let t=new AbortController;return re(e,t.signal),()=>{t.abort()}},[E,A,K,re,D]),Q(()=>{g&&!_?D.update({parent:{type:`context-menu`,context:g},floatingNodeId:k,floatingParentNodeId:C}):_&&D.update({floatingNodeId:k,floatingParentNodeId:C})},[g,_,k,C,D]),VW.useEffect(()=>{A||(B.current=null),I.type===`context-menu`&&(A?H.start(500,()=>{V.current=!0}):(H.clear(),V.current=!1))},[H,A,I.type]),Q(()=>{!A&&!N&&D.set(`hoverEnabled`,!0)},[A,N,D]);let q=$((e,t)=>{let n=t.reason;if(!e&&!D.select(`open`)||A===e&&t.trigger===j&&F===n)return;let i=bz(t);if(!e&&t.trigger==null&&(t.trigger=j??void 0),r?.(e,t),t.isCanceled)return;D.state.floatingRootContext.dispatchOpenChange(e,t);let a=t.event;if(e===!1&&a?.type===`click`&&a.pointerType===`touch`&&!U.current)return;e&&n===`trigger-focus`?(U.current=!1,W.start(300,()=>{U.current=!0})):(U.current=!0,W.clear());let o=(n===`trigger-press`||n===`item-press`)&&a.detail===0,s=!e&&(n===`escape-key`||n==null);B.current=t.event;let c=yz(D.state,e,t.trigger,i());c.openChangeReason=n,c.instantType=I.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?`group`:o||s?o?`click`:`dismiss`:void 0,D.update(c)}),ie=ez({popupStore:D,floatingRootContext:D.state.floatingRootContext,floatingId:S,nested:C!=null,onOpenChange:q}),ae=ie.context.events;Q(()=>{let e=({open:e,eventDetails:t})=>q(e,t);return ae.on(`setOpen`,e),()=>{ae?.off(`setOpen`,e)}},[ae,q]);let oe=VW.useCallback(()=>{D.setOpen(!1,XP(qP))},[D]);VW.useImperativeHandle(u,()=>({unmount:ne,close:oe}),[ne,oe]);let se;I.type===`context-menu`&&(se=I.context),VW.useImperativeHandle(se?.positionerRef,()=>M,[M]),VW.useImperativeHandle(se?.actionsRef,()=>({setOpen:q}),[q]);let ce=mR(ie,{enabled:!P,bubbles:{escapeKey:d&&I.type===`menu`},outsidePress(){return I.type!==`context-menu`||B.current?.type===`contextmenu`||V.current},externalTree:G?O:void 0}),le=JV(),ue=VW.useCallback(e=>{D.select(`activeIndex`)!==e&&D.set(`activeIndex`,e)},[D]),de=bB(ie,{enabled:!P,listRef:D.context.itemDomElements,activeIndex:L,nested:I.type!==void 0,loopFocus:c,orientation:l,parentOrientation:I.type===`menubar`?I.context.orientation:void 0,rtl:le===`rtl`,disabledIndices:JM,onNavigate:ue,openOnArrowKeyDown:I.type!==`context-menu`,externalTree:G?O:void 0,focusItemOnHover:h}),fe=VW.useCallback(e=>{D.context.typingRef.current=e},[D]),pe=wB(ie,{enabled:!P,listRef:D.context.itemLabels,elementsRef:D.context.itemDomElements,activeIndex:L,resetMs:500,onMatch:e=>{A&&e!==L&&D.set(`activeIndex`,e)},onTyping:fe}),me=VW.useMemo(()=>{let e=$I(pe.reference,de.reference,ce.reference,{onMouseMove(){D.set(`allowMouseEnter`,!0)}},te);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=A,e},[D,pe.reference,de.reference,ce.reference,te,A]),J=VW.useMemo(()=>{let e=$I(de.trigger,ce.trigger,te);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[de.trigger,ce.trigger,te]);LM(()=>(D.update({inactiveTriggerProps:J}),null)),wz(D,{floatingRootContext:ie,activeTriggerProps:me,inactiveTriggerProps:J,popupProps:VW.useMemo(()=>$I(Dz,{id:S,role:`menu`,"aria-orientation":l===`horizontal`?`horizontal`:void 0,"aria-labelledby":j?.id,onMouseMove(){D.set(`allowMouseEnter`,!0),I.type===`menu`&&D.set(`hoverEnabled`,!1)},onClick(){D.select(`hoverEnabled`)&&D.set(`hoverEnabled`,!1)},onKeyDown(e){let t=D.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},pe.floating,de.floating,ce.floating),[j,S,l,I.type,D,pe.floating,de.floating,ce.floating]),itemProps:de.item??YM});let he=VW.useMemo(()=>({store:D,parent:b}),[D,b]),ge=(0,HW.jsxs)(_U.Provider,{value:he,children:[f&&(0,HW.jsx)(gz,{handle:f,store:D}),typeof t==`function`?t({payload:R}):t]});return I.type===void 0||I.type===`context-menu`?(0,HW.jsx)(qL,{externalTree:O,children:ge}):ge})}));function GW(e,t){let n=KW(t);return e.clientX>=n.left-qW&&e.clientX<=n.right+qW&&e.clientY>=n.top-qW&&e.clientY<=n.bottom+qW}function KW(e){let t=e.getBoundingClientRect(),n=sj(e);if(CN)return t;let r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(r.content===`none`&&i.content===`none`)return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}var qW,JW=s((()=>{DF(),TN(),qW=5}));function YW(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=tV(),{ref:i,index:a}=LU(e),o=n===a,s=XW.useRef(null),c=nF(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}var XW,ZW=s((()=>{XW=d(m(),1),cF(),iV(),zU()}));function QW(e){let{render:t,className:n,style:r,state:i=YM,props:a=JM,refs:o=JM,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=YW({metadata:s});return gL(l,e,{state:i,ref:[f,...o],props:[d,...a,u],stateAttributesMapping:c})}var $W=s((()=>{XM(),TL(),ZW()}));function eG(e){if(dj(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`);if(!yj(e))return eG(Sj(e))}var tG=s((()=>{Aj()}));function nG(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=rG.useRef(!1);return rG.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,EF(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:YM,[t,n,r])}var rG,iG=s((()=>{rG=d(m(),1),DF(),XM()}));function aG(e,t){let n=eN(),[r,i]=sG.useState(!1);return Q(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function oG(){let e=EW(!0);return sG.useMemo(()=>e?{type:`menubar`,context:e}:{type:void 0},[e])}var sG,cG,lG,uG=s((()=>{RI(),sG=d(m(),1),rN(),DF(),KM(),yF(),oN(),XM(),IB(),WL(),XR(),vU(),fP(),TL(),mV(),JW(),$W(),iV(),tG(),Uz(),xV(),_V(),YP(),iG(),kW(),jL(),FF(),hL(),cG=d(O(),1),lG=HM(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,openOnHover:c,delay:l=100,closeDelay:u=0,handle:d,payload:f,...p}=e,m=hU(!0),h=zz(d)??m?.store;if(!h)throw Error(LI(85));let g=gV(s),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=sG.useRef(null),S=oG(),C=tV(!0),w=$L(),T=sG.useMemo(()=>w??new UL,[w]),{registerTrigger:E,isMountedByThisTrigger:D}=xz(g,x,h,{payload:f,closeDelay:u,parent:S,floatingTreeRoot:T,floatingNodeId:GL(T),floatingParentNodeId:QL(),keyboardEventRelay:C?.relayKeyboardEvent}),O=S.type===`menubar`,k=h.useState(`disabled`),A=a||k||O&&S.context.disabled,{getButtonProps:j,buttonRef:M}=uV({disabled:A,native:o});sG.useEffect(()=>{!y&&S.type===void 0&&(h.context.allowMouseUpTriggerRef.current=!1)},[h,y,S.type]);let N=sG.useRef(null),P=eN(),F=$(e=>{if(!N.current)return;P.clear(),h.context.allowMouseUpTriggerRef.current=!1;let t=e.target;NN(N.current,t)||NN(h.select(`positionerElement`),t)||t===N.current||t!=null&&eG(t)===h.select(`rootId`)||GW(e,N.current)||T.events.emit(`close`,{domEvent:e,reason:GP})});sG.useEffect(()=>{y&&h.select(`lastOpenChangeReason`)===`trigger-hover`&&EF(N.current).addEventListener(`mouseup`,F,{once:!0})},[y,F,h]);let I=O&&S.context.hasSubmenuOpen,L=lB(v,{enabled:(c??I)&&!A&&(!O||I&&!D),handleClose:jB({blockPointerEvents:!O}),mouseOnly:!0,move:!1,restMs:S.type===void 0?l:void 0,delay:{close:u},triggerElementRef:x,externalTree:T,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),R=aG(y,h.select(`lastOpenChangeReason`)),z=fR(v,{enabled:!A,event:y&&O?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:S.type===void 0&&R}),B=Xz(v,{enabled:!A&&I}),V=nG({open:y,enabled:O,mouseDownAction:`open`}),H=sG.useMemo(()=>$I(B.reference,z.reference),[B.reference,z.reference]),U=h.useState(`triggerProps`,D),{preFocusGuardRef:W,handlePreFocusGuardFocus:G,handleFocusTargetFocus:ee}=vV(h,x),te={disabled:A,open:y},ne=[N,t,M,E,x],K=[H,L??YM,U,{"aria-haspopup":`menu`,"aria-controls":b,id:g,onMouseDown:e=>{h.select(`open`)||(P.start(200,()=>{h.context.allowMouseUpTriggerRef.current=!0}),EF(e.currentTarget).addEventListener(`mouseup`,F,{once:!0}))}},O?{role:`menuitem`}:{},V,p,j],re=gL(`button`,e,{enabled:!O,stateAttributesMapping:lP,state:te,ref:ne,props:K});return O?(0,cG.jsx)(QW,{tag:`button`,render:n,className:r,style:i,state:te,refs:ne,props:K,stateAttributesMapping:lP}):y?(0,cG.jsxs)(sG.Fragment,{children:[(0,cG.jsx)(PF,{ref:W,onFocus:G},`${g}-pre-focus-guard`),(0,cG.jsx)(sG.Fragment,{children:re},g),(0,cG.jsx)(PF,{ref:h.context.triggerFocusTargetRef,onFocus:ee},`${g}-post-focus-guard`)]}):(0,cG.jsx)(sG.Fragment,{children:re},g)})})),dG,fG,pG=s((()=>{dG=d(m(),1),TL(),fG=dG.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return gL(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})})}));function mG(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}var hG=s((()=>{})),gG=s((()=>{mU(),vU(),TL(),fP(),SU(),YP(),TU(),XM(),RI(),MU(),zU(),_V(),YN(),ZP(),az(),pz(),qU(),XU(),$U(),OU(),iU(),hL(),rW(),dW(),TW(),yF(),UU(),WW(),zW(),uG(),WV(),TF(),oU(),oN(),DF(),uz(),KA(),Aj(),cH(),ZV(),nH(),pG(),mF(),TN(),IB(),Uz(),FW(),jR()})),_G=s((()=>{gG()})),vG,yG,bG=s((()=>{m(),vG=()=>void 0,yG=()=>vG()}));function xG(){OG||typeof document>`u`||(OG=!0,document.addEventListener(`keydown`,()=>DG=`keyboard`,{capture:!0,passive:!0}),document.addEventListener(`pointerdown`,()=>DG=`pointer`,{capture:!0,passive:!0}))}function SG(){return xG(),DG===`program`?`pointer`:DG}function CG(e){return e?typeof KeyboardEvent<`u`&&e instanceof KeyboardEvent?`keyboard`:e.type===`click`&&e.detail===0?SG():typeof MouseEvent<`u`&&e instanceof MouseEvent||typeof TouchEvent<`u`&&e instanceof TouchEvent?`pointer`:SG():`program`}function wG(e,t){let n=t&&`nativeEvent`in t?t.nativeEvent:t;return n?{reason:e,source:CG(n),event:n}:{reason:e,source:`program`}}function TG(e){return{reason:e,source:SG()}}function EG(e,t){let n=e.reason===`none`?t:e.reason,r=e.event?.type===`base-ui`?void 0:e.event;return r?{reason:n,source:CG(r),event:r}:{reason:n,source:`program`}}var DG,OG,kG=s((()=>{DG=`program`,OG=!1,xG()}));function AG(e,t,n){return FG[e]=t,(r=>{let i=(0,NG.useContext)(IG)[e],a=(0,NG.useRef)(r);a.current=r;let o=(0,NG.useRef)({});return(0,NG.createElement)(i??t,i&&n?jG(r,n,a,o.current):r)})}function jG(e,t,n,r){let i=e;for(let[a,[o,s]]of Object.entries(t))typeof e[a]==`function`&&(i===e&&(i={...e}),i[a]=r[a]??=(...e)=>{let t=n.current[a];if(typeof t==`function`)return e[o]=MG(e[o],s),t(...e)});return i}function MG(e,t){let n=TG(t);if(typeof e!=`object`||!e)return n;let r=e;if(r.source!==void 0)return e;let i=typeof r.reason==`string`&&r.reason!==`none`?r.reason:t,a=r.event instanceof Event?r.event.type===`base-ui`?`program`:CG(r.event):n.source;return Object.isExtensible(e)?(Object.assign(r,{reason:i,source:a}),e):{...r,reason:i,source:a}}var NG,PG,FG,IG,LG=s((()=>{NG=d(m()),kG(),PG={},FG={},IG=(0,NG.createContext)(PG)}));function RG({intent:e=`secondary`,size:t=`default`,block:n=!1,className:r=``}={}){return[`btn`,HG[e],t==="default"?``:`btn-${t}`,n?`btn-block`:``,r].filter(Boolean).join(` `)}function zG({intent:e=`secondary`,size:t=`default`,busy:n=!1,busyLabel:r,block:i=!1,type:a=`button`,className:o,onClick:s,children:c,ref:l,...u}){let d=e=>{n?e.preventDefault():s?.(e)};return(0,VG.jsx)(`button`,{...u,ref:l,type:a,className:RG({intent:e,size:t,block:i,className:o}),"aria-disabled":n||u[`aria-disabled`]||void 0,"data-busy":n||void 0,onClick:d,children:n&&r!==void 0?r:c})}function BG({intent:e,size:t,block:n,className:r,...i}){return(0,VG.jsx)(`a`,{...i,className:RG({intent:e,size:t,block:n,className:r})})}var VG,HG,UG,WG,GG=s((()=>{LG(),VG=d(O(),1),HG={primary:`primary btn-primary`,secondary:`ghost btn-secondary`,quiet:`btn-quiet`,danger:`danger btn-danger`},UG=AG(`Button`,zG),WG=AG(`ButtonLink`,BG)}));function KG({className:e,triggerClassName:t=RG(),triggerTitle:n,triggerLabel:r,label:i,popupClassName:a=`dd-list`,side:o=`bottom`,align:s=`end`,sideOffset:c=4,open:l,onOpenChange:u,finalFocus:d,children:f}){let p=(0,XG.useRef)(null),[m,h]=(0,XG.useState)(null);(0,XG.useEffect)(()=>{h(p.current?.closest(`dialog, [role="dialog"]`))},[]);let[g,_]=(0,XG.useState)(!1),v=l??g;return(0,ZG.jsx)(`div`,{className:e||void 0,children:(0,ZG.jsxs)(UW,{open:v,onOpenChange:(e,t)=>{!e&&t.reason===`escape-key`&&d===void 0&&p.current?.focus({preventScroll:!0}),_(e),u?.(e,EG(t,`implicit`))},children:[(0,ZG.jsx)(lG,{render:(0,ZG.jsx)(`button`,{type:`button`,className:t,title:n,"aria-label":r,ref:p}),children:i}),(0,ZG.jsx)(uW,{container:m??yG(),children:(0,ZG.jsx)(wW,{anchor:()=>p.current?cU(p.current):null,positionMethod:`fixed`,side:o,align:s,sideOffset:c,collisionBoundary:lU(),collisionPadding:8,style:{zIndex:90},children:(0,ZG.jsx)(nW,{className:a,finalFocus:d,children:f})})})]})})}function qG({className:e,labelClassName:t,label:n,children:r}){return(0,ZG.jsxs)(KU,{className:e,children:[(0,ZG.jsx)(YU,{className:t,children:n}),r]})}function JG({className:e=`dd-divider`}){return(0,ZG.jsx)(fG,{className:e})}function YG({className:e=`dd-option`,disabled:t,closeOnClick:n,onClick:r,title:i,children:a,ref:o}){return(0,ZG.jsx)(QU,{render:(0,ZG.jsx)(`button`,{type:`button`,className:e,title:i,ref:o}),nativeButton:!0,disabled:t,closeOnClick:n,onClick:r,children:a})}var XG,ZG,QG,$G,eK=s((()=>{XG=d(m(),1),_G(),uU(),bG(),GG(),kG(),LG(),ZG=d(O(),1),QG=AG(`DropMenu`,KG,{onOpenChange:[1,`implicit`]}),AG(`DropGroup`,qG),AG(`DropSeparator`,JG),$G=AG(`DropItem`,YG)})),tK,nK=s((()=>{Ya(),tK=Va({formatting:`Formatting for {label}`,bold:`Bold`,boldMark:`B`,italicMark:`I`,strikeMark:`S`,italic:`Italic`,strike:`Strikethrough`,textStyle:`Text style`,paragraph:`Paragraph`,heading:`Heading {level}`,quote:`Quote`,codeBlock:`Code block`,inlineCode:`Code`,bulletList:`Bulleted list`,orderedList:`Numbered list`,taskList:`Checklist`,link:`Link`,linkAddress:`Link address`,linkPlaceholder:`https://`,linkApply:`Apply`,linkRemove:`Remove link`,linkInvalid:`A link is a web address (https://…) or mailto:.`,table:`Table`,tableInsert:`Insert table`,tableRowAfter:`Add row below`,tableColumnAfter:`Add column right`,tableRowDelete:`Delete row`,tableColumnDelete:`Delete column`,tableDelete:`Delete table`,picture:`Add picture`,pictureAdding:`Adding picture…`,noPeople:`No one by that name`,people:`People`,group:`Team`})})),rK=s((()=>{})),iK=l({RichTextEditor:()=>lK,cleanPastedHtml:()=>aK});function aK(e){return e.replace(/<!--\[if[\s\S]*?<!\[endif\]-->/gi,``).replace(/<!--[\s\S]*?-->/g,``).replace(/<\/?(?:o|w|m|v):[^>]*>/gi,``).replace(/<(style|xml|title)\b[\s\S]*?<\/\1\s*>/gi,``).replace(/<(?:meta|link)\b[^>]*>/gi,``).replace(/<b\b[^>]*id="docs-internal-guid[^"]*"[^>]*>([\s\S]*)<\/b>/i,`$1`)}function oK(e){let t=e.getHTML().replace(/(?:<p><\/p>)+$/,``);return jr(t)||/<img\b/i.test(t)?t:``}function sK(e){let t=(0,dK.useRef)(e);return t.current=e,t}function cK({label:e,active:t,disabled:n,onClick:r,children:i}){return(0,fK.jsx)(`button`,{type:`button`,className:`rich-tool${t?` is-active`:``}`,title:e,"aria-label":e,"aria-pressed":t,disabled:n,onMouseDown:e=>e.preventDefault(),onClick:r,children:i})}function lK({id:e,value:t,onChange:n,label:r,describedBy:i,invalid:a,disabled:o=!1,autoFocus:s,placeholder:c,mentions:l,pictures:u,onKey:d,onProblem:f,onPopupChange:p}){let[m,h]=(0,dK.useState)(),[g,_]=(0,dK.useState)(),[v,y]=(0,dK.useState)(!1),[b,x]=(0,dK.useState)(0),S=sK({onChange:n,mentions:l,pictures:u,onKey:d,onProblem:f,suggesting:m}),C=(0,dK.useRef)({query:``,count:1}),w=(0,dK.useRef)(null),T=(0,dK.useRef)(null),E=(0,dK.useRef)({html:``,edited:!1}),D=(e,t,n)=>{let r=S.current.pictures,i=t.filter(e=>e.type.startsWith(`image/`));if(!r||!i.length)return!1;for(let t of i)x(e=>e+1),r(t).then(r=>{let i=e.chain().focus();(n===void 0?i:i.setTextSelection(n)).setImage({src:r,alt:t.name}).run()}).catch(e=>S.current.onProblem?.(e.message)).finally(()=>x(e=>e-1));return!0},O=sC({immediatelyRender:!0,shouldRerenderOnTransaction:!0,editable:!o,autofocus:s?`end`:!1,content:t||``,extensions:[xO.configure({heading:{levels:[2,3,4]},horizontalRule:!1,link:{openOnClick:!1,autolink:!0,defaultProtocol:`https`,protocols:[`mailto`],isAllowedUri:e=>Or(e)!==void 0,HTMLAttributes:{rel:`noopener noreferrer`,target:`_blank`}}}),ED,TD.configure({nested:!0}),vA.configure({resizable:!1}),mA,pA,fA,IM.configure({inline:!1,allowBase64:!1}),...c?[gO.configure({placeholder:c})]:[],...l?[NM.extend({addAttributes(){return{...this.parent?.(),kind:{default:null,parseHTML:e=>e.getAttribute(`data-kind`)===`group`?`group`:null,renderHTML:()=>({})},label:{default:null,parseHTML:e=>(e.textContent??``).replace(/^@/,``)||null,renderHTML:()=>({})}}}}).configure({renderText:({node:e})=>`@${e.attrs.label??e.attrs.id}`,renderHTML:({node:e})=>[`span`,{"data-type":`mention`,"data-id":e.attrs.id,...e.attrs.kind===`group`?{"data-kind":`group`}:{}},`@${e.attrs.label??e.attrs.id}`],suggestion:{allowSpaces:!0,allow:({state:e,range:t})=>{if(!e.doc.resolve(t.from).parent.type.contentMatch.matchType(e.schema.nodes.mention))return!1;let n=e.doc.textBetween(t.from+1,t.to);if(!/\s/.test(n))return!0;if(/^\s|\s\s/.test(n)||n.trim().split(/\s+/).length+ +!!/\s$/.test(n)>2)return!1;let r=C.current;return r.count>0||!n.startsWith(r.query)},items:async({query:e})=>{try{return(await S.current.mentions?.(e)??[]).slice(0,8)}catch{return[]}},render:()=>{let e=e=>{if(e.loading||(C.current={query:e.query,count:e.items.length}),!e.loading&&!e.items.length&&/\s/.test(e.query))return h(void 0);h(t=>({items:e.items,index:t&&t.items===e.items?t.index:0,box:()=>e.clientRect?.()??null,pick:t=>e.command({id:t.id,label:t.label,kind:t.kind??null})}))};return{onStart:e,onUpdate:e,onExit:()=>h(void 0),onKeyDown:({event:e})=>{let t=S.current.suggesting;if(!t||!t.items.length)return e.key===`Escape`&&(h(void 0),!0);if(e.key===`ArrowDown`||e.key===`ArrowUp`){let n=e.key===`ArrowDown`?1:-1;return h({...t,index:(t.index+n+t.items.length)%t.items.length}),!0}return e.key===`Enter`||e.key===`Tab`?(t.pick(t.items[t.index]),!0):e.key===`Escape`&&(h(void 0),!0)}}}}})]:[]],editorProps:{attributes:{class:`rich-text rich-text-editable`,role:`textbox`,"aria-multiline":`true`,"aria-label":r,...e?{id:e}:{},...i?{"aria-describedby":i}:{},...a?{"aria-invalid":`true`}:{}},transformPastedHTML:aK,handleKeyDown:(e,t)=>S.current.onKey?.(t)??!1,handlePaste:(e,t)=>{let n=[...t.clipboardData?.files??[]];return n.length>0&&T.current?D(T.current,n):!1},handleDrop:(e,t)=>{let n=[...t.dataTransfer?.files??[]];if(!n.length||!T.current)return!1;let r=e.posAtCoords({left:t.clientX,top:t.clientY})?.pos;return D(T.current,n,r)}},onCreate:({editor:e})=>{E.current={html:oK(e),edited:!1}},onUpdate:({editor:e})=>{let t=oK(e);(E.current.edited||t!==E.current.html)&&(E.current.edited=!0,S.current.onChange(t))}});T.current=O;let k=!!m;if((0,dK.useEffect)(()=>{p?.(k)},[k]),(0,dK.useEffect)(()=>{O&&t!==oK(O)&&(O.commands.setContent(t||``,{emitUpdate:!1}),E.current={html:oK(O),edited:!1})},[O,t]),(0,dK.useEffect)(()=>{O?.setEditable(!o)},[O,o]),!O)return null;let A=e=>()=>e(O.chain().focus()).run(),j=O.isActive(`heading`,{level:2})?tK(`heading`,{level:2}):O.isActive(`heading`,{level:3})?tK(`heading`,{level:3}):O.isActive(`heading`,{level:4})?tK(`heading`,{level:4}):O.isActive(`codeBlock`)?tK(`codeBlock`):tK(`paragraph`),M=O.isActive(`table`),N=()=>{let e=(g??``).trim();e?Or(e)?(O.chain().focus().extendMarkRange(`link`).setLink({href:e}).run(),_(void 0)):y(!0):(O.chain().focus().extendMarkRange(`link`).unsetLink().run(),_(void 0))},P=()=>{y(!1),_(O.getAttributes(`link`).href??``)};return(0,fK.jsxs)(`div`,{className:`rich-editor${a?` is-invalid`:``}${o?` is-disabled`:``}`,children:[(0,fK.jsxs)(`div`,{className:`rich-toolbar`,role:`toolbar`,"aria-label":tK(`formatting`,{label:r}),children:[(0,fK.jsx)(cK,{label:tK(`bold`),active:O.isActive(`bold`),disabled:o,onClick:A(e=>e.toggleBold()),children:(0,fK.jsx)(`strong`,{children:tK(`boldMark`)})}),(0,fK.jsx)(cK,{label:tK(`italic`),active:O.isActive(`italic`),disabled:o,onClick:A(e=>e.toggleItalic()),children:(0,fK.jsx)(`em`,{children:tK(`italicMark`)})}),(0,fK.jsx)(cK,{label:tK(`strike`),active:O.isActive(`strike`),disabled:o,onClick:A(e=>e.toggleStrike()),children:(0,fK.jsx)(`s`,{children:tK(`strikeMark`)})}),(0,fK.jsx)(`span`,{className:`rich-tool-gap`,"aria-hidden":`true`}),(0,fK.jsxs)(QG,{className:`rich-tool-menu`,triggerClassName:`rich-tool rich-tool-wide`,triggerTitle:tK(`textStyle`),triggerLabel:`${tK(`textStyle`)}: ${j}`,label:(0,fK.jsxs)(fK.Fragment,{children:[j,(0,fK.jsx)(`span`,{className:`rich-tool-caret`,"aria-hidden":`true`,children:`▾`})]}),popupClassName:`page-actions-popup rich-menu`,align:`start`,children:[(0,fK.jsx)($G,{className:`page-actions-item`,onClick:A(e=>e.setParagraph()),children:tK(`paragraph`)}),[2,3,4].map(e=>(0,fK.jsx)($G,{className:`page-actions-item rich-menu-h${e}`,onClick:A(t=>t.setHeading({level:e})),children:tK(`heading`,{level:e})},e)),(0,fK.jsx)($G,{className:`page-actions-item`,onClick:A(e=>e.toggleBlockquote()),children:tK(`quote`)}),(0,fK.jsx)($G,{className:`page-actions-item`,onClick:A(e=>e.toggleCodeBlock()),children:tK(`codeBlock`)})]}),(0,fK.jsx)(`span`,{className:`rich-tool-gap`,"aria-hidden":`true`}),(0,fK.jsx)(cK,{label:tK(`bulletList`),active:O.isActive(`bulletList`),disabled:o,onClick:A(e=>e.toggleBulletList()),children:`•≡`}),(0,fK.jsx)(cK,{label:tK(`orderedList`),active:O.isActive(`orderedList`),disabled:o,onClick:A(e=>e.toggleOrderedList()),children:`1≡`}),(0,fK.jsx)(cK,{label:tK(`taskList`),active:O.isActive(`taskList`),disabled:o,onClick:A(e=>e.toggleTaskList()),children:`☑`}),(0,fK.jsx)(`span`,{className:`rich-tool-gap`,"aria-hidden":`true`}),(0,fK.jsx)(cK,{label:tK(`link`),active:O.isActive(`link`),disabled:o,onClick:P,children:`↗`}),(0,fK.jsx)(cK,{label:tK(`inlineCode`),active:O.isActive(`code`),disabled:o,onClick:A(e=>e.toggleCode()),children:`</>`}),(0,fK.jsxs)(QG,{className:`rich-tool-menu`,triggerClassName:`rich-tool`,triggerTitle:tK(`table`),triggerLabel:tK(`table`),label:`⊞`,popupClassName:`page-actions-popup rich-menu`,align:`start`,children:[(0,fK.jsx)($G,{className:`page-actions-item`,disabled:M,onClick:A(e=>e.insertTable({rows:3,cols:3,withHeaderRow:!0})),children:tK(`tableInsert`)}),(0,fK.jsx)($G,{className:`page-actions-item`,disabled:!M,onClick:A(e=>e.addRowAfter()),children:tK(`tableRowAfter`)}),(0,fK.jsx)($G,{className:`page-actions-item`,disabled:!M,onClick:A(e=>e.addColumnAfter()),children:tK(`tableColumnAfter`)}),(0,fK.jsx)($G,{className:`page-actions-item`,disabled:!M,onClick:A(e=>e.deleteRow()),children:tK(`tableRowDelete`)}),(0,fK.jsx)($G,{className:`page-actions-item`,disabled:!M,onClick:A(e=>e.deleteColumn()),children:tK(`tableColumnDelete`)}),(0,fK.jsx)($G,{className:`page-actions-item`,disabled:!M,onClick:A(e=>e.deleteTable()),children:tK(`tableDelete`)})]}),u&&(0,fK.jsxs)(fK.Fragment,{children:[(0,fK.jsx)(cK,{label:tK(b?`pictureAdding`:`picture`),disabled:o,onClick:()=>w.current?.click(),children:`▣`}),(0,fK.jsx)(`input`,{ref:w,type:`file`,accept:`image/*`,hidden:!0,onChange:e=>{let t=[...e.target.files??[]];e.target.value=``,D(O,t)}})]})]}),g!==void 0&&(0,fK.jsxs)(`div`,{className:`rich-link-bar`,children:[(0,fK.jsx)(`input`,{className:`field-control`,type:`url`,autoFocus:!0,"aria-label":tK(`linkAddress`),"aria-invalid":v||void 0,placeholder:tK(`linkPlaceholder`),value:g,onChange:e=>{_(e.target.value),y(!1)},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),N()):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),_(void 0),O.commands.focus())}}),(0,fK.jsx)(`button`,{type:`button`,className:`rich-tool rich-tool-wide`,onClick:N,children:tK(`linkApply`)}),O.isActive(`link`)&&(0,fK.jsx)(`button`,{type:`button`,className:`rich-tool rich-tool-wide`,onClick:()=>{O.chain().focus().extendMarkRange(`link`).unsetLink().run(),_(void 0)},children:tK(`linkRemove`)}),v&&(0,fK.jsx)(`span`,{className:`insert-missing`,role:`alert`,children:tK(`linkInvalid`)})]}),(0,fK.jsx)(bC,{editor:O,className:`rich-editor-body`,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),P())}}),m&&(0,fK.jsx)(uK,{suggesting:m,onPick:e=>m.pick(e)})]})}function uK({suggesting:e,onPick:t}){return(0,fK.jsx)(JB,{open:!0,modal:!1,children:(0,fK.jsx)(HV,{container:ja(),children:(0,fK.jsx)(BH,{anchor:{getBoundingClientRect:()=>{let t=e.box(),n=Cs(),r=(t?.top??0)/n,i=(t?.left??0)/n,a=(t?.width??0)/n,o=(t?.height??0)/n;return{x:i,y:r,top:r,left:i,width:a,height:o,right:i+a,bottom:r+o,toJSON:()=>({})}}},positionMethod:`fixed`,side:`bottom`,align:`start`,sideOffset:4,collisionBoundary:lU(),collisionPadding:8,style:{zIndex:95},children:(0,fK.jsx)(rU,{className:`rich-mentions`,initialFocus:!1,finalFocus:!1,children:(0,fK.jsx)(`div`,{role:`listbox`,"aria-label":tK(`people`),children:e.items.length?e.items.map((n,r)=>(0,fK.jsxs)(`div`,{role:`option`,"aria-selected":r===e.index,className:`rich-mention-option${r===e.index?` is-active`:``}`,onMouseDown:e=>{e.preventDefault(),t(n)},children:[(0,fK.jsx)(`span`,{children:n.label}),n.kind===`group`?(0,fK.jsx)(`span`,{className:`rich-mention-kind`,children:tK(`group`)}):n.handle&&(0,fK.jsxs)(`span`,{className:`rich-mention-handle`,children:[`@`,n.handle]})]},`${n.kind??`person`}:${n.id}`)):(0,fK.jsx)(`div`,{className:`rich-mention-none`,children:tK(`noPeople`)})})})})})})}var dK,fK,pK=s((()=>{dK=d(m()),jC(),SO(),DD(),Qte(),$te(),ene(),yO(),sU(),zr(),tc(),uU(),eK(),nK(),rK(),Pa(),fK=d(O())}));function mK(e,t){let n=e.labelColumn??e.by,r=e=>e==null?``:String(e);if(!nt(n))return r(t[n]);let i=Ye(n);return`problem`in i?``:i.parts.map(e=>`text`in e?e.text:[e.path,...(e.or??[]).map(e=>e.path)].map(e=>r(t[e])).find(Boolean)??``).join(``).replace(/\s+/g,` `).trim()}function hK(e,t,n,r=[]){let i=Br(e.labelColumn??e.by),a=`problem`in i?[e.by]:i.columns,o=e=>n?.find(t=>t.name===e),s=[...new Set([...a,e.by])].filter(e=>gK(o(e))),c=t.trim().split(/\s+/).filter(Boolean).slice(0,s.length>4?1:_K),l=s.length?c.map(e=>`(${s.flatMap(t=>[`${t} startswith ${wn(e)}`,`${t} contains ${wn(` ${e}`)}`]).join(` or `)})`):[];return[e.from,l.join(` and `),`show ${[...new Set([e.by,...a,...r])].join(`, `)}`,`sort ${a.join(`, `)}`].filter(Boolean).join(` `)}var gK,_K,vK=s((()=>{St(),sr(),ot(),Vr(),zr(),gK=e=>!e?.type||ht(e.type)===`text`&&!/uuid|json/i.test(e.type),_K=2})),yK=l({mentionRows:()=>SK});function bK(e){if(!e.through)return;let t=Ys(e.from),n=(Xs(e.through)??[]).find(e=>e.to.table===t?.id&&e.from.columns.length===1);return n&&{column:n.from.columns[0],team:n.to.columns[0]}}async function xK(e,t,n){let r=bK(e);if(!r)return t;let i=[...new Set(t.map(e=>e[r.team]).filter(e=>typeof e==`string`||typeof e==`number`))];if(!i.length)return[];let a=`${e.through} ${r.column} in (${i.map(wn).join(`, `)}) show ${r.column}`,o=await Ns(`/api/run`,{...ao(n??null),q:a,limit:500,offset:0,count:`none`}),s=new Set((o.rows??[]).map(e=>String(e[r.column])));return t.filter(e=>s.has(String(e[r.team])))}async function SK(e,t,n,r){let i=Ys(e.from),a=r===`group`?bK(e):void 0,o=hK(e,t,i?.columns,a?[a.team]:[]),s=await Ns(`/api/run`,{...ao(n??null),q:o,limit:a?24:8,offset:0,count:`none`});return(a?(await xK(e,s.rows??[],n)).slice(0,8):s.rows??[]).flatMap(t=>{let n=t[e.by],i=typeof n==`string`&&Pr.test(n)?n:typeof n==`number`&&Number.isSafeInteger(n)?String(n):void 0;if(i===void 0)return[];let a=mK(e,t)||i;return[{id:i,label:a,...r||!CK(e,i,a)?{}:{handle:i},...r?{kind:r}:{}}]})}function CK(e,t,n){return!Ys(e.from)?.columns?.some(t=>t.name===e.by&&t.primaryKey)&&t!==n&&!/^\d+$/.test(t)&&!wK.test(t)&&!t.includes(`@`)}var wK,TK=s((()=>{tc(),uo(),zr(),vK(),sr(),wK=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i})),EK,DK,OK,kK,AK,jK=s((()=>{EK=d(m(),1),DK=d(O(),1),OK=EK.createContext(void 0),kK=e=>{let t=EK.useContext(OK);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},AK=({client:e,children:t})=>(EK.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,DK.jsx)(OK.Provider,{value:e,children:t}))}));function MK(e){setTimeout(e,0)}var NK,PK,FK,IK=s((()=>{NK={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},PK=class{#e=NK;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},FK=new PK}));function LK(){}function RK(e,t){return typeof e==`function`?e(t):e}function zK(e){return typeof e==`number`&&e>=0&&e!==1/0}function BK(e,t){return Math.max(e+(t||0)-Date.now(),0)}function VK(e,t){return typeof e==`function`?e(t):e}function HK(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==WK(o,t.options))return!1}else if(!KK(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function UK(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(GK(t.options.mutationKey)!==GK(a))return!1}else if(!KK(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function WK(e,t){return(t?.queryKeyHashFn||GK)(e)}function GK(e){return JSON.stringify(e,(e,t)=>XK(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function KK(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n<t.length;n++)if(!KK(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!KK(e[r],t[r]))return!1;return!0}return!1}function qK(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=YK(e)&&YK(t);if(!r&&!(XK(e)&&XK(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:oq.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=qK(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function JK(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function YK(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function XK(e){if(!ZK(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!ZK(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function ZK(e){return Object.prototype.toString.call(e)===`[object Object]`}function QK(e){return new Promise(t=>{FK.setTimeout(t,e)})}function $K(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:qK(e,t)}function eq(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function tq(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}function nq(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===sq?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function rq(e,t){return typeof e==`function`?e(...t):!!e}function iq(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r||(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0})),i)}),e}var aq,oq,sq,cq=s((()=>{IK(),aq=typeof window>`u`||`Deno`in globalThis,oq=Object.prototype.hasOwnProperty,sq=Symbol()})),lq,uq,dq=s((()=>{cq(),lq=()=>aq,uq=()=>lq()})),fq,pq=s((()=>{fq=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}}})),mq,hq,gq=s((()=>{pq(),mq=class extends fq{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},hq=new mq}));function _q(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=vq,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var vq,yq,bq=s((()=>{IK(),vq=MK,yq=_q()})),xq,Sq,Cq=s((()=>{pq(),xq=class extends fq{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}},Sq=new xq}));function wq(e){return Math.min(1e3*2**e,3e4)}function Tq(e){return(e??`online`)!==`online`||Sq.isOnline()}function Eq(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(LK);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new Dq(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>hq.isFocused()&&(e.networkMode===`always`||Sq.isOnline())&&e.canRun(),p=()=>Tq(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(uq()?0:3),a=e.retryDelay??wq,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);t||!s?h(r):(n++,e.onFail?.(n,r),QK(o).then(()=>f()?void 0:g()).then(()=>{t?h(r):_()}))})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g().then(_),s)}}var Dq,Oq=s((()=>{cq(),dq(),gq(),Cq(),Dq=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}}})),kq,Aq=s((()=>{IK(),cq(),dq(),kq=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),zK(this.gcTime)&&(this.#e=FK.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(uq()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(FK.clearTimeout(this.#e),this.#e=void 0)}}}));function jq(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{iq(e,()=>t.signal,()=>n=!0)},u=nq(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?tq:eq;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?Nq:Mq,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Mq(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function Mq(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Nq(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Pq=s((()=>{cq()}));function Fq(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Tq(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Iq(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Lq(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Rq,zq=s((()=>{cq(),bq(),Oq(),Aq(),Pq(),Rq=class extends kq{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Lq(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Lq(this.options);e.data!==void 0&&(this.setState(Iq(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=$K(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(LK).catch(LK):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>VK(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===sq||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>VK(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!BK(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=nq(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?jq(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=Eq({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Dq&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Dq){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Fq(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Iq(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),yq.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}}}));function Bq(e,t){return VK(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||VK(t.retryOnMount,e)!==!1)}function Vq(e,t){return Bq(e,t)||e.state.data!==void 0&&Hq(e,t,t.refetchOnMount)}function Hq(e,t,n){if(VK(t.enabled,e)!==!1&&VK(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Wq(e,t)}return!1}function Uq(e,t,n,r){return(e!==t||VK(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Wq(e,n)}function Wq(e,t){return VK(t.enabled,e)!==!1&&e.isStaleByTime(VK(t.staleTime,e))}var Gq,Kq=s((()=>{IK(),cq(),dq(),pq(),gq(),bq(),zq(),Gq=class extends fq{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Vq(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Hq(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Hq(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof VK(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!JK(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Uq(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||VK(this.options.enabled,this.#t)!==VK(t.enabled,this.#t)||VK(this.options.staleTime,this.#t)!==VK(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||VK(this.options.enabled,this.#t)!==VK(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return JK(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(LK)),t}#h(e){return!uq()&&VK(this.options.enabled,this.#t)!==!1&&zK(e)}#g(){this.#b();let e=VK(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=BK(this.#r.dataUpdatedAt,e)+1;this.#u=FK.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=FK.setInterval(()=>{(this.options.refetchIntervalInBackground||hq.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(FK.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(FK.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Vq(e,t),o=i&&Uq(e,n,t,r);(a||o)&&(l={...l,...Fq(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=$K(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=$K(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Wq(e,t),refetch:this.refetch,isEnabled:VK(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),JK(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();yq.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}}}));function qq(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Jq,Yq=s((()=>{bq(),Oq(),Aq(),Jq=class extends kq{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||qq(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=Eq({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),yq.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}}}));function Xq(e){return e.options.scope?.id}var Zq,Qq=s((()=>{cq(),pq(),bq(),Yq(),Zq=class extends fq{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new Jq({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Xq(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Xq(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Xq(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=Xq(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){yq.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>UK(t,e))}findAll(e={}){return this.getAll().filter(t=>UK(e,t))}notify(e){yq.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return yq.batch(()=>Promise.all(e.map(e=>e.continue().catch(LK))))}}}));function $q(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var eJ,tJ=s((()=>{cq(),pq(),bq(),Kq(),eJ=class extends fq{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,yq.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!JK(e,n)});(o||s)&&(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&($q(e,n).forEach(e=>{e.destroy()}),$q(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){let n=new Set;return t.map((r,i)=>{let a=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?a:r.observer.trackResult(a,e=>{n.has(e)||(n.add(e),t.forEach(t=>{t.observer.trackProp(e)}))})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=qK(this.#a,t(e))),this.#a}return e}#f(){return!this.#r?.combine||this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new Gq(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=this.#t.slice(),this.#t[n]=t,this.#h())}#h(){if(this.hasListeners()){let e=this.#f(),t=this.#a,n=e?t:this.#d(this.#u(this.#t,this.#l),this.#r?.combine);(e||t!==n)&&yq.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}}})),nJ,rJ=s((()=>{cq(),pq(),bq(),zq(),nJ=class extends fq{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??WK(r,t),a=this.get(i);return a||(a=new Rq({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){yq.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>HK(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>HK(e,t)):t}notify(e){yq.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){yq.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){yq.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}}})),iJ,aJ=s((()=>{cq(),gq(),bq(),Cq(),Qq(),rJ(),iJ=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new nJ,this.#t=e.mutationCache||new Zq,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=hq.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Sq.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(VK(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=RK(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return yq.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;yq.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return yq.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=yq.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(LK).catch(LK)}invalidateQueries(e,t={}){return yq.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=yq.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(LK)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(LK)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(VK(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(VK(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(LK).catch(LK)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(LK).catch(LK)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Sq.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(GK(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{KK(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(GK(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{KK(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=WK(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===sq&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}}})),oJ=s((()=>{cq(),bq(),Kq(),tJ(),rJ(),aJ()})),sJ,cJ,lJ,uJ=s((()=>{sJ=d(m(),1),cJ=sJ.createContext(!1),lJ=()=>sJ.useContext(cJ),cJ.Provider}));function dJ(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var fJ,pJ,mJ,hJ=s((()=>{fJ=d(m(),1),O(),pJ=fJ.createContext(dJ()),mJ=()=>fJ.useContext(pJ)})),gJ,_J,vJ,yJ,bJ=s((()=>{gJ=d(m(),1),oJ(),_J=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?rq(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},vJ=e=>{gJ.useEffect(()=>{e.clearReset()},[e])},yJ=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||rq(n,[e.error,r]))})),xJ,SJ,CJ,wJ=s((()=>{xJ=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},SJ=(e,t)=>e?.suspense&&t.isPending,CJ=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()})}));function TJ({queries:e,...t},n){let r=kK(n),i=lJ(),a=mJ(),o=t.subscribed!==!1,s=EJ.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:o?`optimistic`:void 0,t}),[e,r,i,o]);s.forEach(e=>{xJ(e);let t=r.getQueryCache().get(e.queryHash);_J(e,a,t)}),vJ(a);let[c]=EJ.useState(()=>new eJ(r,s,t)),[l,u,d]=c.getOptimisticResult(s,t.combine),f=!i&&o;EJ.useSyncExternalStore(EJ.useCallback(e=>f?c.subscribe(yq.batchCalls(e)):LK,[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),EJ.useEffect(()=>{c.setQueries(s,t)},[s,t,c]);let p=l.some((e,t)=>SJ(s[t],e))?l.flatMap((e,t)=>{let n=s[t];if(n&&SJ(n,e)){let e=new Gq(r,n);return CJ(n,e,a)}return[]}):[];if(p.length>0)throw Promise.all(p);let m=l.find((e,t)=>{let n=s[t];return n&&yJ({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(m)throw m.error;return u(d())}var EJ,Vne=s((()=>{jK(),uJ(),hJ(),bJ(),wJ(),EJ=d(m(),1),oJ()}));function Hne(e,t,n){let r=lJ(),i=mJ(),a=kK(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,xJ(o),_J(o,i,s),vJ(i);let[l]=DJ.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(DJ.useSyncExternalStore(DJ.useCallback(e=>{let t=d?l.subscribe(yq.batchCalls(e)):LK;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),DJ.useEffect(()=>{l.setOptions(o)},[o,l]),SJ(o,u))throw CJ(o,l,i);if(yJ({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}var DJ,Une=s((()=>{jK(),uJ(),hJ(),bJ(),wJ(),DJ=d(m(),1),oJ()}));function OJ(e,t){return Hne(e,Gq,t)}var Wne=s((()=>{Une(),oJ()})),kJ=s((()=>{jK(),Vne(),Wne(),oJ()}));function Gne(){return(0,AJ.useSyncExternalStore)(La,Ia,Ia)}var AJ,Kne=s((()=>{AJ=d(m()),Ya()}));function qne(e){return Ea(window,`online`,e),Ea(window,`offline`,e),()=>{Da(window,`online`,e),Da(window,`offline`,e)}}function jJ({text:e,retry:t,crashed:n=!1}){Gne();let r=(0,NJ.useSyncExternalStore)(qne,IJ,()=>!0),i=(0,NJ.useContext)(OK),a=(0,NJ.useContext)(FJ),o=(0,NJ.useId)(),s=!n&&!r?Ba(`problem.offline`):e;a&&!a.has(s)&&a.set(s,o);let c=!a||a.get(s)===o;if((0,NJ.useEffect)(()=>()=>{a?.get(s)===o&&a.delete(s)},[a,s,o]),!c&&!n)return(0,PJ.jsx)(`p`,{className:`problem problem-repeat`,children:Ba(`problem.sameAbove`)});let l=()=>{t?.(),i?.refetchQueries({type:`active`,predicate:e=>e.state.status===`error`})};return(0,PJ.jsxs)(`div`,{className:`problem`,role:`alert`,...n?{"data-section-error":``}:{},children:[(0,PJ.jsx)(Pe,{name:`warning`,className:`problem-mark`}),(0,PJ.jsx)(`p`,{className:`problem-text`,children:s}),(0,PJ.jsx)(UG,{size:`compact`,className:`problem-retry`,onClick:l,children:Ba(`problem.retry`)})]})}function Jne({mark:e,text:t,detail:n,action:r,className:i,role:a}){return(0,PJ.jsxs)(`div`,{className:i,...a?{role:a}:{},children:[e?(0,PJ.jsx)(Pe,{name:e,className:`empty-note-mark`}):null,(0,PJ.jsxs)(`p`,{className:`empty-note-text`,children:[t,n?(0,PJ.jsxs)(PJ.Fragment,{children:[` `,(0,PJ.jsx)(`span`,{className:`empty-note-detail`,children:n})]}):null]}),r?(0,PJ.jsx)(`div`,{className:`empty-note-action`,children:r}):null]})}function MJ({text:e,detail:t,action:n,className:r=``,mark:i=`tray`}){return(0,PJ.jsx)(Jne,{mark:i,text:e,detail:t,action:n,className:`empty-note${r?` ${r}`:``}`})}var NJ,PJ,FJ,IJ,LJ=s((()=>{NJ=d(m()),kJ(),Ya(),GG(),Fe(),Kne(),Pa(),PJ=d(O()),FJ=(0,NJ.createContext)(null),IJ=()=>typeof navigator>`u`||navigator.onLine!==!1}));function RJ({label:e,hint:t,problem:n,required:r=!1,id:i,group:a=!1,check:o=!1,size:s=`default`,kind:c,optional:l,labelAside:u,labelHidden:d=!1,reserve:f=!1,className:p=``,children:m}){let h=(0,zJ.useId)(),g=i??`field-${h}`,_=t?`${g}-hint`:void 0,v=`${g}-problem`,y=n!=null&&n!==!1&&n!==``,b=`${g}-label`,x=d?`form-field-label form-field-label-hidden`:`form-field-label`,S=a?(0,BJ.jsx)(`span`,{id:b,className:x,children:e}):(0,BJ.jsx)(`label`,{id:b,htmlFor:g,className:x,children:e}),C=l&&!r?(0,BJ.jsx)(`span`,{className:`form-field-optional-word`,children:l}):null,w={id:g,..._||y?{"aria-describedby":[_,y?v:void 0].filter(Boolean).join(` `)}:{},...y?{"aria-invalid":!0}:{},...r?{"aria-required":!0}:{},...a?{"aria-labelledby":b}:{}},T=typeof m==`function`?m(w):(0,zJ.isValidElement)(m)?(0,zJ.cloneElement)(m,{...w,...Yne(m.props,w)}):m;return(0,BJ.jsxs)(`div`,{"data-kind":c,className:[`form-field`,s===`compact`?`form-field-compact`:``,o?`form-field-check`:``,f?`form-field-reserve`:``,r?`is-required`:``,y?`is-invalid`:``,p].filter(Boolean).join(` `),children:[o?(0,BJ.jsxs)(`div`,{className:`form-field-check-row`,children:[T,(0,BJ.jsx)(`label`,{id:b,htmlFor:g,className:`form-field-label`,children:e}),C]}):(0,BJ.jsxs)(BJ.Fragment,{children:[u||C?(0,BJ.jsxs)(`div`,{className:`form-field-label-row`,children:[S,C,u]}):S,T]}),t?(0,BJ.jsx)(`p`,{id:_,className:`form-field-hint`,children:t}):null,(0,BJ.jsx)(`p`,{id:v,className:`form-field-problem`,"aria-live":`polite`,hidden:!y&&!f,children:y?n:null})]})}function Yne(e,t){let n=[typeof e[`aria-describedby`]==`string`?e[`aria-describedby`]:``,t[`aria-describedby`]].filter(Boolean).join(` `);return n?{"aria-describedby":n}:{}}var zJ,BJ,VJ=s((()=>{zJ=d(m(),1),BJ=d(O(),1)})),HJ,UJ,Xne=s((()=>{HJ=d(m()),UJ=(0,HJ.createContext)(void 0)}));function WJ(e){let t=GJ.useContext(KJ);if(!e&&t===void 0)throw Error(LI(27));return t}var GJ,KJ,qJ=s((()=>{RI(),GJ=d(m(),1),KJ=GJ.createContext(void 0)})),JJ,YJ,Zne=s((()=>{JJ=d(m(),1),qJ(),TL(),fP(),YJ=JJ.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,s=WJ(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return gL(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:dP,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})})}));function Qne(){let e=XJ.useContext(ZJ);if(e===void 0)throw Error(LI(26));return e}var XJ,ZJ,QJ=s((()=>{RI(),XJ=d(m(),1),ZJ=XJ.createContext(void 0)})),$J,$ne=s((()=>{$J=`--nested-dialogs`})),eY,ere=s((()=>{fP(),eY=`data-nested-dialog-open`})),tY,nY=s((()=>{YN(),fP(),ere(),tY={...uP,...JN,nestedDialogOpen(e){return e?{[eY]:``}:null}}})),rY,iY,aY,tre=s((()=>{rY=d(m(),1),IB(),qJ(),TL(),QJ(),pz(),qH(),Uz(),$ne(),nY(),iY=d(O(),1),aY=rY.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,c=WJ(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),y=c.useState(`titleElementId`),b=c.useState(`transitionStatus`),x=c.useState(`role`),S=d.useState(`floatingId`);Qne(),dz({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let C=o===void 0?mz(c.context.popupRef):o,w=g>0,T=c.useStateSetter(`popupElement`),E=gL(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:w},props:[f,{id:S,"aria-labelledby":y,"aria-describedby":l,role:x,...Dz,hidden:!m,onKeyDown(e){KH.has(e.key)&&e.stopPropagation()},style:{[$J]:g}},s],ref:[t,c.context.popupRef,T],stateAttributesMapping:tY});return(0,iY.jsx)(sR,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:C,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:E})})})),oY,sY,cY,nre=s((()=>{oY=d(m(),1),WV(),IB(),qJ(),QJ(),bH(),sY=d(O(),1),cY=oY.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=WJ(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,sY.jsx)(ZJ.Provider,{value:n,children:(0,sY.jsxs)(zL,{ref:t,...r,children:[a&&o===!0&&(0,sY.jsx)(yH,{ref:i.context.internalBackdropRef,inert:UV(!s)}),e.children]})}):null})}));function rre({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`disablePointerDismissal`),a=e.useState(`modal`),o=e.useState(`popupElement`),s=e.useState(`floatingRootContext`),[c,l]=lY.useState(0),[u,d]=lY.useState(0),f=c===0,p=mR(s,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:a===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0)return!1;if(`touches`in t){if(t.type===`touchend`){if(t.changedTouches.length!==1||t.touches.length!==0)return!1}else if(t.touches.length!==1)return!1}let n=PN(t);if(f&&!i){if(a){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||NN(n,o)&&!n?.hasAttribute(`data-base-ui-portal`):!0}return!0}return!1},escapeKey:f});return DH(r&&a===!0,o),e.useContextCallback(`onNestedDialogOpen`,(e,t)=>{l(e),d(t)}),Q(()=>(t?.onNestedDialogOpen&&(r?t.onNestedDialogOpen(c+1,u+ +!!n):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,c,u,t]),wz(e,{activeTriggerProps:p.reference,inactiveTriggerProps:p.trigger,popupProps:p.floating,nestedOpenDialogCount:c,nestedOpenDrawerCount:u}),null}var lY,ire=s((()=>{lY=d(m(),1),oN(),NH(),IB(),XR(),Uz()}));function are(e,t,n,r=!1){return{...jz(t,n,r),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}function ore(e){return{popupRef:uY.createRef(),backdropRef:uY.createRef(),internalBackdropRef:uY.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}var uY,dY,fY,pY=s((()=>{uY=d(m(),1),YR(),Uz(),dY={...Lz,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role},fY=class extends KR{constructor(e,t,n){let r=new kz,i=are(e,r,t,n);super(i,ore(r),dY)}setOpen=(e,t)=>{t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),!t.isCanceled&&(this.state.floatingRootContext.dispatchOpenChange(e,t),this.update(yz(this.state,e,t.trigger)))}}}));function sre(e,t){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:s=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:d,defaultTriggerId:f=null}=t,p=e===`drawer`,m=e===`alert-dialog`,h=m?!0:c,g=m||s,_=m?`alertdialog`:`dialog`,v=WJ(!0),y={modal:h,disablePointerDismissal:g,nested:v!=null,role:_},b=hz((e,t)=>new fY({open:i,openProp:r,activeTriggerId:f,triggerIdProp:d,...y},e,t),!0);b.useControlledProp(`openProp`,r),b.useControlledProp(`triggerIdProp`,d),b.useSyncedValues(y),b.useContextCallback(`onOpenChange`,a),b.useContextCallback(`onOpenChangeComplete`,o);let x=b.useState(`open`),S=b.useState(`mounted`),C=b.useState(`payload`);Tz(b,x),Sz(b);let{forceUnmount:w}=Cz(x,b);mY.useImperativeHandle(l,()=>({unmount:w,close:()=>b.setOpen(!1,XP(qP))}),[w,b]);let T=x||S;return(0,hY.jsxs)(KJ.Provider,{value:b,children:[u&&(0,hY.jsx)(gz,{handle:u,store:b}),T&&(0,hY.jsx)(rre,{store:b,parentContext:v?.context,isDrawer:p}),typeof n==`function`?n({payload:C}):n]})}var mY,hY,cre=s((()=>{mY=d(m(),1),ire(),qJ(),pY(),ZP(),YP(),Uz(),hY=d(O(),1)})),gY,lre=s((()=>{KM(),cre(),gY=VM(function(e){return sre(`dialog`,e)})})),ure=s((()=>{Zne(),qJ(),TL(),iU(),ZP(),YP(),_V(),tre(),nre(),lre(),QJ(),nY(),RI(),KM(),mV(),fP(),jL(),Uz(),IB(),jV(),pY(),jR()})),dre=s((()=>{ure()}));function fre({className:e=``,onClose:t,closeDisabled:n=!1,beforeClose:r,children:i,initialFocus:a,finalFocus:o,ariaLabel:s,plain:c=!1,backdrop:l=!0,fullscreen:u=`mobile`,ref:d}){let f=(0,_Y.useContext)(UJ),[p,m]=(0,_Y.useState)(!0),h=(0,_Y.useRef)(!1),g=()=>h.current||n||r?.()===!1?!1:(h.current=!0,m(!1),t(),!0);(0,_Y.useImperativeHandle)(d,()=>({close:g}));let _=(0,_Y.useId)(),[v,y]=(0,_Y.useState)(),b=(0,_Y.useCallback)(e=>{if(s||!e)return;let t=e.querySelector(`h1, h2, h3`);t&&(t.id||=_,y(t.id))},[s,_]),x=e.split(/\s+/)[0],S=x?`modal-backdrop ${x}-backdrop`:`modal-backdrop`,C=u?` modal-fullscreen${u===`mobile`?`-mobile`:``}`:``;return(0,vY.jsx)(gY,{modal:!0,open:p,onOpenChange:(e,t)=>{e||g()||t.cancel()},children:(0,vY.jsxs)(cY,{container:yG(),children:[l?(0,vY.jsx)(YJ,{className:c?S.replace(`modal-backdrop `,``):S}):null,(0,vY.jsx)(aY,{"data-component":f,className:`${c?e:`modal ${e}`.trim()}${C}`,initialFocus:a,...o?{finalFocus:o}:{},ref:b,"aria-label":s,"aria-labelledby":s?void 0:v,"aria-modal":`true`,children:i})]})})}var _Y,vY,yY,bY=s((()=>{_Y=d(m(),1),Xne(),dre(),bG(),LG(),vY=d(O(),1),yY=AG(`Modal`,fre)}));function xY(e,t){let n=e.lastIndexOf(`.`),r=n>0?e.slice(n+1).toLowerCase():``,i=(t??``).toLowerCase();if(SY.test(r)||/^image\/(png|jpeg|gif|webp|avif|bmp)$/.test(i))return`image`;if(r===`pdf`||i===`application/pdf`)return`pdf`;if(CY.test(r)||i.startsWith(`video/`))return`video`;if(wY.test(r)||i.startsWith(`audio/`))return`audio`;if(TY.test(r)||i.startsWith(`text/`)||i===`application/json`)return`text`}var SY,CY,wY,TY,EY=s((()=>{SY=/^(png|jpe?g|gif|webp|avif|bmp)$/,CY=/^(mp4|m4v|mov|webm|ogv)$/,wY=/^(mp3|m4a|wav|ogg|oga|opus|flac)$/,TY=/^(txt|text|md|markdown|csv|tsv|json|log|xml|ya?ml|ini|toml|sql|ts|js|css|html?)$/})),DY,pre=s((()=>{Ya(),DY=Va({download:`Download`,isOverTheLimit:`“{name}” is over the {maxBytes} limit for a file.`,attached:`Attached “{attached}”`,attachedFiles:{one:`Attached {count} file`,other:`Attached {count} files`},attaching:`Attaching…`,orDropFilesHere:`or drop files here`,preview:`Preview {name}`,downloadName:`Download {name}`,more:`More for {name}`,detailsItem:`Details`,removeMore:`Remove…`,aFileNeedsAName:`A file needs a name.`,fileName:`File name`,removeName:`Remove {name}?`,removeQuotedNameQuestion:`Remove “{name}”?`,theFileIsDeleted:`The file is deleted for everyone who can see this record, and Undo cannot bring it back.`,keep:`Keep`,removing:`Removing…`})})),mre=s((()=>{})),OY,hre=s((()=>{Ya(),OY=Va({thisFileIsNoLonger:`This file is no longer here.`,thisFileCouldNotBeRead:`This file could not be read.`,thisFileIsNamed:`This file is named as a PDF, but it is not one.`,thisFileIsNotText:`This file is not text, so it can only be downloaded.`,thisFileIsNotPlayable:`This file is not a recording this browser can play, so it can only be downloaded.`,tooLargeToPlay:`Recordings over {size} are not played here. Download the file to play it.`,tooLargeToShow:`PDFs over {size} are not shown here. Download the file to open it.`,opening:`Opening {name}…`,showingTheFirstDownload:`Showing the first {size}. Download the file for the rest.`,previewOf:`Preview of {name}`,download:`Download`})})),kY=l({FilePreview:()=>vre,mediaType:()=>AY});function AY(e,t){if(!(e.length<12)){if(IY(e,4,4)===`ftyp`)return t===`video`?`video/mp4`:`audio/mp4`;if(e[0]===26&&e[1]===69&&e[2]===223&&e[3]===163)return`${t}/webm`;if(IY(e,0,4)===`OggS`)return`${t}/ogg`;if(t===`audio`){if(IY(e,0,4)===`RIFF`&&IY(e,8,4)===`WAVE`)return`audio/wav`;if(IY(e,0,4)===`fLaC`)return`audio/flac`;if(IY(e,0,3)===`ID3`||e[0]===255&&(e[1]&224)==224)return`audio/mpeg`}}}async function gre(e,t,n,r){if(!e.body){let r=new Uint8Array(await e.arrayBuffer());return r.length>t?{bytes:n?r.subarray(0,t):new Uint8Array,over:!0}:{bytes:r,over:!1}}let i=e.body.getReader(),a=()=>void i.cancel().catch(()=>void 0);r.addEventListener(`abort`,a,{once:!0});let o=[],s=0,c=!1;try{for(;;){let{done:e,value:r}=await i.read();if(e)break;let a=t-s;if(r.length>a){c=!0,n&&a>0&&o.push(r.subarray(0,a));break}o.push(r),s+=r.length}}finally{r.removeEventListener(`abort`,a),c?await i.cancel().catch(()=>void 0):i.releaseLock()}if(c&&!n)return{bytes:new Uint8Array,over:c};let l=new Uint8Array(o.reduce((e,t)=>e+t.length,0)),u=0;for(let e of o)l.set(e,u),u+=e.length;return{bytes:l,over:c}}async function _re(e,t){let n=await fetch(e.href,{credentials:`same-origin`,signal:t});if(!n.ok)return{state:`failed`,why:n.status===404?OY(`thisFileIsNoLonger`):OY(`thisFileCouldNotBeRead`)};let r=e.kind===`video`||e.kind===`audio`||e.kind===`pdf`,i=()=>({state:`refused`,why:OY(e.kind===`pdf`?`tooLargeToShow`:`tooLargeToPlay`,{size:Yi(NY)})});if(r&&Number(n.headers.get(`content-length`))>NY)return n.body?.cancel().catch(()=>void 0),i();let{bytes:a,over:o}=await gre(n,r?NY:PY,!r,t);if(r&&o)return i();if(e.kind===`video`||e.kind===`audio`){let t=AY(a,e.kind);return t?{state:`media`,url:URL.createObjectURL(new Blob([a],{type:t}))}:{state:`refused`,why:OY(`thisFileIsNotPlayable`)}}return e.kind===`pdf`?FY(a)?{state:`pdf`,url:URL.createObjectURL(new Blob([a],{type:`application/pdf`}))}:{state:`refused`,why:OY(`thisFileIsNamed`)}:a.includes(0)?{state:`refused`,why:OY(`thisFileIsNotText`)}:{state:`text`,text:new TextDecoder(`utf-8`).decode(a),cut:o}}function vre({file:e,onClose:t,finalFocus:n}){let r=(0,jY.useRef)(null),i=(0,jY.useRef)(null),[a,o]=(0,jY.useState)({state:`loading`}),[s,c]=(0,jY.useState)(0);(0,jY.useEffect)(()=>{if(e.kind===`image`)return;let t=new AbortController,n;return o({state:`loading`}),_re(e,t.signal).then(e=>{(e.state===`pdf`||e.state===`media`)&&(n=e.url),t.signal.aborted?n&&URL.revokeObjectURL(n):o(e)},e=>{t.signal.aborted||o({state:`failed`,why:e.message||OY(`thisFileCouldNotBeRead`)})}),()=>{t.abort(),n&&URL.revokeObjectURL(n)}},[e.href,e.kind,s]);let l=e.kind===`image`?(0,MY.jsx)(`figure`,{className:`lightbox-figure`,children:(0,MY.jsx)(`img`,{className:`lightbox-image`,src:e.inline??e.href,alt:e.name,draggable:!1})}):a.state===`loading`?(0,MY.jsx)(`p`,{className:`file-preview-note`,role:`status`,children:OY(`opening`,{name:e.name})}):a.state===`pdf`?(0,MY.jsx)(`iframe`,{className:`file-preview-frame`,src:a.url,title:e.name}):a.state===`media`?e.kind===`video`?(0,MY.jsx)(`video`,{className:`file-preview-media`,src:a.url,controls:!0,"aria-label":e.name}):(0,MY.jsx)(`audio`,{className:`file-preview-media is-audio`,src:a.url,controls:!0,"aria-label":e.name}):a.state===`text`?(0,MY.jsxs)(`div`,{className:`file-preview-text`,children:[(0,MY.jsx)(`pre`,{tabIndex:0,"aria-label":e.name,children:a.text}),a.cut&&(0,MY.jsx)(`p`,{className:`file-preview-note`,children:OY(`showingTheFirstDownload`,{size:Yi(PY)})})]}):(0,MY.jsx)(`div`,{className:`file-preview-message`,children:a.state===`refused`?(0,MY.jsx)(MJ,{text:a.why}):(0,MY.jsx)(jJ,{text:a.why,retry:()=>c(e=>e+1)})});return(0,MY.jsx)(yY,{className:`lightbox file-preview`,plain:!0,ref:r,ariaLabel:OY(`previewOf`,{name:e.name}),initialFocus:i,onClose:t,...n?{finalFocus:n}:{},children:(0,MY.jsxs)(`div`,{className:`lightbox-body`,children:[(0,MY.jsxs)(`div`,{className:`lightbox-bar`,children:[(0,MY.jsx)(`span`,{className:`file-preview-name`,children:e.name}),(0,MY.jsxs)(`span`,{className:`file-preview-actions`,children:[(0,MY.jsx)(`a`,{className:`lightbox-close file-preview-download`,href:e.href,download:e.name,children:OY(`download`)}),(0,MY.jsx)(`button`,{type:`button`,ref:i,className:`lightbox-close`,onClick:()=>r.current?.close(),children:OY(`common.close`)})]})]}),(0,MY.jsx)(`div`,{className:`lightbox-stage file-preview-stage is-${e.kind}`,children:l})]})})}var jY,MY,NY,PY,FY,IY,LY=s((()=>{jY=d(m(),1),mre(),bY(),LJ(),xa(),hre(),MY=d(O(),1),NY=67108864,PY=262144,FY=e=>e.length>=5&&String.fromCharCode(...e.subarray(0,5))===`%PDF-`,IY=(e,t,n)=>String.fromCharCode(...e.subarray(t,t+n))})),yre=l({AttachmentList:()=>xre,fileToBase64:()=>bre});async function bre(e){let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));return btoa(n)}function xre({items:e,emptyText:t,empty:n,upload:r}){let[i,a]=(0,RY.useState)(!1),[o,s]=(0,RY.useState)(!1),[c,l]=(0,RY.useState)(),u=(0,RY.useRef)(null),[d,f]=(0,RY.useState)(),[p,m]=(0,RY.useState)(),[h,g]=(0,RY.useState)(),_=(0,RY.useRef)(null),v=async e=>{if(!r||o||!e.length)return;s(!0),l(void 0);let t=[],n=[];for(let i of e){if(i.size>r.maxBytes){n.push(DY(`isOverTheLimit`,{name:i.name,maxBytes:Yi(r.maxBytes)}));continue}let e=await r.send(i);e?n.push(e):t.push(i.name)}s(!1),n.length?l({text:n.join(` `),error:!0}):l({text:t.length===1?DY(`attached`,{attached:t[0]}):DY(`attachedFiles`,{count:t.length}),error:!1})},y=e=>e.includes(`Files`),b=e=>{if(e.save)return;let t=xY(e.name,e.type);return t?{name:e.name,kind:t,href:e.href,...e.inline?{inline:e.inline}:{}}:void 0};return(0,zY.jsxs)(`div`,{className:`attachments${i?` is-over`:``}`,onDragOver:r?e=>{y([...e.dataTransfer.types])&&(e.preventDefault(),a(!0))}:void 0,onDragLeave:r?e=>{e.currentTarget.contains(e.relatedTarget)||a(!1)}:void 0,onDrop:r?e=>{e.preventDefault(),a(!1),v([...e.dataTransfer.files])}:void 0,children:[r&&(0,zY.jsxs)(`div`,{className:`attachments-add`,children:[(0,zY.jsx)(UG,{intent:`secondary`,size:`compact`,busy:o,busyLabel:DY(`attaching`),onClick:()=>u.current?.click(),children:`+ ${r.label}`}),(0,zY.jsx)(`input`,{ref:u,type:`file`,multiple:!0,hidden:!0,"aria-label":r.label,onChange:e=>{let t=[...e.target.files??[]];e.target.value=``,v(t)}}),(0,zY.jsx)(`span`,{className:`attachments-hint`,children:DY(`orDropFilesHere`)}),c&&(0,zY.jsx)(`span`,{role:c.error?`alert`:`status`,className:c.error?`attachments-error`:`attachments-said`,children:c.text})]}),e.length?(0,zY.jsx)(`ul`,{className:`attachments-list`,children:e.map(e=>{let t=b(e);return(0,zY.jsxs)(`li`,{className:`attachments-item`,children:[(0,zY.jsx)(`span`,{className:`attachments-badge`,"aria-hidden":`true`,children:HY(e.name)}),p===e.id&&e.rename?(0,zY.jsx)(Sre,{item:e,onDone:()=>m(void 0)}):(0,zY.jsxs)(zY.Fragment,{children:[(0,zY.jsxs)(`span`,{className:`attachments-text`,children:[t?(0,zY.jsx)(`button`,{type:`button`,className:`attachments-name`,title:DY(`preview`,{name:e.name}),onClick:e=>{_.current=e.currentTarget,f(t)},children:e.name}):(0,zY.jsx)(`a`,{className:`attachments-name`,href:e.href,download:e.name,onClick:VY(e),children:e.name}),e.meta.length>0&&(0,zY.jsx)(`span`,{className:`attachments-meta`,children:e.meta.join(` · `)})]}),(0,zY.jsxs)(`span`,{className:`attachments-actions`,children:[(0,zY.jsx)(WG,{intent:`quiet`,size:`compact`,className:`attachments-download`,href:e.href,download:e.name,onClick:VY(e),"aria-label":DY(`downloadName`,{name:e.name}),children:DY(`download`)}),(e.onOpen||e.rename||e.remove)&&(0,zY.jsxs)(QG,{className:`row-actions-menu`,triggerClassName:`ghost row-actions-trigger`,triggerTitle:DY(`more`,{name:e.name}),triggerLabel:DY(`more`,{name:e.name}),label:`⋯`,popupClassName:`page-actions-popup`,align:`end`,children:[e.onOpen&&(0,zY.jsx)($G,{className:`page-actions-item`,onClick:e.onOpen,children:DY(`detailsItem`)}),e.rename&&(0,zY.jsx)($G,{className:`page-actions-item`,onClick:()=>m(e.id),children:DY(`common.rename`)}),e.remove&&(0,zY.jsx)($G,{className:`page-actions-item is-danger`,onClick:()=>g(e),children:DY(`removeMore`)})]})]})]})]},e.id)})}):n??(0,zY.jsx)(MJ,{className:`attachments-empty`,text:t}),d&&(0,zY.jsx)(BY,{file:d,onClose:()=>f(void 0),finalFocus:_}),h&&(0,zY.jsx)(Cre,{item:h,onClose:()=>g(void 0)})]})}function Sre({item:e,onDone:t}){let[n,r]=(0,RY.useState)(e.name),[i,a]=(0,RY.useState)(!1),[o,s]=(0,RY.useState)(``),c=async()=>{let r=n.trim();if(!r){s(DY(`aFileNeedsAName`));return}if(r===e.name){t();return}a(!0);let i=await e.rename(r);a(!1),i?s(i):t()};return(0,zY.jsxs)(`form`,{className:`attachments-rename`,onSubmit:e=>{e.preventDefault(),c()},onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),t())},children:[(0,zY.jsx)(RJ,{label:DY(`fileName`),size:`compact`,problem:o,children:(0,zY.jsx)(`input`,{type:`text`,value:n,autoFocus:!0,onChange:e=>{r(e.target.value),s(``)}})}),(0,zY.jsxs)(`span`,{className:`attachments-rename-actions`,children:[(0,zY.jsx)(UG,{intent:`primary`,size:`compact`,type:`submit`,busy:i,busyLabel:DY(`common.saving`),children:DY(`common.save`)}),(0,zY.jsx)(UG,{intent:`secondary`,size:`compact`,onClick:t,children:DY(`common.cancel`)})]})]})}function Cre({item:e,onClose:t}){let n=(0,RY.useRef)(null),r=(0,RY.useRef)(null),[i,a]=(0,RY.useState)(!1),[o,s]=(0,RY.useState)(``),c=async()=>{a(!0);let t=await e.remove();a(!1),t?s(t):n.current?.close()};return(0,zY.jsxs)(yY,{className:`confirm attachments-confirm`,ref:n,fullscreen:!1,initialFocus:r,closeDisabled:i,ariaLabel:DY(`removeName`,{name:e.name}),onClose:t,children:[(0,zY.jsx)(`h2`,{children:DY(`removeQuotedNameQuestion`,{name:e.name})}),(0,zY.jsx)(`p`,{children:DY(`theFileIsDeleted`)}),o&&(0,zY.jsx)(`p`,{className:`attachments-error`,role:`alert`,children:o}),(0,zY.jsxs)(`div`,{className:`confirm-actions`,children:[(0,zY.jsx)(UG,{ref:r,intent:`secondary`,disabled:i,onClick:()=>n.current?.close(),children:DY(`keep`)}),(0,zY.jsx)(UG,{intent:`danger`,busy:i,busyLabel:DY(`removing`),onClick:()=>void c(),children:DY(`common.remove`)})]})]})}var RY,zY,BY,VY,HY,wre=s((()=>{RY=d(m()),xa(),tc(),LJ(),GG(),VJ(),bY(),eK(),EY(),wc(),pre(),zY=d(O()),BY=vc(()=>Promise.resolve().then(()=>(LY(),kY)),`FilePreview`,{quiet:!0}),VY=e=>e.save?t=>{t.preventDefault(),e.save().catch(e=>Ws(e.message,`error`))}:void 0,HY=e=>{let t=e.lastIndexOf(`.`);return(t>0?e.slice(t+1).slice(0,4).toUpperCase():``)||`FILE`}}));function Tre(e){return(0,UY.jsx)(`div`,{className:`rich-field`,children:(0,UY.jsx)(WY,{...e})})}function Ere(e,t){return async n=>{let r=n.trim(),{mentionRows:i}=await Promise.resolve().then(()=>(TK(),yK)),[a,o]=await Promise.all([i(e,r,t),e.groups?i(e.groups,r,t,`group`).catch(()=>[]):Promise.resolve([])]);return o.length?[...a.slice(0,8-Math.min(o.length,3)),...o].slice(0,8):a}}function Dre(e,t,n){if(!e||!t||!Ys(e))return;let r=Xs(e).find(e=>e.to.table===t.table&&e.from.columns.length===1&&Object.hasOwn(t.key,e.to.columns[0]));if(!r)return;let i={[r.from.columns[0]]:t.key[r.to.columns[0]]};return async t=>{let{fileToBase64:r}=await Promise.resolve().then(()=>(wre(),yre)),a=await Ns(`/api/file/upload`,{table:e,values:i,...ao(n??null),file:{name:t.name||`picture`,type:t.type,data:await r(t)}});if(a.errors?.length)throw Error(a.errors[0].message);if(typeof a.error==`string`)throw Error(a.error);if(!a.key)throw Error(Tc(`pictureUnread`));return kr(e,a.key)}}var UY,WY,Ore=s((()=>{tc(),uo(),zr(),wc(),Ec(),UY=d(O(),1),WY=vc(()=>Promise.resolve().then(()=>(pK(),iK)),`RichTextEditor`,{quiet:!0})}));function GY(e){let t=KY.useRef(!0);t.current&&(t.current=!1,e())}var KY,qY=s((()=>{KY=d(m(),1)}));function JY(){let e=ZY.useContext(QY);if(e===void 0)throw Error(LI(60));return e}function YY(){let e=ZY.useContext($Y);if(e===void 0)throw Error(LI(101));return e}function XY(){let e=ZY.useContext(eX);if(e===void 0)throw Error(LI(61));return e}var ZY,QY,$Y,eX,tX=s((()=>{RI(),ZY=d(m(),1),QY=ZY.createContext(void 0),$Y=ZY.createContext(void 0),eX=ZY.createContext(void 0)})),nX=s((()=>{XM()})),rX,iX,kre=s((()=>{rX=`data-valid`,iX=`data-invalid`})),aX,oX,sX,cX,lX=s((()=>{kre(),aX={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},oX={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},sX={disabled:!1,...oX},cX={valid(e){return e===null?null:e?{[rX]:``}:{[iX]:``}}}}));function uX(e=!0){let t=dX.useContext(pX);if(t.setValidityData===qM&&!e)throw Error(LI(28));return t}var dX,fX,pX,mX=s((()=>{RI(),dX=d(m(),1),XM(),nX(),lX(),fX={invalid:void 0,name:void 0,validityData:{state:aX,errors:[],error:``,value:``,initialValue:null},setValidityData:qM,disabled:void 0,setTouched:qM,setDirty:qM,setFilled:qM,setFocused:qM,validationMode:`onSubmit`,shouldValidateOnChange:()=>!1,state:sX,registerFieldControl:qM,validation:{getValidationProps:(e,t=YM)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:qM,getInputControl:()=>null,commit:async()=>{},change:qM}},pX=dX.createContext(fX)}));function hX(e,t,n,r,i=!0,a){let{registerFieldControl:o}=uX(),s=LM(()=>Symbol());Q(()=>{let c=s.current;i?o(c,{controlRef:e,getValue:r,id:t,name:a,value:n}):o(c,void 0)},[e,i,r,t,a,o,s,n]),Q(()=>{let e=s.current;return()=>{o(e,void 0)}},[o,s])}var gX=s((()=>{oN(),BM(),mX()}));function _X(){return vX.useContext(yX)}var vX,yX,bX=s((()=>{vX=d(m(),1),nX(),yX=vX.createContext({controlId:void 0,registerControlId:qM,resetControlId:qM,labelId:void 0,setLabelId:qM,messageIds:[],setMessageIds:qM,getDescriptionProps:e=>e})}));function xX(e={}){let{id:t,enabled:n=!0}=e,{controlId:r,registerControlId:i,resetControlId:a}=_X(),o=gV(),s=LM(()=>Symbol()),c=SX.useRef(!1),l=SX.useRef(!1),u=$(()=>{c.current&&i!==qM&&(c.current=!1,i(s.current,void 0))});return Q(()=>{if(!n||i===qM){u();return}let e;if(t!==void 0)l.current=!0,e=t;else if(l.current)e=o;else{a();return}e===void 0?u():(c.current=!0,i(s.current,e))},[t,n,i,a,o,s,u]),Q(()=>u,[u]),(n?r:void 0)??t??o}var SX,CX=s((()=>{SX=d(m(),1),oN(),yF(),BM(),nX(),_V(),bX()}));function Are(e,t,n=Object.is){let{length:r}=e;if(r!==t.length)return!1;for(let i=0;i<r;i+=1)if(!n(e[i],t[i]))return!1;return!0}var jre=s((()=>{}));function wX(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function TX(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!Are(e,t,(e,t)=>wX(e,t,n)):e!==t}function EX(e,t,n){return e?e.some(e=>e!==void 0&&wX(t,e,n)):!1}function DX(e,t,n){return e?e.findIndex(e=>e!==void 0&&wX(e,t,n)):-1}function Mre(e,t){if(t!==jX)return n=>EX(e,n,t);let n=new Set(e);return n.delete(void 0),t=>n.has(t)&&(t!==0||e.some(e=>Object.is(t,e)))}function OX(e,t,n,r){let i=r&&Array.isArray(t)?e.findIndex(Mre(t,n)):DX(e,t,n);return i===-1?null:i}function kX(e,t,n,r,i,a){return EX(r,t,i)?a!=null&&e>a&&EX(r,n[a],i)?a:e:e===a?OX(n,r,i,!0):a}function AX(e,t,n){return e.filter(e=>!wX(t,e,n))}var jX,MX=s((()=>{jre(),jX=(e,t)=>Object.is(e,t)}));function NX(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}var PX=s((()=>{}));function FX(e){return typeof e==`object`&&!!e&&Array.isArray(e.items)}function IX(e){return FX(e?.[0])}function LX(e){return IX(e)?e.flatMap(e=>e.items):e}function RX(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(IX(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function zX(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return NX(e)}function BX(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?NX(e.value):NX(e)}var VX=s((()=>{m(),PX(),O()})),HX,UX=s((()=>{MX(),VX(),HX={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:BX(t,r)!==``},hasNullItemLabel:(e,t)=>t?RX(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(e=>wX(t,e,n)):wX(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows}}));function WX(){return GX.useContext(KX)}var GX,KX,qX=s((()=>{GX=d(m(),1),nX(),KX=GX.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:qM,validationMode:`onSubmit`,submitCountRef:{current:0}})}));function JX(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}var YX=s((()=>{}));function XX(e,t){return Math.max(0,e-t)}function ZX(e,t){if(t<=0)return 0;let n=JX(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}var QX=s((()=>{YX()}));function $X(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,form:l,autoComplete:u,disabled:d=!1,readOnly:f=!1,required:p=!1,modal:m=!0,actionsRef:h,inputRef:g,onOpenChangeComplete:_,items:v,multiple:y=!1,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S=jX,highlightItemOnHover:C=!0,children:w}=e,{clearErrors:T}=WX(),{setDirty:E,setTouched:D,setFocused:O,validityData:k,setFilled:A,name:j,disabled:M,validation:N,validationMode:P}=uX(),F=xX({id:t}),I=M||d,L=j??c,[R,z]=CU({controlled:n,default:y?r??JM:r,name:`Select`,state:`value`}),[B,V]=CU({controlled:a,default:o,name:`Select`,state:`open`}),H=eZ.useRef([]),U=eZ.useRef([]),W=eZ.useRef(null),G=eZ.useRef(null),ee=eZ.useRef(0),te=eZ.useRef(null),ne=eZ.useRef([]),K=eZ.useRef(!1),re=eZ.useRef(null),q=eZ.useRef(null),ie=eZ.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),ae=eZ.useRef(!1),oe=eZ.useRef(R),{mounted:se,setMounted:ce,transitionStatus:le}=rz(B),{openMethod:ue,triggerProps:de}=kV(B),fe=LM(()=>new KR({id:F,labelId:void 0,modal:m,multiple:y,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S,value:R,open:B,mounted:se,transitionStatus:le,items:v,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:YM,triggerProps:YM,triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:qM,setOpen:qM,handleScrollArrowVisibility:qM,onOpenChangeComplete:qM,listRef:H,popupRef:W,scrollHandlerRef:G,scrollArrowsMountedCountRef:ee,valueRef:te,valuesRef:ne,labelsRef:U,typingRef:K,selectionRef:ie,firstItemTextRef:re,selectedItemTextRef:q,alignItemWithTriggerActiveRef:ae,initialValueRef:oe},HX)).current,pe=fe.useState(`activeIndex`),me=fe.useState(`selectedIndex`),J=fe.useState(`triggerElement`),he=fe.useState(`positionerElement`),ge=zne(ue),_e=ue??ge,ve=eZ.useMemo(()=>y?``:BX(R,x),[y,R,x]),ye=eZ.useMemo(()=>y&&Array.isArray(R)?R.map(e=>BX(e,x)):BX(R,x),[y,R,x]);hX(lF(J),F,R,$(()=>ye),!I,c);let be=y?Array.isArray(R)&&R.length>0:R!=null&&ve!==``;Q(()=>{A(be)},[be,A]),Q(function(){let e=OX(ne.current,R,S,y);e===null&&(q.current=null),!B&&fe.set(`selectedIndex`,e)},[y,B,R,S,fe]),TV(R,()=>{T(L),E(TX(R,k.initialValue,S)),N.change(R)});let xe=$((e,t)=>{s?.(e,t),!t.isCanceled&&(V(e),e||t.reason!==`focus-out`&&t.reason!==`outside-press`||(D(!0),O(!1),P===`onBlur`&&N.commit(R)))}),Se=$(()=>{ce(!1),fe.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),_?.(!1)});dz({enabled:!h,open:B,ref:W,onComplete(){B||Se()}}),eZ.useImperativeHandle(h,()=>({unmount:Se}),[Se]);let Ce=$((e,t)=>{i?.(e,t),!t.isCanceled&&z(e)}),we=$(e=>{let t=XX(e.scrollHeight,e.clientHeight),n=ZX(e.scrollTop,t),r=n>0,i=n<t;fe.set(`scrollUpArrowVisible`,r),fe.set(`scrollDownArrowVisible`,i)}),Te=Wz({open:B,onOpenChange:xe,elements:{reference:J,floating:he}}),Ee=fR(Te,{enabled:!I,event:`mousedown`}),De=mR(Te),Oe=bB(Te,{enabled:!I,listRef:H,activeIndex:pe,selectedIndex:me,disabledIndices:JM,onNavigate(e){(e!==null||B)&&fe.set(`activeIndex`,e)},focusItemOnHover:C}),ke=wB(Te,{enabled:!I&&(B||!f&&!y),listRef:U,activeIndex:pe,selectedIndex:me,disabledIndices:e=>mG(H.current[e]),onMatch(e){B?fe.set(`activeIndex`,e):Ce(ne.current[e],XP(AP))},onTyping(e){K.current=e}}),Ae=eZ.useMemo(()=>$I(ke.reference,Oe.reference,De.reference,Ee.reference,de),[Ee.reference,ke.reference,Oe.reference,De.reference,de]),je=eZ.useMemo(()=>$I(Dz,ke.floating,Oe.floating,De.floating),[ke.floating,Oe.floating,De.floating]),Me=Oe.item??YM;fe.useContextCallback(`setValue`,Ce),fe.useContextCallback(`setOpen`,xe),fe.useContextCallback(`handleScrollArrowVisibility`,we),fe.useContextCallback(`onOpenChangeComplete`,_),GY(()=>{fe.update({popupProps:je,triggerProps:Ae})}),fe.useSyncedValues({id:F,modal:m,multiple:y,value:R,open:B,mounted:se,transitionStatus:le,popupProps:je,triggerProps:Ae,items:v,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S,openMethod:_e});let Ne=eZ.useMemo(()=>({disabled:I,readOnly:f,required:p,multiple:y,highlightItemOnHover:C,itemProps:Me}),[I,f,p,y,C,Me]),Pe=nF(g,N.inputRef),Fe=y?void 0:L,Ie=eZ.useMemo(()=>!y||!Array.isArray(R)||!L?null:R.map(e=>{let t=BX(e,x);return(0,tZ.jsx)(`input`,{type:`hidden`,form:l,name:L,value:t,disabled:I},t)}),[y,R,l,L,x,I]);return(0,tZ.jsxs)(QY.Provider,{value:fe,children:[(0,tZ.jsx)($Y.Provider,{value:Ne,children:(0,tZ.jsx)(eX.Provider,{value:Te,children:w})}),(0,tZ.jsx)(`input`,{...N.getValidationProps(I,{onFocus(){fe.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented||I||f)return;let t=e.currentTarget.value,n=XP(AP,e.nativeEvent);function r(){if(y)return;let e=t.toLowerCase(),r=ne.current.findIndex(t=>BX(t,x).toLowerCase()===e||zX(t,b).toLowerCase()===e);r===-1&&(r=ne.current.findIndex((t,n)=>{let r=U.current[n];return r!=null&&r.toLowerCase()===e}));let i=ne.current[r];i!=null&&Ce(i,n)}fe.set(`forceMount`,!0),queueMicrotask(r)}}),id:F&&Fe==null?`${F}-hidden-input`:void 0,form:l,name:Fe,autoComplete:u,value:ve,disabled:I,required:p&&!(y&&be),readOnly:f,ref:Pe,style:L?AF:kF,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Ie]})}var eZ,tZ,nZ=s((()=>{eZ=d(m(),1),jF(),cF(),BM(),qY(),oU(),hG(),TU(),oN(),yF(),dF(),YR(),XM(),IB(),tX(),mX(),gX(),CX(),az(),UX(),ZP(),YP(),pz(),qX(),VX(),MX(),DV(),jV(),QX(),Uz(),hL(),nX(),tZ=d(O(),1)}));function rZ(e,t){return e??t}var iZ=s((()=>{})),aZ,oZ=s((()=>{fP(),aZ=`data-popup-side`})),sZ,cZ,lZ,uZ,dZ=s((()=>{sZ=d(m(),1),DF(),rN(),dF(),tX(),mX(),bX(),fP(),lX(),TL(),JW(),XR(),hL(),iU(),ZP(),YP(),CX(),iZ(),oZ(),cZ=400,lZ={...lP,...cX,popupSide:e=>e?{[aZ]:e}:null,value:()=>null},uZ=sZ.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{setTouched:l,setFocused:u,validationMode:d,validation:f,state:p,disabled:m}=uX(),{labelId:h}=_X(),g=JY(),{readOnly:_,required:v,disabled:y}=YY(),b=m||y||a,x=g.useState(`open`),S=g.useState(`mounted`),C=g.useState(`value`),w=g.useState(`triggerProps`),T=g.useState(`positionerElement`),E=g.useState(`listElement`),D=g.useState(`popupSide`),O=g.useState(`id`),k=g.useState(`labelId`),A=g.useState(`hasSelectedValue`),j=S&&T?D:null,M=i??O,N=rZ(h,k);xX({id:i});let P=lF(T),F=sZ.useRef(null),{getButtonProps:I,buttonRef:L}=uV({disabled:b,native:o}),R=g.useStateSetter(`triggerElement`),z=eN(),B=eN(),V=eN();sZ.useEffect(()=>{if(x)return V.start(cZ,()=>{g.context.selectionRef.current.allowUnselectedMouseUp=!0,g.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{V.clear()};g.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},B.clear()},[x,g,B,V]);let H=$I(w,{id:M,role:`combobox`,"aria-expanded":x,"aria-haspopup":`listbox`,"aria-controls":x?E?.id??SP(T)?.id:void 0,"aria-labelledby":N,"aria-readonly":_||void 0,"aria-required":v||void 0,tabIndex:b?-1:0,onFocus(e){u(!0),x&&g.context.alignItemWithTriggerActiveRef.current&&g.context.setOpen(!1,XP(AP,e.nativeEvent)),z.start(0,()=>{g.set(`forceMount`,!0)})},onBlur(e){NN(T,e.relatedTarget)||(l(!0),u(!1),d===`onBlur`&&f.commit(C))},onMouseDown(e){if(x)return;let t=EF(e.currentTarget);function n(e){if(!F.current)return;let t=e.target;NN(F.current,t)||NN(P.current,t)||GW(e,F.current)||g.context.setOpen(!1,XP(GP,e))}B.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},c,I),U=f.getValidationProps(b,H);U.role=`combobox`;let W={...p,open:x,disabled:b,value:C,readOnly:_,popupSide:j,placeholder:!A};return gL(`button`,e,{ref:[t,F,L,R],state:W,stateAttributesMapping:lZ,props:U})})})),fZ,pZ,mZ,hZ=s((()=>{fZ=d(m(),1),IB(),tX(),pZ=d(O(),1),mZ=fZ.forwardRef(function(e,t){let n=JY(),r=n.useState(`mounted`),i=n.useState(`forceMount`);return r||i?(0,pZ.jsx)(zL,{ref:t,...e}):null})}));function gZ(){let e=_Z.useContext(vZ);if(!e)throw Error(LI(59));return e}var _Z,vZ,yZ=s((()=>{RI(),_Z=d(m(),1),vZ=_Z.createContext(void 0)}));function bZ(e,t){e&&Object.assign(e.style,t)}var xZ,SZ=s((()=>{xZ={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`}})),CZ,wZ,TZ,EZ,DZ=s((()=>{CZ=d(m(),1),WV(),oN(),yF(),tX(),xW(),gH(),yZ(),bH(),jL(),SZ(),ZP(),YP(),MX(),wH(),LH(),wZ=d(O(),1),TZ={position:`fixed`},EZ=CZ.forwardRef(function(e,t){let{anchor:n,className:r,render:i,positionMethod:a,side:o,align:s,sideOffset:c,alignOffset:l,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f,sticky:p,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:g=OL,style:_,...v}=e,y=JY(),b=XY(),x=y.useState(`open`),S=y.useState(`mounted`),C=y.useState(`modal`),w=y.useState(`value`),T=y.useState(`openMethod`),E=y.useState(`positionerElement`),D=y.useState(`triggerElement`),O=y.useState(`isItemEqualToValue`),k=y.useState(`transitionStatus`),A=CZ.useRef(null),j=CZ.useRef(null),[M,N]=CZ.useState(h),P=S&&M&&T!==`touch`;!S&&M!==h&&N(h),CZ.useImperativeHandle(y.context.alignItemWithTriggerActiveRef,()=>P),PH((P||C)&&x,T===`touch`,E,D);let F=dH({anchor:n,floatingRootContext:b,positionMethod:a,mounted:S,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??P,collisionAvoidance:g,keepMounted:!0}),I=P?`none`:F.side,L=P?TZ:F.positionerStyles,R={open:x,side:I,align:F.align,anchorHidden:F.anchorHidden};Q(()=>{y.set(`popupSide`,F.side)},[y,F.side]);let z=CH(e,R,{styles:L,transitionStatus:k,props:v,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!S,inert:!x}),B=CZ.useRef(0),V=$(e=>{if(y.context.valuesRef.current.length===0)return;let t=B.current;B.current=e.size;let n=XP(AP);if(t!==0&&!y.state.multiple&&w!==null&&DX(y.context.valuesRef.current,w,O)===-1){let e=y.context.initialValueRef.current,t=e!=null&&DX(y.context.valuesRef.current,e,O)!==-1?e:null;y.context.setValue(t,n),t===null&&(y.set(`selectedIndex`,null),y.context.selectedItemTextRef.current=null)}if(t!==0&&y.state.multiple&&Array.isArray(w)){let e=w.filter(e=>DX(y.context.valuesRef.current,e,O)!==-1);e.length!==w.length&&(y.context.setValue(e,n),e.length===0&&(y.set(`selectedIndex`,null),y.context.selectedItemTextRef.current=null))}if(x&&P){y.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};bZ(E,e),bZ(y.context.popupRef.current,e)}}),H=CZ.useMemo(()=>({...F,side:I,alignItemWithTriggerActive:P,setControlledAlignItemWithTrigger:N,scrollUpArrowRef:A,scrollDownArrowRef:j}),[F,I,P,N]);return(0,wZ.jsx)(fW,{elementsRef:y.context.listRef,labelsRef:y.context.labelsRef,onMapChange:V,children:(0,wZ.jsxs)(vZ.Provider,{value:H,children:[S&&C&&(0,wZ.jsx)(yH,{inert:UV(!x),cutout:D}),z]})})})})),OZ,kZ,AZ,jZ=s((()=>{OZ=d(O(),1),kZ=`base-ui-disable-scrollbar`,AZ={className:kZ,getElement(e){return(0,OZ.jsx)(`style`,{nonce:e,href:kZ,precedence:`base-ui:low`,children:`.${kZ}{scrollbar-width:none}.${kZ}::-webkit-scrollbar{display:none}`})}}}));function MZ(){return NZ.useContext(PZ)??FZ}var NZ,PZ,FZ,IZ=s((()=>{NZ=d(m(),1),PZ=NZ.createContext(void 0),FZ={disableStyleElements:!1}})),LZ,RZ=s((()=>{LZ=`--transform-origin`}));function zZ(e){let t=e.maxHeight;return t.endsWith(`px`)&&parseFloat(t)||1/0}function BZ(e){return XX(e.scrollHeight,e.clientHeight)}function VZ(e){return aM.getScale(e)}function HZ(e,t,n){return e/n[t]}function UZ(e,t){return FA({x:HZ(e.x,`x`,t),y:HZ(e.y,`y`,t),width:HZ(e.width,`x`,t),height:HZ(e.height,`y`,t)})}function WZ(e){let{style:t}=e,n={};for(let[e,r]of YZ)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of YZ){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var GZ,KZ,qZ,JZ,YZ,XZ=s((()=>{GZ=d(m(),1),KA(),$P(),TN(),yF(),DF(),oN(),TF(),YX(),IB(),tX(),fP(),yZ(),jZ(),YN(),pz(),TL(),SZ(),ZP(),YP(),ZH(),qH(),SH(),QX(),IZ(),ZV(),RZ(),KZ=d(O(),1),qZ={...uP,...JN},JZ=GZ.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,s=JY(),{multiple:c,readOnly:l,highlightItemOnHover:u}=YY(),d=XY(),{side:f,align:p,alignItemWithTriggerActive:m,isPositioned:h,setControlledAlignItemWithTrigger:g}=gZ(),_=JH(!0)!=null,v=JV(),{nonce:y,disableStyleElements:b}=MZ(),x=s.useState(`id`),S=s.useState(`open`),C=s.useState(`openMethod`),w=s.useState(`mounted`),T=s.useState(`popupProps`),E=s.useState(`transitionStatus`),D=s.useState(`triggerElement`),O=s.useState(`positionerElement`),k=s.useState(`listElement`),A=GZ.useRef(!1),j=GZ.useRef(!1),M=GZ.useRef({}),N=bF(),P=$(e=>{if(!O||!s.context.popupRef.current||!j.current)return;let t=O.style.top===`0px`,n=O.style.bottom===`0px`;if(A.current||!m||!t&&!n){s.context.handleScrollArrowVisibility(e);return}let r=VZ(O),i=HZ(O.getBoundingClientRect().height,`y`,r),a=EF(O),o=sj(O),c=o.getComputedStyle(O),l=parseFloat(c.marginTop),u=parseFloat(c.marginBottom),d=zZ(o.getComputedStyle(s.context.popupRef.current)),f=Math.min(a.documentElement.clientHeight-l-u,d),p=e.scrollTop,h=BZ(e),g=null,_=e=>{O.style.height=`${e}px`},v=t?h-p:p,y=Math.min(i+v,f);if(v<=1){let n=JX(v,0,f-i);n>0&&_(i+n),e.scrollTop=t?h:0,f-(i+n)<=1&&(A.current=!0),s.context.handleScrollArrowVisibility(e);return}f-y>1?g=t?1/0:0:n&&p<h&&(g=p-(v-(i+v-f)));let b=Math.ceil(y);if(b!==0&&_(b),g!=null){let t=JX(g,0,BZ(e));Math.abs(e.scrollTop-t)>1&&(e.scrollTop=t)}b>=f-1&&(A.current=!0),s.context.handleScrollArrowVisibility(e)});GZ.useImperativeHandle(s.context.scrollHandlerRef,()=>P,[P]),dz({open:S,ref:s.context.popupRef,onComplete(){S&&s.context.onOpenChangeComplete(!0)}});let F={open:S,transitionStatus:E,side:f,align:p};Q(()=>{O&&s.context.popupRef.current&&!Object.keys(M.current).length&&(M.current={top:O.style.top||`0`,left:O.style.left||`0`,right:O.style.right,height:O.style.height,bottom:O.style.bottom,minHeight:O.style.minHeight,maxHeight:O.style.maxHeight,marginTop:O.style.marginTop,marginBottom:O.style.marginBottom})},[s,O]),Q(()=>{S||m||(j.current=!1,A.current=!1,bZ(O,M.current))},[S,m,O]),Q(()=>{let e=s.context.popupRef.current;if(!S||!D||!O||!e||m&&!h||s.state.transitionStatus===`ending`)return;if(j.current=!0,e.style.removeProperty(LZ),!m){N.request(()=>s.context.handleScrollArrowVisibility(k||e));return}let t=WZ(e);try{let t=s.context.selectedItemTextRef.current;t?.isConnected||(t=!s.select(`hasSelectedValue`)&&s.context.firstItemTextRef.current?.isConnected?s.context.firstItemTextRef.current:null);let n=s.context.valueRef.current,r=sj(O),i=r.getComputedStyle(O),a=r.getComputedStyle(e),o=EF(D),c=VZ(D),l=UZ(D.getBoundingClientRect(),c),d=UZ(O.getBoundingClientRect(),c),f=l.height,p=k||e,m=p.scrollHeight,h=parseFloat(a.borderBottomWidth),_=parseFloat(i.marginTop)||10,y=parseFloat(i.marginBottom)||10,b=parseFloat(i.minHeight)||100,x=zZ(a),S=o.documentElement.clientHeight-_-y,C=o.documentElement.clientWidth,w=S-l.bottom+f,T,E=v===`rtl`?l.right-d.width:l.left,j=0;if(t&&n){let e=UZ(n.getBoundingClientRect(),c);T=UZ(t.getBoundingClientRect(),c),E=d.left+(v===`rtl`?e.right-T.right:e.left-T.left);let r=e.top-l.top+e.height/2;j=T.top-d.top+T.height/2-r}let N=w+j+y+h,P=Math.min(S,N),F=S-_-y,I=N-P,L=C-5;O.style.left=`${JX(E,5,L-d.width)}px`,O.style.height=`${P}px`,O.style.maxHeight=`none`,O.style.marginTop=`${_}px`,O.style.marginBottom=`${y}px`,e.style.height=`100%`;let R=BZ(p),z=I>=R-1;z&&(P=Math.min(S,d.height)-(I-R));let B=l.top<20||l.bottom>S-20||Math.ceil(P)+1<Math.min(m,b),V=(r.visualViewport?.scale??1)!==1&&yN;if(B||V){bZ(O,M.current),g(!1);return}let H=Math.max(b,P);if(z){let e=Math.max(0,S-N);O.style.top=d.height>=F?`0`:`${e}px`,O.style.height=`${P}px`,p.scrollTop=BZ(p)}else O.style.bottom=`0`,p.scrollTop=I;if(T){let t=d.top,n=d.height,r=T.top+T.height/2,i=JX(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(LZ,`50% ${i}%`)}(H===S||P>=x)&&(A.current=!0),s.context.handleScrollArrowVisibility(p),u&&s.state.selectedIndex===null&&s.state.activeIndex===null&&s.context.listRef.current[0]!=null&&s.set(`activeIndex`,0)}finally{t()}},[s,S,O,D,m,g,N,k,u,v,h]),GZ.useEffect(()=>{if(!m||!O||!S)return;let e=sj(O);function t(e){s.context.setOpen(!1,XP(JP,e))}return QP(e,`resize`,t)},[s,m,O,S]);let I={...k?{role:`presentation`}:{role:`listbox`,"aria-multiselectable":c||void 0,"aria-readonly":l||void 0,id:`${x}-list`},onKeyDown(e){_&&KH.has(e.key)&&e.stopPropagation()},onScroll(e){k||P(e.currentTarget)},...m&&{style:k?{height:`100%`}:xZ},className:!k&&m?AZ.className:void 0},L=gL(`div`,e,{ref:[t,s.context.popupRef],state:F,stateAttributesMapping:qZ,props:[T,I,xH(E),o]});return(0,KZ.jsxs)(GZ.Fragment,{children:[!b&&AZ.getElement(y),(0,KZ.jsx)(sR,{context:d,modal:!1,disabled:!w,openInteractionType:C,returnFocus:a,restoreFocus:!0,children:L})]})}),YZ=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]]})),ZZ,QZ,$Z=s((()=>{ZZ=d(m(),1),tX(),yZ(),TL(),jZ(),SZ(),QZ=ZZ.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=JY(),{multiple:s,readOnly:c}=YY(),{alignItemWithTriggerActive:l}=gZ(),u=o.useState(`hasScrollArrows`),d=o.useState(`openMethod`),f={id:`${o.useState(`id`)}-list`,role:`listbox`,"aria-multiselectable":s||void 0,"aria-readonly":c||void 0,onScroll(e){o.context.scrollHandlerRef.current?.(e.currentTarget)},...l&&{style:xZ},className:u&&d!==`touch`?AZ.className:void 0};return gL(`div`,e,{ref:[t,o.useStateSetter(`listElement`)],props:[f,a]})})})),eQ,tQ,nQ=s((()=>{eQ=d(m(),1),tQ=eQ.createContext(void 0)})),rQ,iQ,aQ,oQ=s((()=>{rQ=d(m(),1),oN(),tX(),zU(),TL(),nQ(),iU(),ZP(),YP(),MX(),jN(),iQ=d(O(),1),aQ=rQ.memo(rQ.forwardRef(function(e,t){let{render:n,className:r,style:i,value:a=null,label:o,disabled:s=!1,nativeButton:c=!1,...l}=e,u=rQ.useRef(null),d=LU({guess:!0,label:o,textRef:u}),f=JY(),{itemProps:p,multiple:m,disabled:h,readOnly:g}=YY(),_=h||s,v=f.useState(`isActive`,d.index),y=f.useState(`open`),b=f.useState(`isSelected`,a),x=f.useState(`isSelectedByFocus`,d.index),S=f.useState(`isItemEqualToValue`),C=d.index,w=rQ.useRef(null);Q(()=>{let e=f.context.valuesRef.current;return e[C]=a,()=>{delete e[C]}},[C,a,f]),Q(()=>{let e=f.state.value,t=f.state.selectedIndex,n=t,r;m&&Array.isArray(e)?(n=kX(C,a,f.context.valuesRef.current,e,S,t),r=n===C,C===t&&!r&&(f.context.selectedItemTextRef.current=null)):(r=e!==void 0&&wX(a,e,S),r&&(n=C)),f.set(`selectedIndex`,n),r&&u.current&&(f.context.selectedItemTextRef.current=u.current)},[C,m,S,f,a]);let T=rQ.useRef(`mouse`),E=rQ.useRef(!1),{getButtonProps:D,buttonRef:O}=uV({disabled:_,focusableWhenDisabled:!0,native:c,composite:!0}),k={disabled:_,selected:b,highlighted:v};function A(e){if(h||g)return;let t=f.state.value;if(m){let n=Array.isArray(t)?t:[],r=b?AX(n,a,S):[...n,a];f.context.setValue(r,XP(FP,e))}else f.context.setValue(a,XP(FP,e)),f.context.setOpen(!1,XP(FP,e))}function j(){f.context.selectionRef.current.dragY=0}let M={role:`option`,"aria-selected":b,tabIndex:y&&v?0:-1,onKeyDown(e){f.set(`activeIndex`,C),e.key===` `&&f.context.typingRef.current&&e.preventDefault()},onClick(e){let t=T.current!==`touch`,n=e.nativeEvent.pointerType,r=t&&ON(e.nativeEvent)&&(n!==void 0||v),i=t&&!r&&!E.current;E.current=!1,!(_||i)&&A(e.nativeEvent)},onPointerEnter(e){T.current=e.pointerType},onPointerMove(e){if(e.pointerType===`mouse`&&e.buttons===1){let t=f.context.selectionRef.current;t.dragY+=e.movementY,t.dragY**2>=64&&(t.allowUnselectedMouseUp=!0)}},onPointerDown(e){T.current=e.pointerType,E.current=!0,j()},onMouseUp(){if(j(),_||T.current===`touch`||E.current)return;let e=!f.context.selectionRef.current.allowSelectedMouseUp&&b,t=!f.context.selectionRef.current.allowUnselectedMouseUp&&!b;e||t||(E.current=!0,w.current?.click(),E.current=!1)}},N=gL(`div`,e,{ref:[O,t,d.ref,w],state:k,props:[p,M,l,D]}),P=rQ.useMemo(()=>({selected:b,index:C,textRef:u,selectedByFocus:x}),[b,C,u,x]);return(0,iQ.jsx)(tQ.Provider,{value:P,children:N})}))})),sQ=s((()=>{nZ(),TL(),mX(),lX(),Aj(),DF(),yF(),XR(),oN(),_V(),bX(),tX(),dZ(),VX(),fP(),hZ(),YN(),DZ(),XZ(),$Z(),oQ(),nQ(),az(),pz(),yZ(),rN(),QX(),RI()})),cQ=s((()=>{sQ()}));function lQ(e){return(0,pQ.jsx)(dQ,{...e})}function uQ(e){return(0,pQ.jsx)(dQ,{...e,multiple:!0})}function dQ(e){let{items:t,ariaLabel:n,ariaInvalid:r,ariaDescribedBy:i,ariaLabelledBy:a,id:o,buttonRef:s,popupRef:c,onOpenChange:l,disabled:u,readOnly:d,valueClassName:f,actions:p=[],buttonClassName:m,listClassName:h,valueId:g,placeholder:_}=e,v=e.multiple===!0,y=(0,fQ.useId)(),b=(0,fQ.useId)(),x=o??y,S=e.multiple===!0?e.value:[e.value],C=t.find(e=>e.value===S[0]),w=v?t.filter(e=>S.includes(e.value)).map(e=>e.label).join(`, `):C?.label??``,T=(0,fQ.useRef)(null),[E,D]=(0,fQ.useState)(null);(0,fQ.useEffect)(()=>{D(T.current?.closest(`dialog, [role="dialog"]`))},[]);let O=(0,fQ.useRef)(null);return(0,pQ.jsx)(`div`,{className:`dd`,ref:T,children:(0,pQ.jsxs)($X,{multiple:v||void 0,value:v?S:C?C.value:null,disabled:u,readOnly:d,onOpenChange:l&&((e,t)=>l(e,EG(t,`implicit`))),items:t.map(e=>({value:e.value,label:e.label})),onValueChange:(n,r)=>{let i=EG(r,r.event?.type===`base-ui`?`sync`:`autofill`);if(e.multiple===!0){if(!Array.isArray(n))return;let r=n.find(e=>typeof e==`string`&&e.startsWith(mQ));r?p[Number(r.slice(9))]?.onSelect():e.onChange(t.map(e=>e.value).filter(e=>n.includes(e)),i)}else typeof n==`string`&&(n.startsWith(mQ)?p[Number(n.slice(9))]?.onSelect():n!==e.value&&e.onChange(n,i))},children:[(0,pQ.jsxs)(uZ,{render:(0,pQ.jsx)(`button`,{type:`button`,role:`button`,id:x,className:m?`dd-button ${m}`:`dd-button`,ref:e=>{O.current=e,typeof s==`function`?s(e):s&&(s.current=e)},"aria-label":a?void 0:n,"aria-labelledby":a??(n?`${x} ${g??b}`:void 0),"aria-invalid":r||void 0,"aria-describedby":i,title:C?.detail??``}),children:[C?.swatches&&(0,pQ.jsx)(`span`,{className:`dd-swatches`,"aria-hidden":`true`,children:C.swatches.map((e,t)=>(0,pQ.jsx)(`span`,{style:{background:e}},t))}),(0,pQ.jsx)(`span`,{id:g??b,className:`dd-value${f?` ${f}`:``}${w?``:` is-empty`}`,children:w||_||`—`}),(0,pQ.jsx)(`span`,{className:`dd-caret`,"aria-hidden":`true`,children:`▾`})]}),(0,pQ.jsx)(mZ,{container:E??yG(),children:(0,pQ.jsx)(EZ,{anchor:()=>O.current?cU(O.current):null,alignItemWithTrigger:!1,positionMethod:`fixed`,side:`bottom`,align:`start`,sideOffset:4,collisionBoundary:lU(),collisionPadding:8,style:{zIndex:40},children:(0,pQ.jsx)(JZ,{ref:c,className:`dd-popup`,children:(0,pQ.jsxs)(QZ,{className:[`dd-list`,v?`dd-list-multi`:``,h].filter(Boolean).join(` `),"aria-label":n,"aria-labelledby":n?void 0:a?.split(` `)[0],children:[t.map(t=>(0,pQ.jsxs)(aQ,{value:t.value,label:t.label,disabled:t.disabled,className:e=>`dd-option${e.selected?` selected`:``}${t.disabled?` disabled`:``}${t.tone?` dd-tone-${t.tone}`:``}${e.highlighted?` active`:``}`,children:[v?(0,pQ.jsx)(`span`,{className:`dd-box`,"aria-hidden":`true`}):(0,pQ.jsx)(`span`,{className:`dd-check`,"aria-hidden":`true`,children:t.value===e.value?`✓`:``}),t.swatches&&(0,pQ.jsx)(`span`,{className:`dd-swatches`,"aria-hidden":`true`,children:t.swatches.map((e,t)=>(0,pQ.jsx)(`span`,{style:{background:e}},t))}),(0,pQ.jsxs)(`span`,{className:`dd-text`,children:[(0,pQ.jsx)(`span`,{className:`dd-label`,children:t.label}),t.detail&&(0,pQ.jsx)(`span`,{className:`dd-detail`,children:t.detail})]}),t.badge&&(0,pQ.jsx)(`span`,{className:`dd-badge`,children:t.badge})]},t.value)),p.length?(0,pQ.jsx)(`div`,{className:`dd-divider`,role:`presentation`}):null,p.map((e,t)=>(0,pQ.jsxs)(aQ,{value:`${mQ}${t}`,label:e.label,className:e=>`dd-option dd-action${e.highlighted?` active`:``}`,children:[(0,pQ.jsx)(`span`,{className:`dd-check`,"aria-hidden":`true`}),(0,pQ.jsx)(`span`,{className:`dd-text`,children:(0,pQ.jsx)(`span`,{className:`dd-label`,children:e.label})})]},e.label))]})})})})]})})}var fQ,pQ,mQ,hQ,gQ,_Q=s((()=>{fQ=d(m(),1),cQ(),uU(),bG(),kG(),LG(),pQ=d(O(),1),mQ=`~~action:`,hQ={onChange:[1,`item-press`],onOpenChange:[1,`implicit`]},gQ=AG(`Dropdown`,lQ,hQ),AG(`MultiDropdown`,uQ,hQ)})),vQ,yQ=s((()=>{Ya(),vQ=Va({select:`Select`})}));function bQ(e){return!/[??]/.test(e)&&e.trim().split(/\s+/).length<=2}function xQ(e){return(0,SQ.jsx)(gQ,{...e,ariaLabel:e.ariaLabel??vQ(`select`)})}var SQ,CQ=s((()=>{_Q(),yQ(),SQ=d(O(),1)}));function wQ(e){if(typeof e!=`string`||!/^\d{4}-\d{2}-\d{2}$/.test(e))return!1;let t=new Date(`${e}T00:00:00Z`);return!Number.isNaN(t.getTime())&&t.toISOString().slice(0,10)===e}function TQ(e,t){let n=JSON.stringify([e??null,t]),r=YQ.get(n);return r||(r=new Intl.DateTimeFormat(e,t),YQ.set(n,r)),r}function EQ(e){return wQ(e)&&e>=`0001-01-01`&&e<=`9999-12-31`}function DQ(e){if(!EQ(e))throw RangeError(`Expected an existing ISO date from 0001-01-01 through 9999-12-31.`);return{year:Number(e.slice(0,4)),month:Number(e.slice(5,7)),day:Number(e.slice(8,10))}}function OQ({year:e,month:t,day:n}){let r=new Date(0);return r.setUTCFullYear(e,t-1,n),r}function kQ(e){return`${String(e.getUTCFullYear()).padStart(4,`0`)}-${String(e.getUTCMonth()+1).padStart(2,`0`)}-${String(e.getUTCDate()).padStart(2,`0`)}`}function AQ(e){if(!Number.isSafeInteger(e))throw RangeError(`Calendar steps must be safe integers.`)}function jQ(e,t){if(AQ(e),AQ(t),e<1||e>9999||t<1||t>12)throw RangeError(`Invalid calendar month.`);return[31,e%4==0&&(e%100!=0||e%400==0)?29:28,31,30,31,30,31,31,30,31,30,31][t-1]}function MQ(e,t){let n=OQ(DQ(e));AQ(t);let r=OQ(DQ(qQ)).getTime(),i=OQ(DQ(JQ)).getTime();return kQ(new Date(Math.min(i,Math.max(r,n.getTime()+t*864e5))))}function NQ(e,t){let n=DQ(e);AQ(t);let r=Math.min(119987,Math.max(0,(n.year-1)*12+n.month-1+t)),i=Math.floor(r/12)+1,a=r%12+1;return kQ(OQ({year:i,month:a,day:Math.min(n.day,jQ(i,a))}))}function PQ(e,t){let n=e&&wQ(e)&&e<`0001-01-01`?qQ:e||`0001-01-01`,r=t||`9999-12-31`;if(DQ(n),DQ(r),n>r)throw RangeError(`Minimum date must not exceed maximum date.`);return{min:n,max:r}}function FQ(e,t){return EQ(e)&&e>=t.min&&e<=t.max}function IQ(e,t){return DQ(e),e<t.min?t.min:e>t.max?t.max:e}function LQ(e,t=1,n=PQ()){if(AQ(t),t<0||t>6)throw RangeError(`First weekday must be between 0 (Sunday) and 6.`);let r=DQ(e),i=OQ({...r,day:1}),a=(i.getUTCDay()-t+7)%7;return Array.from({length:42},(e,t)=>{let o=new Date(i.getTime()+(t-a)*864e5);if(o.getUTCFullYear()<1||o.getUTCFullYear()>9999)return{date:null,inMonth:!1,disabled:!0};let s=kQ(o);return{date:s,inMonth:o.getUTCMonth()+1===r.month,disabled:!FQ(s,n)}})}function RQ(e,t){return TQ(t,{calendar:`gregory`,timeZone:`UTC`,month:`long`,year:`numeric`}).format(OQ(DQ(e)))}function zQ(e,t=1){if(AQ(t),t<0||t>6)throw RangeError(`First weekday must be between 0 (Sunday) and 6.`);let n=TQ(e,{calendar:`gregory`,timeZone:`UTC`,weekday:`short`}),r=TQ(e,{calendar:`gregory`,timeZone:`UTC`,weekday:`long`});return Array.from({length:7},(e,i)=>{let a=OQ({year:2023,month:1,day:1+(t+i)%7});return{short:n.format(a),long:r.format(a)}})}function BQ(e){return typeof e==`string`&&XQ.test(e)}function VQ(e){return e.search(/[T ]/)===10?{date:e.slice(0,10),time:e.slice(11)}:null}function HQ(e){let t=typeof e==`string`?VQ(e):null;return!!(t&&EQ(t.date)&&BQ(t.time))}function UQ(e,t){let n=VQ(e)?.time;return`${t} ${n&&BQ(n)?n:`00:00`}`}function WQ(e){if(!HQ(e))return null;let{date:t,time:n}=VQ(e),[r,i=`00`]=[n.slice(0,5),n.slice(6)],[a=`00`,o=``]=i.split(`.`);return`${t}T${r}:${a.padEnd(2,`0`)}.${o.padEnd(3,`0`)}`}function GQ(e,t,n){let r=WQ(e);if(r===null)return!1;let i=t?WQ(t):null,a=n?WQ(n):null;return(i===null||r>=i)&&(a===null||r<=a)}function KQ(e,t){let n=TQ(`en-US`,{calendar:`gregory`,numberingSystem:`latn`,timeZone:t,year:`numeric`,month:`2-digit`,day:`2-digit`}).formatToParts(e),r=e=>n.find(t=>t.type===e).value,i=`${r(`year`).padStart(4,`0`)}-${r(`month`)}-${r(`day`)}`;return DQ(i),i}var qQ,JQ,YQ,XQ,ZQ=s((()=>{qQ=`0001-01-01`,JQ=`9999-12-31`,YQ=new Map,XQ=/^([01]\d|2[0-3]):[0-5]\d(:[0-5]\d(\.\d{1,3})?)?$/}));function QQ(e){let t;try{t=TQ(e,{year:`numeric`,month:`2-digit`,day:`2-digit`,timeZone:`UTC`,calendar:`gregory`}).formatToParts(Date.UTC(2006,10,22))}catch{t=[]}let n=t.filter(e=>[`year`,`month`,`day`].includes(e.type)).map(e=>e.type);if(n.length!==3)return{order:[`year`,`month`,`day`],sep:`-`,hint:`YYYY-MM-DD`};let r=t.find(e=>e.type===`literal`)?.value.trim()||`/`,i={year:`YYYY`,month:`MM`,day:`DD`};return{order:n,sep:r,hint:n.map(e=>i[e]).join(r)}}function $Q(e,t){let{year:n,month:r,day:i}=DQ(e),a={year:String(n).padStart(4,`0`),month:String(r).padStart(2,`0`),day:String(i).padStart(2,`0`)};return t.order.map(e=>a[e]).join(t.sep)}function e$(e,t){if(i$(e))return e;let n=e.trim().match(/^(\d{1,4})\D(\d{1,2})\D(\d{1,4})$/);if(!n)return;let r={};if(t.order.forEach((e,t)=>r[e]=n[t+1]),r.year.length!==4)return;let i=`${r.year}-${r.month.padStart(2,`0`)}-${r.day.padStart(2,`0`)}`;return EQ(i)?i:void 0}function t$({id:e,words:t,calendarIcon:n,value:r,onChange:i,onBlur:a,onKeyDown:o,disabled:s,required:c,min:l,max:u,locale:d,timezone:f,now:p,firstDay:m=1,className:h=``,name:g,inputRef:_,placeholder:v,withTime:y=!1,popupRef:b,onOpenChange:x,"aria-label":S,"aria-invalid":C,"aria-describedby":w}){let T=y?VQ(r)?.date??r.slice(0,10):r,E=(0,n$.useMemo)(()=>{try{return PQ(y?l?.slice(0,10):l,y?u?.slice(0,10):u)}catch{return null}},[l,u,y]),D=E??PQ(),O=KQ(p??new Date,f),k=()=>IQ(EQ(T)?T:O,D),[A,j]=(0,n$.useState)(k),[M,N]=(0,n$.useState)(!1),P=(0,n$.useRef)(x);(0,n$.useLayoutEffect)(()=>{P.current=x});let F=(e,t)=>{N(e),P.current?.(e,t)},[I,L]=(0,n$.useState)(null),R=(0,n$.useRef)(null),z=(0,n$.useRef)(null),B=(0,n$.useRef)(null);(0,n$.useImperativeHandle)(_,()=>B.current,[]);let V=(0,n$.useRef)(null),H=(0,n$.useCallback)(e=>{V.current=e,b?.(e)},[b]),U=(0,n$.useRef)(!1),W=(0,n$.useRef)(!1),G=(0,n$.useRef)(void 0),ee=(0,n$.useRef)(!1),te=(0,n$.useRef)(a);(0,n$.useLayoutEffect)(()=>{te.current=a});let ne=(0,n$.useId)(),K=(0,n$.useId)(),re=(0,n$.useMemo)(()=>QQ(d),[d]),[q,ie]=(0,n$.useState)(null),ae=y?r:q??(EQ(r)?$Q(r,re):r),oe=y?t.dateTimePattern:re.hint;(0,n$.useEffect)(()=>{q!==null&&r!==(e$(q,re)??q)&&ie(null)},[r]);let se=LQ(A,m,D),ce=zQ(d,m);(0,n$.useEffect)(()=>(L(z.current?.closest(`dialog, [role="dialog"]`)),()=>{clearTimeout(G.current)}),[]);let le=!E||r!==``&&(y?!HQ(r)||!FQ(T,D)||!GQ(r,l,u):!FQ(r,D));(0,n$.useEffect)(()=>{B.current?.setCustomValidity(le?y?t.enterDateAndTime:t.enterDate(re.hint):``)},[le,y,re]),(0,n$.useLayoutEffect)(()=>{if(!M)return;if(!E||s){F(!1,wG(`disabled`));return}let e=IQ(EQ(T)?T:A,E);e!==A&&(W.current=!!V.current?.querySelector(`[data-date]:focus`),j(e))},[r,l,u,s]),(0,n$.useLayoutEffect)(()=>{M&&W.current&&(V.current?.querySelector(`[data-date="${A}"]`)?.focus(),W.current=!1)},[A,M]);let ue=e=>!!(e&&(R.current?.contains(e)||V.current?.contains(e))),de=()=>{U.current&&(U.current=!1,ie(null),te.current?.())},fe=()=>{clearTimeout(G.current),G.current=setTimeout(()=>{ue(document.activeElement)||de()},0)},pe=e=>{e.relatedTarget?(clearTimeout(G.current),ue(e.relatedTarget)||de()):fe()},me=(e,t)=>{e&&(ee.current=!1,j(k())),F(e,t),e||fe()},J=()=>{let e=z.current;e?.isConnected&&(!I||I.isConnected&&!I.hasAttribute(`data-closed`))&&e.focus({preventScroll:!0})},he=(e,t)=>{let n=wG(`day-press`,t);ee.current=!0,ie(null),J(),i(y&&e?UQ(r,e):e,n),me(!1,n)},ge=e=>{W.current=!0,j(IQ(e,D))},_e=e=>{let t=se.findIndex(e=>e.date===A)%7,n={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7,Home:-t,End:6-t};Object.hasOwn(n,e.key)?(e.preventDefault(),e.stopPropagation(),ge(MQ(A,n[e.key]))):(e.key===`PageUp`||e.key===`PageDown`)&&(e.preventDefault(),e.stopPropagation(),ge(NQ(A,(e.key===`PageUp`?-1:1)*(e.shiftKey?12:1))))},ve=e=>{let t=DQ(e),n=new Date(0);return n.setUTCFullYear(t.year,t.month-1,t.day),TQ(d,{calendar:`gregory`,timeZone:`UTC`,dateStyle:`full`}).format(n)},ye=NQ(A,-1),be=NQ(A,1);return(0,r$.jsx)(JB,{open:M&&!s&&!!E,onOpenChange:(e,t)=>{ee.current=!e&&t.reason===`escape-key`,ee.current&&J(),me(e,EG(t,`implicit`))},children:(0,r$.jsxs)(`span`,{ref:R,className:y?`date-field with-time`:`date-field`,onFocus:()=>{U.current=!0},onBlur:pe,children:[(0,r$.jsx)(`input`,{ref:B,id:e,name:g,type:`text`,value:ae,className:`date-field-input ${h}`,placeholder:v??(y?t.dateTimePattern:re.hint),autoComplete:`off`,spellCheck:!1,disabled:s,required:c,"aria-required":c,"aria-label":S,"aria-invalid":C||le||void 0,"aria-describedby":[w,K].filter(Boolean).join(` `),onChange:e=>{let t=e.target.value,n=wG(`input-change`,e);if(y)return i(t,n);ie(t),i(e$(t,re)??t,n)},onKeyDown:e=>{e.altKey&&e.key===`ArrowDown`?(e.preventDefault(),e.stopPropagation(),E&&me(!0,wG(`open-key`,e))):o?.(e)}}),(0,r$.jsxs)(`span`,{id:K,className:`date-field-hint`,children:[y?t.dateAndTimeFormat:t.dateFormat(oe),` `,t.openWithKeys]}),(0,r$.jsx)(PV,{render:(0,r$.jsx)(`button`,{ref:z,type:`button`,className:`date-field-trigger`,disabled:s||!E,"aria-label":t.chooseDate(S||void 0)}),children:n}),(0,r$.jsx)(HV,{container:I??yG(),children:(0,r$.jsx)(BH,{anchor:()=>z.current?cU(z.current):null,positionMethod:`fixed`,side:`bottom`,align:`end`,sideOffset:6,collisionBoundary:lU(),collisionPadding:8,style:{zIndex:45},children:(0,r$.jsxs)(rU,{ref:H,finalFocus:()=>{let e=z.current,t=document.activeElement;return ee.current&&e?.isConnected&&(!I||I.isConnected&&!I.hasAttribute(`data-closed`))&&(t===e||t===document.body||t===I)?e:!1},className:`date-field-popup`,"aria-label":t.calendar(S||void 0),initialFocus:()=>V.current?.querySelector(`[data-date="${A}"]`)??!0,children:[(0,r$.jsxs)(`div`,{className:`date-field-head`,children:[(0,r$.jsx)(`button`,{type:`button`,"aria-label":t.previousMonth,disabled:ye.slice(0,7)===A.slice(0,7)||ye.slice(0,7)<D.min.slice(0,7),onClick:()=>j(IQ(ye,D)),children:`←`}),(0,r$.jsx)(`span`,{id:ne,"aria-live":`polite`,"aria-atomic":`true`,children:RQ(A,d)}),(0,r$.jsx)(`button`,{type:`button`,"aria-label":t.nextMonth,disabled:be.slice(0,7)===A.slice(0,7)||be.slice(0,7)>D.max.slice(0,7),onClick:()=>j(IQ(be,D)),children:`→`})]}),(0,r$.jsxs)(`table`,{className:`date-field-calendar`,role:`grid`,"aria-labelledby":ne,children:[(0,r$.jsx)(`thead`,{children:(0,r$.jsx)(`tr`,{children:ce.map(e=>(0,r$.jsx)(`th`,{scope:`col`,"aria-label":e.long,children:e.short},e.long))})}),(0,r$.jsx)(`tbody`,{children:Array.from({length:6},(e,t)=>(0,r$.jsx)(`tr`,{children:se.slice(t*7,t*7+7).map((e,t)=>(0,r$.jsx)(`td`,{"aria-selected":e.date===T,children:e.date&&(0,r$.jsx)(`button`,{type:`button`,"data-date":e.date,"data-outside":!e.inMonth||void 0,"data-selected":e.date===T||void 0,"aria-current":e.date===O?`date`:void 0,disabled:e.disabled,tabIndex:e.date===A?0:-1,"aria-label":ve(e.date),onKeyDown:_e,onClick:t=>he(e.date,t),children:Number(e.date.slice(8))})},e.date??t))},t))})]}),(0,r$.jsxs)(`div`,{className:`date-field-foot`,children:[(0,r$.jsx)(`button`,{type:`button`,onClick:e=>he(``,e),children:t.clear}),(0,r$.jsx)(`button`,{type:`button`,disabled:!FQ(O,D),onClick:e=>he(O,e),children:t.today})]})]})})})]})})}var n$,r$,i$,a$,o$=s((()=>{n$=d(m(),1),sU(),uU(),ZQ(),kG(),bG(),LG(),r$=d(O(),1),i$=e=>EQ(e),a$=AG(`DateField`,t$,{onChange:[1,`input-change`],onOpenChange:[1,`implicit`]})})),s$,c$=s((()=>{Ya(),s$=Va({enterADateAndTime:`Enter a date and time as YYYY-MM-DD HH:MM within the allowed range.`,enterADateInYyyy:`Enter a date as {format} within the allowed range.`,yyyyMmDdHh:`YYYY-MM-DD HH:MM`,dateAndTimeFormat:`Date and time format: YYYY-MM-DD HH:MM.`,dateFormatIs:`Date format: {format}.`,altAndDownArrow:`Alt and Down arrow opens the calendar.`,chooseDateFor:`Choose date for {label}`,chooseDate:`Choose date`,calendar:`Calendar for {label}`,previousMonth:`Previous month`,nextMonth:`Next month`})}));function l$(e){return(0,u$.jsx)(a$,{...e,words:d$(),calendarIcon:(0,u$.jsx)(Pe,{name:`calendar-blank`,size:18})})}var u$,d$,f$=s((()=>{o$(),Fe(),c$(),Ya(),u$=d(O(),1),d$=()=>({dateTimePattern:Fa(`mistri.form.dateTimeHint`,s$(`yyyyMmDdHh`)),enterDateAndTime:s$(`enterADateAndTime`),enterDate:e=>s$(`enterADateInYyyy`,{format:e}),dateAndTimeFormat:s$(`dateAndTimeFormat`),dateFormat:e=>s$(`dateFormatIs`,{format:e}),openWithKeys:s$(`altAndDownArrow`),chooseDate:e=>e?s$(`chooseDateFor`,{label:e}):s$(`chooseDate`),calendar:e=>e?s$(`calendar`,{label:e}):s$(`chooseDate`),previousMonth:s$(`previousMonth`),nextMonth:s$(`nextMonth`),clear:s$(`common.clear`),today:s$(`common.today`)})})),p$,m$,h$=s((()=>{Li(),p$={activeApp:()=>Mi().app(),inAppMode:()=>Mi().inApp()},m$=p$}));function g$({className:e,load:t,couldNotLoad:n,threw:r}){let i=new Map,a=new Set,o=new Set,s=0;function c(e,t){i.set(e,t),s+=1;for(let e of o)e()}function l(e,r){a.has(r)||(a.add(r),t(e).then(e=>c(r,e),t=>{n(e,t),c(r,null)}))}let u=e=>(o.add(e),()=>{o.delete(e)}),d=()=>s;class f extends _$.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e){i.get(this.props.slot)!==null&&(r(this.props.id,e),c(this.props.slot,null))}render(){return this.state.failed?this.props.fallback:this.props.children}}function p({id:t,fallback:n,props:r}){(0,_$.useSyncExternalStore)(u,d,d);let a=Mi().components.useKey(t);(0,_$.useEffect)(()=>{l(t,a)},[t,a]);let o=i.get(a);return o?(0,v$.jsx)(f,{id:t,slot:a,fallback:n,children:(0,v$.jsx)(`span`,{className:e,"data-component":t,children:(0,_$.createElement)(o,r)})}):(0,v$.jsx)(v$.Fragment,{children:n})}return p}var _$,v$,y$=s((()=>{_$=d(m()),Li(),v$=d(O())}));function b$(e,t){let n=m$.activeApp()?.resources,r=n?.[e]?.inputs;if(r&&Object.hasOwn(r,t))return r[t].id;let i=n?.[e]?.display,a=i&&Object.hasOwn(i,t)?i[t]:void 0;return a?.slider?`${C$}slider`:a?.scan?`${C$}scan`:a?.signature&&typeof a.signature==`object`?`${C$}signature`:a?.format&&E$.has(a.format)?`${C$}${a.format}`:void 0}function x$({component:e,fallback:t,...n}){return(0,S$.jsx)(T$,{id:e,fallback:t,props:n})}var S$,C$,w$,T$,E$,D$=s((()=>{h$(),Li(),y$(),S$=d(O(),1),C$=`mistri:`,w$=e=>`${C$}${e}`,T$=g$({className:`custom-input`,load:e=>e.startsWith(C$)?Mi().components.builtIn(e.slice(7)):Mi().components.load(e),couldNotLoad:(e,t)=>console.error(`the input "${e}" could not be loaded; its field is the platform's control.`,t),threw:(e,t)=>console.error(`the input "${e}" threw; its field is the platform's control.`,t)}),E$=new Set([`rating`,`color`,`time`,`month`,`year`,`json`])})),O$,k$=s((()=>{Ya(),O$=Va({addRow:`Add row`,anEmailAddress:`an email address`,aWebAddressStarting:`a web address, starting https://`,aPhoneNumber:`a phone number`,aColor:`a color, such as #1d6a5a`,theFormHasAnInput:`The form has an input it does not ask for.`,isRequired:`{label} is required.`,requiredWord:`(required)`,optionalWord:`(optional)`,checkThisBoxTo:`Check this box to continue.`,mustBeAtLeast:`{label} must be at least {minLength} characters.`,mustBeCharactersOrFewer:`{label} must be {maxLength} characters or fewer.`,must:`{label} must be {value}.`,isNotInTheForm:`{label} is not in the form it takes.`,mustBeBefore:`{label} must be before {other}.`,mustBeLessThan:`{label} must be less than {other}.`,mustBeAfter:`{label} must be after {other}.`,mustBeMoreThan:`{label} must be more than {other}.`,hasCharactersAForm:`{label} has characters a form does not take.`,mustBeASafe:`{label} must be a safe whole number.`,hasMoreDecimalsThanTheCurrency:`{label} has more decimal places than the currency takes.`,mustBeOnOrAfter:`{label} must be on or after {min}.`,labelMustBeAt:`{label} must be at least {min}.`,mustBeOnOrBefore:`{label} must be on or before {max}.`,mustBeAtMost:`{label} must be at most {max}.`,chooseLabel:`Choose {label}.`,takesAtMostRows:`{label} takes at most {max} rows.`,mustBeANumber:`{label} must be a number.`,mustBeYes:`{label} must be yes or no.`,mustBeADate:`{label} must be a date.`,mustBeADateAndTime:`{label} must be a date and time.`,mustBeATime:`{label} must be a time of day.`,isNotInAForm:`{label} is not in a form it takes.`,choosePlaceholder:`Choose {label}`,chooseOne:`Choose one`,groupRow:`{label}, row {index}`,rowLabel:`Row`,removeRow:`Remove row {index} of {label}`,addRowTo:`Add row to {label}`,needsAtLeastRows:{one:`{label} needs at least {count} row.`,other:`{label} needs at least {count} rows.`},rowMatch:`row {match}`,needsAtLeastFiles:{one:`{label} needs at least {count} file.`,other:`{label} needs at least {count} files.`},takesAtMostFiles:{one:`{label} takes at most {count} file.`,other:`{label} takes at most {count} files.`},inTheFormItTakes:`in the form it takes`,chooseAlone:`Choose {label} on its own, or another.`})}));function A$({id:e,options:t,value:n,describedBy:r,required:i,invalid:a,disabled:o,onChange:s}){let c=t.findIndex(e=>e.value===n);return(0,j$.jsx)(`div`,{className:`command-choices`,role:`radiogroup`,id:e,"aria-labelledby":`${e}-label`,"aria-describedby":r,"aria-required":i||void 0,"aria-invalid":a||void 0,children:t.map((t,n)=>(0,j$.jsxs)(`label`,{className:`command-choice`,children:[(0,j$.jsx)(`input`,{type:`radio`,name:e,checked:n===c,disabled:o,onChange:()=>s(t.value)}),t.label]},`${typeof t.value}:${t.value}`))})}var j$,M$=s((()=>{j$=d(O())}));function N$(e,t){F$.set(e,t)}function P$(e){let t=F$.get(e);t?.url&&URL.revokeObjectURL(t.url),F$.delete(e)}var F$,I$,L$=s((()=>{F$=new Map,I$=e=>F$.get(e)}));function R$(e,t){let n=TQ(`en-US`,{...H$,timeZone:t}).formatToParts(new Date(e)),r=e=>Number(n.find(t=>t.type===e)?.value??0);return{year:r(`year`),month:r(`month`),day:r(`day`),hour:r(`hour`),minute:r(`minute`),second:r(`second`)}}function z$(e,t,n,r,i,a,o=0){let s=new Date(0);return s.setUTCFullYear(e,t-1,n),s.setUTCHours(r,i,a,o),s.getTime()}function B$(e,t){if(!HQ(e))return;let{date:n,time:r}=VQ(e),[i,a,o=`0`]=r.split(`:`),[s,c=``]=o.split(`.`),l=z$(Number(n.slice(0,4)),Number(n.slice(5,7)),Number(n.slice(8,10)),Number(i),Number(a),Number(s),Number(c.padEnd(3,`0`))),u=864e5,d=[l-U$(l-u,t),l-U$(l+u,t)],f=l-(l%1e3+1e3)%1e3,p=d.filter(e=>{let n=R$(e,t);return z$(n.year,n.month,n.day,n.hour,n.minute,n.second)===f});return new Date(p.length?Math.min(...p):Math.max(...d)).toISOString()}function V$(e,t){let n=Date.parse(e);if(!/[zZ]|[+-]\d{2}(?::?\d{2})?$/.test(e)||!Number.isFinite(n))return;let r=R$(n,t),i=e=>String(e).padStart(2,`0`),a=r.second?`:${i(r.second)}`:``;return`${String(r.year).padStart(4,`0`)}-${i(r.month)}-${i(r.day)} ${i(r.hour)}:${i(r.minute)}${a}`}var H$,U$,W$=s((()=>{ZQ(),H$={calendar:`gregory`,numberingSystem:`latn`,hourCycle:`h23`,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`},U$=(e,t)=>{let n=R$(e,t);return z$(n.year,n.month,n.day,n.hour,n.minute,n.second)-(e-(e%1e3+1e3)%1e3)}})),G$=l({DateTimeInput:()=>K$});function K$({value:e,onChange:t,min:n,max:r,...i}){let a=zi(),o=e=>e&&(V$(e,a)??e),[s,c]=(0,q$.useState)(()=>o(e)??``),[l,u]=(0,q$.useState)(e);return e!==l&&(u(e),c(o(e)??``)),(0,J$.jsx)(l$,{...i,withTime:!0,min:o(n),max:o(r),locale:Ri(),timezone:a,now:Vi(),value:s,onChange:e=>{c(e);let n=e.trim(),r=n?B$(n,a)??e:``;u(r),t(r)}})}var q$,J$,Y$=s((()=>{q$=d(m()),f$(),xa(),W$(),J$=d(O())})),X$=l({ActionBar:()=>e1,Columns:()=>t1,HelpTip:()=>Z$,ProgressBar:()=>Q$,ReviewList:()=>n1,StepHeader:()=>$$});function Z$({text:e,label:t,icon:n}){let[r,i]=(0,r1.useState)(!1),a=(0,r1.useId)(),o=(0,r1.useRef)(null);return(0,r1.useEffect)(()=>{if(!r)return;let e=e=>{o.current&&!o.current.contains(e.target)&&i(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[r]),(0,i1.jsxs)(`span`,{className:`help-tip`,ref:o,children:[(0,i1.jsx)(`button`,{type:`button`,className:`help-tip-button`,"aria-label":t,"aria-expanded":r,"aria-describedby":r?a:void 0,onClick:()=>i(!r),onKeyDown:e=>{e.key===`Escape`&&r&&(e.stopPropagation(),i(!1))},children:n??(0,i1.jsx)(`span`,{"aria-hidden":`true`,children:`i`})}),r?(0,i1.jsx)(`span`,{role:`tooltip`,id:a,className:`help-tip-text`,children:e}):null]})}function Q$({value:e,max:t,min:n=0,label:r,decorative:i}){return(0,i1.jsx)(`div`,{className:`progress-bar`,...i?{"aria-hidden":!0}:{role:`progressbar`,"aria-label":r,"aria-valuemin":n,"aria-valuemax":t,"aria-valuenow":e},children:(0,i1.jsx)(`span`,{className:`progress-bar-fill`,style:{width:`${t>0?Math.min(100,e/t*100):0}%`}})})}function $$({title:e,lead:t,mark:n,level:r=1,id:i}){return(0,i1.jsxs)(`header`,{className:`step-header`,children:[(0,i1.jsxs)(r===1?`h1`:`h2`,{className:`step-title`,id:i,tabIndex:-1,children:[n?(0,i1.jsx)(`span`,{className:`step-mark`,"aria-hidden":`true`,children:n}):null,e]}),t?(0,i1.jsx)(`p`,{className:`step-lead`,children:t}):null]})}function e1({back:e,primary:t,className:n}){return(0,i1.jsxs)(`footer`,{className:n?`action-bar ${n}`:`action-bar`,children:[e?(0,i1.jsxs)(UG,{intent:`quiet`,size:`large`,className:`action-bar-back`,onClick:e.onClick,children:[e.icon,e.label]}):null,(0,i1.jsxs)(UG,{intent:`primary`,size:`large`,className:`action-bar-primary`,disabled:t.disabled,busy:t.busy,busyLabel:t.busyLabel,onClick:t.onClick,children:[t.label,t.icon]})]})}function t1({cols:e,children:t}){return(0,i1.jsx)(`div`,{className:`form-columns`,style:e?{"--form-columns":e}:void 0,children:t})}function n1({label:e,children:t}){return(0,i1.jsx)(`div`,{className:`review-list`,role:`group`,"aria-label":e,children:t})}var r1,i1,a1=s((()=>{r1=d(m(),1),GG(),i1=d(O(),1)}));function o1(e){return{label:e.label,hint:e.hint,problem:e.problem,required:e.required,labelHidden:e.labelHidden,id:e.id,kind:e.kind,className:e.className,optional:e.optional,labelAside:e.tip?(0,s1.jsx)(Z$,{...e.tip}):void 0,reserve:e.reserve??!0}}var s1,c1=s((()=>{a1(),s1=d(O())}));function l1(e){let t=(0,m1.useId)();return(0,h1.jsx)(RJ,{...o1(e),group:!0,children:n=>(0,h1.jsx)(`div`,{className:`choice-pair`,role:`radiogroup`,"aria-labelledby":n[`aria-labelledby`],"aria-describedby":n[`aria-describedby`],"aria-invalid":n[`aria-invalid`],children:[`yes`,`no`].map(n=>(0,h1.jsxs)(`label`,{className:`choice-pick${e.value===n?` is-on`:``}`,children:[(0,h1.jsx)(`input`,{type:`radio`,name:t,className:`choice-input`,checked:e.value===n,onChange:t=>e.onChange(n,wG(`select`,t))}),e[n]]},n))})})}function u1(e){let t=(0,m1.useId)(),n=(t,n,r)=>{let i=wG(`select`,r);if(!e.multiple||t===e.exclusive)return e.onChange(n?[t]:[],i);let a=e.value.filter(n=>n!==t&&n!==e.exclusive);e.onChange(n?e.options.map(e=>e.value).filter(e=>e===t||a.includes(e)):a,i)};return e.multiple?(0,h1.jsx)(RJ,{...o1(e),group:!0,children:t=>(0,h1.jsx)(g1,{"aria-labelledby":t[`aria-labelledby`],"aria-describedby":t[`aria-describedby`],"aria-invalid":t[`aria-invalid`],cards:e.options.map(t=>({key:t.value,label:t.label,icon:t.icon,on:e.value.includes(t.value)})),onToggle:(t,r,i)=>n(e.options[t].value,r,i.event)})}):(0,h1.jsx)(RJ,{...o1(e),group:!0,children:r=>(0,h1.jsx)(`div`,{className:`choice-cards`,role:`radiogroup`,"aria-labelledby":r[`aria-labelledby`],"aria-describedby":r[`aria-describedby`],"aria-invalid":r[`aria-invalid`],children:e.options.map(r=>{let i=e.value.includes(r.value);return(0,h1.jsxs)(`label`,{className:`choice-card${i?` is-on`:``}`,children:[r.icon?(0,h1.jsx)(`span`,{className:`choice-card-icon`,"aria-hidden":`true`,children:r.icon}):null,(0,h1.jsx)(`span`,{className:`choice-card-label`,children:r.label}),(0,h1.jsx)(`input`,{type:`radio`,name:t,className:`choice-input`,checked:i,onChange:e=>n(r.value,e.target.checked,e.nativeEvent)}),(0,h1.jsx)(`span`,{className:`choice-box`,"aria-hidden":`true`})]},r.value)})})})}function d1(e){let{cards:t}=e,[n,r]=(0,m1.useState)(void 0),i=(0,m1.useRef)([]),a=t.findIndex(e=>e.on),o=n!==void 0&&n<t.length?n:Math.max(a,0),s=e=>{let n=(e+t.length)%t.length;r(n),i.current[n]?.focus()},c=(n,r)=>{let i=n.key===`ArrowDown`||n.key===`ArrowRight`?r+1:n.key===`ArrowUp`||n.key===`ArrowLeft`?r-1:n.key===`Home`?0:n.key===`End`?t.length-1:void 0;i===void 0?n.key===` `&&(n.preventDefault(),e.disabled||e.onToggle(r,!t[r].on,wG(`toggle`,n))):(n.preventDefault(),s(i))};return(0,h1.jsx)(`div`,{className:`choice-cards`,role:`group`,"data-fit":e.fit,id:e.id,"aria-labelledby":e[`aria-labelledby`],"aria-describedby":e[`aria-describedby`],"aria-invalid":e[`aria-invalid`],children:t.map((t,n)=>(0,h1.jsxs)(`div`,{ref:e=>{i.current[n]=e},role:`checkbox`,"aria-checked":t.on,"aria-disabled":e.disabled||void 0,tabIndex:n===o?0:-1,className:`choice-card${t.on?` is-on`:``}`,onClick:i=>{r(n),e.disabled||e.onToggle(n,!t.on,wG(`toggle`,i))},onFocus:()=>r(n),onKeyDown:e=>c(e,n),children:[t.icon?(0,h1.jsx)(`span`,{className:`choice-card-icon`,"aria-hidden":`true`,children:t.icon}):null,(0,h1.jsxs)(`span`,{className:`choice-card-label`,children:[t.label,t.help?(0,h1.jsx)(`span`,{className:`choice-card-help`,children:t.help}):null]}),(0,h1.jsx)(`span`,{className:`choice-box`,"aria-hidden":`true`})]},t.key))})}function f1(e){return(0,h1.jsx)(RJ,{...o1(e),check:!0,children:t=>(0,h1.jsx)(`input`,{...t,type:`checkbox`,className:`field-check`,checked:e.checked,disabled:e.disabled,onChange:t=>e.onChange(t.target.checked,wG(`toggle`,t))})})}function p1(e){return(0,h1.jsx)(_1,{...e,className:[`form-field-consent`,e.className].filter(Boolean).join(` `)})}var m1,h1,g1,_1,v1=s((()=>{m1=d(m(),1),VJ(),c1(),kG(),LG(),h1=d(O(),1),AG(`YesNo`,l1,{onChange:[1,`select`]}),AG(`ChoiceCards`,u1,{onChange:[1,`select`]}),g1=AG(`CheckCards`,d1,{onToggle:[2,`toggle`]}),_1=AG(`Checkbox`,f1,{onChange:[1,`toggle`]}),AG(`Consent`,p1,{onChange:[1,`toggle`]})}));function y1(e,t,n,r,i,a,o,s,c,l=2){let u=une(n.current,{event:e,orientation:r,loopFocus:i,rtl:a,cols:l,disabledIndices:o,minIndex:s,maxIndex:c,prevIndex:t>c?s:t,stopEvent:!0});return LF(n.current,u)?void 0:u}var b1=s((()=>{UF()}));function x1(){let e=E1.useContext(D1);if(!e)throw Error(LI(22));return e}function S1(){let e=E1.useContext(O1);if(!e)throw Error(LI(23));return e}function C1(){let e=E1.useContext(k1);if(!e)throw Error(LI(24));return e}function w1(){return E1.useContext(j1)}function T1(){return E1.useContext(A1)}var E1,D1,O1,k1,A1,j1,M1=s((()=>{RI(),E1=d(m(),1),D1=E1.createContext(void 0),O1=E1.createContext(void 0),k1=E1.createContext(void 0),A1=E1.createContext(!1),j1=E1.createContext(``)})),N1,P1=s((()=>{MX(),VX(),N1={id:e=>e.id,labelId:e=>e.labelId,items:e=>e.items,selectedValue:e=>e.selectedValue,hasSelectionChips:e=>{let t=e.selectedValue;return Array.isArray(t)&&t.length>0},hasSelectedValue:e=>{let{selectedValue:t,selectionMode:n}=e;return t==null?!1:n===`multiple`&&Array.isArray(t)?t.length>0:!0},hasNullItemLabel:(e,t)=>t?RX(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMounted:e=>e.forceMounted,inline:e=>e.inline,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.selectedValue;return Array.isArray(r)?r.some(e=>wX(t,e,n)):wX(t,r,n)},transitionStatus:e=>e.transitionStatus,popupProps:e=>e.popupProps,listProps:e=>e.listProps,inputProps:e=>e.inputProps,triggerProps:e=>e.triggerProps,itemProps:e=>e.itemProps,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupId:e=>e.popupId,triggerElement:e=>e.triggerElement,inputElement:e=>e.inputElement,inputGroupElement:e=>e.inputGroupElement,popupSide:e=>e.popupSide,openMethod:e=>e.openMethod,inputInsidePopup:e=>e.inputInsidePopup,inputOwnsFormValue:e=>e.inputOwnsFormValue,selectionMode:e=>e.selectionMode,name:e=>e.name,form:e=>e.form,disabled:e=>e.disabled,readOnly:e=>e.readOnly,required:e=>e.required,grid:e=>e.grid,virtualized:e=>e.virtualized,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,modal:e=>e.modal,autoHighlight:e=>e.autoHighlight}}));function F1(e){return e==null?void 0:`${e}-popup`}function I1(e,t){return(n,r)=>n!=null&&e.contains(n,r,t)}var L1=s((()=>{}));function R1(e){return Array.isArray(e)?e.map(e=>R1(e)).join(`,`):e==null?``:String(e)}var z1=s((()=>{}));function B1(e={}){let t={usage:`search`,sensitivity:`base`,ignorePunctuation:!0,...e},n=`${R1(e.locale)}|${JSON.stringify(t)}`,r=V1.get(n);if(r)return r;let i=new Intl.Collator(e.locale,t),a={contains(e,t,n){if(!t)return!0;let r=zX(e,n);for(let e=0;e<=r.length-t.length;e+=1)if(i.compare(r.slice(e,e+t.length),t)===0)return!0;return!1},startsWith(e,t,n){if(!t)return!0;let r=zX(e,n);return i.compare(r.slice(0,t.length),t)===0},endsWith(e,t,n){if(!t)return!0;let r=zX(e,n),a=t.length;return r.length>=a&&i.compare(r.slice(r.length-a),t)===0}};return V1.set(n,a),a}var V1,H1=s((()=>{z1(),VX(),V1=new Map})),U1,W1=s((()=>{m(),H1(),U1=B1}));function G1(e,t=!1){let{overflowY:n}=bj(e);return n!==`auto`&&n!==`scroll`?!1:t?e.clientHeight>0:e.scrollHeight>e.clientHeight}var K1=s((()=>{Aj()})),q1,J1,Y1=s((()=>{q1=Symbol(`none`),J1={value:q1,index:-1}}));function X1(e,t,n){let r=e.get(t);if(r!==void 0||n===jX)return r;for(let[r,i]of e)if(wX(r,t,n))return i}var Z1=s((()=>{MX()}));function Q1(e){let{id:t,onOpenChangeComplete:n,defaultSelectedValue:r=null,selectedValue:i,onSelectedValueChange:a,defaultInputValue:o,inputValue:s,open:c,defaultOpen:l=!1,selectionMode:u,onItemHighlighted:d,name:f,form:p,disabled:m=!1,readOnly:h=!1,required:g=!1,inputRef:_,grid:v=!1,items:y,filteredItems:b,filter:x,filterQuery:S,openOnInputClick:C=!0,autoHighlight:w=!1,keepHighlight:T=!1,highlightItemOnHover:E=!0,loopFocus:D=!0,itemToStringLabel:O,itemToStringValue:k,isItemEqualToValue:A=jX,virtualized:j=!1,inline:M=!1,fillInputOnItemPress:N=!0,modal:P=!1,limit:F=-1,autoComplete:I=`list`,formAutoComplete:L,locale:R,submitOnItemClick:z=!1}=e,{clearErrors:B}=WX(),{setDirty:V,validityData:H,setFilled:U,name:W,disabled:G,setTouched:ee,setFocused:te,validationMode:ne,validation:K}=uX(),re=JV(),q=xX({id:t}),ie=U1({locale:R}),ae=Array.isArray(y)?null:y;if(ae&&typeof ae.label!=`function`)throw Error(LI(100));let oe=ae?ae.data:y,se=ae?.value,ce=se?void 0:oe,le=$1.useMemo(()=>{if(!b||!se)return;let e=LX(b),t=e.map(se),n;return{values:t,findItem(r,i){if(!n){n=new Map;for(let r=0;r<t.length;r+=1)n.has(t[r])||n.set(t[r],e[r])}return X1(n,r,i)}}},[b,se]),ue=$1.useMemo(()=>ae?e=>ae.label(e,A,e=>{let t=le?.findItem(e,A);return t==null?zX(e,O):ae.itemLabel(t)}):O,[ae,O,le,A]),de=$1.useMemo(()=>ae?Object.assign(e=>ae.itemLabel(e),{selected:e=>zX(e,ue)}):O,[ae,ue,O]);function fe(e){return zX(e,ue)}let[pe,me]=$1.useState(!1),[J,he]=$1.useState(null),ge=$1.useRef(J),_e=$1.useRef([]),ve=$1.useRef([]),ye=$1.useRef(null),be=$1.useRef(null),xe=$1.useRef(null),Se=$1.useRef(null),Ce=$1.useRef(null),we=$1.useRef(!0),Te=$1.useRef(!1),Ee=$1.useRef(null),De=$1.useRef(null),Oe=$1.useRef(null),ke=$1.useRef(J1),Ae=$1.useRef(null),je=$1.useRef([]),Me=$1.useRef(null),Ne=G||m,Pe=W??f,Fe=u===`multiple`,Ie=u===`single`,Le=s!==void 0||o!==void 0,Re=oe!==void 0,ze=b!==void 0,Be;Be=w===`always`?`always`:w?`input-change`:!1;let[Ve,He]=CU({controlled:i,default:Fe?r??JM:r,name:`Combobox`,state:`selectedValue`}),Ue=$1.useMemo(()=>x===null?()=>!0:x===void 0?I1(ie,de):x,[x,ie,de]),We=LM(()=>Le?o??``:Ie?fe(Ve):``).current,[Ge,Ke]=CU({controlled:s,default:We,name:`Combobox`,state:`inputValue`}),[qe,Je]=CU({controlled:c,default:l,name:`Combobox`,state:`open`}),Ye=IX(oe),Xe=!qe&&J!==null?J:String(Ge).trim(),Ze=Ie?fe(Ve):``,Qe=Ie&&!pe&&Xe!==``&&Ze.length===Xe.length&&ie.contains(Ze,Xe),$e=Qe?``:S??Xe,et=Re&&ze&&Qe&&(!ae||ae.hasValue(Ve,A)),tt=$1.useMemo(()=>oe?LX(oe):JM,[oe]),nt=$1.useMemo(()=>{if(b&&!et)return b;if(!oe)return JM;if(Ye){let e=oe,t=[],n=0;for(let r of e){if(F>-1&&n>=F)break;let e=F>-1?F-n:1/0,i=$e===``?r.items.slice(0,e):[];if($e!==``)for(let t of r.items){if(i.length>=e)break;Ue(t,$e,de)&&i.push(t)}if(i.length>0){let e={...r,items:i};t.push(e),n+=i.length}}return t}if($e===``)return F>-1?tt.slice(0,F):tt;let e=[];for(let t of tt){if(F>-1&&e.length>=F)break;Ue(t,$e,de)&&e.push(t)}return e},[b,et,oe,Ye,$e,F,Ue,de,tt]),rt=$1.useMemo(()=>{if(le&&nt===b)return le.values;let e=LX(nt);return se?e.map(e=>se(e)):e},[nt,b,le,se]),it=LM(()=>{let e=null;return M&&qe&&Re&&u!==`none`&&(e=OX(rt,Ve,A,Fe)),new KR({id:q,labelId:void 0,selectedValue:Ve,open:qe,items:ce,selectionMode:u,name:Pe,form:p,disabled:Ne,readOnly:h,required:g,grid:v,virtualized:j,openOnInputClick:C,itemToStringLabel:ue,isItemEqualToValue:A,modal:P,autoHighlight:Be,submitOnItemClick:z,hasInputValue:Le,mounted:!1,forceMounted:!1,transitionStatus:`idle`,inline:M,activeIndex:null,selectedIndex:e,popupProps:{},listProps:{},inputProps:{},triggerProps:{},itemProps:YM,positionerElement:null,listElement:null,popupId:void 0,triggerElement:null,inputElement:null,inputGroupElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,inputOwnsFormValue:u===`none`},{onOpenChangeComplete:qM,setOpen:qM,setInputValue:qM,setSelectedValue:qM,setIndices:qM,handleSelection:qM,forceMount:qM,requestSubmit:qM,listRef:_e,labelsRef:ve,popupRef:ye,emptyRef:Ce,inputRef:be,startDismissRef:xe,endDismissRef:Se,keyboardActiveRef:we,chipsContainerRef:Ee,clearRef:De,valuesRef:je,pointerDownItemRef:Me,selectionEventRef:Oe},N1)}).current,at=u===`none`?Ge:Ve,ot=$1.useMemo(()=>u===`none`?at:Array.isArray(Ve)?Ve.map(e=>BX(e,k)):BX(Ve,k),[at,k,u,Ve]),st=$(d),ct=$(n),lt=it.useState(`activeIndex`),ut=it.useState(`selectedIndex`),dt=it.useState(`positionerElement`),ft=it.useState(`listElement`),pt=it.useState(`triggerElement`),mt=it.useState(`inputElement`),ht=it.useState(`inputGroupElement`),gt=it.useState(`inline`),_t=it.useState(`inputInsidePopup`),vt=it.useState(`inputOwnsFormValue`),yt=Ie&&!_t&&Ge===Ze,bt=lF(pt),{mounted:xt,setMounted:St,transitionStatus:Ct}=rz(qe),{openMethod:wt,triggerProps:Tt}=kV(qe),Et=$(()=>ot);hX(_t?bt:be,q,at,Et,!Ne,f);let Dt=$(()=>{oe?ve.current=rt.map(fe):it.set(`forceMounted`,!0)}),Ot=$((e,t,n)=>{if(t===-1){if(ke.current===J1)return;ke.current=J1}else ke.current={value:e,index:t};st(e,lne(n,void 0,{index:t}))}),kt=$(e=>{let t={};e.activeIndex!==void 0&&(t.activeIndex=e.activeIndex),e.selectedIndex!==void 0&&(t.selectedIndex=e.selectedIndex),it.update(t);let n=e.activeIndex;if(n===void 0)return;let r=e.type||`none`;n===null?Ot(void 0,-1,r):Ot(je.current[n],n,r)}),At=$((t,n)=>{if(e.onInputValueChange?.(t,n),!n.isCanceled){if(Te.current=n.reason===RP,n.reason===`input-change`){qe&&J!==null&&he(null);let e=n.event,r=e.inputType;if(e.type===`compositionend`||r!=null&&r!==``&&r!==`insertReplacementText`){let e=t.trim()!==``;e&&me(!0),Ae.current={hasQuery:e};let n=it.state.listElement;if(!it.state.virtualized&&n){let e=ye.current;for(let t of wj(n.firstElementChild??n)){if(!dj(t)||(e?!NN(e,t):t.getAttribute(`role`)===`dialog`))break;if(G1(t)){t.scrollTop=0;break}}}e&&Be&&it.state.activeIndex==null&&(qe||gt)&&it.set(`activeIndex`,0)}}else n.reason===`input-clear`&&t===``&&it.state.inputInsidePopup&&(Ae.current={hasQuery:!1,selection:!0});Ke(t)}}),jt=$(e=>{let t=!e&&_t&&!gt&&Ge!==``&&(String(Ge).trim()===J||Ge===Ze);!e&&(t||Ge===``||yt)&&me(!1),he(null),t&&At(``,XP(RP))}),Mt=$((t,n)=>{if(qe!==t&&(n.reason===`escape-key`&&Re&&rt.length===0&&!Ce.current&&n.allowPropagation(),e.onOpenChange?.(t,n),!n.isCanceled&&(t&&J!==null&&jt(n.reason===LP),!t&&pe&&(Ie?(gt||he(Xe),Xe===``&&me(!1)):Fe&&(gt||he(Xe),_t&&kt({activeIndex:null}),(!_t||gt)&&At(``,XP(RP,n.event,void 0,{isItemPress:n.reason===FP})))),Je(t),!t&&_t&&(n.reason===`focus-out`||n.reason===`outside-press`)&&(ee(!0),te(!1),ne===`onBlur`)))){let e=u===`none`?Ge:Ve;K.commit(e)}}),Nt=$((e,t)=>{a?.(e,t),!t.isCanceled&&(He(e),(u===`none`&&ye.current&&N||Ie&&!it.state.inputInsidePopup)&&At(fe(e),XP(t.reason,t.event)))}),Pt=$((e,t)=>{let n=PN(e),r=Oe.current??e;Oe.current=null;let i=XP(FP,r),a=n?.closest(`a`)?.getAttribute(`href`);if(a)a.startsWith(`#`)&&Mt(!1,i);else if(Fe){let e=Array.isArray(Ve)?Ve:[],n=EX(e,t,A),r=n?AX(e,t,A):[...e,t];if(Nt(r,i),i.isCanceled||!(be.current&&be.current.value.trim()!==``))return;if(it.state.inputInsidePopup){At(``,XP(RP,i.event,void 0,{isItemPress:!0}));let e=Ae.current;e&&!n&&(e.toggledValue=t)}else Mt(!1,i)}else{if(Nt(t,i),i.isCanceled)return;Mt(!1,i)}}),Ft=$(()=>{let e=K.inputRef.current?.form??it.state.inputElement?.form;e&&typeof e.requestSubmit==`function`&&e.requestSubmit()}),It=$(()=>{if(St(!1),ct?.(!1),me(!1),he(null),kt(u===`none`?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),Fe&&be.current&&be.current.value!==``&&!Te.current&&At(``,XP(RP)),Ie){if(it.state.inputInsidePopup)be.current&&be.current.value!==``&&At(``,XP(RP));else{let e=fe(Ve);be.current&&be.current.value!==e&&At(e,XP(e===``?RP:AP))}}}),Lt=$1.useMemo(()=>gt&&dt?{current:dt.closest(`[role="dialog"]`)}:ye,[gt,dt]);dz({enabled:!e.actionsRef,open:qe,ref:Lt,onComplete(){qe||It()}}),$1.useImperativeHandle(e.actionsRef,()=>({unmount:It}),[It]),Q(function(){let e=ge.current!==null&&J===null;if(ge.current=J,qe&&(!e||!Re)||(qe||(Me.current=null),u===`none`))return;let t=Re?rt:je.current;kt({selectedIndex:OX(t,Ve,A,Fe)})},[qe,J,Ve,u,Fe,Re,rt,A,kt]),Q(()=>{oe&&(je.current=rt,_e.current.length=rt.length)},[oe,rt]),Q(()=>{let e=Ae.current;if(e){let t=qe||gt||it.state.positionerElement?.hidden===!1;if(e.hasQuery)Be&&t&&it.set(`activeIndex`,0),Ae.current=null;else if(String(Ge).trim()===``&&(Ae.current=null,t)){let t=e.selection;Be===`always`&&!t&&it.state.selectionMode===`none`&&it.set(`activeIndex`,0),queueMicrotask(()=>{if(!it.state.open&&!it.state.inline||be.current&&be.current.value.trim()!==``)return;let n=it.state.selectedValue,r=it.state.selectionMode===`multiple`;if(r&&Array.isArray(n)?n.length>0:it.state.selectionMode!==`none`&&n!=null){let t=Re||ze?rt:je.current,i=DX(t,e.toggledValue,it.state.isItemEqualToValue);it.set(`activeIndex`,i===-1?OX(t,n,it.state.isItemEqualToValue,r):i)}else t?it.set(`activeIndex`,null):Be===`always`&&it.set(`activeIndex`,0)})}}if(!qe&&!gt)return;let t=Re||ze?rt:je.current,n=it.state.activeIndex;if(n==null){if(Be===`always`&&t.length>0){it.set(`activeIndex`,0);return}Ot(void 0,-1,AP);return}if(n>=t.length){Ot(void 0,-1,AP),it.set(`activeIndex`,null);return}let r=t[n],i=ke.current.value,a=i!==q1&&wX(r,i,it.state.isItemEqualToValue);ke.current.index===n&&a||Ot(r,n,AP)},[lt,Be,Ot,ze,Re,rt,gt,qe,it,Ge]),Q(()=>{U(u===`none`?String(Ge)!==``:Fe?Array.isArray(Ve)&&Ve.length>0:Ve!=null)},[U,u,Ge,Ve,Fe]),$1.useEffect(()=>{Re&&Be&&rt.length===0&&kt({activeIndex:null})},[Re,Be,rt.length,kt]);function Rt(){qe&&Xe!==``&&Xe!==String(We)&&!yt&&me(!0)}function zt(){qe&&J!==null&&jt(!1)}let Bt=!1;function Vt(){!Bt&&Ge!==Ze&&(Bt=!0,At(Ze,XP(AP)))}function Ht(){u!==`none`&&(B(Pe),V(TX(Ve,H.initialValue,A)),K.change(Ve),Ie&&!Le&&!_t&&Vt())}function Ut(){Ie&&!Le&&!_t&&!pe&&Vt()}function Wt(){u===`none`&&(B(Pe),V(Ge!==H.initialValue),K.change(Ge))}TV(Xe,Rt),TV(qe,zt),TV(Ve,Ht),TV(Ze,Ut),TV(oe,Ut),TV(Ge,Wt);let Gt=Wz({open:gt?!0:qe,onOpenChange:Mt,elements:{reference:_t?pt:mt,floating:dt}}),Kt=v?`grid`:`listbox`,qt=qe||gt,Jt=qt?`true`:`false`,Yt=$1.useMemo(()=>{let e=mt?.tagName===`INPUT`,t=mt==null||e,n=t||qt,r=t?{autoComplete:`off`,spellCheck:`false`,autoCorrect:`off`,autoCapitalize:`none`}:{};return n&&(r.role=`combobox`,r[`aria-expanded`]=Jt,r[`aria-haspopup`]=Kt,r[`aria-controls`]=qt?ft?.id:void 0,r[`aria-autocomplete`]=h?`none`:I),{reference:r,floating:{role:`presentation`}}},[mt,qt,Jt,Kt,ft?.id,I,h]),Xt=fR(Gt,{enabled:!Ne&&C,event:`mousedown-only`,toggle:!1,touchOpenDelay:_t?0:100,reason:zP}),Zt=mR(Gt,{enabled:!Ne&&!gt,outsidePressEvent:{mouse:`sloppy`,touch:`intentional`},bubbles:gt?!0:void 0,outsidePress(e){let t=PN(e);return!NN(pt,t)&&!NN(De.current,t)&&!NN(Ee.current,t)&&!NN(ht,t)}}),Qt=bB(Gt,{enabled:!Ne,id:q,listRef:_e,activeIndex:lt,selectedIndex:ut,virtual:!0,loopFocus:D,allowEscape:D&&!Be,focusItemOnOpen:pe||u===`none`&&!Be?!1:`auto`,focusItemOnHover:E,resetOnPointerLeave:!T,orientation:v?`horizontal`:void 0,rtl:re===`rtl`,disabledIndices:JM,grid:v?y1:void 0,onNavigate(e,t){(t||qe)&&Ct!==`ending`&&kt(t?{activeIndex:e,type:we.current?UP:WP}:{activeIndex:e})}}),$t=$1.useMemo(()=>$I(Qt.reference,{onKeyDown(e){v&&it.state.activeIndex==null&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&e.preventBaseUIHandler()}},Zt.reference,Xt.reference,Yt.reference),[Qt.reference,Zt.reference,Xt.reference,Yt.reference,v,it]),en=$1.useMemo(()=>$I(Dz,Zt.floating),[Zt.floating]),tn=$1.useMemo(()=>$I(Qt.floating,Yt.floating),[Qt.floating,Yt.floating]),nn=$1.useMemo(()=>{let e=Qt.item;return e?{...e,onFocus:void 0}:YM},[Qt.item]);it.useContextCallback(`setOpen`,Mt),it.useContextCallback(`setInputValue`,At),it.useContextCallback(`setSelectedValue`,Nt),it.useContextCallback(`setIndices`,kt),it.useContextCallback(`handleSelection`,Pt),it.useContextCallback(`forceMount`,Dt),it.useContextCallback(`requestSubmit`,Ft),it.useContextCallback(`onOpenChangeComplete`,n),GY(()=>{it.update({inline:M,popupProps:en,listProps:tn,inputProps:$t,triggerProps:Tt,itemProps:nn})});let rn={id:q,selectedValue:Ve,open:qe,mounted:xt,transitionStatus:Ct,items:ce,inline:M,popupProps:en,listProps:tn,inputProps:$t,triggerProps:Tt,itemProps:nn,openMethod:wt,selectionMode:u,name:Pe,form:p,disabled:Ne,readOnly:h,required:g,grid:v,virtualized:j,openOnInputClick:C,itemToStringLabel:ue,modal:P,autoHighlight:Be,isItemEqualToValue:A,submitOnItemClick:z,hasInputValue:Le};Q(()=>{it.update({...rn,inputOwnsFormValue:u===`none`&&(M||!it.state.inputInsidePopup)})},[it,...Object.values(rn)]);let an=nF(_,K.inputRef),on=$1.useMemo(()=>({query:Xe,hasItems:Re,filteredItems:nt,flatFilteredValues:rt}),[Xe,Re,nt,rt]),sn=$1.useMemo(()=>Array.isArray(at)?``:BX(at,k),[at,k]),cn=Fe&&Array.isArray(Ve)&&Ve.length>0,ln=Fe||u===`none`&&vt?void 0:Pe,un=$1.useMemo(()=>!Fe||!Array.isArray(Ve)||!Pe?null:Ve.map(e=>{let t=BX(e,k);return(0,e0.jsx)(`input`,{type:`hidden`,form:p,name:Pe,value:t,disabled:Ne},t)}),[Fe,Ve,p,Pe,k,Ne]),dn=(0,e0.jsxs)($1.Fragment,{children:[e.children,(0,e0.jsx)(`input`,{...K.getValidationProps(Ne,{onFocus(){_t?pt?.focus():(be.current||pt)?.focus()},onChange(e){if(e.nativeEvent.defaultPrevented||Ne||h)return;let t=e.currentTarget.value,n=t.toLowerCase(),r=XP(AP,e.nativeEvent),i=()=>je.current.findIndex(e=>BX(e,k).toLowerCase()===n||fe(e).toLowerCase()===n);function a(){if(Fe)return;if(u===`none`){At(t,r);return}let e=i();e===-1&&(e=je.current.findIndex((e,t)=>{let r=ve.current[t];return r!=null&&r.toLowerCase()===n}));let a=e===-1?void 0:je.current[e];a!=null&&Nt?.(a,r)}Ie&&(Dt(),oe&&i()===-1&&it.set(`forceMounted`,!0)),queueMicrotask(a)}}),id:q&&ln==null?`${q}-hidden-input`:void 0,form:p,name:ln,autoComplete:L,disabled:Ne,required:g&&!cn,readOnly:h,value:sn,ref:an,style:ln?AF:kF,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),un]});return(0,e0.jsx)(D1.Provider,{value:it,children:(0,e0.jsx)(O1.Provider,{value:Gt,children:(0,e0.jsx)(A1.Provider,{value:Re,children:(0,e0.jsx)(k1.Provider,{value:on,children:(0,e0.jsx)(j1.Provider,{value:Ge,children:dn})})})})})}var $1,e0,t0=s((()=>{RI(),$1=d(m(),1),TU(),oN(),qY(),yF(),cF(),dF(),jF(),BM(),YR(),XM(),Aj(),IB(),b1(),XR(),ZP(),YP(),M1(),P1(),pz(),mX(),gX(),qX(),CX(),L1(),W1(),az(),jV(),K1(),DV(),nX(),Uz(),hL(),VX(),MX(),Y1(),ZV(),Z1(),e0=d(O(),1)}));function n0(e){let{openOnInputClick:t=!1,value:n,defaultValue:r,onValueChange:i,mode:a=`list`,itemToStringValue:o,...s}=e,c=(a===`inline`||a===`both`)&&!e.readOnly,l=a===`inline`||a===`none`,u=n!==void 0,[d,f]=r0.useState(r??``),[p,m]=r0.useState(``);r0.useEffect(()=>{(u||!c)&&m(``)},[n,u,c]);let h;h=c&&p!==``?p:u?n??``:d;let g=U1({locale:s.locale}),_=String((u?n:d)??``).trim(),v=l||s.filter===null?null:s.filter??g.contains;function y(e,t){m(``),u||f(e),i?.(e,t)}function b(t,n){e.onItemHighlighted?.(t,n),n.reason!==`pointer`&&m(c&&t!=null?zX(t,o):``)}return(0,i0.jsx)(Q1,{...s,itemToStringLabel:o,openOnInputClick:t,selectionMode:`none`,fillInputOnItemPress:!0,filter:v,filterQuery:a===`both`?_:void 0,autoComplete:a,inputValue:h,defaultInputValue:r,onInputValueChange:y,onItemHighlighted:b})}var r0,i0,a0=s((()=>{r0=d(m(),1),t0(),W1(),VX(),YP(),i0=d(O(),1)})),o0,s0,c0=s((()=>{fP(),o0=`data-popup-side`,s0=`data-list-empty`})),l0,u0=s((()=>{fP(),lX(),c0(),l0={...lP,...cX,popupSide:e=>e?{[o0]:e}:null,listEmpty:e=>e?{[s0]:``}:null}}));function d0(e){let t=e.useState(`mounted`),n=e.useState(`popupSide`),r=e.useState(`positionerElement`);return t&&r?n:null}function f0(){return C1().filteredItems.length===0}function p0(e){return e===`rtl`?[`ArrowRight`,`ArrowLeft`]:[`ArrowLeft`,`ArrowRight`]}function m0(e,t){let n=e>=t-1?t-2:e;return n>=0?n:void 0}function h0(e,t,n){let r=e.context.listRef.current[t];r&&(e.context.selectionEventRef.current=n,r.click(),e.context.selectionEventRef.current=null)}var g0=s((()=>{M1()}));function _0(){return v0.useContext(y0)}var v0,y0,b0=s((()=>{v0=d(m(),1),y0=v0.createContext(void 0)}));function x0(e){let t=S0.useContext(C0);if(t===void 0&&!e)throw Error(LI(21));return t}var S0,C0,w0=s((()=>{RI(),S0=d(m(),1),C0=S0.createContext(void 0)})),T0,E0,D0,O0=s((()=>{T0=d(m(),1),cF(),jF(),iU(),ZP(),YP(),M1(),E0=d(O(),1),D0=T0.forwardRef(function(e,t){let n=x1(),{buttonRef:r,getButtonProps:i}=uV({native:!1}),a=nF(t,r);function o(e){n.context.setOpen(!1,XP(IP,e.nativeEvent,e.currentTarget))}let s=i({onClick:o});return(0,E0.jsx)(`span`,{ref:a,...s,"aria-label":`Dismiss`,tabIndex:void 0,style:AF})})})),k0,A0,j0,M0=s((()=>{k0=d(m(),1),yF(),TN(),_V(),TL(),M1(),u0(),mX(),lX(),bX(),b0(),XR(),w0(),ZP(),YP(),ZV(),O0(),g0(),A0=d(O(),1),j0=k0.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,id:a,style:o,...s}=e,{state:c,disabled:l,setTouched:u,setFocused:d,validationMode:f,validation:p}=uX(),{labelId:m}=_X(),h=_0(),g=!!x0(!0),_=x1(),v=w1(),y=JV(),b=_.useState(`required`),x=_.useState(`disabled`),S=_.useState(`readOnly`),C=_.useState(`name`),w=_.useState(`form`),T=_.useState(`selectionMode`),E=_.useState(`autoHighlight`),D=_.useState(`inputProps`),O=_.useState(`triggerProps`),k=_.useState(`open`),A=_.useState(`mounted`),j=_.useState(`selectedValue`),M=_.useState(`id`),N=_.useState(`inline`),P=_.useState(`modal`),F=!!E,I=d0(_),L=l||x||i,R=f0(),z=g||N,B=!z||P,V=gV(a??(z?void 0:M)),H=g?oX:c,[U,W]=k0.useState(null),G=k0.useRef(!1),ee=k0.useRef(null),te=k0.useRef(!1),ne=T===`none`&&!g,K=$(e=>{let t=g||_.state.inline;t&&!_.state.hasInputValue&&_.context.setInputValue(``,XP(AP)),_.update({inputElement:e,inputInsidePopup:t,inputOwnsFormValue:ne})}),re=g?s:p.getValidationProps(L,s);function q(){_.context.setIndices({activeIndex:null,selectedIndex:null,type:_.context.keyboardActiveRef.current?UP:WP})}function ie(){_.context.keyboardActiveRef.current=!1}let ae={...H,open:k,disabled:L,readOnly:S,popupSide:I,listEmpty:R};function oe(e){if(!h)return;let t,{highlightedChipIndex:n}=h,r=h.chipsRef.current.length,[i,a]=p0(y);return n===void 0?(e.key===i&&(e.currentTarget.selectionStart??0)===0&&j.length>0&&(e.preventDefault(),t=r>0?r-1:void 0),t):(e.key===i?(e.preventDefault(),t=n>0?n-1:void 0):e.key===a?(e.preventDefault(),t=n<r-1?n+1:void 0):(e.key===`Backspace`||e.key===`Delete`)&&(e.preventDefault(),t=m0(n,j.length),q()),t)}let se=gL(`input`,e,{state:ae,ref:[t,_.context.inputRef,K],props:[D,O,{value:U??v,"aria-readonly":S||void 0,"aria-required":b||void 0,"aria-labelledby":m,disabled:L,readOnly:S,required:T===`none`?b:void 0,form:w,...ne&&C&&{name:C},id:V,onFocus(){if(d(!0),!N||!te.current)return;te.current=!1;let e=ee.current;e!=null&&Object.hasOwn(_.context.valuesRef.current,e)&&_.context.setIndices({activeIndex:e})},onBlur(){u(!0),d(!1);let e=_.state.activeIndex;if(N&&e!==null&&E!==`always`&&(ee.current=e,te.current=!0,_.context.setIndices({activeIndex:null})),f===`onBlur`){let e=T===`none`?v:j;p.commit(e)}},onCompositionStart(e){hN||(G.current=!0,W(e.currentTarget.value))},onCompositionEnd(e){G.current=!1;let t=e.currentTarget.value;W(null),_.context.setInputValue(t,XP(LP,e.nativeEvent))},onChange(e){let t=e.nativeEvent,n=t.inputType,r=!n||n===`insertReplacementText`,i=G.current||!r;function a(e){!S&&!L&&e&&i&&(_.context.setOpen(!0,XP(LP,t)),F||q())}if(G.current){let n=e.currentTarget.value;W(n),n===``&&!_.state.openOnInputClick&&!_.state.inputInsidePopup&&_.context.setOpen(!1,XP(RP,t));let r=n.trim(),i=F&&r!==``;a(r),k&&_.state.activeIndex!==null&&!i&&q();return}let o=XP(LP,t);if(_.context.setInputValue(e.currentTarget.value,o),o.isCanceled)return;let s=e.currentTarget.value===``,c=XP(RP,t);s&&!_.state.inputInsidePopup&&(T===`single`&&_.context.setSelectedValue(null,c),_.state.openOnInputClick||_.context.setOpen(!1,c)),a(e.currentTarget.value.trim()),k&&_.state.activeIndex!==null&&!F&&q()},onKeyDown(e){if(e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)return;if(_.context.keyboardActiveRef.current=!0,L||S){S&&e.key===`Enter`&&k&&_.state.activeIndex!==null&&EN(e);return}let t=e.currentTarget,n=t.scrollWidth-t.clientWidth,r=y===`rtl`;if(e.key===`Home`){EN(e);let n=bN&&r?t.value.length:0;t.setSelectionRange(n,n),t.scrollLeft=0;return}if(e.key===`End`){EN(e);let i=bN&&r?0:t.value.length;t.setSelectionRange(i,i),t.scrollLeft=r?-n:n;return}if(!A&&e.key===`Escape`){let t=T===`multiple`&&Array.isArray(j)?j.length===0:j===null,n=XP(VP,e.nativeEvent),r=T===`multiple`?[]:null;_.context.setInputValue(``,n),_.context.setSelectedValue(r,n),t||_.state.inline||n.isPropagationAllowed||e.stopPropagation();return}if(h&&e.key===`Backspace`&&t.value===``&&h.highlightedChipIndex===void 0&&Array.isArray(j)&&j.length>0){let t=h.chipsRef.current.length,n=t>0?t-1:j.length-1,r=j.filter((e,t)=>t!==n);q(),_.context.setSelectedValue(r,XP(AP,e.nativeEvent));return}let i=h?.highlightedChipIndex!==void 0,a=oe(e);if(h?.setHighlightedChipIndex(a),a===void 0?i&&_.context.inputRef.current?.focus():h?.chipsRef.current[a]?.focus(),e.which!==229&&e.key===`Enter`&&k){let t=_.state.activeIndex,n=e.nativeEvent;if(t===null){if(N)return;_.context.setOpen(!1,XP(AP,n));return}EN(e),h0(_,t,n)}},onPointerMove:ie,onPointerDown:ie},re],stateAttributesMapping:l0}),ce=g?(0,A0.jsx)(pX.Provider,{value:fX,children:se}):se;return(0,A0.jsxs)(k0.Fragment,{children:[k&&B&&(0,A0.jsx)(D0,{ref:_.context.startDismissRef}),ce]})})}));function N0(){return P0.useContext(F0)}var P0,F0,I0=s((()=>{P0=d(m(),1),O(),F0=P0.createContext(null)}));function L0(e){let{children:t}=e,{filteredItems:n}=C1(),r=N0(),i=r?r.items:n;return(0,z0.jsx)(R0.Fragment,{children:i.map(t)})}var R0,z0,B0=s((()=>{R0=d(m(),1),M1(),I0(),z0=d(O(),1)})),V0,H0,U0,W0=s((()=>{V0=d(m(),1),yF(),TL(),M1(),w0(),B0(),xW(),XR(),g0(),H0=d(O(),1),U0=V0.forwardRef(function(e,t){var n;let{render:r,className:i,style:a,children:o,...s}=e,c=x1(),l=S1(),u=!!x0(!0),{filteredItems:d,hasItems:f}=C1(),p=c.useState(`selectionMode`),m=c.useState(`grid`),h=c.useState(`readOnly`),g=c.useState(`listProps`),_=c.useState(`virtualized`),v=c.useState(`forceMounted`),y=p===`multiple`,b=d.length===0,x=$(e=>{c.set(`positionerElement`,e)}),S=$(e=>{c.set(`listElement`,e)}),C=V0.useMemo(()=>typeof o==`function`?n||=(0,H0.jsx)(L0,{children:o}):o,[o]),w={empty:b},T=l.useState(`floatingId`),E=gL(`div`,e,{state:w,ref:[t,S,u?null:x],props:[g,{children:C,tabIndex:-1,id:T,role:m?`grid`:`listbox`,"aria-multiselectable":y?`true`:void 0,"aria-readonly":!m&&h?!0:void 0,onKeyDown(e){if(!(c.state.disabled||c.state.readOnly)&&e.key===`Enter`){let t=c.state.activeIndex;if(t==null)return;EN(e),h0(c,t,e.nativeEvent)}},onKeyDownCapture(){c.context.keyboardActiveRef.current=!0},onPointerMoveCapture(){c.context.keyboardActiveRef.current=!1}},s]});if(_)return E;let D=f&&!v?void 0:c.context.labelsRef;return(0,H0.jsx)(fW,{elementsRef:c.context.listRef,labelsRef:D,children:E})})}));function G0(e){let t=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=null;for(;t.nextNode();){let e=t.currentNode;e.nodeValue!==``&&(n=e)}return n}function K0(){let e=eN(),t=q0.useRef(null);return q0.useEffect(()=>{if(pN)return;let n=t.current;if(n==null)return;let r=G0(n);if(r==null)return;let i=r.data,a=`${i}${J0}`;return r.nodeValue=a,e.start(200,()=>{r.nodeValue===a&&(r.nodeValue=i)}),()=>{e.clear(),r.nodeValue===a&&(r.nodeValue=i)}},[t,e]),t}var q0,J0,Y0=s((()=>{q0=d(m(),1),TN(),rN(),J0=``}));function X0(){let e=Z0.useContext(Q0);if(e===void 0)throw Error(LI(20));return e}var Z0,Q0,$0=s((()=>{RI(),Z0=d(m(),1),Q0=Z0.createContext(void 0)})),e2,t2,n2,r2=s((()=>{e2=d(m(),1),IB(),M1(),$0(),t2=d(O(),1),n2=e2.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=x1(),a=i.useState(`mounted`),o=i.useState(`forceMounted`);return a||n||o?(0,t2.jsx)(Q0.Provider,{value:n,children:(0,t2.jsx)(zL,{ref:t,...r})}):null})})),i2,a2,o2,s2=s((()=>{i2=d(m(),1),oN(),yF(),WV(),M1(),w0(),g0(),gH(),$0(),jL(),bH(),wH(),LH(),a2=d(O(),1),o2=i2.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a,side:o,align:s,sideOffset:c,alignOffset:l,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f,sticky:p,disableAnchorTracking:m=!1,collisionAvoidance:h=OL,style:g,..._}=e,v=x1(),y=S1(),b=X0(),x=v.useState(`modal`),S=v.useState(`open`),C=v.useState(`mounted`),w=v.useState(`openMethod`),T=v.useState(`positionerElement`),E=v.useState(`triggerElement`),D=v.useState(`inputElement`),O=v.useState(`inputGroupElement`),k=v.useState(`inputInsidePopup`),A=v.useState(`transitionStatus`),j=f0(),M=dH({anchor:i??(k?E:O??D),floatingRootContext:y,positionMethod:a,mounted:C,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m,keepMounted:b,collisionAvoidance:h,lazyFlip:!0});PH(S&&x,w===`touch`,T,E);let N={open:S,side:M.side,align:M.align,anchorHidden:M.anchorHidden,empty:j};Q(()=>{v.set(`popupSide`,M.side)},[v,M.side]);let P=$(e=>{v.set(`positionerElement`,e)}),F=CH(e,N,{styles:M.positionerStyles,transitionStatus:A,props:_,refs:[t,P],hidden:!C,inert:!S});return(0,a2.jsxs)(C0.Provider,{value:M,children:[C&&x&&(0,a2.jsx)(yH,{inert:UV(!S),cutout:O??D??E}),F]})})})),c2,l2,u2,d2,f2=s((()=>{c2=d(m(),1),oN(),IB(),TL(),M1(),fP(),w0(),pz(),YN(),XR(),SH(),O0(),L1(),g0(),l2=d(O(),1),u2={...uP,...JN},d2=c2.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=x1(),l=x0(),u=S1(),d=c.useState(`mounted`),f=c.useState(`open`),p=c.useState(`openMethod`),m=c.useState(`popupProps`),h=c.useState(`transitionStatus`),g=c.useState(`inputInsidePopup`),_=c.useState(`inputElement`),v=c.useState(`modal`),y=c.useState(`id`),b=f0(),x=s.id??(g?F1(y):void 0);Q(()=>(c.set(`popupId`,c.context.popupRef.current?.id||x),()=>{c.set(`popupId`,void 0)}),[c,x]),dz({open:f,ref:c.context.popupRef,onComplete(){f&&c.context.onOpenChangeComplete(!0)}});let S=gL(`div`,e,{state:{open:f,side:l.side,align:l.align,anchorHidden:l.anchorHidden,transitionStatus:h,empty:b},ref:[t,c.context.popupRef],props:[m,{id:x,role:g?`dialog`:`presentation`,onFocus(e){let t=PN(e.nativeEvent);p!==`touch`&&(NN(c.state.listElement,t)||t===e.currentTarget)&&c.context.inputRef.current?.focus()}},xH(h),s],stateAttributesMapping:u2}),C=a===void 0?g?e=>e===`touch`?c.context.popupRef.current:_:!1:a,w;w=o??(g?void 0:!1);let T=!g||v;return(0,l2.jsx)(sR,{context:u,disabled:!d,modal:T,openInteractionType:p,initialFocus:C,returnFocus:w,getInsideElements:()=>[c.context.startDismissRef.current,c.context.endDismissRef.current],children:(0,l2.jsxs)(c2.Fragment,{children:[S,T&&(0,l2.jsx)(D0,{ref:c.context.endDismissRef})]})})})})),p2,m2,h2=s((()=>{p2=d(m(),1),m2=p2.createContext(void 0)}));function g2(){return _2.useContext(v2)}var _2,v2,y2=s((()=>{_2=d(m(),1),v2=_2.createContext(!1)}));function b2(e){let{componentProps:t,forwardedRef:n,virtualized:r,indexFromFilter:i}=e,{render:a,className:o,style:s,value:c=null,index:l,disabled:u=!1,nativeButton:d=!1,...f}=t,p=S2.useRef(null),m=LU({guess:!0,index:l,textRef:p}),h=x1(),g=g2(),_=T1(),v=h.useState(`selectionMode`),y=h.useState(`disabled`),b=h.useState(`readOnly`),x=h.useState(`isItemEqualToValue`),S=y||u,C=v!==`none`,w=l??i??m.index,T=w!==-1,E=h.useState(`id`),D=h.useState(`isActive`,w),O=h.useState(`isSelected`,c),k=h.useState(`itemProps`),A=S2.useRef(null),j=E!=null&&T?`${E}-${w}`:void 0,M=O&&C;Q(()=>{if(!T||!r&&l==null)return;let e=h.context.listRef.current;return e[w]=A.current,()=>{delete e[w]}},[T,r,w,l,h]),Q(()=>{if(!T||_)return;let e=h.context.valuesRef.current;return e[w]=c,()=>{delete e[w]}},[T,_,w,c,h]),Q(()=>{if(!T||_)return;let e=h.state.selectedValue,t=h.state.selectedIndex;h.state.selectionMode===`multiple`&&Array.isArray(e)?t=kX(w,c,h.context.valuesRef.current,e,x,t):wX(c,e,x)&&(t=w),h.set(`selectedIndex`,t)},[T,_,h,w,c,x]);let{getButtonProps:N,buttonRef:P}=uV({disabled:S,focusableWhenDisabled:!0,native:d,composite:!0}),F={disabled:S,selected:M,highlighted:D};function I(e){function t(){h.context.handleSelection(e,c)}h.state.submitOnItemClick?(C2.flushSync(t),h.context.requestSubmit()):t()}let L={id:j,role:g?`gridcell`:`option`,"aria-selected":C?M:void 0,tabIndex:void 0,onPointerDownCapture(e){e.isPrimary&&(h.context.pointerDownItemRef.current=e.currentTarget),e.preventDefault()},onMouseDown(e){e.preventDefault()},onClick(e){S||b||I(e.nativeEvent)},onMouseUp(e){let t=h.context.pointerDownItemRef.current===e.currentTarget;h.context.pointerDownItemRef.current=null,!(S||b||e.button!==0||t||!D)&&I(e.nativeEvent)}},R=gL(`div`,t,{ref:[P,n,m.ref,A],state:F,props:[k,L,f,N]}),z=S2.useMemo(()=>({selected:M,textRef:p}),[M,p]);return(0,w2.jsx)(m2.Provider,{value:z,children:R})}function x2(e){let{componentProps:t,forwardedRef:n}=e,r=x1().useState(`isItemEqualToValue`),{flatFilteredValues:i}=C1(),a=DX(i,t.value??null,r);return(0,w2.jsx)(b2,{componentProps:t,forwardedRef:n,virtualized:!0,indexFromFilter:a})}var S2,C2,w2,T2,E2=s((()=>{S2=d(m(),1),C2=d(g(),1),oN(),M1(),zU(),TL(),h2(),iU(),y2(),MX(),w2=d(O(),1),T2=S2.memo(S2.forwardRef(function(e,t){let n=x1().useState(`virtualized`);return n&&e.index==null?(0,w2.jsx)(x2,{componentProps:e,forwardedRef:t}):(0,w2.jsx)(b2,{componentProps:e,forwardedRef:t,virtualized:n,indexFromFilter:void 0})}))})),D2,O2=s((()=>{E2(),D2=T2})),k2,A2,j2=s((()=>{k2=d(m(),1),TL(),M1(),Y0(),A2=k2.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,{filteredItems:s}=C1(),c=x1(),l=K0(),u=s.length===0?a:null;return gL(`div`,e,{ref:[t,c.context.emptyRef,l],props:[{children:u,role:`status`,"aria-live":`polite`,"aria-atomic":!0},o]})})})),M2=s((()=>{a0(),M1(),yF(),rN(),DF(),TL(),iU(),u0(),mX(),bX(),XR(),JW(),ZP(),YP(),IB(),CX(),L1(),g0(),M0(),Aj(),CP(),az(),YN(),pz(),fP(),W0(),Y0(),r2(),s2(),f2(),w0(),RI(),I0(),oN(),_V(),O2(),y2(),B0(),j2(),W1()})),N2=s((()=>{M2()}));function P2({text:e,onText:t,items:n,itemKey:r,itemLabel:i,itemClassName:a,renderItem:o,onPick:s,open:c,onOpenChange:l,inputProps:u,inputRef:d,popupRef:f,anchorRef:p,fit:m=`min-width`,popupClassName:h,listClassName:g,empty:_,emptyClassName:v,portal:y=`dialog`,autoHighlight:b=!0,onHighlight:x}){let S=(0,F2.useRef)(null),[C,w]=(0,F2.useState)(null);(0,F2.useEffect)(()=>{w(y===`body`?null:S.current?.closest(`dialog, [role="dialog"]`))},[y]);let[T,E]=(0,F2.useState)(null);(0,F2.useLayoutEffect)(()=>{let e=p?.current??S.current;if(!c||m!==`width`||!e)return;let t=()=>{let t=ws(e).width;E(t>0?t:null)};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[c,m,p]);let D=e=>{S.current=e,typeof d==`function`?d(e):d&&(d.current=e)},[O,k]=(0,F2.useState)(),A=u[`aria-label`]!==void 0||u[`aria-labelledby`]!==void 0;(0,F2.useEffect)(()=>{if(A)return;let e=[...S.current?.labels??[]].map(e=>(e.textContent??``).replace(/\s+/g,` `).trim()).filter(Boolean).join(` `);k(e||u.title||void 0)});let j={label:A?u[`aria-label`]:O,labelledBy:u[`aria-labelledby`]},{onKeyDown:M,onFocus:N,...P}=u;return(0,I2.jsxs)(n0,{items:n,filteredItems:n,itemToStringValue:i,value:e,onValueChange:(e,n)=>{n.reason!==`item-press`&&t(String(e??``),EG(n,`input-change`))},open:c,onOpenChange:(e,t)=>l(e,EG(t,`implicit`)),openOnInputClick:!0,autoHighlight:b,onItemHighlighted:x&&(e=>x(e)),children:[(0,I2.jsx)(j0,{...P,ref:D,onFocus:N,onKeyDown:e=>{if(M?.(e),e.key===`Escape`&&c){if(e.stopPropagation(),e.defaultPrevented)return;e.preventDefault(),l(!1,wG(`escape-key`,e))}}}),(0,I2.jsx)(n2,{container:C??yG(),children:(0,I2.jsx)(o2,{anchor:()=>{let e=p?.current??S.current;return e?cU(e):null},positionMethod:`fixed`,side:`bottom`,align:`start`,sideOffset:4,collisionBoundary:lU(),collisionPadding:8,style:{zIndex:40,...m===`width`?{width:T===null?`var(--anchor-width)`:`${T}px`,maxWidth:`var(--available-width)`}:{}},children:(0,I2.jsxs)(d2,{ref:f,className:h,style:{...m===`width`?{width:`100%`}:{minWidth:`var(--anchor-width)`,maxWidth:`var(--available-width)`}},children:[n.length>0?(0,I2.jsx)(U0,{className:g,"aria-label":j.label,"aria-labelledby":j.labelledBy,children:n.map(e=>(0,I2.jsx)(D2,{value:e,className:t=>a(e,t.highlighted),onClick:()=>s(e),children:o(e)},r(e)))}):null,_===void 0?null:(0,I2.jsx)(`div`,{className:n.length>0?void 0:g,children:(0,I2.jsx)(A2,{className:v,children:_})})]})})})]})}var F2,I2,L2,R2=s((()=>{F2=d(m(),1),N2(),Os(),uU(),bG(),kG(),LG(),I2=d(O(),1),L2=AG(`Typeahead`,P2,{onText:[1,`input-change`],onOpenChange:[1,`implicit`]})}));function z2({typed:e,asked:t,placeholder:n=!1,rows:r,label:i}){let a=e.trim(),o=t===a&&!n;if(o)return{choices:r??[],answered:o};let s=a.toLowerCase();return{choices:(r??[]).filter(e=>i(e).toLowerCase().includes(s)),answered:o}}var B2=s((()=>{})),V2,H2=s((()=>{Ya(),V2=Va({choicesCouldNotBeLoaded:`Choices could not be loaded. Try again.`,loadingChoices:`Loading choices…`,noMatchingChoices:`No matching choices.`,loadingName:`Loading…`,nameCouldNotBeLoaded:`Its name could not be loaded.`,tryAgain:`Try again`,noLongerAvailable:`No longer available. Change this answer.`})}));function U2(e){throw Error(`${e}: invalid form declaration.`)}function W2(e,t){return e===null?null:typeof e==`boolean`||typeof e==`string`&&e.length<=s4||typeof e==`number`&&Number.isFinite(e)&&Math.abs(e)<=2**53-1?e:U2(t)}function G2(e){return Object.freeze(e)}function K2(e,t){return{label:``,dialect:`sqlite`,readAt:``,foreignKeys:[],tables:[{name:e,schema:``,id:e,isView:!1,columns:[...t]}]}}function q2(e){let[t,n,...r]=e.split(`.`);return!r.length&&n!==void 0&&[t,n].every(e=>c4.test(e)&&!l4.has(e))}function J2(e,t,n){if((!c4.test(e.column)||l4.has(e.column))&&(!n||!q2(e.column)))throw Error(n?`${t}: "${e.column}" goes past one reference; a validation reads the record's own columns and, through one reference, that record's (order_id.status).`:`${t}: "${e.column}" is a path; a condition here reads the record's own columns.`);let r=e=>(Array.isArray(e)?e:[e]).map(e=>W2(e,t));if(e.other!==void 0){let n=u4[e.op];return n&&c4.test(e.other)&&!l4.has(e.other)||U2(t),{field:e.column,operator:n,values:[],other:e.other}}if(e.op===`isNull`)return{field:e.column,operator:`eq`,values:[null]};if(e.op===`isNotNull`)return{field:e.column,operator:`ne`,values:[null]};if(e.op===`in`)return{field:e.column,operator:`eq`,values:r(e.value)};if(e.op===`has`)return{field:e.column,operator:`has`,values:r(e.value)};let i=u4[e.op];if(!i)throw Error(`${t}: "${e.op}" matches text, which a condition here cannot; compare with =, !=, <, <=, >, >=, in, has (a list of several choices) or is empty.`);return{field:e.column,operator:i,values:r(e.value)}}function Y2(e,t,n,r=`record`,i=!1){if(typeof e!=`string`||!e.trim()||e.length>2e3)throw Error(`${t}: a condition is query-language text, like "status = shipped".`);let a=zn(`${r} ${e}`,n?{schema:K2(r,n),columnValues:!0}:{});if(a.errors[0]?.message===`me is the signed-in person, and nobody is named here to be it. Quote it ("me") to mean the text.`)throw Error(`${t} compares with me. A form's conditions and a validation read the record's own values, where the session is not; show the field always, or narrow who may write it with roles.`);if(a.errors.length)throw Error(`${t}: ${a.errors[0].message}`);let o=a.query;if(o.orderBy.length||o.columns.length||o.limit!==void 0)throw Error(`${t}: a condition is only a condition — no sort, show or limit.`);if(!o.filter.groups.length)throw Error(`${t}: a condition is query-language text, like "status = shipped".`);let s=o.filter.groups.map(e=>G2(e.map(e=>G2(J2(e,t,i)))));if(s.flat().length>16)throw Error(`${t}: a condition compares at most 16 times.`);return G2(s)}function X2(e){let t=e.type.trim().toLowerCase();if(/^(?:bool|boolean)$/.test(t))return`boolean`;if(/^(?:(?:tiny|small|medium|big)?int(?:eger)?|int[248]|(?:small|big)?serial|numeric|decimal|real|double(?: precision)?|float[48]?)(?:\s*\(\s*\d+(?:\s*,\s*\d+)?\s*\))?(?: unsigned)?$/.test(t))return`number`;if(/^(?:date)$/.test(t))return`date`;if(/^(?:timestamptz(?:\(\d+\))?|timestamp(?:\(\d+\))? with time zone)$/.test(t))return`instant`;if(/^(?:datetime|timestamp)(?:\(\d+\))?(?: without time zone)?$/.test(t))return`datetime`;if(e.allowed||/^(?:text|(?:tiny|medium|long)text|n?varchar|(?:character varying)|n?char|character|uuid|clob)(?:\(\d+\))?$/.test(t)||t.startsWith(`enum(`))return`text`}function Z2(e){if(typeof e==`bigint`&&(e=e.toString()),typeof e==`number`){if(!Number.isFinite(e)||Math.abs(e)>2**53-1)return;e=String(e)}if(typeof e!=`string`||e.length>s4)return;let t=/^([+-]?)(?:(\d+)(?:\.(\d*))?|\.(\d+))(?:[eE]([+-]?\d{1,4}))?$/.exec(e.trim());if(!t)return;let n=Number(t[5]??0);if(Math.abs(n)>s4)return;let r=t[3]??t[4]??``,i=((t[2]??`0`)+r).replace(/^0+/,``)||`0`,a=r.length-n;for(;i.endsWith(`0`)&&i!==`0`;)i=i.slice(0,-1),a--;return{coefficient:BigInt((t[1]===`-`?`-`:``)+i),scale:i===`0`?0:a}}function Q2(e){let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return!1;let[,n,r,i]=t,a=Number(n),o=Number(r),s=Number(i),c=[31,a%4==0&&(a%100!=0||a%400==0)?29:28,31,30,31,30,31,31,30,31,30,31];return a>=1&&o>=1&&o<=12&&s>=1&&s<=c[o-1]}function $2(e,t){if(e instanceof Date&&t===`instant`){let t=Date.prototype.getTime.call(e);if(!Number.isFinite(t))return;e=new Date(t).toISOString()}if(typeof e!=`string`||e.length>64)return;if(t===`date`)return Q2(e)?e:void 0;let n=/^(\d{4}-\d{2}-\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,9}))?)?(Z|[+-]\d{2}(?::?\d{2})?)?$/.exec(e);if(!n||!Q2(n[1])||Number(n[2])>23||Number(n[3])>59||Number(n[4]??0)>59)return;let[,r,i,a,o=`00`,s=``,c]=n;if(t===`datetime`)return c?void 0:`${r}T${i}:${a}:${o}.${s.padEnd(9,`0`)}`;if(!c)return;let l=0;if(c!==`Z`){let e=/^([+-])(\d{2})(?::?(\d{2}))?$/.exec(c),t=Number(e[2]),n=Number(e[3]??0);if(t>14||n>59||t===14&&n!==0)return;l=(t*60+n)*(e[1]===`-`?-1:1)}let u=Date.parse(`${r}T${i}:${a}:${o}Z`)-l*6e4;return String(BigInt(u)*1000000n+BigInt(s.padEnd(9,`0`)))}function e4(e,t){let n=X2(e);if(!n)return;if(t===null)return{kind:`null`};if(n===`number`){let r=Z2(t);return!r||/int|serial/i.test(e.type)&&r.scale>0?void 0:{kind:n,value:r}}if(n===`boolean`)return t===!0||t===1||t===1n||typeof t==`string`&&/^(true|yes|1|t)$/i.test(t.trim())?{kind:n,value:!0}:t===!1||t===0||t===0n||typeof t==`string`&&/^(false|no|0|f)$/i.test(t.trim())?{kind:n,value:!1}:void 0;if(n===`text`)return typeof t==`string`&&t.length<=s4?{kind:n,value:t}:void 0;let r=$2(t,n);return r===void 0?void 0:{kind:n,value:r}}function t4(e,t,n){if(!e||!n)return`unknown`;if(e.kind===`null`||n.kind===`null`){if(t!==`eq`&&t!==`ne`)return`unknown`;let r=e.kind===n.kind;return t===`eq`?r:!r}if(e.kind!==n.kind)return`unknown`;let r;if(e.kind===`number`&&n.kind===`number`){let t=Math.max(e.value.scale,n.value.scale),i=e.value.coefficient*10n**BigInt(t-e.value.scale),a=n.value.coefficient*10n**BigInt(t-n.value.scale);r=i<a?-1:+(i>a)}else if(e.kind===`instant`&&n.kind===`instant`){let t=BigInt(e.value),i=BigInt(n.value);r=t<i?-1:+(t>i)}else if(e.kind===`boolean`&&n.kind===`boolean`){if(t!==`eq`&&t!==`ne`)return`unknown`;r=e.value===n.value?0:1}else if(typeof e.value==`string`&&typeof n.value==`string`){if(e.kind===`text`&&t!==`eq`&&t!==`ne`)return`unknown`;r=e.value<n.value?-1:+(e.value>n.value)}else return`unknown`;switch(t){case`eq`:return r===0;case`ne`:return r!==0;case`lt`:return r<0;case`lte`:return r<=0;case`gt`:return r>0;case`gte`:return r>=0}}function n4(e,t){let n=e.filter(e=>e.name===t);return n.length===1?n[0]:void 0}function r4(e,t){let n=Object.getOwnPropertyDescriptor(e,t);return n&&Object.hasOwn(n,`value`)?n.value:void 0}function i4(e,t,n){let r=n4(n,e.field);if(!r)return`unknown`;if(e.operator===`has`){let n=r4(t,e.field);return Array.isArray(n)?e.values.some(e=>n.some(t=>String(t)===String(e))):`unknown`}if(e.other!==void 0){let i=n4(n,e.other);return!i||X2(r)!==X2(i)?`unknown`:t4(e4(r,r4(t,e.field)),e.operator,e4(i,r4(t,e.other)))}let i=e.operator,a=e.values.map(n=>t4(e4(r,r4(t,e.field)),i,e4(r,n)));return a.includes(`unknown`)?`unknown`:a.some(e=>e===!0)}function a4(e,t,n){let r=e.map(e=>e.map(e=>i4(e,t,n)));return r.flat().includes(`unknown`)?`unknown`:r.some(e=>e.every(e=>e===!0))}function o4(e,t,n){if(n==null||n===``)return null;let r=e.columns.find(e=>e.name===t);if(!r)return null;if(gt(r))return n===!0||n===1||/^(1|true|t|yes|y)$/i.test(String(n));let i=ht(r.type);if(i===`number`){let e=Number(n);return Number.isFinite(e)?e:null}if(i===`date`){let e=String(n);return/^\d{4}-\d{2}-\d{2}$/.test(e)?{day:e}:Number.isNaN(Date.parse(e))?null:{instant:new Date(e)}}return String(n)}var s4,c4,l4,u4,d4=s((()=>{St(),sr(),s4=4096,c4=/^[^\s.\x00-\x1f\x7f]{1,256}$/u,l4=new Set([`__proto__`,`prototype`,`constructor`]),u4={"=":`eq`,"!=":`ne`,"<":`lt`,"<=":`lte`,">":`gt`,">=":`gte`}})),f4=s((()=>{br()})),p4=s((()=>{sr()})),m4=s((()=>{br(),f4(),p4()})),h4=s((()=>{br(),d4(),m4()})),g4,_4=s((()=>{h4(),br(),g4=/^(number|code|sku|ref|reference|stock_ref)$|_(number|code|no|ref|reference)$/i}));function v4(e,t){let n=t.references?ct(e,t.references.table):void 0,r=n&&ft(n);return n&&r&&!pt(n).includes(r)?r:void 0}function y4(e,t,n,r){let i=e=>t.columns.find(t=>t.name===e),a=n?r?.[n]?.subtitle:void 0;if(typeof a==`string`&&a!==n&&i(a))return{path:a,declared:!0};let o=t.columns.filter(e=>e.name!==n&&!e.primaryKey&&!e.references),s=o.find(e=>w4(e)&&g4.test(e.name)&&(t.unique??[]).includes(e.name));if(s)return{path:s.name,declared:!1};let c=o.find(e=>w4(e)&&S4.test(e.name));if(c)return{path:c.name,declared:!1};let l=e?t.columns.find(t=>t.name!==n&&t.references&&!t.nullable&&v4(e,t)):void 0;if(l)return{path:`${l.name}.${v4(e,l)}`,declared:!1};let u=o.find(e=>ht(e.type)===`date`&&C4.test(e.name));return u?{path:u.name,declared:!1}:void 0}function b4(e){if(e==null||e===``)return;let t=String(e);return/^\d{4}-\d{2}-\d{2}[T ]\d{2}:/.test(t)?t.slice(0,10):t}function x4(e){let t=new Set,n=new Set;for(let r of e)(t.has(r)?n:t).add(r);return n}var S4,C4,w4,T4=s((()=>{_4(),St(),S4=/(^|_)e?mail(_address)?$/i,C4=/^(created|opened|started|joined|hired|registered)(_at|_on|_date)?$|^(date_)?(created|opened)$/i,w4=e=>ht(e.type)===`text`}));function E4(e,t,n,r,i){let a=A4(e,t,n,r);k4.delete(a),k4.set(a,i),k4.size>O4&&k4.delete(k4.keys().next().value)}function D4(e,t,n,r){return k4.get(A4(e,t,n,r))}var O4,k4,A4,j4=s((()=>{O4=500,k4=new Map,A4=(e,t,n,r)=>JSON.stringify([n,typeof t==`string`?t:[t.visitor.app,t.visitor.via??``],e.from,e.by,e.labelColumn,e.query??``,typeof r,String(r)])})),M4,N4=s((()=>{Ya(),M4=Va({aFile:`A file`,signed:`Signed`})}));function P4(e,t){let n=``,r=0;for(let i of e){if(r>=t.length)break;L4.test(i)?n+=t[r++]:n+=i}return n}function F4(e,t,n,r){let i=Number.isInteger(e)?0:r?void 0:n===void 0||Number.isInteger(n)?0:2;try{return new Intl.NumberFormat(Ri(),{style:`currency`,currency:t||Hi(),currencyDisplay:`narrowSymbol`,minimumFractionDigits:i,maximumFractionDigits:i}).format(e)}catch{return e.toLocaleString(Ri())}}function I4(e){let t=e||Hi();try{return new Intl.NumberFormat(Ri(),{style:`currency`,currency:t,currencyDisplay:`narrowSymbol`}).formatToParts(0).find(e=>e.type===`currency`)?.value??t}catch{return t}}var L4,R4=s((()=>{xa(),L4=/[0a*]/}));function z4(e){return(e.type===`text`||e.type===`textarea`)&&`sensitive`in e&&!!e.sensitive}function B4(e,t){let n=new Set,r=[...e];for(let e=Math.max(r.length-4,r.length>4?0:r.length);e<r.length;e++)n.add(e);let i=r.map((e,t)=>n.has(t)?e:`•`);if(!t)return i.join(``);let a=0,o=``;for(let e of t){if(a>=i.length)break;o+=e===`0`||e===`a`||e===`*`?i[a++]:e}return o+i.slice(a).join(``)}function V4(e,t,n){if(t==null||t===``)return`—`;if(e.type===`reference`&&n)return(typeof t==`string`||typeof t==`number`?n(e,t):void 0)??`…`;let r=`mask`in e&&typeof e.mask==`string`?e.mask:void 0;if(z4(e))return B4(String(t),e.mask);if(e.type===`boolean`)return t?Fa(`mistri.form.yes`,M4(`common.yes`)):Fa(`mistri.form.no`,M4(`common.no`));if(e.type===`files`){let e=Array.isArray(t)?t:[t];return e.length?e.map(e=>I$(String(e))?.name??M4(`aFile`)).join(`, `):`—`}if(e.type===`signature`)return M4(`signed`);if(e.type===`date`&&/^\d{4}-\d{2}-\d{2}$/.test(String(t)))return new Date(`${String(t)}T00:00:00Z`).toLocaleDateString(Ri(),{timeZone:`UTC`,dateStyle:`medium`});if(e.type===`money`&&Number.isFinite(Number(t)))return F4(Number(t),e.currency,e.step,e.minor);if(r&&typeof t==`string`)return P4(r,t);if(e.type===`choice`)return e.options.find(e=>e.value===t)?.label??String(t);if(e.type===`choices`){let n=Array.isArray(t)?t:[t];return n.length?n.map(t=>e.options.find(e=>e.value===t)?.label??String(t)).join(`, `):`—`}if(e.type===`group`){let r=U4(e,t,n);return r.length?r.join(`; `):`—`}return String(t)}function H4(e,t,n){let r=e.flatMap(e=>{let r=t[e.name];if(!W4(r))return[];if(e.type===`boolean`)return r?[e.label]:[];if(e.type===`reference`){let t=(typeof r==`string`||typeof r==`number`)&&n?n(e,r):void 0;return t===void 0?[]:[t]}return[V4(e,r,n)]});return r.length?r.join(`, `):void 0}function U4(e,t,n){let r=t=>e.fields.flatMap(r=>{let i=t?.[r.name];return W4(i)?[e.fields.length>1?`${r.label}: ${V4(r,i,n)}`:V4(r,i,n)]:[]});return e.repeat?(Array.isArray(t)?t:[]).map(e=>r(e).join(`, `)).filter(Boolean):r(t)}var W4,G4=s((()=>{xa(),Ya(),N4(),R4(),L$(),W4=e=>e!=null&&e!==``&&!(Array.isArray(e)&&!e.length)})),K4=s((()=>{})),q4,J4=s((()=>{Ya(),q4=Va({choose:`Choose…`,loading:`Loading…`,couldNotLoad:`The choices could not be loaded.`,nothingToChoose:`Nothing to choose from.`,noMatches:`Nothing matches.`,firstOnly:`The first {count} only. Type to search.`,path:`Path`})})),Y4=l({TreePicker:()=>X4});function X4({from:e,by:t,labelColumn:n,parent:r,where:i,ask:a,scope:o,value:s,onChange:c,known:l,id:u,ariaLabel:d,listLabel:f,describedBy:p,invalid:m,required:h,disabled:g,placeholder:_,inputRef:v}){let y=kK(),b=(0,Z4.useId)(),x=`${b}-tree`,S=`${b}-trail`,[C,w]=(0,Z4.useState)(new Map),[T,E]=(0,Z4.useState)(new Map),[D,O]=(0,Z4.useState)(new Set),[k,A]=(0,Z4.useState)(new Map),[j,M]=(0,Z4.useState)(new Set),[N,P]=(0,Z4.useState)(!1),[F,I]=(0,Z4.useState)(``),[L,R]=(0,Z4.useState)(!1),[z,B]=(0,Z4.useState)(``),[V,H]=(0,Z4.useState)(),[U,W]=(0,Z4.useState)(),G=(0,Z4.useRef)(C);G.current=C;let ee=(0,Z4.useRef)(new Set),te=JSON.stringify([o,e,t,n,r,i??``]),[ne,K]=(0,Z4.useState)(te);ne!==te&&(K(te),w(new Map),E(new Map),O(new Set),A(new Map),M(new Set),H(void 0),ee.current=new Set);let re=`show ${[...new Set([t,n,r])].join(`, `)}`,q=e=>{let i=e?.[t];if(!(typeof i==`string`||typeof i==`number`&&Number.isSafeInteger(i)))return null;let a=e[r];return{key:String(i),value:i,label:String(e[n]??i),parent:n3(a)?null:String(a)}},ie=e=>{if(!e.length)return;let t=new Map(G.current);for(let n of e)t.set(n.key,n);G.current=t,w(t)},ae=(e,t)=>y.fetchQuery({queryKey:[`tree-picker`,o,e,t],staleTime:3e4,queryFn:async()=>{let n=await a(`/api/run`,{q:e,limit:t,offset:0,count:`none`});if(n.errors?.length||!Array.isArray(n.rows))throw Error(q4(`couldNotLoad`));return n.rows}}),oe=t=>y.fetchQuery({queryKey:[`tree-picker`,o,`branches`,e,r,i??``,t],staleTime:3e4,queryFn:async()=>{let n=await a(`/api/breakdown`,{text:`${e} ${vn(i,`${r} in (${t.map(wn).join(`, `)})`)} count as children by ${r}`,limit:t.length});if(n.errors?.length||!Array.isArray(n.rows))throw Error(q4(`couldNotLoad`));return new Set(n.rows.filter(e=>Number(e.children)>0).map(e=>String(e[r])))}}),se=async t=>{if(ee.current.has(t))return;ee.current.add(t),E(e=>new Map(e).set(t,`loading`));let a=G.current.get(t),o=t===``?`${r} is empty`:`${r} = ${wn(a?a.value:t)}`;try{let r=await ae(`${e} ${vn(i,o)} ${re} sort ${n}`,201),a=r.slice(0,$4).map(q).filter(e=>e!==null);if(ie(a),E(e=>new Map(e).set(t,a.map(e=>e.key))),r.length>$4&&O(e=>new Set(e).add(t)),t!==``&&A(e=>new Map(e).set(t,a.length>0)),!a.length)return;let s=await oe(a.map(e=>e.value)).catch(()=>void 0);s&&A(e=>{let t=new Map(e);for(let e of a)t.has(e.key)&&t.get(e.key)===!1||t.set(e.key,s.has(e.key));return t})}catch{ee.current.delete(t),E(e=>new Map(e).set(t,`error`))}},ce=(e,t=C)=>{let n=[],r=new Set;for(let i=t.get(e);i&&!r.has(i.key)&&n.length<=t3;i=i.parent===null?void 0:t.get(i.parent))r.add(i.key),n.unshift(i);return n},le=async n=>{let r=e=>[...new Set(e.flatMap(e=>e.parent===null||G.current.has(e.parent)?[]:[e.parent]))],i=r(n);for(let n=0;n<t3&&i.length;n++){let n=(await ae(`${e} ${t} in (${i.map(wn).join(`, `)}) ${re}`,i.length)).map(q).filter(e=>e!==null);ie(n),i=r(n)}},ue=n3(s)?void 0:String(s);(0,Z4.useEffect)(()=>{if(s===void 0||s===``)return;let n=!0,r=G.current.get(String(s));return(r?Promise.resolve(r):ae(`${e} ${vn(i,`${t} = ${wn(s)}`)} ${re}`,1).then(e=>{let t=q(e[0]);return t&&n&&ie([t]),t})).then(e=>e&&n?le([e]):void 0).catch(()=>{}),()=>{n=!1}},[s,te]);let de=L&&F.trim()!==``;(0,Z4.useEffect)(()=>{let e=setTimeout(()=>B(F.trim()),150);return()=>clearTimeout(e)},[F]),(0,Z4.useEffect)(()=>{if(!N||!de||!z)return;let t=!0,r=`${n} contains ${JSON.stringify(z)}`;return ae(`${e} ${vn(i,r)} ${re} sort ${n}`,e3).then(async e=>{let n=e.map(q).filter(e=>e!==null);ie(n),await le(n).catch(()=>{}),t&&H({for:z,keys:n.map(e=>e.key)})}).catch(()=>t&&H({for:z,error:!0})),()=>{t=!1}},[N,de,z,te]);let fe=(0,Z4.useRef)(!1);(0,Z4.useEffect)(()=>{if(!N||de){N||(fe.current=!1);return}if(se(``),fe.current||!ue)return;let e=ce(ue);if(!e.length||e[0].parent!==null)return;fe.current=!0;let t=e.slice(0,-1);M(e=>new Set([...e,...t.map(e=>e.key)]));for(let e of t)se(e.key);W(ue)},[N,de,ue,C]);let pe=e=>k.get(e)!==!1,me=[];if(de){let e=V?.for===F.trim()?V:void 0;if(!e)me.push({key:`note:`,depth:1,note:q4(`loading`)});else if(`error`in e)me.push({key:`note:`,depth:1,note:q4(`couldNotLoad`)});else if(!e.keys.length)me.push({key:`note:`,depth:1,note:q4(`noMatches`)});else for(let t of e.keys){let e=C.get(t);e&&me.push({key:t,depth:1,node:e,path:ce(t).slice(0,-1).map(e=>e.label)})}}else{let e=(t,n,r)=>{let i=T.get(t);if(i===void 0||i===`loading`)return void me.push({key:`note:${t}`,depth:n,note:q4(`loading`)});if(i===`error`)return void me.push({key:`note:${t}`,depth:n,note:q4(`couldNotLoad`)});!i.length&&t===``&&me.push({key:`note:`,depth:n,note:q4(`nothingToChoose`)});for(let t of i){let i=C.get(t);i&&!r.has(t)&&(me.push({key:t,depth:n,node:i}),j.has(t)&&pe(t)&&e(t,n+1,new Set(r).add(t)))}D.has(t)&&me.push({key:`more:${t}`,depth:n,note:q4(`firstOnly`,{count:Wi($4)})})};N&&e(``,1,new Set)}let J=me.filter(e=>e.node),he=J.find(e=>e.key===U)??(de?J[0]:void 0),ge=e=>`${b}-${me.indexOf(e)}`;(0,Z4.useEffect)(()=>{N&&he&&Ma(ge(he))?.scrollIntoView?.({block:`nearest`})},[N,he?.key]);let _e=e=>{M(t=>new Set(t).add(e)),se(e)},ve=e=>M(t=>{let n=new Set(t);return n.delete(e),n}),ye=()=>{P(!1),ue!==void 0&&(R(!1),I(``))},be=e=>{c(e.value,e.label),R(!1),I(``),W(e.key),P(!1)},xe=e=>{let t=he?J.indexOf(he):-1,n=e=>e&&W(e.key),r=N&&!de&&he?.node,i={ArrowDown:()=>N?n(J[Math.min(t+1,J.length-1)]):P(!0),ArrowUp:()=>N?n(J[Math.max(t-1,0)]):P(!0),Home:N&&!de?()=>n(J[0]):void 0,End:N&&!de?()=>n(J[J.length-1]):void 0,ArrowRight:r?()=>{let e=he.key,t=T.get(e);j.has(e)?Array.isArray(t)&&t.length&&W(t[0]):pe(e)&&_e(e)}:void 0,ArrowLeft:r?()=>{let e=he.node;j.has(e.key)&&pe(e.key)?ve(e.key):e.parent!==null&&J.some(t=>t.key===e.parent)&&W(e.parent)}:void 0,Enter:N&&he?.node?()=>be(he.node):void 0,Escape:N?()=>{e.stopPropagation(),ye()}:void 0}[e.key];i&&(e.preventDefault(),i())},Se=(0,Z4.useRef)(null),[Ce,we]=(0,Z4.useState)(null),[Te,Ee]=(0,Z4.useState)(null);(0,Z4.useLayoutEffect)(()=>{if(!N||!Se.current)return;let e=Se.current;Ee(e.closest(`dialog, [role="dialog"]`));let t=()=>{let t=ws(e).width;we(t>0?t:null)};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[N]);let De=L?F:ue===void 0?``:C.get(ue)?.label??l??ue,Oe=ue===void 0||L?[]:ce(ue),ke=Oe.length>1;return(0,Q4.jsxs)(`div`,{className:`tree-picker`,children:[(0,Q4.jsxs)(`div`,{className:`picker`,ref:Se,children:[(0,Q4.jsx)(`input`,{ref:v,id:u,className:`picker-input`,role:`combobox`,"aria-label":d,"aria-expanded":N,"aria-controls":x,"aria-haspopup":de?`listbox`:`tree`,"aria-autocomplete":`list`,"aria-activedescendant":N&&he?ge(he):void 0,"aria-describedby":[p,ke?S:void 0].filter(Boolean).join(` `)||void 0,"aria-invalid":m||void 0,required:h,disabled:g,placeholder:_??q4(`choose`),autoComplete:`off`,value:De,onChange:e=>{I(e.target.value),R(!0),W(void 0),P(!0),ue!==void 0&&c(``)},onClick:()=>!g&&P(!0),onBlur:ye,onKeyDown:xe}),(0,Q4.jsx)(JB,{open:N&&!g,modal:!1,onOpenChange:()=>{},children:(0,Q4.jsx)(HV,{container:Te??ja(),children:(0,Q4.jsx)(BH,{anchor:()=>Se.current?cU(Se.current):null,positionMethod:`fixed`,side:`bottom`,align:`start`,sideOffset:4,collisionBoundary:lU(),collisionPadding:8,style:{zIndex:40,width:Ce===null?`var(--anchor-width)`:`${Ce}px`,maxWidth:`var(--available-width)`},children:(0,Q4.jsx)(rU,{role:`presentation`,initialFocus:!1,finalFocus:!1,className:`picker-popup tree-picker-popup`,onMouseDown:e=>e.preventDefault(),children:(0,Q4.jsx)(`ul`,{id:x,role:de?`listbox`:`tree`,"aria-label":d??f,className:`picker-list`,children:me.map(e=>{let t=e.node;if(!t)return(0,Q4.jsx)(`li`,{role:`presentation`,className:`picker-empty`,style:{paddingInlineStart:r3(e.depth)},children:e.note},e.key);let n=e===he,r=!de&&pe(t.key);return(0,Q4.jsxs)(`li`,{id:ge(e),role:de?`option`:`treeitem`,"aria-level":de?void 0:e.depth,"aria-expanded":r?j.has(t.key):void 0,"aria-selected":n,className:`picker-option tree-picker-option${n?` active`:``}${t.key===ue?` chosen`:``}`,style:de?void 0:{paddingInlineStart:r3(e.depth)},onClick:()=>be(t),children:[!de&&(0,Q4.jsx)(`span`,{className:`tree-picker-caret${r?``:` is-leaf`}`,"aria-hidden":`true`,onClick:e=>{e.stopPropagation(),W(t.key),r&&(j.has(t.key)?ve(t.key):_e(t.key))},children:r&&(0,Q4.jsx)(Pe,{name:j.has(t.key)?`caret-down`:`caret-right`,size:12})}),(0,Q4.jsx)(`span`,{className:`picker-option-label`,children:t.label}),e.path&&e.path.length>0&&(0,Q4.jsx)(`span`,{className:`picker-option-detail tree-picker-path`,children:e.path.join(` › `)})]},e.key)})})})})})})]}),ke&&(0,Q4.jsx)(`p`,{id:S,className:`tree-picker-trail`,"aria-label":q4(`path`),children:Oe.map((e,t)=>(0,Q4.jsxs)(Z4.Fragment,{children:[t>0&&(0,Q4.jsx)(`span`,{className:`tree-picker-sep`,"aria-hidden":`true`,children:`›`}),(0,Q4.jsx)(`span`,{children:e.label})]},e.key))})]})}var Z4,Q4,$4,e3,t3,n3,r3,i3=s((()=>{K4(),Z4=d(m(),1),kJ(),sU(),uU(),Os(),Pa(),sr(),Fe(),xa(),J4(),Q4=d(O(),1),$4=200,e3=20,t3=12,n3=e=>e==null||e===``,r3=e=>`calc(var(--space-2) + ${(e-1)*18}px)`})),a3=l({CommandReferenceField:()=>p3,ReferenceName:()=>u3,ReviewNamed:()=>f3,commandChoicePage:()=>_3,commandChoices:()=>g3,readReferenceName:()=>l3,run:()=>o3});async function o3(e,t){return s3(e,`/api/run`,t)}async function s3(e,t,n){if(typeof e==`string`)return Ps(t,{...ao(e),...n});let{app:r,via:i}=e.visitor,a=new URLSearchParams({app:r,...i?{via:i}:{}}),o=await Eo(`${t}?${a}`,{method:`POST`,credentials:`same-origin`,signal:AbortSignal.timeout(15e3),headers:{"content-type":`application/json`,"x-mistri-read":`picker`},body:JSON.stringify(n)});if(!o.ok)throw Error(V2(`choicesCouldNotBeLoaded`));return o.json()}function c3(e,t){if(typeof t!=`string`||!Gs.schema)return;let n=Gs.schema,r=lt(n,e.from);if(!r)return;let i={[e.labelColumn]:Hs(r.id,e.labelColumn)},a=y4(n,r,e.labelColumn,i);return a&&a.path!==e.by?a:void 0}async function l3(e,t,n){let r=c3(e,n),i=r?.declared?r:void 0,a=`${e.by} = ${typeof t==`number`?t:JSON.stringify(t)}`,o=await o3(n,{q:[e.from,vn(yn(e.query??``).head,a),S3(e,i)].join(` `),limit:1,offset:0,count:`none`});if(o.errors?.length||!Array.isArray(o.rows))throw Error(V2(`choicesCouldNotBeLoaded`));let s=o.rows[0],c=C3(s?.[e.labelColumn]);if(!s||c===void 0)return null;let l=i?b4(s[i.path]):void 0;return{label:c,...l?{detail:l}:{}}}function u3({field:e,value:t,source:n,identityEpoch:r}){let i=OJ({queryKey:[`reference-review-name`,r,n,e.from,e.by,e.labelColumn,e.query??``,t],retry:!1,gcTime:0,staleTime:0,refetchOnMount:`always`,queryFn:()=>l3(e,t,n)});return i.isPending?(0,b3.jsx)(`span`,{"aria-busy":`true`,children:V2(`loadingName`)}):i.isError?(0,b3.jsxs)(`span`,{children:[V2(`nameCouldNotBeLoaded`),` `,(0,b3.jsx)(UG,{intent:`quiet`,size:`compact`,onClick:()=>void i.refetch(),children:V2(`tryAgain`)})]}):i.data?(0,b3.jsxs)(b3.Fragment,{children:[i.data.label,i.data.detail&&(0,b3.jsxs)(`span`,{className:`review-detail`,children:[` · `,i.data.detail]})]}):(0,b3.jsx)(`span`,{children:V2(`noLongerAvailable`)})}function d3({field:e,value:t,from:n}){return e.type===`reference`&&(typeof t==`string`||typeof t==`number`)&&t!==``?(0,b3.jsx)(u3,{field:e,value:t,source:n.source,identityEpoch:n.identityEpoch}):(0,b3.jsx)(b3.Fragment,{children:V4(e,t)})}function f3({field:e,value:t,from:n}){if(e.type!==`group`)return(0,b3.jsx)(d3,{field:e,value:t,from:n});let r=t=>e.fields.map(e=>({member:e,held:t?.[e.name]})).filter(({held:e})=>W4(e)),i=e.repeat?(Array.isArray(t)?t:[]).map(r).filter(e=>e.length):r(t).map(e=>[e]);if(!i.length)return(0,b3.jsx)(b3.Fragment,{children:`—`});let a=t=>t.map(({member:t,held:r},i)=>(0,b3.jsxs)(y3.Fragment,{children:[i>0&&`, `,e.fields.length>1&&`${t.label}: `,(0,b3.jsx)(d3,{field:t,value:r,from:n})]},t.name));return i.length===1?(0,b3.jsx)(b3.Fragment,{children:a(i[0])}):(0,b3.jsx)(`ul`,{className:`review-lines`,children:i.map((e,t)=>(0,b3.jsx)(`li`,{children:a(e)},t))})}function p3(e){return e.field.tree?(0,b3.jsx)(m3,{...e}):(0,b3.jsx)(h3,{...e})}function m3({field:e,id:t,describedBy:n,invalid:r,connection:i,identityEpoch:a,value:o,disabled:s,onChange:c,isCurrent:l}){let u=typeof o==`string`||typeof o==`number`?o:``;return(0,b3.jsx)(x3,{from:e.from,by:e.by,labelColumn:e.labelColumn,parent:e.tree,where:yn(e.query??``).head||void 0,ask:(e,t)=>s3(i,e,t),scope:JSON.stringify([a,i]),value:u,known:u===``?void 0:D4(e,i,a,u),onChange:(t,n)=>{l()&&(t!==``&&n!==void 0&&E4(e,i,a,t,n),c(t))},id:t,listLabel:e.label,describedBy:n,invalid:r,required:e.required,disabled:s,placeholder:bQ(e.label)?O$(`choosePlaceholder`,{label:e.label.toLowerCase()}):O$(`chooseOne`)})}function h3({field:e,id:t,describedBy:n,invalid:r,connection:i,identityEpoch:a,value:o,disabled:s,onChange:c,isCurrent:l}){let u=t=>typeof t==`string`||typeof t==`number`?D4(e,i,a,t):void 0,[d,f]=(0,y3.useState)(o===void 0?``:u(o)??String(o)),[p,m]=(0,y3.useState)(o),h=(0,y3.useRef)(o);o!==p&&(m(o),o!==h.current&&f(o===void 0||o===``?``:u(o)??String(o)),h.current=o);let[g,_]=(0,y3.useState)(``),[v,y]=(0,y3.useState)(!1);(0,y3.useEffect)(()=>{let e=setTimeout(()=>_(d.trim()),150);return()=>clearTimeout(e)},[d]);let b=typeof o==`string`||typeof o==`number`?o:void 0,x=OJ({queryKey:[`command-choice-label`,a,i,e.from,e.by,e.labelColumn,e.query??``,b],retry:!1,enabled:b!==void 0&&b!==``&&l(),queryFn:async()=>{let t=await l3(e,b,i);return t&&E4(e,i,a,b,t.label),t?.label??null}});(0,y3.useEffect)(()=>{x.data&&b!==void 0&&d===String(b)&&f(x.data)},[x.data,b,d]);let S=OJ({queryKey:[`command-choices`,a,i,e,g],retry:!1,enabled:v&&!s&&l(),queryFn:async()=>{if(!l())throw Error(O$(`common.thisCommandFormIsNoLonger`));let t=await g3(e,g,i);if(!l())throw Error(O$(`common.thisCommandFormIsNoLonger`));return t}}),{choices:C,answered:w}=z2({typed:d,asked:g,placeholder:S.isPlaceholderData,rows:S.data,label:e=>e.label}),T=x4(C.map(e=>e.label));return(0,b3.jsx)(`div`,{className:`picker`,children:(0,b3.jsx)(L2,{text:d,onText:e=>{f(e),h.current=``,c(``)},open:v&&!s,onOpenChange:y,items:C,itemKey:e=>`${typeof e.value}:${e.value}`,itemLabel:e=>e.label,itemClassName:(e,t)=>`picker-option${t?` active`:``}`,renderItem:e=>(0,b3.jsxs)(b3.Fragment,{children:[(0,b3.jsx)(`span`,{className:`picker-option-label`,children:e.label}),e.detail&&(e.declared||T.has(e.label))&&(0,b3.jsx)(`span`,{className:`picker-option-detail`,children:e.detail})]}),onPick:t=>{l()&&(E4(e,i,a,t.value,t.label),h.current=t.value,c(t.value),f(t.label),y(!1))},inputProps:{id:t,"aria-describedby":n,"aria-invalid":r||void 0,required:e.required,disabled:s,className:`picker-input`,placeholder:bQ(e.label)?O$(`choosePlaceholder`,{label:e.label.toLowerCase()}):O$(`chooseOne`)},fit:`width`,popupClassName:`picker-popup`,listClassName:`picker-list`,emptyClassName:`picker-empty`,empty:S.isError?V2(`choicesCouldNotBeLoaded`):S.isFetching||!w?V2(`loadingChoices`):V2(`noMatchingChoices`)})})}async function g3(e,t,n){return(await v3(e,t,n,20,0)).choices}async function _3(e,t,n,r,i){let a=await v3(e,t,n,i+1,r);return{choices:a.choices.slice(0,i),more:a.rows>i}}async function v3(e,t,n,r,i){let a=vn(yn(e.query??``).head,t?`${e.labelColumn} contains ${JSON.stringify(t)}`:``),o=c3(e,n),s=await o3(n,{q:[e.from,a,S3(e,o),`sort ${e.labelColumn}`].filter(Boolean).join(` `),limit:r,offset:i,count:`none`});if(s.errors?.length||!Array.isArray(s.rows))throw Error(V2(`choicesCouldNotBeLoaded`));return{choices:s.rows.slice(0,r).flatMap(t=>{let n=t[e.by];return typeof n==`string`||typeof n==`number`&&Number.isSafeInteger(n)?[{value:n,label:String(t[e.labelColumn]??n),...o&&b4(t[o.path])?{detail:b4(t[o.path]),declared:o.declared}:{}}]:[]}),rows:s.rows.length}}var y3,b3,x3,S3,C3,w3=s((()=>{y3=d(m()),kJ(),tc(),Do(),uo(),R2(),GG(),B2(),CQ(),wc(),k$(),H2(),sr(),St(),T4(),j4(),G4(),b3=d(O()),x3=vc(()=>Promise.resolve().then(()=>(i3(),Y4)),`TreePicker`,{quiet:!0}),S3=(e,t)=>`show ${[...new Set([e.by,e.labelColumn,...t?[t.path]:[]])].join(`, `)}`,C3=e=>e==null||e===``?void 0:String(e)})),T3=s((()=>{})),E3=s((()=>{}));function D3(e){let t=e.toUpperCase(),n=M3.get(t);if(n===void 0){try{n=new Intl.NumberFormat(`en`,{style:`currency`,currency:t}).resolvedOptions().maximumFractionDigits??2}catch{n=2}M3.set(t,n)}return n}function O3(e,t){let n=/^(-?)0*(\d+)$/.exec(typeof e==`number`?Number.isSafeInteger(e)?String(e):``:typeof e==`string`||typeof e==`bigint`?String(e).trim():``);if(!n)return;let r=D3(t),i=n[2].padStart(r+1,`0`);return(/[1-9]/.test(i)?n[1]:``)+(r?`${i.slice(0,-r)}.${i.slice(-r)}`:i)}function k3(e,t){let n=O3(e,t);if(n!==void 0)return n;let r=typeof e==`number`?e:typeof e==`string`&&e.trim()?Number(e):NaN;return Number.isFinite(r)?r/10**D3(t):void 0}function A3(e,t){if(!e?.currencyColumn)return;let n=t.lastIndexOf(`.`);return n<0?e.currencyColumn:`${t.slice(0,n+1)}${e.currencyColumn}`}function j3(e,t,n,r=``){let i=A3(e,r),a=i&&t?t[i]:void 0;return typeof a==`string`&&/^[A-Za-z]{3}$/.test(a.trim())?a.trim().toUpperCase():e?.currency??n}var M3,N3=s((()=>{M3=new Map})),P3,F3,I3,L3=s((()=>{P3=`house.tray.list.list-checks.kanban.table.calendar.calendar-check.clock.chart-bar.chart-line.chart-pie.gauge.target.flag.user.users.user-circle.address-book.handshake.buildings.storefront.briefcase.package.truck.car.shopping-cart.receipt.currency-dollar.credit-card.wallet.bank.file.file-text.folder.clipboard-text.note.archive.tag.ticket.star.bookmark-simple.bell.envelope.chat-circle.phone.headset.megaphone.globe.map-pin.magnifying-glass.gear.sliders.wrench.bug.shield-check.lock.key.database.stack.lightning.check-circle.warning.info.cell-signal-low.cell-signal-medium.cell-signal-high.cell-signal-full.fire.hourglass.circle-dashed.x-circle.plus-circle.pencil-simple.paper-plane-tilt.arrows-left-right.arrow-circle-down.arrow-circle-up.laptop.monitor.device-mobile.printer.stethoscope.heartbeat.heart.pill.syringe.first-aid-kit.thermometer.flask.test-tube.microscope.bed.hospital.ambulance.tooth.eyeglasses.wheelchair.baby.dna.brain.bandaids.hand-heart.graduation-cap.book-open.student.chalkboard-teacher.factory.warehouse.house-line.plant.leaf.sun.cloud.drop.airplane.bicycle.bus.train.boat.hammer.toolbox.plug.lightbulb.cube.camera.image.trophy.gift.coffee.fork-knife.shopping-bag.basket.barcode.qr-code.scales.gavel.certificate.identification-card.fingerprint.eye.link.paperclip.scissors.palette.code.terminal.users-three.user-plus.caret-left.caret-right.caret-up.caret-down.arrow-left.arrow-right.x.plus.dots-three`.split(`.`),F3=new Set(P3),I3=e=>typeof e==`string`&&F3.has(e)})),R3,z3=s((()=>{Ya(),R3=Va({choosePlaceholder:`Choose {label}`,chooseOne:`Choose one`,showValue:`Show`,hideValue:`Hide`,yesWord:`Yes`,noWord:`No`,monthPlaceholder:`MM/YYYY`})})),B3=l({IntakeControl:()=>Z3,drawnHere:()=>U3});function V3(e,t,n){let r=(e.type===`choice`||e.type===`choices`)&&e.source?e.source:void 0,i=r?.match,a=i?Yr(i,n??{}):void 0,o=i&&a?li(a):void 0,s=r&&(e.type===`choice`||e.type===`choices`)&&(r.served||e.options.length)?e.options:void 0,c=r?qr(r,Ri()):void 0,l=OJ({queryKey:[`command-choices`,typeof t==`string`?t:t?.visitor,r?.from,r?.by,r?.labelColumn,r?.sort?.column,r?.sort?.direction,c?.column,...i?ii(i).map(e=>n?.[e]??null):[]],enabled:r!==void 0&&t!==void 0&&s===void 0&&(!i||a!==void 0),staleTime:6e4,queryFn:async()=>{let e=[...new Set([r.by,r.labelColumn,...c?[c.column]:[]])].join(`, `),n=await o3(t,{q:`${r.from}${o?` ${o}`:``} show ${e} sort ${r.sort?`${r.sort.column} ${r.sort.direction}`:r.labelColumn}`,limit:e6,offset:0,count:`none`});return Jr((Array.isArray(n.rows)?n.rows:[]).filter(e=>typeof e[r.by]==`string`||typeof e[r.by]==`number`),r,c)}});if(r)return i&&!a?[]:s&&i?s.filter(e=>Xr(a,e.row)):s??l.data}function H3(e,t){let{field:n,value:r,onChange:i}=e,a=(n.type===`choice`||n.type===`choices`)&&n.source?.match!==void 0,o=t?.map(e=>String(e.value)).join(`\0`);(0,Q3.useEffect)(()=>{if(!a||!t)return;let e=new Set(t.map(e=>String(e.value)));if(Array.isArray(r)){let t=r.filter(t=>e.has(String(t)));t.length!==r.length&&i(t)}else r!==void 0&&r!==``&&!e.has(String(r))&&i(``)},[a,o,r])}function U3(e){switch(e.type){case`money`:case`month`:case`choices`:return!0;case`number`:return e.as===`slider`;case`text`:return e.mask!==void 0||e.sensitive!==void 0;case`boolean`:return e.as===`buttons`||e.statement!==void 0;case`choice`:return e.as===`cards`||e.as===`buttons`||e.source!==void 0;default:return!1}}function W3(e,t){let n=[...e].filter(e=>L4.test(e)),r=``;for(let e of t){let t=n[r.length];if(!t)break;(t===`0`?/\d/.test(e):t===`a`?/[A-Za-z]/.test(e):/[A-Za-z0-9]/.test(e))&&(r+=e)}return r}function G3(e){let t=e.replace(/\D/g,``).slice(0,6);return t.length===6?`${t.slice(2)}-${t.slice(0,2)}`:t}function K3(e){if(!(e.length<3||e.some(e=>e.label.length>o6)))return e.every(e=>!e.help&&e.label.length<=a6)?`short`:e.every(e=>(e.help?.length??0)<=s6)?`brief`:void 0}function q3(e){let t=V3(e.field,e.source,e.answers);H3(e,t);let{field:n,id:r,value:i,disabled:a,onChange:o}=e;if(n.type!==`choice`&&n.type!==`choices`||!t)return null;let s=t,c={...n,options:s,source:void 0};if(n.type===`choice`&&n.as===`radios`)return(0,$3.jsx)(A$,{id:r,options:s,value:i,describedBy:e[`aria-describedby`],required:n.required,invalid:e[`aria-invalid`]===!0||e[`aria-invalid`]===`true`,disabled:a,onChange:o});if(n.type===`choice`&&n.as!==`cards`&&n.as!==`buttons`&&(n.as===`select`||s.length>t6)){let t=s.findIndex(e=>e.value===i);return(0,$3.jsx)(xQ,{id:r,ariaLabelledBy:`${r}-label`,ariaInvalid:e[`aria-invalid`]===!0||e[`aria-invalid`]===`true`,ariaDescribedBy:e[`aria-describedby`],disabled:a,value:t<0?``:String(t),valueClassName:t<0?`is-empty`:void 0,items:[...t<0?[{value:``,label:bQ(n.label)?R3(`choosePlaceholder`,{label:n.label.toLowerCase()}):R3(`chooseOne`)}]:[],...s.map((e,t)=>({value:String(t),label:e.label}))],onChange:e=>{e!==``&&o(s[Number(e)].value)}})}return(0,$3.jsx)(Z3,{...e,field:c})}function J3(e){let t=String(e??``),n=Number(t);return t.trim()&&Number.isFinite(n)?n.toLocaleString(Ri(),{maximumFractionDigits:20}):t}function Y3(e,t){let n=String(e??``);if(!/^-?\d*\.?\d*$/.test(n.trim())||!/\d/.test(n))return n;try{return new Intl.NumberFormat(Ri(),{minimumFractionDigits:t,maximumFractionDigits:t}).format(n.trim())}catch{return n}}function X3(e,t){let[n,...r]=e.replace(/[^\d.-]/g,``).split(`.`);return t&&r.length?`${n}.${r.join(``).slice(0,t)}`:n}function Z3(e){let{field:t,id:n,value:r,disabled:i,onChange:a}=e,o={"aria-describedby":e[`aria-describedby`],"aria-invalid":e[`aria-invalid`]},[s,c]=(0,Q3.useState)(!1),[l,u]=(0,Q3.useState)(!1);if(t.type===`money`&&t.as!==`slider`){let s=(t.currency||e.currency)??void 0,c=I4(s),d=t.minor?D3(s||Hi()):void 0;return(0,$3.jsxs)(`div`,{className:`intake-money`,children:[(0,$3.jsx)(`span`,{className:`intake-money-symbol`,"aria-hidden":`true`,children:c}),(0,$3.jsx)(`input`,{...o,id:n,className:`field-control`,style:{paddingInlineStart:`calc(var(--money-pad) + ${c.length}ch + var(--space-2))`},type:`text`,inputMode:(d===void 0?t.step!==void 0&&Number.isInteger(t.step):d===0)?`numeric`:`decimal`,enterKeyHint:`next`,autoComplete:`off`,placeholder:t.placeholder,disabled:i,required:t.required,value:l?String(r??``):d===void 0?J3(r):Y3(r,d),onFocus:()=>u(!0),onBlur:()=>u(!1),onChange:e=>a(d===void 0?e.target.value.replace(/[^\d.-]/g,``):X3(e.target.value,d))})]})}if(t.type===`month`)return(0,$3.jsx)(`input`,{...o,id:n,className:`field-control intake-month`,type:`text`,inputMode:`numeric`,enterKeyHint:`next`,autoComplete:`off`,placeholder:Fa(`mistri.form.monthHint`,R3(`monthPlaceholder`)),disabled:i,required:t.required,value:r6(typeof r==`string`?r:``),onChange:e=>a(G3(e.target.value))});if((t.type===`number`||t.type===`money`)&&t.as===`slider`){let s=t.min??0,c=t.max??100,l=typeof r==`number`?r:r===void 0||r===``?s:Number(r),u=c>s?(l-s)/(c-s)*100:0,d=n=>t.type===`money`?F4(n,e.currency,t.step):n.toLocaleString(Ri()),f=d(l);return(0,$3.jsxs)(`div`,{className:`intake-slider`,children:[(0,$3.jsx)(`output`,{className:`field-control field-readout`,htmlFor:n,"aria-hidden":`true`,children:f}),(0,$3.jsx)(`input`,{...o,id:n,type:`range`,className:`field-range`,min:s,max:c,step:t.step??(t.type===`money`||t.integer?1:`any`),value:l,disabled:i,"aria-valuetext":f,style:{"--range-share":`${u}%`},onChange:e=>a(Number(e.target.value))}),(0,$3.jsxs)(`div`,{className:`intake-slider-ends`,"aria-hidden":`true`,children:[(0,$3.jsx)(`span`,{children:d(s)}),(0,$3.jsx)(`span`,{children:d(c)})]})]})}if(t.type===`text`&&t.sensitive){let e=typeof r==`string`?r:``,l=t.mask?P4(t.mask,e):e;return(0,$3.jsxs)(`div`,{className:`field-with-action`,children:[(0,$3.jsx)(`input`,{...o,id:n,className:`field-control${s?``:` field-hidden`}`,type:s?`text`:`password`,inputMode:t.mask?n6(t.mask):`text`,enterKeyHint:`next`,autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`off`,spellCheck:!1,"data-1p-ignore":!0,"data-lpignore":`true`,placeholder:t.placeholder,disabled:i,required:t.required,value:l,onChange:e=>a(t.mask?W3(t.mask,e.target.value):e.target.value)}),(0,$3.jsx)(UG,{intent:`quiet`,"aria-controls":n,"aria-pressed":s,onClick:()=>c(!s),children:R3(s?`hideValue`:`showValue`)})]})}if(t.type===`text`&&t.mask){let e=t.mask;return(0,$3.jsx)(`input`,{...o,id:n,className:`field-control`,type:`text`,inputMode:n6(e),enterKeyHint:`next`,autoComplete:`off`,placeholder:t.placeholder??e.replace(/[0a*]/g,`_`),disabled:i,required:t.required,value:P4(e,typeof r==`string`?r:``),onChange:t=>a(W3(e,t.target.value))})}if(t.type===`boolean`)return t.as===`buttons`?(0,$3.jsx)(`div`,{className:`choice-pair`,role:`radiogroup`,id:n,"aria-labelledby":`${n}-label`,...o,children:[!0,!1].map(e=>(0,$3.jsxs)(`label`,{className:`choice-pick${r===e?` is-on`:``}`,children:[(0,$3.jsx)(`input`,{type:`radio`,name:n,className:`choice-input`,checked:r===e,disabled:i,onChange:()=>a(e)}),e?Fa(`mistri.form.yes`,R3(`yesWord`)):Fa(`mistri.form.no`,R3(`noWord`))]},String(e)))}):(0,$3.jsxs)(`span`,{className:`intake-consent`,children:[(0,$3.jsx)(`input`,{...o,id:n,type:`checkbox`,className:`command-check field-check`,required:t.accept===!0,checked:r===!0,disabled:i,onChange:e=>a(e.target.checked)}),(0,$3.jsx)(`span`,{className:`intake-statement`,children:t.statement})]});if((t.type===`choice`||t.type===`choices`)&&t.source)return(0,$3.jsx)(q3,{...e});if(t.type===`choice`||t.type===`choices`){let s=t.type===`choices`,c=s?Array.isArray(r)?r:[]:r===void 0?[]:[r],l=t.type===`choices`?t.exclusive??[]:[],u=(e,n)=>{if(!s)return a(e.value);if(l.includes(e.value))return a(n?[e.value]:[]);let r=c.filter(t=>t!==e.value&&!l.includes(t));a(t.options.map(e=>e.value).filter(t=>n&&t===e.value||r.includes(t)))},d=t.as===`buttons`;return s?(0,$3.jsx)(g1,{id:n,"aria-labelledby":`${n}-label`,"aria-describedby":e[`aria-describedby`],"aria-invalid":e[`aria-invalid`],disabled:i,fit:K3(t.options),cards:t.options.map(e=>({key:i6(e),label:e.label,icon:e.icon&&I3(e.icon)?(0,$3.jsx)(Pe,{name:e.icon}):void 0,help:e.help,on:c.includes(e.value)})),onToggle:(e,n)=>u(t.options[e],n)}):(0,$3.jsx)(`div`,{className:d?`choice-pair intake-buttons`:`choice-cards`,"data-fit":d?void 0:K3(t.options),role:s?`group`:`radiogroup`,id:n,"aria-labelledby":`${n}-label`,"aria-required":!s&&t.required||void 0,...o,children:t.options.map(e=>{let t=c.includes(e.value);return(0,$3.jsxs)(`label`,{className:`${d?`choice-pick`:`choice-card`}${t?` is-on`:``}`,children:[e.icon&&!d&&I3(e.icon)?(0,$3.jsx)(`span`,{className:`choice-card-icon`,"aria-hidden":`true`,children:(0,$3.jsx)(Pe,{name:e.icon})}):null,(0,$3.jsxs)(`span`,{className:`choice-card-label`,children:[e.label,e.help&&!d?(0,$3.jsx)(`span`,{className:`intake-choice-help`,children:e.help}):null]}),(0,$3.jsx)(`input`,{type:s?`checkbox`:`radio`,name:s?void 0:n,className:`choice-input`,checked:t,disabled:i,onChange:t=>u(e,t.target.checked)}),d?null:(0,$3.jsx)(`span`,{className:`choice-box`,"aria-hidden":`true`})]},i6(e))})})}return null}var Q3,$3,e6,t6,n6,r6,i6,a6,o6,s6,c6=s((()=>{Q3=d(m()),kJ(),CQ(),GG(),v1(),w3(),T3(),E3(),ui(),xa(),N3(),Fe(),L3(),Ya(),z3(),R4(),M$(),$3=d(O()),e6=200,t6=6,n6=e=>[...e].every(e=>!L4.test(e)||e===`0`)?`numeric`:`text`,r6=e=>{let t=/^(\d{4})-(\d{2})$/.exec(e),n=t?`${t[2]}${t[1]}`:e.replace(/\D/g,``);return n.length>2?`${n.slice(0,2)}/${n.slice(2)}`:n},i6=e=>`${typeof e.value}:${e.value}`,a6=14,o6=24,s6=40}));function l6(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(/\s/.test(r)){n++;continue}if(/\d/.test(r)){let r=/\d+(?:\.\d+)?/y;r.lastIndex=n;let i=r.exec(e)[0];t.push({t:`number`,v:i,at:n}),n+=i.length;continue}if(r===`'`){let r=n+1,i=``;for(;;){if(r>=e.length)throw new lr(`a quoted text is not closed.`,n);if(e[r]===`'`){if(e[r+1]===`'`){i+=`'`,r+=2;continue}break}i+=e[r++]}if([...i].some(e=>e===`\\`||e.charCodeAt(0)<32||e.charCodeAt(0)===127))throw new lr(`a quoted text holds a backslash or a control character, which engines read differently.`,n);t.push({t:`text`,v:i,at:n}),n=r+1;continue}let i=e.slice(n,n+2);if([`!=`,`<>`,`<=`,`>=`].includes(i)){t.push({t:`op`,v:i===`<>`?`!=`:i,at:n}),n+=2;continue}if(`=<>+-*/(),`.includes(r)){t.push({t:`op`,v:r,at:n}),n++;continue}g6.lastIndex=n;let a=g6.exec(e);if(a)t.push({t:`word`,v:a[0],at:n}),n+=a[0].length;else throw new lr(`"${r}" is not part of an expression.`,n)}return t.push({t:`end`,v:``,at:e.length}),t}function u6(e,t){let n=l6(e),r=0,i=()=>n[r],a=e=>i().t===`word`&&i().v.toLowerCase()===e,o=()=>n[r++],s=e=>{if(i().t!==`op`||i().v!==e)throw new lr(`expected "${e}"${i().t===`end`?` before the end`:` at "${i().v}"`}.`,i().at);o()},c=()=>{let e=l();for(;a(`or`);)o(),e={k:`op`,op:`or`,left:e,right:l()};return e},l=()=>{let e=u();for(;a(`and`);)o(),e={k:`op`,op:`and`,left:e,right:u()};return e},u=()=>a(`not`)?(o(),{k:`not`,of:u()}):d(),d=()=>{let e=f();if(a(`is`)){o();let t=a(`not`);if(t&&o(),!a(`empty`))throw new lr(`say "is empty" or "is not empty".`,i().at);return o(),{k:`empty`,of:e,negate:t}}let c=a(`not`)&&n[r+1].t===`word`&&n[r+1].v.toLowerCase()===`in`;if(c||a(`in`)){c&&o(),o(),s(`(`);let a=[];for(;;){let c=i(),l=n[r+1];if(a.push(e.k===`path`&&c.t===`word`&&!m6.has(c.v.toLowerCase())&&!c.v.includes(`.`)&&!t(c.v)&&l.t===`op`&&(l.v===`,`||l.v===`)`)?(o(),{k:`text`,value:c.v}):f()),i().t===`op`&&i().v===`,`)o();else{s(`)`);break}}let l=a.map(t=>({k:`op`,op:`=`,left:e,right:t})).reduce((e,t)=>({k:`op`,op:`or`,left:e,right:t}));return c?{k:`not`,of:l}:l}let l=i();if(l.t===`op`&&[`=`,`!=`,`<`,`<=`,`>`,`>=`].includes(l.v)){o();let a=i(),s=(l.v===`=`||l.v===`!=`)&&e.k===`path`&&a.t===`word`&&!m6.has(a.v.toLowerCase())&&!a.v.includes(`.`)&&!t(a.v)&&(n[r+1].t===`end`||n[r+1].t===`word`||n[r+1].t===`op`&&n[r+1].v===`)`)?(o(),{k:`text`,value:a.v}):f();if(l.v===`=`&&s.k===`path`&&/^null$/i.test(s.path))throw new lr(`"= null" is never true; say "is empty".`,a.at);return{k:`op`,op:l.v,left:e,right:s}}return e},f=()=>{let e=p();for(;i().t===`op`&&(i().v===`+`||i().v===`-`);)e={k:`op`,op:o().v,left:e,right:p()};return e},p=()=>{let e=m();for(;i().t===`op`&&(i().v===`*`||i().v===`/`);)e={k:`op`,op:o().v,left:e,right:m()};return e},m=()=>{if(i().t===`op`&&i().v===`-`)return o(),{k:`neg`,of:m()};let e=h();return i().t===`word`&&Object.hasOwn(h6,i().v.toLowerCase())?{k:`span`,of:e,unit:h6[o().v.toLowerCase()]}:e},h=()=>{let e=o();if(e.t===`number`)return{k:`number`,value:Number(e.v)};if(e.t===`text`)return{k:`text`,value:e.v};if(e.t===`op`&&e.v===`(`){let e=c();return s(`)`),e}if(e.t===`word`){let n=e.v.toLowerCase();if(i().t===`op`&&i().v===`(`){if(!f6(n))throw new lr(`"${e.v}" is not a function; an expression calls ${d6.join(`, `)}.`,e.at);o();let t=[];if(i().t!==`op`||i().v!==`)`)for(;t.push(c()),i().t===`op`&&i().v===`,`;)o();s(`)`);let r=n,a=r===`coalesce`||r===`min`||r===`max`;if(r===`concat`?t.length<1:a?t.length<2:r===`round`?t.length<1||t.length>2:t.length!==1)throw new lr(r===`concat`?`concat(…) takes one text or more: concat(first, ' ', last).`:a?`${r}(…) takes two values or more: ${r}(a, b).`:r===`round`?`round(…) takes a number and, if you like, how many places: round(total) or round(total, 2).`:`${r}(…) takes one number.`,e.at);if(r===`round`&&t[1]&&!(t[1].k===`number`&&Number.isInteger(t[1].value)&&t[1].value<=p6))throw new lr(`round(…)'s places are a whole number from 0 to ${p6}, written out: round(total, 2).`,e.at);return{k:`call`,fn:r,args:t}}if(n===`true`||n===`false`)return{k:`bool`,value:n===`true`};if(n===`today`||n===`now`||n===`me`)return{k:n};if(Object.hasOwn(h6,n)&&t(e.v))return{k:`path`,path:e.v};if([`and`,`or`,`not`,`is`,`empty`,`in`].includes(n)||Object.hasOwn(h6,n))throw new lr(`"${e.v}" stands where a value goes.`,e.at);return{k:`path`,path:e.v}}throw new lr(e.t===`end`?`the expression ends where a value goes.`:`"${e.v}" stands where a value goes.`,e.at)},g=c();if(i().t!==`end`)throw new lr(`"${i().v}" follows a complete expression; join two with "and" or "or".`,i().at);return g}var d6,f6,p6,m6,h6,g6,_6=s((()=>{ur(),d6=[`coalesce`,`round`,`min`,`max`,`abs`,`concat`],f6=e=>d6.includes(e),p6=10,m6=new Set([`today`,`now`,`me`,`true`,`false`]),h6={minute:`minute`,minutes:`minute`,hour:`hour`,hours:`hour`,day:`day`,days:`day`,week:`week`,weeks:`week`,month:`month`,months:`month`,year:`year`,years:`year`},g6=/[A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z_$][A-Za-z0-9_$]*)*/y}));function v6(e,t){let n=10**t,r=Number((Math.abs(e)*n).toPrecision(15)),i=Math.round(r)/n;return i===0?0:Math.sign(e)*i}function y6(e,t,n=e=>{throw new lr(`"${e}" is a column, and this expression reads none.`,0)}){let r=e=>({count:Number(l(e.of)),unit:e.unit}),i=(e,t,n)=>{let r=`day`in e?new Date(`${e.day}T00:00:00Z`):new Date(e.instant),i=t.count*n;if(t.unit===`hour`||t.unit===`minute`)return{instant:new Date(r.getTime()+i*(t.unit===`hour`?36e5:6e4))};if(t.unit===`day`||t.unit===`week`)r.setTime(r.getTime()+i*(t.unit===`week`?7:1)*x6);else{let e=t.unit===`year`?i*12:i,n=r.getUTCDate();r.setUTCDate(1),r.setUTCMonth(r.getUTCMonth()+e);let a=new Date(Date.UTC(r.getUTCFullYear(),r.getUTCMonth()+1,0)).getUTCDate();r.setUTCDate(Math.min(n,a))}return`day`in e?{day:S6(r)}:{instant:r}},a=e=>typeof e==`object`&&!!e,o=e=>`day`in e?Date.parse(`${e.day}T00:00:00Z`):e.instant.getTime(),s=e=>a(e)?o(e):e,c=e=>e===null?null:!!e,l=e=>{switch(e.k){case`number`:return e.value;case`text`:return e.value;case`bool`:return e.value;case`today`:return{day:t.today};case`date`:return{day:e.value};case`now`:return{instant:t.now};case`instant`:return{instant:new Date(e.value)};case`me`:return t.me;case`nobody`:return null;case`not`:{let t=c(l(e.of));return t===null?null:!t}case`neg`:{let t=l(e.of);return t===null?null:-Number(t)}case`empty`:{let t=l(e.of);return(t===null||t===``)!==e.negate}case`span`:return Number(l(e.of));case`call`:{let t=e.args.map(l);if(e.fn===`coalesce`)return t.find(e=>e!==null)??null;if(e.fn===`concat`)return t.map(e=>e===null?``:String(e)).join(``);if(t.some(e=>e===null))return null;if(e.fn===`abs`)return Math.abs(Number(t[0]));if(e.fn===`round`)return v6(Number(t[0]),t[1]===void 0?0:Number(t[1]));let n=t[0];for(let r of t.slice(1)){let[t,i]=[s(r),s(n)];(e.fn===`min`?t<i:t>i)&&(n=r)}return n}case`path`:{let t=n(e.path);return t===void 0||t===``?null:t}case`json`:return b6(n(e.column),e.keys);case`op`:{if(e.op===`and`||e.op===`or`){let t=c(l(e.left)),n=c(l(e.right));return e.op===`and`?t===!1||n===!1?!1:t===null||n===null?null:!0:t===!0||n===!0?!0:t===null||n===null?null:!1}let t=l(e.left),n=l(e.right);if(C6.has(e.op)){if(t===null||n===null)return null;let r=s(t),i=s(n);switch(e.op){case`=`:return r===i;case`!=`:return r!==i;case`<`:return r<i;case`<=`:return r<=i;case`>`:return r>i;default:return r>=i}}if(t===null||n===null)return null;if(e.op===`+`||e.op===`-`){let s=e.op===`+`?1:-1;return a(t)&&a(n)&&e.op===`-`?Math.round((o(t)-o(n))/x6):a(t)&&!a(n)?i(t,e.right.k===`span`?r(e.right):{count:Number(n),unit:`day`},s):a(n)&&!a(t)&&e.op===`+`?i(n,e.left.k===`span`?r(e.left):{count:Number(t),unit:`day`},1):Number(t)+s*Number(n)}return e.op===`*`?Number(t)*Number(n):Number(n)===0?null:Number(t)/Number(n)}}},u=l(e);return u===null&&w6(e)?!1:u}function b6(e,t){let n=e;if(typeof n==`string`)try{n=JSON.parse(n)}catch{return null}for(let e of t){if(typeof n!=`object`||!n||Array.isArray(n)||!Object.hasOwn(n,e))return null;n=n[e]}return n==null?null:typeof n==`object`?JSON.stringify(n):String(n)}var x6,S6,C6,w6,T6=s((()=>{ur(),x6=864e5,S6=e=>e.toISOString().slice(0,10),C6=new Set([`=`,`!=`,`<`,`<=`,`>`,`>=`]),w6=e=>e.k===`not`||e.k===`empty`||e.k===`bool`||e.k===`op`&&(e.op===`and`||e.op===`or`||C6.has(e.op))})),E6=s((()=>{})),D6=l({CommandLive:()=>A6,liveFigures:()=>k6});function O6(e,t){let n=`${[...t].join(`,`)}|${e}`;if(!N6.has(n))try{N6.set(n,u6(e,e=>t.has(e)))}catch{N6.set(n,null)}return N6.get(n)}function k6(e,t,n){let r=new Set(t.filter(e=>e.type===`number`||e.type===`money`).map(e=>e.name)),i=[];for(let[t,a]of Object.entries(e.live??{})){let e=O6(a,r);if(!e)continue;let o=!1,s=y6(e,{today:``,now:new Date,me:null},e=>{let t=P6(n[e]);return t===null&&(o=!0),t});!o&&typeof s==`number`&&Number.isFinite(s)&&i.push([t,s])}return i}function A6({field:e,fields:t,values:n,id:r,currency:i=`USD`}){let a=(0,j6.useMemo)(()=>k6(e,t,n),[e,t,n]),o=t=>new Intl.NumberFormat(Ri(),e.type===`money`?{style:`currency`,currency:i,maximumFractionDigits:Math.abs(t)>=1e3?0:2}:{maximumFractionDigits:2}).format(t);return(0,M6.jsx)(`p`,{id:r,className:`command-live`,"aria-live":`polite`,children:a.map(([e,t],n)=>(0,M6.jsxs)(`span`,{children:[n>0&&` · `,o(t),` `,e]},e))})}var j6,M6,N6,P6,F6=s((()=>{ur(),_6(),T6(),xa(),j6=d(m()),E6(),M6=d(O()),N6=new Map,P6=e=>{if(typeof e==`number`)return Number.isFinite(e)?e:null;if(typeof e!=`string`||!e.trim())return null;let t=Number(e.replace(/[,\s]/g,``));return Number.isFinite(t)?t:null}})),I6=l({bindRecord:()=>Nre,boundText:()=>G6,brokenRules:()=>q6,choiceWhere:()=>J6,draftHolds:()=>K6,draftNames:()=>V6,readsRecord:()=>c8,readsTarget:()=>l8,recordComparisons:()=>o8});function L6(e,t){return e.replace(Wt,(e,n,r,i)=>Rt(t,n,Number(r),i))}function R6(e){switch(e.type){case`number`:case`money`:return`NUMERIC`;case`boolean`:return`BOOLEAN`;case`date`:return`DATE`;case`datetime`:return`TIMESTAMPTZ`;case`choice`:return e.options.length&&e.options.every(e=>typeof e.value==`number`)?`NUMERIC`:`TEXT`;case`text`:case`textarea`:case`month`:case`time`:case`reference`:return`TEXT`;case`choices`:return ln;default:return}}function z6(e){return e.flatMap(e=>{let t=R6(e);return!t||e.type===`text`&&e.sensitive?[]:[{name:e.name,type:t,nullable:!0,primaryKey:!1}]})}function B6(e,t,n=new Date,r){let i=L6(e8(e),i8(n)),a=r8(Y2(i,t,void 0,`record`,!0));if(!r)return a;let o=z6(r),s=new Set(o.map(e=>e.name));for(let e of a.flat())for(let t of[e.field,...e.other===void 0?[]:[e.other]])s.has(t)||(s.add(t),o.push({name:e8(t),type:``,nullable:!0,primaryKey:!1}));try{return r8(Y2(i,t,o,`record`,!0))}catch{return a}}function V6(e,t){let n=new Set,r=new Set,i=new Set,a=new Set,o=new Set,s=e.replace(/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/g,`""`);for(let c of B6(e,t).flat()){if(c.operator===`has`&&(c.field.startsWith(Y6)||c.field.startsWith(X6)||c.field.includes(`.`)))throw Error(`${t}: "${t8(c.field)} has …" asks a field of the input; has reads the several answers of a choices field.`);for(let e of[c.field,...c.other===void 0?[]:[c.other]])if(e.startsWith(Y6)){let n=e.slice(7);if(n.split(`.`).length>3)throw Error(`${t}: "${e}" follows more than 2 references; read a nearer column, or judge it in the handler.`);r.add(n)}else if(e.startsWith(X6))i.add(e.slice(7));else if(e.includes(`.`))throw Error(`${t}: "${e}" is a path; a condition here names a field of the input, record.<column> for the record's own, or tenant.<column>.`);else n.add(e),(c.operator===`has`?a:o).add(e);let e=c.other??c.values.find(e=>n8(e)!==void 0||typeof e==`string`&&e.startsWith(Y6)&&RegExp(`(?<![\\w.])${e.replace(/\./g,`\\.`)}(?![\\w.])`).test(s));if(c.field.startsWith(X6)&&e!==void 0)throw Error(`${t}: "${c.field}" is compared with "${t8(e)}"; compare a tenant's value with a literal.`);for(let e of c.values){let n=n8(e);if(n!==void 0){if(!c.field.startsWith(Y6))throw Error(`${t}: "tenant.${n}" is compared with "${c.field}"; the browser is never told a tenant's value, so compare it with a record part (record.<column>) or a literal.`);i.add(n)}}}return{fields:[...n],record:[...r],tenant:[...i],has:[...a],plain:[...o]}}function H6(e,t){return e.map(e=>e.map(e=>e.operator!==`has`&&e.other===void 0&&e.values.length===1&&typeof e.values[0]==`string`&&t.has(e.values[0])&&e.values[0]!==e.field?{field:e.field,operator:e.operator,values:[],other:e.values[0]}:e))}function U6(e){let t=e.field.startsWith(Y6)?e.field.slice(7):e.field;return e.operator===`has`?`${t} has (${e.values.map(a8).join(`, `)})`:e.other===void 0?e.values.length===1&&e.values[0]===null?`${t} ${e.operator===`ne`?`is not empty`:`is empty`}`:e.values.length>1?`${t} in (${e.values.map(a8).join(`, `)})`:`${t} ${{eq:`=`,ne:`!=`,lt:`<`,lte:`<=`,gt:`>`,gte:`>=`}[e.operator]} ${a8(e.values[0])}`:`${t} ${{eq:`=`,ne:`!=`,lt:`<`,lte:`<=`,gt:`>`,gte:`>=`}[e.operator]} ${e.other}`}function W6(e,t){let n=e.field.slice(7),r=t?.[n];if(r===void 0)return!1;if(d8(e))return r===null==(e.operator===`eq`);if(r===null)return!1;let i=[{name:e.field,type:s8(r),nullable:!0,primaryKey:!1}];return a4([[e]],{[e.field]:r},i)===!0}async function Nre(e,t,n,r=new Date,i,a){let o=[];for(let s of B6(e,t,r,i)){let e=[],t=!0;for(let r of s){let i=r.field.startsWith(Y6)?await n(U6(r)):r.field.startsWith(X6)?W6(r,a):void 0;if(i===void 0)e.push(r);else if(!i){t=!1;break}}t&&o.push(e)}return o}function G6(e){return e.length?e.some(e=>!e.length)?!0:e.map(e=>e.map(U6).join(` and `)).join(` or `):!1}function K6(e,t,n,r=new Date){let i=z6(n),a=new Set(i.map(e=>e.name)),o=H6(typeof e==`string`?B6(e,`Condition`,r,n):e,a);if(!o.length)return!1;if(o.some(e=>!e.length))return!0;let s=Object.fromEntries(i.map(e=>[e.name,u8(t[e.name])?null:t[e.name]])),c=e=>!d8(e)&&[e.field,...e.other===void 0?[]:[e.other]].some(e=>s[e]===null)?!1:a4([[e]],s,i)===!0;return o.some(e=>e.every(c))}function q6(e,t,n,r=new Date){let i=[];for(let a of e)V6(a.must,`Rule`).fields.some(e=>t[e]===void 0||t[e]===null||t[e]===``)||a.when!==void 0&&!K6(a.when,t,n,r)||K6(a.must,t,n,r)||i.push({field:f8(a),message:a.message});return i}function J6(e,t,n){let r=e.replace(h8,(e,t,r)=>t!==void 0||r===void 0||m8.has(r.toLowerCase())||!n.has(r)?e:`${p8}${r}`),i=e=>typeof e==`string`&&e.startsWith(p8)?e.slice(10):void 0,a;try{a=Y2(r,t)}catch(e){throw Error(e.message.split(p8).join(``))}let o=new Set,s=new Set;for(let[,t,r]of e.matchAll(h8))t===void 0?r!==void 0&&!m8.has(r.toLowerCase())&&!n.has(r)&&o.add(r):s.add(t.slice(1,-1));for(let e of a.flat())for(let n of e.values)if(typeof n==`string`&&o.has(n)&&!s.has(n))throw Error(`${t}: compares ${i(e.field)??e.field} with "${n}", which is no input of the form; a column is compared with an answer or a value, and text is written in quotes ("${n}")`);return a.map(e=>e.map(e=>{let n=i(e.field)??e.field;if(e.operator===`has`)throw Error(`${t}: "has" asks a list of choices the form answers; a where compares a column of the table with =, !=, <, <=, >, >= or in`);let r=e.values.map(e=>{let t=i(e);return t===void 0?e:{answer:t}});return{column:n,operator:e.operator,values:r}}))}var Y6,X6,Z6,Q6,$6,e8,t8,n8,r8,i8,a8,o8,s8,c8,l8,u8,d8,f8,p8,m8,h8,g8=s((()=>{un(),d4(),sr(),Kt(),ui(),Y6=`record.`,X6=`tenant.`,Z6=`__via__`,Q6=`tenant${Z6}`,$6=/("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')|(?<![\w.])record\.([A-Za-z_]\w*(?:\.[A-Za-z_]\w*)+)|(?<![\w.])tenant\.([A-Za-z_]\w*)(?![\w.])/g,e8=e=>e.replace($6,(e,t,n,r)=>t===void 0?n===void 0?`${Q6}${r}`:`${Y6}${n.split(`.`).join(Z6)}`:e),t8=e=>e.startsWith(Q6)?`${X6}${e.slice(Q6.length)}`:e.split(Z6).join(`.`),n8=e=>typeof e==`string`&&e.startsWith(Q6)?e.slice(Q6.length):void 0,r8=e=>e.map(e=>e.map(e=>({...e,field:t8(e.field),...e.other===void 0?{}:{other:t8(e.other)}}))),i8=e=>e.toISOString().slice(0,10),a8=e=>{let t=n8(e);return t===void 0?wn(e):`${X6}${t}`},o8=e=>B6(e,`Condition`).flat().filter(e=>e.field.startsWith(Y6)).map(U6),s8=e=>typeof e==`boolean`?`BOOLEAN`:typeof e==`number`?`NUMERIC`:/^\d{4}-\d{2}-\d{2}$/.test(String(e))?`DATE`:`TEXT`,c8=e=>B6(e,`Condition`).flat().some(e=>e.field.startsWith(Y6)||e.field.startsWith(X6)),l8=e=>B6(e,`Condition`).flat().some(e=>e.field.startsWith(Y6)),u8=e=>e==null||e===``,d8=e=>e.other===void 0&&e.values.length===1&&e.values[0]===null,f8=e=>V6(e.must,`Rule`).fields[0],p8=`__answer__`,m8=new Set([`and`,`or`,`not`,`in`,`is`,`empty`,`null`,`true`,`false`,`yes`,`no`,`today`,`me`]),h8=/("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')|(?<![\w.])([A-Za-z_]\w*)(?![\w.])/g}));function _8(e,t,n){let r=e.columns.find(e=>e.name===t);if(!r)return`shape`;let i=typeof n==`string`?n.trim():n;if(gt(r))return typeof i==`boolean`?{value:i}:i===1||i===`true`||i===`1`?{value:!0}:i===0||i===`false`||i===`0`?{value:!1}:`type`;if(r.allowed?.length)return r.allowed.includes(String(i))?{value:String(i)}:`choice`;let a=ht(r.type);if(a===`number`){let e=typeof i==`number`?i:typeof i==`string`&&/^-?\d+(\.\d+)?$/.test(i)?Number(i):NaN;return Number.isFinite(e)?{value:e}:`type`}return typeof i==`string`?a===`date`?Hr(i)||Wr(i)!==void 0?{value:i}:`type`:{value:i}:`type`}var v8=s((()=>{ui(),St()}));function y8(e){let t=e.via.lastIndexOf(`.`),n=e.via.slice(t+1);return t<0||n.includes(`+`)?void 0:{table:e.via.slice(0,t),column:n}}function b8(e,t,n,r,i){let a={today:new Date().toISOString().slice(0,10),now:new Date,me:null},o=new Map,s=(e,t,n,r)=>r?y6(r.expr,a,n=>o4(e,n,t[n])):o4(e,n,t[n]),c=n=>{if(o.has(n))return o.get(n);o.set(n,null);let l=null,u=t.rollups?.[n],d=t.computed?.[n];if(u){let t=y8(u),n=t&<(e,t.table),r=(n&&i[n.id])??[];if(n&&!u.of&&!u.filter&&u.fn!==`latest`){let e=r.map(e=>s(n,e,u.column??``,u.expression)).filter(e=>typeof e==`number`&&Number.isFinite(e));l=u.fn===`count`?r.length:u.fn===`sum`?e.reduce((e,t)=>e+t,0):e.length?u.fn===`avg`?e.reduce((e,t)=>e+t,0)/e.length:u.fn===`min`?Math.min(...e):Math.max(...e):null}}else d&&(l=y6(d.expr,a,e=>t.rollups?.[e]||t.computed?.[e]?c(e):o4(t,e,r[e])));return o.set(n,l),l};return Object.fromEntries(n.filter(e=>t.rollups?.[e]||t.computed?.[e]).map(e=>[e,c(e)]))}var Pre=s((()=>{ur(),T6(),St(),d4()}));function Fre(e,t){return!!(e?.primaryKey||e?.references||e?.identifier||C8.test(e?.sourceName??t))}function Ire(e,t,n){let r=n.map(e=>e[t]).filter(e=>e!=null),i=ht(e?.type),a={align:`left`,kind:i,mono:!1},o=r.length>0&&r.every(e=>typeof e==`number`);if(i===`boolean`||e?.flag===!0||o&&x8.test(e?.sourceName??t)&&r.every(e=>e===0||e===1))return{...a,kind:`boolean`,align:`center`};if(i===`number`||o){let t=!!(e?.primaryKey||e?.references||e?.identifier),n=t?0:Math.min(e?.places??6,Math.max(0,...r.map(Lre))),i=!t&&r.some(e=>Math.abs(Number(e))>=1e4);return{...a,kind:`number`,align:`right`,decimals:n,group:i,identifier:t}}if(i===`date`||r.length&&r.every(e=>typeof e==`string`&&S8.test(e))){let e=r.some(e=>/[ T]\d{2}:\d{2}/.test(String(e))&&!/[ T]00:00:00(\.0+)?$/.test(String(e)));return{...a,kind:`date`,mono:!0,showTime:e}}let s=Math.max(0,...r.map(e=>String(e).length));return{...a,kind:`text`,mono:s<=12&&r.length>0,idLike:Fre(e,t)}}function Lre(e){let t=String(e),n=t.indexOf(`.`);return n===-1?0:Math.min(6,t.length-n-1)}var x8,S8,C8,Rre=s((()=>{St(),x8=/^(is|has|can|should|was)_|_(flag|enabled|disabled)$|^(active|enabled|disabled|deleted|archived|verified|published|visible|locked|hidden|default|primary|required|readonly)$/i,S8=/^\d{4}-\d{2}-\d{2}([ T]\d{2}:\d{2}(:\d{2})?)?/,C8=/(^|_)(id|uuid|code|sku|vin|ref|key|token|serial|number|no|hash|slug)$/i}));function w8(e,t){return Ire(e,e?.name??``,t?[t]:[]).kind===`boolean`?/bool/i.test(e?.type??``)?{yes:`true`,no:`false`}:{yes:`1`,no:`0`}:null}var T8=s((()=>{tc(),Rre(),h$()}));function zre(e){let t=new Set;return e.flatMap(e=>[...typeof e?.field==`string`?[{field:e.field,message:e.message}]:[],...Array.isArray(e?.fields)?e.fields:[]]).flatMap(e=>typeof e?.field!=`string`||!/^[^\s.\x00-\x1f\x7f]{1,256}(?:\.[A-Za-z_][A-Za-z0-9_]{0,127})?$/u.test(e.field)||typeof e.message!=`string`||!e.message.trim()||e.message.length>256||t.has(e.field)?[]:(t.add(e.field),[{field:e.field,message:e.message}]))}var Bre=s((()=>{})),E8,Vre=s((()=>{Ya(),E8=Va({updateNotConfirmedTheRecord:`Update not confirmed. The record may already have changed. Check the stored values before editing again.`,anUpdateIsAlready:`An update is already pending for this record.`,theRequestMayStill:`The request may still complete.`,theServerDidNotAcknowledge:`The server did not acknowledge exactly the requested fields on one record.`})}));function Hre(e,t){if(!k8(e)||e.affected!==1||!k8(e.applied)||e.outcome!==void 0&&e.outcome!==`applied`)return;let n=e.applied;if(Object.keys(t).every(e=>Object.hasOwn(n,e))&&Object.values(n).every(e=>e===null||typeof e==`string`||typeof e==`boolean`||typeof e==`number`&&Number.isFinite(e)))return n}function Ure(e=()=>!1){let t=new Map,n=new Set,r=0,i=0,a=()=>{r++;for(let e of n)e()},o=e=>t.get(O8(e));return{get:o,run:async(n,r,s)=>{let c=i,l=e(),u=O8(n);if(t.has(u))return{kind:`blocked`,message:o(n).message||E8(`anUpdateIsAlready`)};let d={...r},f=l?Mi().mutations.start(`update`):void 0;t.set(u,{phase:`pending`,values:d,message:``}),a();let p=e=>{Mi().mutations.unknown(f);let n=D8;return c===i&&(t.set(u,{phase:`uncertain`,values:d,message:n,detail:e}),a()),{kind:`uncertain`,message:n}},m=(e,n=[])=>(Mi().mutations.settle(f),c===i&&(t.delete(u),a()),{kind:`rejected`,message:e,...n.length?{fields:n}:{}}),h=setTimeout(()=>p(E8(`theRequestMayStill`)),3e4),g;try{g=await s()}catch(e){let t=k8(e)?e.status:void 0,n=k8(e)?e.outcome:void 0,r=e instanceof Error?e.message:String(e);return n!==`unknown`&&(n===`rejected`||n===`not_applied`||!l&&typeof t==`number`&&[400,401,403,404,409,422,501].includes(t))?m(r):p(r)}finally{clearTimeout(h)}if(k8(g)&&Array.isArray(g.errors)){let e=k8(g.errors[0])&&typeof g.errors[0].message==`string`?g.errors[0].message:``;return e&&g.outcome===`rejected`?m(e,zre(g.errors.filter(k8))):p(e)}let _=Hre(g,d);if(!_)return p(E8(`theServerDidNotAcknowledge`));Mi().mutations.settle(f),c===i&&(t.delete(u),a());let v=k8(g)?Po(g.undoId,l):void 0;return{kind:`applied`,applied:_,...v===void 0?{}:{undoId:v}}},reset:()=>{i++,t.clear(),a()},hasUnresolved:()=>t.size>0,version:()=>r,subscribe:e=>(n.add(e),()=>{n.delete(e)})}}var D8,O8,k8,A8,Wre=s((()=>{wo(),Fo(),Li(),Bre(),Vre(),Pa(),D8=E8(`updateNotConfirmedTheRecord`),O8=e=>JSON.stringify([e.connection,e.table,Object.keys(e.key).sort().map(t=>[t,String(e.key[t])])]),k8=e=>!!e&&typeof e==`object`&&!Array.isArray(e),A8=Ure(()=>So().tenantRequired===!0),mo(()=>A8.reset()),Ea(window,`beforeunload`,e=>{A8.hasUnresolved()&&(e.preventDefault(),e.returnValue=``)})})),Gre=s((()=>{Ya()})),Kre=s((()=>{Gre()})),qre=s((()=>{Ya()})),Jre=s((()=>{qre()}));function Yre(e,t){let n=typeof e==`number`?Number.isFinite(e)?String(e):``:e.trim(),r=/^([-+]?)(\d*)(?:\.(\d*))?$/.exec(n);if(!r||!r[2]&&!r[3])return;let i=D3(t),a=(r[3]??``).replace(/0+$/,``);if(a.length>i)return;let o=`${r[2]}${a.padEnd(i,`0`)}`.replace(/^0+(?=\d)/,``)||`0`;return r[1]===`-`&&o!==`0`?`-${o}`:o}function Xre(e,t){let n=Yre(e,t);if(n===void 0)return;let r=Number(n);return Number.isSafeInteger(r)?r:void 0}var Zre=s((()=>{N3()})),Qre=s((()=>{Ya()}));function j8(e,t){return e==null||e===``?``:O3(e,t)??e}function M8(e,t){if(e.trim()===``)return``;let n=Xre(e,t);return n===void 0?e:String(n)}function N8({value:e,currency:t,onChange:n,children:r}){let[i,a]=(0,P8.useState)(()=>j8(e,t));return(0,P8.useEffect)(()=>{M8(i,t)!==e&&a(j8(e,t))},[e,t]),(0,F8.jsx)(F8.Fragment,{children:r(i,e=>{a(e),n(M8(e,t))})})}var P8,F8,I8=s((()=>{P8=d(m(),1),N3(),Zre(),Qre(),F8=d(O(),1)})),$re=s((()=>{Ya()}));function L8(e,t){return e&&Object.hasOwn(e.resources,t)?e.resources[t]:void 0}var eie=s((()=>{$re()})),R8,tie=s((()=>{Ya(),R8=Va({remove:`Remove {shownLabel}`,choose:`Choose {name}`,search:`Search {name}…`,nothingToChoose:`Nothing to choose from.`})}));function nie(e){let t=Zs(e);if(t?.startsWith(`$`))return;let n=L8(Mi().app(),e.id)?.display;return y4(Gs.schema??void 0,e,t,n)}async function rie(e,t,n=pt(e)[0],r=Gs.activeConnection,i=``,a=[],o){let s=Zs(e)??n,c=n;if(!c)return[];let l=o&&o.path!==c?[o.path]:[],u=[i,t?`${s} contains ${JSON.stringify(t)}`:``].filter(Boolean).join(` and `);return((await Ns(`/api/run`,{q:[e.id,u,`show ${[...new Set([s,c,...pt(e),...a,...l])].join(`, `)}`,`sort ${s}`].filter(Boolean).join(` `),limit:U8,offset:0,count:`none`,...ao(r)})).rows??[]).map(t=>({value:String(t[c]),label:Qs(e)===void 0?String(t[s]??t[c]):Ls(e,t),...a.length?{row:t}:{},...l.length&&b4(t[l[0]])?{sub:b4(t[l[0]])}:{}}))}function z8(e){return e.editing?(0,H8.jsx)(iie,{...e}):(0,H8.jsx)(B8,{...e})}function iie(e){let t=(0,V8.useSyncExternalStore)(mo,So,So),n=JSON.stringify([t.epoch,Gs.activeConnection,e.table.id,e.valueColumn??pt(e.table)[0],Zs(e.table)]);return(0,H8.jsx)(B8,{...e,scope:n},n)}function B8(e){let{table:t,ariaLabel:n,placeholder:r,app:i,inputRef:a}=e,o=e.editing,s=Gs.activeConnection,c=e.valueColumn??pt(t)[0],l=e.face?void 0:nie(t),u=e.multiple===!0?e.value:e.value?[e.value]:[],[d,f]=(0,V8.useState)(new Map),[p,m]=(0,V8.useState)(new Map),h=e.multiple===!0?void 0:e.known,g=e=>d.get(e)??(h?.value===e?h.label:void 0)??e,[_,v]=(0,V8.useState)(()=>e.multiple!==!0&&e.value?g(e.value):``),[y,b]=(0,V8.useState)(null),x=o&&typeof e.value==`string`?y??(e.value?g(e.value):``):_,S=o&&typeof e.value==`string`?y??``:_,[C,w]=(0,V8.useState)(``),[T,E]=(0,V8.useState)(!1),D=JSON.stringify(u),O=(0,V8.useRef)(D),k=(0,V8.useRef)(null),[A,j]=(0,V8.useState)(D);o&&A!==D&&(j(D),k.current!==D&&(b(null),E(!1),w(``),f(new Map)),k.current=null);let M=!!(o&&y!==null),N=(0,V8.useRef)(null);(0,V8.useLayoutEffect)(()=>{o&&(N.current?.unresolvedReference!==M||N.current?.open!==T)&&(N.current={unresolvedReference:M,open:T},o.onStateChange(N.current))});let P=(0,V8.useRef)(null),F=(0,V8.useRef)(null);(0,V8.useEffect)(()=>{f(new Map)},[s,t.id,c]);let I=e=>{F.current=e,typeof a==`function`?a(e):a&&(a.current=e)};(0,V8.useEffect)(()=>{let e=setTimeout(()=>w(x.trim()),150);return()=>clearTimeout(e)},[x]);let L=OJ({queryKey:[`picker`,s,t.id,c,C,e.scope,o?D:void 0,Zs(t),Qs(t),e.where??``,e.face?.columns.join(),l?.path],queryFn:()=>rie(t,C,c,s,e.where,e.face?.columns,e.face?void 0:l),enabled:T&&!e.disabled,placeholderData:(n,r)=>r&&r.queryKey[1]===s&&r.queryKey[2]===t.id&&r.queryKey[3]===c&&r.queryKey[5]===e.scope&&(!o||r.queryKey[6]===D)&&r.queryKey[7]===Zs(t)&&r.queryKey[8]===Qs(t)&&r.queryKey[9]===(e.where??``)?n:void 0}),{choices:R,answered:z}=z2({typed:S,asked:C,placeholder:L.isPlaceholderData,rows:L.data,label:e=>e.label}),B=OJ({queryKey:[`picker-labels`,s,t.id,c,u,e.scope,Zs(t),Qs(t),l?.path],enabled:!!(c&&u.length),queryFn:async()=>{let n=Zs(t)??c,r=[...new Set([c,n,...pt(t),...e.multiple&&l?[l.path]:[]])];return((r.some(e=>e.includes(`.`))||n.startsWith(`$`)?await Ns(`/api/view/run`,{...ao(s),view:{id:`picker:${t.id}`,name:``,base:t.id,columns:r.map(e=>({path:e})),filter:{groups:[[{path:c,op:`in`,value:u}]]},limit:u.length}}):await Ns(`/api/query`,{...ao(s),table:t.id,columns:r,filter:{groups:[[{column:c,op:`in`,value:u}]]},limit:u.length,offset:0})).rows??[]).map(r=>({value:String(r[c]),label:Qs(t)===void 0?String(r[n]??r[c]):Ls(t,r),...e.multiple&&l&&b4(r[l.path])?{sub:b4(r[l.path])}:{}}))}});(0,V8.useEffect)(()=>{B.data&&f(e=>new Map([...e,...B.data.map(e=>[e.value,e.label])])),B.data?.some(e=>e.sub)&&m(e=>new Map([...e,...B.data.flatMap(e=>e.sub?[[e.value,e.sub]]:[])]))},[B.data]),(0,V8.useEffect)(()=>{if(o)return;let t=O.current!==D;O.current=D;let n=k.current===D;n&&(k.current=null),e.multiple!==!0&&(!T&&!n||t&&!n)&&v(e.value?g(e.value):``)},[D,d,T]);let V=t=>{k.current=JSON.stringify(t),e.multiple===!0?e.onChange(t):e.onChange(t[0]??``)},H=t=>{f(e=>new Map(e).set(t.value,t.label)),t.sub&&m(e=>new Map(e).set(t.value,t.sub)),e.multiple?(V(u.includes(t.value)?u.filter(e=>e!==t.value):[...u,t.value]),v(``)):(b(null),V([t.value]),v(t.label),E(!1))},U=e=>{V(u.filter(t=>t!==e)),F.current?.focus()},W=()=>{b(null),V([]),v(``),F.current?.focus()},G=e=>d.get(e)??e,ee=x4(R.map(e=>e.label)),te=e=>e.sub&&(l?.declared||ee.has(e.label))?e.sub:void 0,ne=x4(u.map(G)),K=e=>ne.has(G(e))&&p.get(e)?`${G(e)} · ${p.get(e)}`:G(e);return(0,H8.jsxs)(`div`,{className:`picker${e.multiple?` picker-multi`:``}`,ref:P,onKeyDownCapture:e=>{o&&T&&e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),o.onCancel?.(),b(null),E(!1))},children:[(0,H8.jsx)(`span`,{className:`picker-chips`,children:e.multiple&&u.map(e=>(0,H8.jsxs)(`span`,{className:`picker-chip`,children:[(0,H8.jsx)(`span`,{children:K(e)}),(0,H8.jsx)(`button`,{type:`button`,className:`picker-chip-x`,"aria-label":R8(`remove`,{shownLabel:K(e)}),onClick:()=>U(e),children:`×`})]},e))}),(0,H8.jsx)(L2,{text:x,onText:t=>{o?b(t):v(t),E(!0),!o&&!e.multiple&&u.length&&V([])},open:T,onOpenChange:E,items:R,itemKey:e=>e.value,itemLabel:e=>e.label,itemClassName:(e,t)=>`picker-option${t?` active`:``}${u.includes(e.value)?` chosen`:``}`,renderItem:t=>e.face&&t.row?e.face.draw(t.row,t.label,R.flatMap(e=>e.row?[e.row]:[])):(0,H8.jsxs)(H8.Fragment,{children:[te(t)?(0,H8.jsxs)(`span`,{className:`picker-option-name`,children:[(0,H8.jsx)(`span`,{className:`picker-option-label`,children:t.label}),(0,H8.jsx)(`span`,{className:`picker-option-sub`,children:te(t)})]}):(0,H8.jsx)(`span`,{className:`picker-option-label`,children:t.label}),!e.hideKey&&t.label!==t.value&&(0,H8.jsx)(`span`,{className:`picker-option-detail`,children:t.value})]}),onPick:H,inputRef:I,popupRef:o?.popupRef,anchorRef:P,fit:`width`,inputProps:{type:`text`,className:`picker-input`,"aria-label":n??R8(`choose`,{name:mr(t.name)}),placeholder:r??(i?R8(`search`,{name:(L8(Mi().app(),t.id)?.noun?.one??mr(t.name)).toLowerCase()}):`→ ${t.name}`),autoComplete:`off`,spellCheck:!1,...e.disabled?{disabled:!0}:{},...e.invalid?{"aria-invalid":!0}:{},...e.describedBy?{"aria-describedby":e.describedBy}:{},onKeyDown:t=>{o&&t.key===`Escape`&&t.preventBaseUIHandler?.(),t.key===`Backspace`&&e.multiple&&!x&&u.length&&V(u.slice(0,-1))}},popupClassName:`picker-popup`,listClassName:`picker-list`,empty:L.isPending||!z?void 0:R8(x?`common.nothingMatches`:`nothingToChoose`),emptyClassName:`picker-empty`}),(0,H8.jsx)(`button`,{type:`button`,className:`picker-clear`,"aria-label":R8(`common.clear`),hidden:u.length===0&&!M,onClick:W,children:`×`})]})}var V8,H8,U8,W8=s((()=>{uo(),V8=d(m(),1),kJ(),tc(),R2(),B2(),St(),br(),Li(),eie(),T4(),wo(),tie(),H8=d(O(),1),U8=20}));function aie(e){return/[^aeiou]ies$/i.test(e)?`${e.slice(0,-3)}${e.at(-3)===`I`?`Y`:`y`}`:/(x|ch|sh|ss|z)es$/i.test(e)?e.slice(0,-2):e.slice(0,-1)}function oie(e){if(K8.test(e))return e.slice(0,-1);if(q8.test(e)&&!/(ss|us|is)$/i.test(e)&&/[aeiouy]/i.test(e.slice(0,-1)))return aie(e)}function sie(e,t){return G8.test(e)?oie(t)??t:t}var G8,K8,q8,cie=s((()=>{G8=/^[-−]?1$/,K8=/^(second|minute|hour|day|night|week|month|year)s$/i,q8=/^(?=[a-z]*[aeiouy][a-z]*s$)[a-z]{3,}s$/i})),J8,lie=s((()=>{Ya(),J8=Va({textOfMax:`{text} of {max}`,starsOf:`{stars} of {outOf} stars`,signed:`Signed`})}));function Y8(e,t){return e.whole?Ki(t,e.currency):Gi(t,e.currency)}function X8(e,t){return gr(e,t)}function uie(e,t){let n=(t,n)=>[t,...n].map(t=>e?.values&&Object.hasOwn(e.values,t)?e.values[t]:void 0).find(Boolean);return{yes:n(t.yes,n5.yes),no:n(t.no,n5.no)}}function Z8(e,t){return t?t===`%`?Ji(e):t.startsWith(`/`)?`${e}${t}`:`${e} ${sie(e,t)}`:e}function Q8(e,t,n){if(!e.tone)return null;let r=Object.hasOwn(e.tone,n)?e.tone[n]:void 0;if(r)return r;let i=Object.hasOwn(e.tone,`*`)?e.tone[`*`]:n.trim()?`neutral`:null,a=Number(t);if(!Number.isFinite(a))return die(e.tone,n)??i;for(let[t,n]of Object.entries(e.tone)){let e=/^(>=|<=|>|<)\s*(-?\d+(?:\.\d+)?)$/.exec(t);if(!e)continue;let r=Number(e[2]);if(e[1]===`>=`?a>=r:e[1]===`<=`?a<=r:e[1]===`>`?a>r:a<r)return n}return i}function die(e,t){let n=Object.keys(e).filter(e=>/^[<>]/.test(e));if(!n.length)return null;let r=sa(t);if(r===null)return null;let i=oa();for(let t of n){let n=Bt(t);if(n&&Vt(n,r,i))return e[t]}return null}function fie(e,t){if(!e||t==null||t===``)return;if(e.masked===!0)return yr;let n=e.masked?.prefix;return n&&String(t).startsWith(n)?`${n}${yr}`:void 0}function pie(e){return e.trim().split(/[\s._-]+/).filter(e=>/[\p{L}\p{N}]/u.test(e)).slice(0,2).map(e=>[...e.replace(/[^\p{L}\p{N}]/gu,``)][0]??``).join(``).toUpperCase()||`?`}function mie(e,t){let n=e<0?`−`:``,r=Math.round(Math.abs(e)),i=[];for(let[e,t,n]of r5){let a=Math.floor(r/t);if(r-=a*t,a&&i.length<2)i.push({unit:e,count:a,mark:n});else if(i.length)break}i.length||i.push({unit:`seconds`,count:0,mark:`s`});let a=Intl.DurationFormat;if(a)try{return n+new a(t,{style:`narrow`}).format(Object.fromEntries(i.map(({unit:e,count:t})=>[e,t])))}catch{}return n+i.map(({count:e,mark:t})=>`${e}${t}`).join(` `)}function hie(e){let t=0;for(let n of e)t=t*31+(n.codePointAt(0)??0)>>>0;return t%8}function gie(e){let t=e;if(typeof e==`string`&&e.trim().startsWith(`[`))try{t=JSON.parse(e)}catch{t=e}return(Array.isArray(t)?t.map(e=>e==null?``:String(e)):String(t).split(/\r?\n|,/)).map(e=>e.trim()).filter(Boolean)}function _ie(e,t){let n=Object.keys(e.values??{}).find(e=>e.trim()!==``&&Number(e)===t);return n===void 0?void 0:e.values?.[n]}function $8(e,t){return e.icons&&Object.hasOwn(e.icons,t)?e.icons[t]:void 0}function vie(e,t){if(!e||t==null)return null;let n=fie(e,t);if(n!==void 0)return{kind:`masked`,text:n};if(e.format===`avatars`){let e=gie(t);return e.length?{kind:`avatars`,names:e.slice(0,i5),more:Math.max(0,e.length-i5),text:e.join(`, `)}:null}e.minor&&e.format===`money`&&(t=k3(t,e.currency||Hi())??t);let r=String(t);if(e.signature&&typeof e.signature==`object`&&r.trim())return{kind:`signature`,src:kr(e.signature.table,{[e.signature.key]:r}),text:J8(`signed`)};let i=xie(e,t,r);if(i!==void 0)return i;let a=Q8(e,t,r),o=Number(t);if(e.bar&&e.max!==void 0&&e.format!==`percent`&&Number.isFinite(o)&&Number.isSafeInteger(Math.trunc(o)))return{kind:`meter`,text:e.format===`money`?Y8(e,o):Wi(o),fill:Math.max(0,Math.min(100,o/e.max*100)),tone:a,title:J8(`textOfMax`,{text:r,max:e.max})};let s=Number.isFinite(o)&&Number.isSafeInteger(Math.trunc(o))||e.format===`money`&&t5(t),c=a?!s||r.trim()===``?!1:e.format===`money`||e.format===`percent`||e.format===`number`||!!e.unit:!1;if(a&&!(c&&a===`neutral`)){let n=!s||r.trim()===``?null:e.format===`money`?Z8(Y8(e,typeof t==`string`?r:o),e.unit):e.format===`percent`?qi(o):e.format===`number`||e.unit?Z8(Wi(o),e.unit):null,i=$8(e,r);return{kind:`tone`,tone:a,text:r,label:n??X8(e,r)??yie(e,t,r)??hr(r),...i?{icon:i}:{},...n===null?{}:{figure:!0}}}let l=$8(e,r);if(l)return{kind:`mark`,icon:l,text:r,label:X8(e,r)??hr(r)};let u=e.format===void 0&&!e.bar&&!e.avatar?X8(e,r):void 0;if(u!==void 0)return{kind:`word`,text:r,label:u};let d=(e.format===`money`||e.format===`number`||e.format===`percent`)&&s&&r.trim()?_ie(e,o):void 0;if(d!==void 0)return{kind:`word`,text:r,label:d};if(e.format===`money`&&s)return{kind:`money`,text:Z8(Y8(e,typeof t==`string`?r:o),e.unit),title:r};if(e.format===`percent`&&s){let t=qi(o),n=Math.max(0,Math.min(100,o));return e.bar?{kind:`percent`,text:t,bar:n}:e.ring?{kind:`percent`,text:t,ring:n}:{kind:`percent`,text:t}}if((e.format===`number`||e.format===void 0&&e.unit)&&s&&r.trim()!==``)return{kind:`number`,text:Z8(Wi(o),e.unit),title:r};if(e.format===`duration`&&s)return{kind:`number`,text:mie(o,Ri()),title:`${r} s`};if(e.format===`richText`)return{kind:`richText`,html:r,text:Mr(r)};if(e.format===`items`){let e=r.split(/\r?\n/).map(e=>e.trim()).filter(Boolean);if(e.length)return{kind:`items`,items:e,text:e.join(`, `)}}if(e.format===`relative`){let t=e5(e,r),n=sa(r),i=e.open===!0&&n!==null&&n<0?{overdue:!0}:{};if(t)return{kind:`relative`,...t,...i}}return e.avatar&&r.trim()?{kind:`avatar`,text:r,initials:pie(r),hue:hie(r)}:null}function e5(e,t){let n=aa(t);if(!n)return null;let r=sa(t);return r!==null&&(e.absolute||Math.abs(r)>14)?{text:Qi(t),title:n}:{text:n,title:t}}function yie(e,t,n){if(typeof t!=`string`||!a5.test(n.trim()))return;if(e.format===`relative`)return e5(e,n.trim())?.text;if(e.format!==void 0)return;let r=bie(n.trim()).text;return r===n?void 0:r}function bie(e){let t=/[ T]00:00(:00(\.0+)?)?$/.test(e),n=ka().classList.contains(`app-mode`)?ca(e,!t):null;if(n)return{text:n.text,title:n.title};let r=t?Qi(e):$i(e);return{text:r,title:r===e?void 0:e}}function xie(e,t,n){switch(e.format){case`rating`:{let r=e.outOf??5,i=Number(t);if(n.trim()===``||!Number.isFinite(i))return null;let a=Math.max(0,Math.min(r,Math.round(i)));return{kind:`rating`,value:a,outOf:r,tone:Q8(e,t,n),text:J8(`starsOf`,{stars:a,outOf:r})}}case`color`:return o5.test(n.trim())?{kind:`color`,hex:n.trim().toLowerCase(),text:n.trim()}:null;case`time`:{let e=s5.exec(n.trim());return!e||Number(e[1])>23||Number(e[2])>59?null:{kind:`number`,text:new Intl.DateTimeFormat(Ri(),{hour:`numeric`,minute:`2-digit`,timeZone:`UTC`}).format(Date.UTC(2e3,0,1,Number(e[1]),Number(e[2]))),title:n}}case`month`:{let e=c5.exec(n.trim());return!e||Number(e[2])<1||Number(e[2])>12?null:{kind:`number`,text:new Intl.DateTimeFormat(Ri(),{month:`short`,year:`numeric`,timeZone:`UTC`}).format(Date.UTC(Number(e[1]),Number(e[2])-1,1)),title:n}}case`date`:case`datetime`:{if(typeof t!=`string`||!n.trim())return null;let r=ra(n,{time:e.format===`datetime`,zone:e.timezone});if(r===n)return null;let i=e.tone?Q8(e,t,n):null;return i&&i!==`neutral`?{kind:`tone`,tone:i,text:n,label:r}:{kind:`date`,text:r,title:n}}case`year`:return/^\d{1,4}$/.test(n.trim())?{kind:`number`,text:n.trim(),title:n}:null;case`json`:{let e=typeof t==`string`?n:JSON.stringify(t),r;try{r=JSON.parse(e)}catch{return null}return!r||typeof r!=`object`?null:{kind:`json`,text:e,excerpt:e.replace(/\s+/g,` `).slice(0,120)}}case`qr`:return n.trim()?{kind:`qr`,text:n}:null;case`address`:{let e=Sie(n);return e.length?{kind:`address`,lines:e,text:e.join(`, `)}:null}}}function Sie(e){return e.split(/\r?\n/).map(e=>e.trim().replace(/\s+/g,` `)).filter(Boolean)}var t5,n5,r5,i5,a5,o5,s5,c5,l5=s((()=>{zr(),br(),xa(),N3(),Kt(),cie(),lie(),Pa(),t5=e=>typeof e==`number`&&Number.isFinite(e)||typeof e==`string`&&/^\s*[+-]?\d+(\.\d+)?\s*$/.test(e),n5={yes:[`true`,`1`,`t`],no:[`false`,`0`,`f`]},r5=[[`days`,86400,`d`],[`hours`,3600,`h`],[`minutes`,60,`m`],[`seconds`,1,`s`]],i5=3,a5=/^\d{4}-\d{2}-\d{2}(?:[ T]\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}(?::?\d{2})?)?)?$/,o5=/^#[0-9a-f]{6}$|^#[0-9a-f]{3}$/i,s5=/^(\d{1,2}):(\d{2})(?::\d{2}(?:\.\d+)?)?$/,c5=/^(\d{4})-(\d{2})(?:-\d{2})?/}));function u5(e,t){return!!t.references&&!Xs(e.id).some(e=>e.from.columns.length>1&&e.from.columns.includes(t.name))}var d5=s((()=>{tc()})),f5,Cie=s((()=>{Ya(),f5=Va({one:`one of: {allowed}`,saved:`Saved {label}.`,edit:`Edit {label}`})}));function wie(e){let t=(0,m5.useId)(),n=b$(e.table.id,e.column.name);return n?(0,h5.jsx)(x$,{component:n,fallback:(0,h5.jsx)(p5,{...e}),value:e.value,onChange:t=>e.onChange(t===null||t===``?e.column.nullable?null:``:String(t)),id:e.id??t,describedBy:e.describedBy,invalid:e.invalid===!0,disabled:!1,required:e.column.nullable===!1,label:e.label,field:{name:e.column.name,resource:e.table.id},context:`edit`}):(0,h5.jsx)(p5,{...e})}function p5({table:e,column:t,value:n,onChange:r,label:i,id:a,row:o,onPickerState:s,describedBy:c,invalid:l,valueLabel:u}){let d=(0,m5.useId)(),f=e=>r(e===``&&t.nullable?null:e),p=t.references&&u5(e,t)?Ys(t.references.table):void 0;if(p)return(0,h5.jsx)(z8,{table:p,valueColumn:t.references.column,value:n??``,onChange:f,ariaLabel:i,app:!0,...u&&n?{known:{value:n,label:u}}:{},editing:{onStateChange:e=>s?.(e)}});let m=w8(t,o);if(t.allowed?.length||m){let r=m?uie(Hs(e.id,t.name),m):{},o=t.allowed?.length?t.allowed.map(e=>({value:e,label:hr(e)||mr(e)})):[{value:m.yes,label:r.yes??f5(`common.yes`)},{value:m.no,label:r.no??f5(`common.no`)}];return n!==null&&!o.some(e=>e.value===n)&&o.unshift({value:n,label:n}),(0,h5.jsx)(xQ,{ariaLabel:i,id:a,value:n??``,ariaInvalid:l,ariaDescribedBy:c,items:[...t.nullable?[{value:``,label:f5(`common.noValue`)}]:[],...o],onChange:f})}if(ht(t.type)===`date`&&!/time/i.test(t.type))return(0,h5.jsx)(l$,{id:a??d,value:n??``,onChange:f,"aria-label":i,"aria-invalid":l||void 0,"aria-describedby":c,locale:Ri(),timezone:zi(),now:Vi()});let h=Hs(e.id,t.name);return h?.format===`money`&&h.minor?(0,h5.jsx)(N8,{value:n??``,currency:j3(h,o,h.currency||Hi()),onChange:f,children:(e,t)=>(0,h5.jsx)(`input`,{id:a,type:`text`,inputMode:`decimal`,className:`cell-edit`,"aria-label":i,"aria-invalid":l||void 0,"aria-describedby":c,value:e,"data-null":String(n===null),onChange:e=>t(e.target.value)})}):(0,h5.jsx)(`input`,{id:a,type:`text`,className:`cell-edit`,"aria-label":i,"aria-invalid":l||void 0,"aria-describedby":c,value:n??``,"data-null":String(n===null),onChange:e=>f(e.target.value),title:t.allowed?.length?f5(`one`,{allowed:t.allowed.join(`, `)}):void 0})}var m5,h5,Tie=s((()=>{m5=d(m(),1),tc(),uo(),St(),br(),T8(),Wre(),Kre(),Jre(),Li(),wo(),xa(),N3(),I8(),CQ(),W8(),f$(),l5(),d5(),D$(),Cie(),h5=d(O(),1)})),Eie=s((()=>{br(),f4()}));function Die(e,t,n,r){return U(`/api/file?${new URLSearchParams({...ao(n??null),table:e,key:JSON.stringify(t),inline:`1`,...r?{variant:r}:{}})}`)}var Oie=s((()=>{W(),uo(),Eie()}));function g5(e,t){let n=Gs.activeConnection??null,r=e.flatMap(e=>{let n=v5(e.display),r=n&&e.photoOwner?Ys(n.from):void 0,i=r?pt(r):[];if(!n||!r||!i.length||!e.photoOwner)return[];let a=[...new Set(t.map(t=>t[e.photoOwner]).filter(e=>e!=null))];if(!a.length)return[];let[o,s=`asc`]=(n.sort??``).split(/\s+/),c=`${r.id} ${n.whose} in (${a.map(y5).join(`, `)}) sort ${n.whose}${o?`, ${o} ${s}`:``} show ${[...new Set([...i,n.whose])].join(`, `)}`;return[{column:e.name,from:r,key:i,whose:n.whose,text:c}]}),i=TJ({queries:r.map(e=>({queryKey:[`run`,n??``,`avatar-photos`,e.text],staleTime:6e4,queryFn:async()=>{let t=await Ns(`/api/run`,{q:e.text,limit:500,offset:0,count:`none`,...ao(n)});return t.errors?.length?[]:t.rows??[]}}))}),a=r.map((e,t)=>`${e.text}@${i[t]?.dataUpdatedAt??0}`).join(`
|
|
208
|
+
`);return/\s/.test(n)}):!1}function hM(e){return()=>{let t=e.state.selection.$anchor.pos,{top:n,right:r,bottom:i,left:a}=e.view.coordsAtPos(t);try{return new DOMRect(a,n,r-a,i-n)}catch{return null}}}function gM(e,t,n,r){return n?()=>{let n=r.getState(e.state)?.decorationId;return t.dom.querySelector(`[data-decoration-id="${n}"]`)?.getBoundingClientRect()||null}:hM(e)}function _M({match:e,dismissedRange:t,state:n,transaction:r,editor:i,shouldResetDismissed:a,effectiveAllowSpaces:o}){return a?.({editor:i,state:n,range:t,match:e,transaction:r,allowSpaces:o})?!1:o?e.range.from===t.from:e.range.from===t.from&&!mM(r)}function vM({view:e,pluginKeyRef:t}){let n=e.state.tr.setMeta(t,{exit:!0});e.dispatch(n)}function yM({pluginKey:e,decorationTag:t,decorationClass:n,decorationContent:r,decorationEmptyClass:i,renderer:a,dispatchExit:o}){return{handleKeyDown(t,n){var r;let i=e.getState(t.state);if(!i.active)return!1;if(n.key===`Escape`||n.key===`Esc`){var s;return a==null||(s=a.onKeyDown)==null||s.call(a,{view:t,event:n,range:i.range}),o(t),!0}return(a==null||(r=a.onKeyDown)==null?void 0:r.call(a,{view:t,event:n,range:i.range}))||!1},decorations(a){let{active:o,range:s,decorationId:c,query:l}=e.getState(a);if(!o)return null;let u=!l?.length,d=[n];return u&&d.push(i),Wg.create(a.doc,[Vg.inline(s.from,s.to,{nodeName:t,class:d.join(` `),"data-decoration-id":c||void 0,"data-decoration-content":r})])}}}function bM({editor:e,char:t,effectiveAllowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,findSuggestionMatch:o,allow:s,shouldShow:c,shouldKeepDismissed:l,pluginKey:u}){return{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}},apply(d,f,p,m){let{isEditable:h}=e,{composing:g}=e.view,{selection:_}=d,{empty:v,from:y}=_,b={...f},x=d.getMeta(u);if(x&&x.exit)return b.active=!1,b.decorationId=null,b.range={from:0,to:0},b.query=null,b.text=null,b.dismissedRange=f.active?{...f.range}:f.dismissedRange,b;if(b.composing=g,d.docChanged&&b.dismissedRange!==null&&(b.dismissedRange={from:d.mapping.map(b.dismissedRange.from),to:d.mapping.map(b.dismissedRange.to)}),h&&(v||e.view.composing)){(y<f.range.from||y>f.range.to)&&!g&&!f.composing&&(b.active=!1);let u=o({char:t,allowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,$position:_.$from}),p=`id_${Math.floor(Math.random()*4294967295)}`;u&&s({editor:e,state:m,range:u.range,isActive:f.active})&&(!c||c({editor:e,range:u.range,query:u.query,text:u.text,transaction:d}))?(b.dismissedRange!==null&&!l({match:u,dismissedRange:b.dismissedRange,state:m,transaction:d})&&(b.dismissedRange=null),b.dismissedRange===null?(b.active=!0,b.decorationId=f.decorationId||p,b.range=u.range,b.query=u.query,b.text=u.text):b.active=!1):(u||(b.dismissedRange=null),b.active=!1)}else b.active=!1;return b.active||(b.decorationId=null,b.range={from:0,to:0},b.query=null,b.text=null),b}}}function xM({editor:e,items:t}){let n=null,r=null,i=null,a=()=>{r!==null&&(clearTimeout(r),r=null),i?.(),i=null},o=e=>new Promise(t=>{i=t,r=setTimeout(()=>{r=null;let e=i;i=null,e?.()},e)}),s=()=>{n?.abort(),a(),n=null};return{abort:s,fetch:async(r,i)=>{s(),n=new AbortController;let a=n;if(i>0&&await o(i),n!==a||a.signal.aborted)return{status:`aborted`};try{let i=await t({editor:e,query:r,signal:a.signal});return n!==a||a.signal.aborted?{status:`aborted`}:{status:`resolved`,items:i}}catch{return n!==a||a.signal.aborted?{status:`aborted`}:{status:`error`}}}}}function SM({placement:e,offset:t,flip:n,floatingUi:r}){var i;let a=[oM({mainAxis:t.mainAxis??4,crossAxis:t.crossAxis??0})];return n&&a.push(cM()),r!=null&&(i=r.middleware)!=null&&i.length&&a.push(...r.middleware),{placement:e,strategy:r?.strategy??`absolute`,middleware:a}}function CM(e){if(e instanceof HTMLElement)return e;if(typeof e==`string`)try{let t=document.querySelector(e);if(t)return t}catch{return document.body}return document.body}function wM({getReferenceRect:e,contextElement:t,config:n,container:r,dismissOnOutsideClick:i,dismiss:a}){return(o,s={})=>{let c={getBoundingClientRect:()=>e()??new DOMRect,contextElement:t},l=!1,u=!o.isConnected;u&&CM(r).appendChild(o),s.onPosition||(o.style.visibility=`hidden`,o.style.width=`max-content`);let d=tM(c,o,()=>{dM(c,o,{placement:n.placement,strategy:n.strategy,middleware:n.middleware}).then(({x:e,y:t,placement:n,strategy:r})=>{s.onPosition?s.onPosition({x:e,y:t,placement:n,strategy:r}):(Object.assign(o.style,{position:r,left:`${e}px`,top:`${t}px`}),l||(l=!0,o.style.visibility=``))})},s.autoUpdate),f;return i&&(f=e=>{let n=e.target;!(n instanceof Node)||o.contains(n)||t.contains(n)||a()},document.addEventListener(`pointerdown`,f,!0)),()=>{d(),f&&document.removeEventListener(`pointerdown`,f,!0),u&&o.remove()}}}function TM({editor:e,pluginKey:t,items:n,renderer:r,minQueryLength:i,debounce:a,initialItems:o,placement:s,offset:c,container:l,flip:u,floatingUi:d,dismissOnOutsideClick:f,command:p,clientRectFor:m,dispatchExit:h}){let g,_=xM({editor:e,items:n}),v=SM({placement:s,offset:c,flip:u,floatingUi:d});function y(e,t){switch(e){case`started`:var n;r==null||(n=r.onStart)==null||n.call(r,t);break;case`updated`:var i;r==null||(i=r.onUpdate)==null||i.call(r,t);break;case`stopped`:var a;r==null||(a=r.onExit)==null||a.call(r,t)}}return{update:async(n,d)=>{let b=t.getState(d),x=t.getState(n.state);if(!b||!x)return;let S=null,C=b.query!==x.query,w=b.text!==x.text,T=b.range.from!==x.range.from||b.range.to!==x.range.to,E=C||w||T;if(!b.active&&x.active)S=`started`;else if(b.active&&!x.active)S=`stopped`;else if(x.active&&E)S=`updated`;else return;let D=S===`stopped`?b:x,O=n.dom.querySelector(`[data-decoration-id="${D.decorationId}"]`),k=m(n,O),A=i===0||(D.query?D.query.length>=i:!1),j=(S===`started`||S===`updated`)&&A;if(g={editor:e,range:D.range,query:D.query||``,text:D.text||``,items:o??[],command:t=>p({editor:e,range:D.range,props:t}),decorationNode:O,clientRect:k,loading:j,placement:s,offset:{mainAxis:c.mainAxis??4,crossAxis:c.crossAxis??0},container:l,flip:u,floatingUi:v,mount:wM({getReferenceRect:k,contextElement:n.dom,config:v,container:l,dismissOnOutsideClick:f,dismiss:()=>h(e.view)})},S===`started`){var M;r==null||(M=r.onBeforeStart)==null||M.call(r,g)}if(S===`updated`){var N;r==null||(N=r.onBeforeUpdate)==null||N.call(r,g)}if(S===`started`&&y(S,g),S===`started`||S===`updated`){if(!j)_.abort(),g={...g,items:o??[],loading:!1};else{g={...g,items:o??[],loading:!0},S=`updated`,y(S,g);let e=await _.fetch(D.query||``,a);if(e.status===`aborted`)return;if(!t.getState(n.state)?.active){_.abort();return}g=e.status===`resolved`?{...g,items:e.items,loading:!1}:{...g,loading:!1}}}S===`stopped`?(_.abort(),y(S,g),g=void 0):S===`updated`&&y(S,g)},destroy:()=>{var e;_.abort(),g&&(r==null||(e=r.onExit)==null||e.call(r,g))}}}function EM({pluginKey:e=DM,editor:t,char:n=`@`,allowSpaces:r=!1,allowToIncludeChar:i=!1,allowedPrefixes:a=[` `],startOfLine:o=!1,decorationTag:s=`span`,decorationClass:c=`suggestion`,decorationContent:l=``,decorationEmptyClass:u=`is-empty`,command:d=()=>null,items:f=()=>[],minQueryLength:p=0,debounce:m=0,initialItems:h,placement:g=`bottom-start`,offset:_={},container:v,flip:y=!0,floatingUi:b,dismissOnOutsideClick:x=!0,render:S=()=>({}),allow:C=()=>!0,findSuggestionMatch:w=pM,shouldShow:T,shouldResetDismissed:E}){let D=S?.(),O=r&&!i,k=(n,r)=>gM(t,n,r,e);function A(e){return _M({...e,editor:t,shouldResetDismissed:E,effectiveAllowSpaces:O})}let j=t=>vM({view:t,pluginKeyRef:e});return new Rd({key:e,view:()=>TM({editor:t,pluginKey:e,items:f,renderer:D,minQueryLength:p,debounce:m,initialItems:h,placement:g,offset:_,container:v,flip:y,floatingUi:b,dismissOnOutsideClick:x,command:d,clientRectFor:k,dispatchExit:j}),state:bM({editor:t,char:n,effectiveAllowSpaces:O,allowToIncludeChar:i,allowedPrefixes:a,startOfLine:o,findSuggestionMatch:w,allow:C,shouldShow:T,shouldKeepDismissed:A,pluginKey:e}),props:yM({pluginKey:e,decorationTag:s,decorationClass:c,decorationContent:l,decorationEmptyClass:u,renderer:D,dispatchExit:j})})}var DM,OM=s((()=>{Hd(),eS(),r_(),fM(),DM=new Bd(`suggestion`)}));function kM({editor:e,overrideSuggestionOptions:t,extensionName:n,char:r=`@`}){return{editor:e,char:r,pluginKey:new Bd,command:({editor:e,range:t,props:i})=>{var a,o;let s=e.view.state.selection.$to.nodeAfter;s!=null&&(a=s.text)!=null&&a.startsWith(` `)&&(t.to+=1),e.chain().focus().insertContentAt(t,[{type:n,attrs:{...i,mentionSuggestionChar:r}},{type:`text`,text:` `}]).run(),(o=e.view.dom.ownerDocument.defaultView)==null||(o=o.getSelection())==null||o.collapseToEnd()},allow:({state:e,range:t})=>{let r=e.doc.resolve(t.from),i=e.schema.nodes[n];return!!r.parent.type.contentMatch.matchType(i)},...t}}function AM(e){return(e.options.suggestions.length?e.options.suggestions:[e.options.suggestion]).map(t=>kM({editor:e.editor,overrideSuggestionOptions:t,extensionName:e.name,char:t.char}))}function jM(e,t){let n=AM(e);return n.find(e=>e.char===t)||(n.length?n[0]:null)}var MM,NM,$te=s((()=>{eS(),Ff(),OM(),Hd(),MM=$x.create({name:`mention`,priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:e,suggestion:t}){return`${t?.char??`@`}${e.attrs.label??e.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:e,node:t,suggestion:n}){return[`span`,Ov(this.HTMLAttributes,e.HTMLAttributes),`${n?.char??`@`}${t.attrs.label??t.attrs.id}`]},suggestions:[],suggestion:{}}},group:`inline`,inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:e=>e.getAttribute(`data-id`),renderHTML:e=>e.id?{"data-id":e.id}:{}},label:{default:null,parseHTML:e=>e.getAttribute(`data-label`),renderHTML:e=>e.label?{"data-label":e.label}:{}},mentionSuggestionChar:{default:`@`,parseHTML:e=>e.getAttribute(`data-mention-suggestion-char`),renderHTML:e=>({"data-mention-suggestion-char":e.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:e,HTMLAttributes:t}){let n=jM(this,e.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn(`renderLabel is deprecated use renderText and renderHTML instead`),[`span`,Ov({"data-type":this.name},this.options.HTMLAttributes,t),this.options.renderLabel({options:this.options,node:e,suggestion:n})];let r={...this.options};r.HTMLAttributes=Ov({"data-type":this.name},this.options.HTMLAttributes,t);let i=this.options.renderHTML({options:r,node:e,suggestion:n});return typeof i==`string`?[`span`,Ov({"data-type":this.name},this.options.HTMLAttributes,t),i]:i},...jee({nodeName:`mention`,name:`@`,selfClosing:!0,allowedAttributes:[`id`,`label`,{name:`mentionSuggestionChar`,skipIfDefault:`@`}],parseAttributes:e=>{let t={},n=/(?:^|\s)(\w+)=(?:"([^"]*)"|'([^']*)')/g,r=n.exec(e);for(;r!==null;){let[,i,a,o]=r;t[i===`char`?`mentionSuggestionChar`:i]=a??o,r=n.exec(e)}return t},serializeAttributes:e=>Object.entries(e).filter(([,e])=>e!=null).map(([e,t])=>`${e===`mentionSuggestionChar`?`char`:e}="${t}"`).join(` `)}),renderText({node:e}){let t={options:this.options,node:e,suggestion:jM(this,e.attrs.mentionSuggestionChar)};return this.options.renderLabel===void 0?this.options.renderText(t):(console.warn(`renderLabel is deprecated use renderText and renderHTML instead`),this.options.renderLabel(t))},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:e,state:t})=>{let n=!1,{selection:r}=t,{empty:i,anchor:a}=r;if(!i)return!1;let o=new Nl,s=0;return t.doc.nodesBetween(a-1,a,(e,t)=>{if(e.type.name===this.name)return n=!0,o=e,s=t,!1}),n&&e.insertText(this.options.deleteTriggerWithBackspace?``:o.attrs.mentionSuggestionChar,s,s+o.nodeSize),n})}},addProseMirrorPlugins(){return AM(this).map(EM)}}),NM=MM})),PM,FM,IM,ene=s((()=>{eS(),PM=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,FM=$x.create({name:`image`,addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?`inline`:`block`},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?`img[src]`:`img[src]:not([src^="data:"])`}]},renderHTML({HTMLAttributes:e}){return[`img`,Ov(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode(`image`,{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{let t=e.attrs?.src??``,n=e.attrs?.alt??``,r=e.attrs?.title??``;return r?``:``},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>`u`)return null;let{directions:e,minWidth:t,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize,i=new Set([`src`,`width`,`height`]);return({node:a,getPos:o,HTMLAttributes:s,editor:c})=>{let l=document.createElement(`img`);l.draggable=!1;let u=Ov(this.options.HTMLAttributes,s);Object.entries(u).forEach(([e,t])=>{if(t!=null)switch(e){case`src`:case`width`:case`height`:break;default:l.setAttribute(e,t)}}),u.src!==null&&(l.src=u.src);let d={...s},f=e=>{typeof e==`string`&&e!==``?l.getAttribute(`src`)!==e&&(l.src=e):(l.hasAttribute(`src`)&&l.removeAttribute(`src`),l.src!==``&&(l.src=``))};f(s.src);let p=new Qx({element:l,editor:c,node:a,getPos:o,onResize:(e,t)=>{l.style.width=`${e}px`,l.style.height=`${t}px`},onCommit:(e,t)=>{let n=o();n!==void 0&&this.editor.chain().setNodeSelection(n).updateAttributes(this.name,{width:e,height:t}).run()},onUpdate:e=>{if(e.type!==a.type)return!1;let t=kv(e,c.extensionManager.attributes.filter(t=>t.type===e.type.name));return Object.keys(d).forEach(e=>{!i.has(e)&&!(e in t)&&l.removeAttribute(e)}),Object.entries(t).forEach(([e,t])=>{i.has(e)||(t==null?l.removeAttribute(e):l.setAttribute(e,t))}),f(t.src),d=t,!0},options:{directions:e,min:{width:t,height:n},preserveAspectRatio:r===!0}}),m=p.dom,h=()=>{m.style.visibility=``,m.style.pointerEvents=``};return m.style.visibility=`hidden`,m.style.pointerEvents=`none`,l.complete&&l.naturalWidth>0?h():(l.onload=h,l.onerror=h),p}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[Ky({find:PM,type:this.type,getAttributes:e=>{let[,,t,n,r]=e;return{src:n,alt:t,title:r}}})]}}),IM=FM}));function LM(e,t){let n=RM.useRef(zM);return n.current===zM&&(n.current=e(t)),n}var RM,zM,BM=s((()=>{RM=d(m(),1),zM={}}));function tne(){return GM}function nne(e){WM.push(e)}function VM(e){let t=(t,n)=>{let r=LM(rne).current,i;try{GM=r;for(let e of WM)e.before(r);i=e(t,n);for(let e of WM)e.after(r);r.didInitialize=!0}finally{GM=void 0}return i};return t.displayName=e.displayName||e.name,t}function HM(e){return UM.forwardRef(VM(e))}function rne(){return{didInitialize:!1}}var UM,WM,GM,KM=s((()=>{UM=d(m(),1),BM(),WM=[],GM=void 0}));function qM(){}var JM,YM,XM=s((()=>{JM=Object.freeze([]),YM=Object.freeze({})}));function ZM(e){QM.useEffect(e,JM)}var QM,$M=s((()=>{QM=d(m(),1),XM()}));function eN(){let e=LM(nN.create).current;return ZM(e.disposeEffect),e}var tN,nN,rN=s((()=>{BM(),$M(),tN=0,nN=class e{static create(){return new e}currentId=tN;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=tN,t()},e)}isStarted(){return this.currentId!==tN}clear=()=>{this.currentId!==tN&&(clearTimeout(this.currentId),this.currentId=tN)};disposeEffect=()=>this.clear}})),iN,aN,Q,oN=s((()=>{iN=d(m(),1),aN=()=>{},Q=typeof document<`u`?iN.useLayoutEffect:aN}));function ine(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var sN,cN,lN,uN,dN,fN=s((()=>{({userAgent:sN,platform:cN,maxTouchPoints:lN}=ine()),uN=sN.toLowerCase(),dN=cN.toLowerCase()})),pN,mN,hN,gN,_N,vN=s((()=>{fN(),pN=/^i(os$|p)/.test(dN)||dN===`macintel`&&lN>1,mN=`android`,hN=dN===mN||uN.includes(mN),gN=!pN&&dN.startsWith(`mac`),dN.startsWith(`win`),!hN&&/^(linux|chrome os)/.test(dN),_N=gN||pN})),yN,bN,xN=s((()=>{fN(),yN=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`),bN=!yN&&uN.includes(`firefox`),!yN&&uN.includes(`chrom`)})),SN,ane=s((()=>{vN(),SN=_N})),CN,one=s((()=>{fN(),CN=/jsdom|happydom/.test(uN)})),wN=s((()=>{vN(),xN(),ane(),one()})),TN=s((()=>{wN()}));function EN(e){e.preventDefault(),e.stopPropagation()}function DN(e){return`nativeEvent`in e}function ON(e){return e.pointerType===``&&e.isTrusted?!0:hN&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function kN(e){return CN?!1:!hN&&e.width===0&&e.height===0||hN&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function AN(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function sne(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}var jN=s((()=>{TN()}));function MN(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function NN(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&fj(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function PN(e){return`composedPath`in e?e.composedPath()[0]??e.target:e.target}var FN=s((()=>{Aj()})),IN,LN,RN,zN,BN,VN,HN=s((()=>{IN=`data-base-ui-focusable`,LN=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,RN=`ArrowLeft`,zN=`ArrowRight`,BN=`ArrowUp`,VN=`ArrowDown`})),UN,WN,GN=s((()=>{UN=`data-starting-style`,WN=`data-ending-style`})),KN,qN,JN,YN=s((()=>{GN(),KN={[UN]:``},qN={[WN]:``},JN={transitionStatus(e){return e===`starting`?KN:e===`ending`?qN:null}}})),XN,ZN,QN,$N=s((()=>{GN(),XN=`data-open`,ZN=`data-closed`,QN=`data-anchor-hidden`})),eP,tP,nP=s((()=>{eP=`data-popup-open`,tP=`data-pressed`})),rP,iP,aP,oP,sP,cP,lP,uP,dP,fP=s((()=>{YN(),$N(),nP(),rP={[eP]:``},iP={[eP]:``,[tP]:``},aP={[XN]:``},oP={[ZN]:``},sP={[QN]:``},cP={open(e){return e?rP:null}},lP={open(e){return e?iP:null}},uP={open(e){return e?aP:oP},anchorHidden(e){return e?sP:null}},dP={...uP,...JN}})),pP,mP=s((()=>{fP(),pP=`data-trigger-disabled`}));function hP(e,t){if(!uj(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(pP);for(let[,e]of t.entries())if(NN(e,n))return!e.hasAttribute(pP);return!1}function gP(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 _P(e){return e.matches(`html,body`)}function vP(e){return dj(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function yP(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${LN}`)!=null}function bP(e){return e?e.getAttribute(`role`)===`combobox`&&vP(e):!1}function xP(e){if(!e||CN)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function SP(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}var CP=s((()=>{Aj(),TN(),FN(),HN(),mP()}));function wP(e,t){return t!=null&&!AN(t)?0:typeof e==`function`?e():e}function TP(e,t,n){let r=wP(e,n);return typeof r==`number`?r:r?.[t]}function EP(e){return typeof e==`function`?e():e}function DP(e,t){return t||e===`click`||e===`mousedown`}function OP(e){return e?.includes(`mouse`)&&e!==`mousedown`}var kP=s((()=>{jN(),CP()})),AP,jP,MP,NP,PP,FP,IP,LP,RP,zP,BP,VP,HP,UP,WP,GP,KP,qP,JP,cne=s((()=>{AP=`none`,jP=`trigger-press`,MP=`trigger-hover`,NP=`trigger-focus`,PP=`outside-press`,FP=`item-press`,IP=`close-press`,LP=`input-change`,RP=`input-clear`,zP=`input-press`,BP=`focus-out`,VP=`escape-key`,HP=`list-navigation`,UP=`keyboard`,WP=`pointer`,GP=`cancel-open`,KP=`sibling-open`,qP=`imperative-action`,JP=`window-resize`})),YP=s((()=>{cne()}));function XP(e,t,n,r){let i=!1,a=!1,o=r??YM;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}}function lne(e,t,n){let r=n??YM;return{reason:e,event:t??new Event(`base-ui`),...r}}var ZP=s((()=>{XM()}));function QP(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}var $P=s((()=>{}));function eF(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}var tF=s((()=>{}));function nF(e,t,n,r){let i=LM(iF).current;return aF(i,e,t,n,r)&&sF(i,[e,t,n,r]),i.callback}function rF(e){let t=LM(iF).current;return oF(t,e)&&sF(t,e),t.callback}function iF(){return{callback:null,cleanup:null,refs:[]}}function aF(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function oF(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function sF(e,t){e.refs=t,e.callback=t.every(e=>e==null)?null: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}}}}}}var cF=s((()=>{BM()}));function lF(e){let t=LM(uF,e).current;return t.next=e,Q(t.effect),t}function uF(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var dF=s((()=>{oN(),BM()})),fF,pF,mF=s((()=>{fF=d(m(),1),pF={...fF}}));function $(e){let t=LM(hF).current;return t.next=e,vF(t.effect),t.trampoline}function hF(){let e={next:void 0,callback:gF,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function gF(){}var _F,vF,yF=s((()=>{mF(),BM(),_F=pF.useInsertionEffect,vF=_F&&_F!==pF.useLayoutEffect?_F:e=>e()}));function bF(){let e=LM(wF.create).current;return ZM(e.disposeEffect),e}var xF,SF,CF,wF,TF=s((()=>{BM(),$M(),xF=null,globalThis.requestAnimationFrame,SF=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)}},CF=new SF,wF=class e{static create(){return new e}static request(e){return CF.request(e)}static cancel(e){return CF.cancel(e)}currentId=xF;request(e){this.cancel(),this.currentId=CF.request(()=>{this.currentId=xF,e()})}cancel=()=>{this.currentId!==xF&&(CF.cancel(this.currentId),this.currentId=xF)};disposeEffect=()=>this.cancel}}));function EF(e){return e?.ownerDocument||document}var DF=s((()=>{Aj()})),OF,kF,AF,jF=s((()=>{OF={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},kF={...OF,position:`fixed`,top:0,left:0},AF={...OF,position:`absolute`}})),MF,NF,PF,FF=s((()=>{MF=d(m(),1),oN(),TN(),jF(),NF=d(O(),1),PF=MF.forwardRef(function(e,t){let[n,r]=MF.useState();Q(()=>{SN&&yN&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,NF.jsx)(`span`,{...e,ref:t,style:kF,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})})}));function IF(e,t,n){return Math.floor(e/t)!==n}function LF(e,t){return t<0||t>=e.length}function RF(e,t){return BF(e.current,{disabledIndices:t})}function zF(e,t){return BF(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function BF(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&VF(e,a,r));return a}function une(e,{event:t,orientation:n,loopFocus:r,onLoop:i,rtl:a,cols:o,disabledIndices:s,minIndex:c,maxIndex:l,prevIndex:u,stopEvent:d=!1}){let f=u,p;if(t.key===`ArrowUp`?p=`up`:t.key===`ArrowDown`&&(p=`down`),p){let n=[],a=[],m=!1,h=0;{let t=null,r=-1;e.forEach((e,i)=>{if(e==null)return;h+=1;let o=e.closest(`[role="row"]`);o&&(m=!0),(o!==t||r===-1)&&(t=o,r+=1,n[r]=[]),n[r].push(i),a[i]=r})}let g=!1,_=0;if(m)for(let e of n){let t=e.length;t>_&&(_=t),t!==o&&(g=!0)}let v=g&&h<e.length,y=_||o,b=o=>{if(!g||u===-1)return;let c=a[u];if(c==null)return;let l=n[c].indexOf(u),d=o===`up`?-1:1;for(let o=c+d,f=0;f<n.length;f+=1,o+=d){if(o<0||o>=n.length){if(!r||v)return;if(o=o<0?n.length-1:0,i){let e=Math.min(l,n[o].length-1),r=i(t,u,n[o][e]??n[o][0]);o=a[r]??o}}let c=n[o];for(let t=Math.min(l,c.length-1);t>=0;--t){let n=c[t];if(!VF(e,n,s))return n}}},x=t=>{if(!v||u===-1)return;let n=u%y,i=t===`up`?-y:y,a=l-l%y,o=zA(l/y)+1;for(let t=u-n+i,c=0;c<o;c+=1,t+=i){if(t<0||t>l){if(!r)return;t=t<0?a:0}let i=Math.min(t+y-1,l);for(let r=Math.min(t+n,i);r>=t;--r)if(!VF(e,r,s))return r}};d&&EN(t);let S=b(p)??x(p);if(S!==void 0)f=S;else if(u===-1)f=p===`up`?l:c;else if(f=BF(e,{startingIndex:u,amount:y,decrement:p===`up`,disabledIndices:s}),r){if(p===`up`&&(u-y<c||f<0)){let e=u%y,n=l%y,r=l-(n-e);f=n===e?l:n>e?r:r-y,i&&(f=i(t,u,f))}p===`down`&&u+y>l&&(f=BF(e,{startingIndex:u%y-y,amount:y,disabledIndices:s}),i&&(f=i(t,u,f)))}LF(e,f)&&(f=u)}if(n===`both`){let n=zA(u/o);t.key===(a?`ArrowLeft`:`ArrowRight`)&&(d&&EN(t),u%o===o-1?r&&(f=BF(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):(f=BF(e,{startingIndex:u,disabledIndices:s}),r&&IF(f,o,n)&&(f=BF(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f)))),IF(f,o,n)&&(f=u)),t.key===(a?`ArrowRight`:`ArrowLeft`)&&(d&&EN(t),u%o===0?r&&(f=BF(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f))):(f=BF(e,{startingIndex:u,decrement:!0,disabledIndices:s}),r&&IF(f,o,n)&&(f=BF(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f)))),IF(f,o,n)&&(f=u));let c=zA(l/o)===n;LF(e,f)&&(r&&c?(f=t.key===(a?`ArrowRight`:`ArrowLeft`)?l:BF(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):f=u)}return f}function VF(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?!HF(r)||r.matches(`:disabled`)?!0:!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!1}function dne(e){return e.visibility===`hidden`||e.visibility===`collapse`}function HF(e,t=e?bj(e):null){return!e||!e.isConnected||!t||dne(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var UF=s((()=>{KA(),Aj(),jN(),HN()}));function fne(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return fj(n)?n.host:null}function WF(e){for(let t of Array.from(e.children))if(oj(t)===`summary`)return t;return null}function pne(e,t){let n=WF(t);return!!n&&(e===n||NN(n,e))}function GF(e){let t=e?oj(e):``;return e!=null&&e.matches(sI)&&(t!==`summary`||e.parentElement!=null&&oj(e.parentElement)===`details`&&WF(e.parentElement)===e)&&(t!==`details`||WF(e)==null)&&(t!==`input`||e.type!==`hidden`)}function KF(e){if(!GF(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=fne(t)){let n=t!==e,r=oj(t)===`slot`;if(t.hasAttribute(`inert`)||n&&oj(t)===`details`&&!t.open&&!pne(e,t)||t.hasAttribute(`hidden`)||!r&&!mne(t,n))return!1}return!0}function mne(e,t){let n=bj(e);return t?n.display!==`none`:HF(e,n)}function qF(e){let t=e.tabIndex;if(t<0){let t=oj(e);if(t===`details`||t===`audio`||t===`video`||dj(e)&&e.isContentEditable)return 0}return t}function JF(e){if(oj(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function hne(e,t){let n=JF(e);if(!n)return!0;let r=t.find(e=>{let t=JF(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=JF(e);return t?.name===n.name&&t.form===n.form})===n}function YF(e){if(dj(e)&&oj(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return dj(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function XF(e,t){YF(e).forEach(e=>{GF(e)&&t.push(e),XF(e,t)})}function ZF(e,t,n){YF(e).forEach(e=>{dj(e)&&e.matches(t)&&n.push(e),ZF(e,t,n)})}function QF(e){return KF(e)&&qF(e)>=0}function $F(e){let t=[];return XF(e,t),t.filter(KF)}function eI(e){let t=$F(e);return t.filter(e=>qF(e)>=0&&hne(e,t))}function tI(e,t){let n=eI(e),r=n.length;if(r===0)return;let i=MN(EF(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function nI(e){return tI(EF(e).body,1)||e}function rI(e){return tI(EF(e).body,-1)||e}function iI(e,t){if(!e)return null;let n=eI(EF(e).body),r=n.length;if(r===0)return null;let i=n.indexOf(e);return i===-1?null:n[(i+t+r)%r]}function gne(e){return iI(e,1)}function _ne(e){return iI(e,-1)}function aI(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!NN(n,r)}function vne(e){eI(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function oI(e){let t=[];ZF(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}var sI,cI=s((()=>{Aj(),DF(),CP(),UF(),sI=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`}));function lI(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...lI(e,t.id,n)])}function uI(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}var dI=s((()=>{}));function fI(e){return`data-base-ui-${e}`}var pI=s((()=>{}));function mI(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(hI);function a(){(!i||i())&&e?.focus({preventScroll:n})}if(r)return a(),qM;let o=requestAnimationFrame(a);return hI=o,()=>{hI===o&&(cancelAnimationFrame(o),hI=0)}}var hI,gI=s((()=>{XM(),hI=0}));function _I(e){return CI[e]}function vI(e){return e?fj(e)?e.host:vI(e.parentNode):null}function yI(e,t,n,r,{mark:i=!0}){let a=null;r?a=`inert`:n&&(a=`aria-hidden`);let o=null,s=null,c=EI(t,e),l=i?OI(t,DI(c),new Set(c)):[],u=[],d=[];if(a){let e=xI[a],n=_I(a);s=n,o=e;let r=EI(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=c.concat(r);OI(t,DI(i),new Set(i)).forEach(t=>{let r=t.getAttribute(a),i=r!==null&&r!==`false`,o=(e.get(t)||0)+1;e.set(t,o),u.push(t),o===1&&i&&n.add(t),i||t.setAttribute(a,a===`inert`?``:`true`)})}return i&&l.forEach(e=>{let t=(wI.get(e)||0)+1;wI.set(e,t),d.push(e),t===1&&e.setAttribute(SI,``)}),TI+=1,()=>{o&&u.forEach(e=>{let t=(o.get(e)||0)-1;o.set(e,t),t||(!s?.has(e)&&a&&e.removeAttribute(a),s?.delete(e))}),i&&d.forEach(e=>{let t=(wI.get(e)||0)-1;wI.set(e,t),t||e.removeAttribute(SI)}),--TI,TI||(xI.inert=new WeakMap,xI[`aria-hidden`]=new WeakMap,CI.inert=new WeakSet,CI[`aria-hidden`]=new WeakSet,wI=new WeakMap)}}function bI(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0}=t,a=EF(e[0]).body;return yI(e,a,n,r,{mark:i})}var xI,SI,CI,wI,TI,EI,DI,OI,kI=s((()=>{Aj(),DF(),xI={inert:new WeakMap,"aria-hidden":new WeakMap},SI=`data-base-ui-inert`,CI={inert:new WeakSet,"aria-hidden":new WeakSet},wI=new WeakMap,TI=0,EI=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=vI(t);return e.contains(n)?n:null}).filter(e=>e!=null),DI=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},OI=(e,t,n)=>{let r=[],i=e=>{e&&!n.has(e)&&Array.from(e.children).forEach(e=>{oj(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r}}));function AI(e,t=`mui`){let[n,r]=MI.useState(e),i=e||n;return MI.useEffect(()=>{n??(NI+=1,r(`${t}-${NI}`))},[n,t]),i}function jI(e,t){if(PI!==void 0){let n=PI();return e??(t?`${t}-${n}`:n)}return AI(e,t)}var MI,NI,PI,FI=s((()=>{MI=d(m(),1),mF(),NI=0,PI=pF.useId}));function II(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 LI,RI=s((()=>{LI=II(`https://base-ui.com/production-error`,`Base UI`)}));function zI(e){return BI>=e}var BI,VI=s((()=>{m(),BI=19}));function HI(e){if(!UI.isValidElement(e))return null;let t=e,n=t.props;return(zI(19)?n?.ref:t.ref)??null}var UI,WI=s((()=>{UI=d(m(),1),VI()}));function GI(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}var KI=s((()=>{}));function qI(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)}else i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}var JI=s((()=>{}));function YI(e,t){return typeof e==`function`?e(t):e}var XI=s((()=>{}));function ZI(e,t){return typeof e==`function`?e(t):e}var QI=s((()=>{}));function $I(e,t,n,r,i){if(!n&&!r&&!i&&!e)return tL(t);let a=tL(e);return t&&(a=nL(a,t)),n&&(a=nL(a,n)),r&&(a=nL(a,r)),i&&(a=nL(a,i)),a}function eL(e){if(e.length===0)return pL;if(e.length===1)return tL(e[0]);let t=tL(e[0]);for(let n=1;n<e.length;n+=1)t=nL(t,e[n]);return t}function tL(e){return oL(e)?{...sL(e,pL)}:rL(e)}function nL(e,t){return oL(t)?sL(t,e):iL(e,t)}function rL(e){let t={...e};for(let e in t){let n=t[e];aL(e,n)&&(t[e]=lL(n))}return t}function iL(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=GI(e.style,r);break;case`className`:e[n]=dL(e.className,r);break;default:e[n]=aL(n,r)?cL(e[n],r):r}}return e}function aL(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 oL(e){return typeof e==`function`}function sL(e,t){return oL(e)?e(t):e??pL}function cL(e,t){return t?e?(...n)=>{let r=n[0];if(fL(r)){let i=r;uL(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:lL(t):e}function lL(e){return e&&((...t)=>{let n=t[0];return fL(n)&&uL(n),e(...t)})}function uL(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function dL(e,t){return t?e?t+` `+e:t:e}function fL(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}var pL,mL=s((()=>{KI(),pL={}})),hL=s((()=>{mL()}));function gL(e,t,n={}){let r=t.render;n.enabled!==!1&&(r=yL(r));let i=_L(t,n,r);if(n.enabled===!1)return null;let a=n.state??YM;return bL(e,r,i,a)}function _L(e,t,n){let{className:r,style:i}=e,{state:a=YM,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?YI(r,a):void 0,d=l?ZI(i,a):void 0,f=l?qI(a,c):YM,p=l&&s?vL(s):void 0,m=l?GI(f,p)??{}:YM;return typeof document<`u`&&(l?m.ref=Array.isArray(o)?rF([m.ref,HI(n),...o]):nF(m.ref,HI(n),o):nF(null,null)),l?(u!==void 0&&(m.className=dL(m.className,u)),d!==void 0&&(m.style=GI(m.style,d)),m):YM}function vL(e){return Array.isArray(e)?eL(e):$I(void 0,e)}function yL(e){if(e?.$$typeof!==wL)return e;let t=SL.Children.toArray(e)[0];return SL.isValidElement(t)?t:e}function bL(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=$I(n,t.props);return e.ref=n.ref,SL.cloneElement(t,e)}if(e&&typeof e==`string`)return xL(e,n);throw Error(LI(8))}function xL(e,t){return e===`button`?(0,CL.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,CL.createElement)(`img`,{alt:``,...t,key:t.key}):SL.createElement(e,t)}var SL,CL,wL,TL=s((()=>{RI(),SL=d(m(),1),cF(),WI(),KI(),XM(),JI(),XI(),QI(),hL(),CL=d(m(),1),wL=Symbol.for(`react.lazy`)})),EL,DL,OL,kL,AL,jL=s((()=>{EL={style:{transition:`none`}},DL=`data-base-ui-click-trigger`,OL={fallbackAxisSide:`none`},kL={fallbackAxisSide:`end`},AL={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0}}));function ML(e={}){let{ref:t,container:n,componentProps:r=YM,elementProps:i}=e,a=jI(),o=LL()?.portalNode,[s,c]=NL.useState(null),[l,u]=NL.useState(null),d=$(e=>{e!==null&&u(e)}),f=NL.useRef(null);Q(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}let e=(n&&(lj(n)?n:n.current))??o??document.body;e==null?f.current&&(f.current=null,u(null),c(null)):f.current!==e&&(f.current=e,u(null),c(e))},[n,o]);let p=gL(`div`,r,{ref:[t,d],props:[{id:a,[RL]:``},i]}),m=s&&p?PL.createPortal(p,s):null;return{node:l,nodeId:NL.isValidElement(p)?p.props.id:void 0,subtree:m}}var NL,PL,FL,IL,LL,RL,zL,BL=s((()=>{NL=d(m(),1),PL=d(g(),1),Aj(),$P(),tF(),FI(),oN(),yF(),XM(),FF(),cI(),ZP(),YP(),pI(),TL(),jL(),FL=d(O(),1),IL=NL.createContext(null),LL=()=>NL.useContext(IL),RL=fI(`portal`),zL=NL.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}=ML({container:o,ref:t,componentProps:e,elementProps:c}),f=NL.useRef(null),p=NL.useRef(null),m=NL.useRef(null),h=NL.useRef(null),[g,_]=NL.useState(null),v=NL.useRef(!1),y=g?.modal,b=g?.open,x=!!g&&!g.modal&&g.open&&!!l;NL.useEffect(()=>{if(!l||y)return;function e(e){l&&e.relatedTarget&&aI(e)&&(e.type===`focusin`?v.current&&=(oI(l),!1):(vne(l),v.current=!0))}return eF(QP(l,`focusin`,e,!0),QP(l,`focusout`,e,!0))},[l,y]),Q(()=>{l&&b===!0&&v.current&&(oI(l),v.current=!1)},[b,l]);let S=NL.useMemo(()=>({beforeOutsideRef:f,afterOutsideRef:p,beforeInsideRef:m,afterInsideRef:h,portalNode:l,setFocusManagerState:_}),[l]);return(0,FL.jsxs)(NL.Fragment,{children:[d,(0,FL.jsxs)(IL.Provider,{value:S,children:[x&&l&&(0,FL.jsx)(PF,{"data-type":`outside`,ref:f,onFocus:e=>{aI(e,l)?m.current?.focus():rI(g?g.domReference:null)?.focus()}}),x&&l&&(0,FL.jsx)(`span`,{role:s,"aria-owns":u,style:AL}),l&&PL.createPortal(a,l),x&&l&&(0,FL.jsx)(PF,{"data-type":`outside`,ref:p,onFocus:e=>{aI(e,l)?h.current?.focus():(nI(g?g.domReference:null)?.focus(),g?.closeOnFocusOut&&g?.onOpenChange(!1,XP(`focus-out`,e.nativeEvent)))}})]})]})})}));function VL(){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 HL=s((()=>{})),UL,WL=s((()=>{HL(),UL=class{nodesRef={current:[]};events=VL();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)}}}));function GL(e){let t=jI(),n=$L(e),r=QL();return Q(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function KL(e){let{children:t,id:n}=e,r=QL();return(0,YL.jsx)(XL.Provider,{value:JL.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function qL(e){let{children:t,externalTree:n}=e,r=LM(()=>n??new UL).current;return(0,YL.jsx)(ZL.Provider,{value:r,children:t})}var JL,YL,XL,ZL,QL,$L,eR=s((()=>{JL=d(m(),1),FI(),oN(),BM(),WL(),YL=d(O(),1),XL=JL.createContext(null),ZL=JL.createContext(null),QL=()=>JL.useContext(XL)?.id||null,$L=e=>{let t=JL.useContext(ZL);return e??t}}));function tR(e){return e==null?e:`current`in e?e.current:e}var nR=s((()=>{}));function yne(e,t){let n=sj(PN(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}function rR(){dR=dR.filter(e=>e.deref()?.isConnected)}function iR(e){rR(),e&&oj(e)!==`body`&&(dR.push(new WeakRef(e)),dR.length>uR&&(dR=dR.slice(-20)))}function aR(){return rR(),dR[dR.length-1]?.deref()}function bne(e){return e?QF(e)?e:eI(e)[0]||e:null}function oR(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=$F(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return QF(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 sR(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,restoreFocus:o=!1,modal:s=!0,closeOnFocusOut:c=!0,openInteractionType:l=``,nextFocusableElement:u,previousFocusableElement:d,beforeContentFocusGuardRef:f,externalTree:p,getInsideElements:m}=e,h=`rootStore`in t?t.rootStore:t,g=h.useState(`open`),_=h.useState(`domReferenceElement`),v=h.useState(`floatingElement`),{events:y,dataRef:b}=h.context,x=$(()=>b.current.floatingContext?.nodeId),S=i===!1,C=bP(_)&&S,w=lF(i),T=lF(a),E=lF(l),D=lF(g),O=$L(p),k=LL(),A=cR.useRef(!1),j=cR.useRef(!1),M=cR.useRef(!1),N=cR.useRef(null),P=cR.useRef(``),F=cR.useRef(``),I=cR.useRef(null),L=cR.useRef(null),R=nF(I,f,k?.beforeInsideRef),z=nF(L,k?.afterInsideRef),B=eN(),V=eN(),H=bF(),U=k!=null,W=SP(v),G=$((e=W)=>e?eI(e):[]),ee=$(()=>m?.().filter(e=>e!=null)??[]);cR.useEffect(()=>{if(r||!s)return;function e(e){e.key===`Tab`&&NN(W,MN(EF(W)))&&G().length===0&&!C&&EN(e)}return QP(EF(W),`keydown`,e)},[r,W,s,C,G]),cR.useEffect(()=>{if(r||!g)return;let e=EF(W);function t(){M.current=!1}function n(e){let t=PN(e),n=ee(),r=NN(v,t)||NN(_,t)||NN(k?.portalNode,t)||n.some(e=>e===t||NN(e,t));M.current=!r,F.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(j.current=!0,V.start(0,()=>{j.current=!1}))}function i(){F.current=`keyboard`}return eF(QP(e,`pointerdown`,n,!0),QP(e,`pointerup`,t,!0),QP(e,`pointercancel`,t,!0),QP(e,`keydown`,i,!0),t)},[r,v,_,W,g,k,V,ee]),cR.useEffect(()=>{if(r||!c)return;let e=EF(W);function t(){j.current=!0,V.start(0,()=>{j.current=!1})}function n(e){let t=PN(e);QF(t)&&(N.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=PN(t);s&&n==null&&i!=null&&NN(v,i)&&iR(i),queueMicrotask(()=>{let a=x(),c=h.context.triggerElements,l=ee(),f=n?.hasAttribute(fI(`focus-guard`))&&[I.current,L.current,k?.beforeInsideRef.current,k?.afterInsideRef.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,tR(d),tR(u)].includes(n),p=!(NN(_,n)||NN(v,n)||NN(n,v)||NN(k?.portalNode,n)||l.some(e=>e===n||NN(e,n))||c.hasMatchingElement(e=>NN(e,n))||f||O&&(lI(O.nodesRef.current,a).find(e=>NN(e.context?.elements.floating,n)||NN(e.context?.elements.domReference,n))||uI(O.nodesRef.current,a).find(e=>[e.context?.elements.floating,SP(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===_&&W&&oR(W),o&&r!==_&&!HF(i)&&MN(e)===e.body){if(dj(W)&&(W.focus(),o===`popup`)){H.request(()=>{W.focus()});return}let e=G(),t=N.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||W;dj(n)&&n.focus()}b.current.insideReactTree?b.current.insideReactTree=!1:(C||!s)&&n&&p&&!j.current&&(C||n!==aR())&&(A.current=!0,h.setOpen(!1,XP(BP,t)))})}function a(){M.current||(b.current.insideReactTree=!0,B.start(0,()=>{b.current.insideReactTree=!1}))}let l=dj(_)?_:null;if(v||l)return eF(l&&QP(l,`focusout`,i),l&&QP(l,`pointerdown`,t),v&&QP(v,`focusin`,n),v&&QP(v,`focusout`,i),v&&k&&QP(v,`focusout`,a,!0))},[r,_,v,W,s,O,k,h,c,o,G,C,x,b,B,V,H,u,d,ee]),cR.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(k?.portalNode?.querySelectorAll(`[${fI(`portal`)}]`)||[]),t=(O?uI(O.nodesRef.current,x()):[]).find(e=>bP(e.context?.elements.domReference||null))?.context?.elements.domReference,n=bI([v,...e,I.current,L.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,...ee(),t,tR(d),tR(u),C?_:null].filter(e=>e!=null),{ariaHidden:s||C,mark:!1}),i=bI([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,s,k,C,O,x,u,d,ee]),Q(()=>{if(!g||r||!dj(W))return;P.current=``,F.current=``;let e=EF(W),t=MN(e);queueMicrotask(()=>{let n=w.current,r=typeof n==`function`?n(E.current||``):n;if(r===void 0||r===!1||NN(W,t))return;let i=null,a=()=>(i??=G(W),i[0]||W),o;o=r===!0||r===null?a():tR(r),o||=a();let s=NN(W,MN(e));mI(o,{preventScroll:o===W,shouldFocus(){if(!D.current)return!1;if(s)return!0;let t=MN(e);return!(t!==o&&NN(W,t))}})})},[r,g,W,G,w,E,D]),Q(()=>{if(r||!W)return;let e=EF(W),t=MN(e),n=E.current==null;iR(t);function i(e){if(e.open||(P.current=yne(e.nativeEvent,F.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(A.current=!0),e.reason===`outside-press`){if(e.nested)A.current=!1;else if(ON(e.nativeEvent)||kN(e.nativeEvent))A.current=!1;else{let e=!1;EF(W).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?A.current=!1:A.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&&oj(t)!==`body`?t:null,s=n?o||a:a||o;return s||=aR()||null,typeof i==`boolean`?s:tR(i)||s||null}return()=>{y.off(`openchange`,i);let t=MN(e),n=ee(),r=NN(v,t)||n.some(e=>e===t||NN(e,t))||O&&lI(O.nodesRef.current,x(),!1).some(e=>NN(e.context?.elements.floating,t)),o=T.current,s=P.current,c=a(s);queueMicrotask(()=>{let n=bne(c),i=typeof o!=`boolean`;if(o&&!A.current&&dj(n)&&(i||n===t||t===e.body||r)){let e={preventScroll:!0};s===`keyboard`&&(e.focusVisible=!0),n.focus(e)}A.current=!1})}},[r,v,W,T,E,y,O,_,x,ee]),Q(()=>{if(!yN||g||!v)return;let e=MN(EF(v));dj(e)&&vP(e)&&NN(v,e)&&e.blur()},[g,v]),Q(()=>{if(!r&&k)return k.setFocusManagerState({modal:s,closeOnFocusOut:c,open:g,onOpenChange:h.setOpen,domReference:_}),()=>{k.setFocusManagerState(null)}},[r,k,s,g,h,c,_]),Q(()=>{if(!r&&W)return oR(W),()=>{queueMicrotask(rR)}},[r,W]);let te=!r&&(!s||!C)&&(U||s);return(0,lR.jsxs)(cR.Fragment,{children:[te&&(0,lR.jsx)(PF,{"data-type":`inside`,ref:R,onFocus:e=>{if(s){let e=G();mI(e[e.length-1])}else k?.portalNode&&(A.current=!1,aI(e,k.portalNode)?nI(_)?.focus():tR(d??k.beforeOutsideRef)?.focus())}}),n,te&&(0,lR.jsx)(PF,{"data-type":`inside`,ref:z,onFocus:e=>{s?mI(G()[0]):k?.portalNode&&(c&&(A.current=!0),aI(e,k.portalNode)?rI(_)?.focus():tR(u??k.afterOutsideRef)?.focus())}})]})}var cR,lR,uR,dR,xne=s((()=>{cR=d(m(),1),Aj(),$P(),tF(),cF(),dF(),yF(),oN(),rN(),TN(),TF(),DF(),FF(),CP(),jN(),cI(),dI(),UF(),ZP(),YP(),pI(),gI(),kI(),BL(),eR(),jL(),nR(),lR=d(O(),1),uR=20,dR=[]}));function fR(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=jP}=t,l=`rootStore`in e?e.rootStore:e,u=l.context.dataRef,d=pR.useRef(void 0),f=bF(),p=eN(),m=pR.useMemo(()=>{function e(e,t,n,r){let i=XP(c,t,n);e&&r===`touch`&&s>0?p.start(s,()=>{l.setOpen(!0,i)}):l.setOpen(e,i)}function t(e,t,n){let r=u.current.openEvent,a=l.select(`domReferenceElement`)!==t;return e&&a||!e||!i?!0:r&&o?!n(r.type):!1}return{onPointerDown(e){d.current=AN(e.pointerType,!0)&&kN(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(n){let i=d.current,o=n.nativeEvent,s=l.select(`open`);if(n.button!==0||r===`click`||AN(i,!0)&&a)return;let c=t(s,n.currentTarget,e=>e===`click`||e===`mousedown`),u=PN(o);if(vP(u)){e(c,o,u,i);return}let p=n.currentTarget;f.request(()=>{e(c,o,p,i)})},onClick(n){if(r===`mousedown-only`)return;let i=d.current;r===`mousedown`&&i?d.current=void 0:AN(i,!0)&&a||e(t(l.select(`open`),n.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),n.nativeEvent,n.currentTarget,i)},onKeyDown(){d.current=void 0}}},[u,r,a,c,l,o,i,f,p,s]);return pR.useMemo(()=>n?{reference:m}:YM,[n,m])}var pR,Sne=s((()=>{pR=d(m(),1),TF(),rN(),XM(),CP(),jN(),ZP(),YP()}));function Cne(){return!1}function wne(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function mR(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=Cne,bubbles:s,externalTree:c}=t,l=`rootStore`in e?e.rootStore:e,u=l.useState(`open`),d=l.useState(`floatingElement`),{dataRef:f,events:p}=l.context,m=$L(c),h=$(typeof i==`function`?i:()=>!1),g=typeof i==`function`?h:i,_=g!==!1,v=$(()=>a),{escapeKey:y,outsidePress:b}=wne(s),x=hR.useRef(!1),S=hR.useRef(!1),C=hR.useRef(!1),w=hR.useRef(!1),T=hR.useRef(!1),E=hR.useRef(``),D=hR.useRef(null),O=eN(),k=eN(),A=$(()=>{k.clear(),f.current.insideReactTree=!1}),j=$(e=>{let t=f.current.floatingContext?.nodeId;return(m?lI(m.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),M=$(e=>gP(e,l.select(`floatingElement`))||gP(e,l.select(`domReferenceElement`))),N=$(e=>{o()&&l.setOpen(!1,XP(jP,e.nativeEvent))}),P=$(e=>{if(!u||!n||!r||e.key!==`Escape`||T.current||!y&&j(`__escapeKeyBubbles`))return;let t=DN(e)?e.nativeEvent:e,i=XP(VP,t);l.setOpen(!1,i),i.isCanceled||e.preventDefault(),!y&&!i.isPropagationAllowed&&e.stopPropagation()}),F=$(()=>{f.current.insideReactTree=!0,k.start(0,A)}),I=$(e=>{if(!u||!n||e.button!==0)return;let t=PN(e.nativeEvent);NN(l.select(`floatingElement`),t)&&(x.current||(x.current=!0,S.current=!1))}),L=$(e=>{u&&n&&(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&x.current&&(S.current=!0)});hR.useEffect(()=>{function e(e){e.open||(w.current=!1)}return p.on(`openchange`,e),()=>{p.off(`openchange`,e)}},[p]),hR.useEffect(()=>{if(!u||!n)return u||(w.current=!1),A;f.current.__escapeKeyBubbles=y,f.current.__outsidePressBubbles=b;let e=new nN,t=new nN,i=EF(d);function a(){e.clear(),T.current=!0}function o(){e.start(yN?5:0,()=>{T.current=!1})}function s(){C.current=!0,t.start(0,()=>{C.current=!1})}function c(){x.current=!1,S.current=!1}function p(){let e=E.current,t=e===`pen`||!e?`mouse`:e,n=v(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function h(e){let t=p();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function k(e){let t=f.current.floatingContext?.nodeId,n=m&&lI(m.nodesRef.current,t).some(t=>gP(e,t.context?.elements.floating));return M(e)||n}function N(e){if(h(e)){e.type!==`click`&&!M(e)&&(t.clear(),C.current=!1),A();return}if(f.current.insideReactTree){A();return}let n=PN(e),r=`[${fI(`inert`)}]`,i=uj(n)?n.getRootNode():null,a=Array.from((fj(i)?i:EF(l.select(`floatingElement`))).querySelectorAll(r)),o=l.context.triggerElements;if(n&&(o.hasElement(n)||o.hasMatchingElement(e=>NN(e,n))))return;let s=uj(n)?n:null;for(;s&&!yj(s);){let e=Sj(s);if(yj(e)||!uj(e))break;s=e}if(!(a.length&&uj(n)&&!_P(n)&&!NN(n,l.select(`floatingElement`))&&a.every(e=>!NN(s,e)))){if(dj(n)&&!(`touches`in e)){let t=yj(n),r=bj(n),i=/auto|scroll/,a=t||i.test(r.overflowX),o=t||i.test(r.overflowY),s=a&&n.clientWidth>0&&n.scrollWidth>n.clientWidth,c=o&&n.clientHeight>0&&n.scrollHeight>n.clientHeight,l=r.direction===`rtl`,u=c&&(l?e.offsetX<=n.offsetWidth-n.clientWidth:e.offsetX>n.clientWidth),d=s&&e.offsetY>n.clientHeight;if(u||d)return}if(!k(e)){if(p()===`intentional`){if(e.detail!==0&&!ON(e)&&!w.current)return;if(C.current){t.clear(),C.current=!1;return}}typeof g==`function`&&!g(e)||j(`__outsidePressBubbles`)||(l.setOpen(!1,XP(PP,e)),A())}}}function F(e){p()===`sloppy`&&e.pointerType!==`touch`&&l.select(`open`)&&n&&!M(e)&&N(e)}function I(e){if(p()!==`sloppy`||!l.select(`open`)||!n||M(e))return;let t=e.touches[0];t&&(D.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},O.start(1e3,()=>{D.current&&(D.current.dismissOnTouchEnd=!1,D.current.dismissOnMouseDown=!1)}))}function L(e,t){let n=PN(e);if(!n)return;let r=QP(n,e.type,()=>{t(e),r()})}function R(e){E.current=`touch`,L(e,I)}function z(e){O.clear(),e.type===`pointerdown`&&(e.button===0&&(w.current=!0),E.current=e.pointerType),(e.type!==`mousedown`||!D.current||D.current.dismissOnMouseDown)&&L(e,e=>{e.type===`pointerdown`?F(e):N(e)})}function B(e){if(e.type===`pointercancel`&&(w.current=!1),!x.current)return;let n=S.current;c(),p()===`intentional`&&(e.type===`pointercancel`?n&&s():k(e)||(n?s():(typeof g!=`function`||g(e))&&(t.clear(),C.current=!0,A())))}function V(e){if(p()!==`sloppy`||!D.current||M(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-D.current.startX),r=Math.abs(t.clientY-D.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(D.current.dismissOnTouchEnd=!0),i>10&&(N(e),O.clear(),D.current=null)}function H(e){L(e,V)}function U(e){p()===`sloppy`&&D.current&&!M(e)&&(D.current.dismissOnTouchEnd&&N(e),O.clear(),D.current=null)}function W(e){L(e,U)}let G=eF(r&&eF(QP(i,`keydown`,P),QP(i,`compositionstart`,a),QP(i,`compositionend`,o)),_&&eF(QP(i,`click`,z,!0),QP(i,`pointerdown`,z,!0),QP(i,`pointerup`,B,!0),QP(i,`pointercancel`,B,!0),QP(i,`mousedown`,z,!0),QP(i,`mouseup`,B,!0),QP(i,`touchstart`,R,{capture:!0,passive:!0}),QP(i,`touchmove`,H,{capture:!0,passive:!0}),QP(i,`touchend`,W,{capture:!0,passive:!0})));return()=>{G(),e.clear(),t.clear(),c(),C.current=!1,A()}},[f,d,r,_,g,u,n,y,b,P,A,v,j,M,m,l,O]);let R=hR.useMemo(()=>({onKeyDown:P,onPointerDown:N,onClick:N}),[P,N]),z=hR.useMemo(()=>({onKeyDown:P,onPointerDown:L,onMouseDown:L,onClickCapture:F,onMouseDownCapture(e){F(),I(e)},onPointerDownCapture(e){F(),I(e)},onMouseUpCapture:F,onTouchEndCapture:F,onTouchMoveCapture:F}),[P,F,I,L]);return hR.useMemo(()=>n?{reference:R,floating:z,trigger:R}:{},[n,R,z])}var hR,Tne=s((()=>{hR=d(m(),1),$P(),tF(),DF(),yF(),rN(),Aj(),TN(),eR(),ZP(),YP(),pI(),CP(),jN(),dI()}));function gR(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(!gR(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)&&!gR(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function _R(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function vR(e,t){let n=_R(e);return Math.round(t*n)/n}function yR(e){let t=bR.useRef(e);return CR(()=>{t.current=e}),t}function Ene(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]=bR.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=bR.useState(r);gR(f,r)||p(r);let[m,h]=bR.useState(null),[g,_]=bR.useState(null),v=bR.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=bR.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=bR.useRef(null),C=bR.useRef(null),w=bR.useRef(u),T=c!=null,E=yR(c),D=yR(i),O=yR(l),k=bR.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),dM(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!gR(w.current,t)&&(w.current=t,SR.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);CR(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=bR.useRef(!1);CR(()=>(A.current=!0,()=>{A.current=!1}),[]),CR(()=>{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=bR.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=bR.useMemo(()=>({reference:b,floating:x}),[b,x]),N=bR.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=vR(M.floating,u.x),r=vR(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,..._R(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return bR.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var bR,xR,SR,CR,wR,TR,ER,DR,OR,kR=s((()=>{fM(),bR=d(m(),1),xR=d(m(),1),SR=d(g(),1),CR=typeof document<`u`?xR.useLayoutEffect:function(){},wR=(e,t)=>{let n=oM(e);return{name:n.name,fn:n.fn,options:[e,t]}},TR=(e,t)=>{let n=sM(e);return{name:n.name,fn:n.fn,options:[e,t]}},ER=(e,t)=>({fn:uM(e).fn,options:[e,t]}),DR=(e,t)=>{let n=cM(e);return{name:n.name,fn:n.fn,options:[e,t]}},OR=(e,t)=>{let n=lM(e);return{name:n.name,fn:n.fn,options:[e,t]}}})),AR=s((()=>{})),jR=s((()=>{})),MR=s((()=>{})),NR=s((()=>{}));function PR(e,t,n,r,i){return VR(e,t,n,r,i)}function FR(e,t,n,r,i){let a=RR.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,zR.useSyncExternalStore)(e.subscribe,a,a)}function IR(e,t,n,r,i){let a=tne();if(!a)return FR(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 LR(e,t,n,r,i){return(0,BR.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var RR,zR,BR,VR,HR=s((()=>{RR=d(m(),1),zR=Wd(),BR=rC(),VI(),KM(),VR=zI(19)?IR:LR,nne({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,zR.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}})})),UR,WR=s((()=>{HR(),UR=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 PR(this,e,t,n,r)}}})),GR,KR,qR=s((()=>{GR=d(m(),1),WR(),HR(),yF(),oN(),XM(),KR=class extends UR{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){GR.useDebugValue(e);let n=this;Q(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;Q(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this,n=Object.values(e);Q(()=>{t.update(e)},[t,...n])}useControlledProp(e,t){GR.useDebugValue(e);let n=this,r=t!==void 0;Q(()=>{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 GR.useDebugValue(e),PR(this,this.selectors[e],t,n,r)}useContextCallback(e,t){GR.useDebugValue(e);let n=$(t??qM);this.context[e]=n}useStateSetter(e){let t=GR.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)}})}}})),JR=s((()=>{m(),g(),Wd(),O()})),YR=s((()=>{MR(),NR(),HR(),WR(),qR(),JR()})),XR=s((()=>{CP(),dI(),jN(),UF(),cI()})),ZR,QR,$R=s((()=>{YR(),HL(),XR(),ZR={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},QR=class extends KR{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:VL(),nested:n,triggerElements:i},ZR),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&sne(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)=>{this.syncOnly||this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}}}));function ez(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=t.context.triggerElements,d=o,f=tz.useRef(null);r===void 0&&f.current===null&&(f.current=new QR({open:s,transitionStatus:void 0,referenceElement:c,floatingElement:l,triggerElements:u,onOpenChange:d,floatingId:i,syncOnly:!0,nested:a}));let p=r??f.current;return t.useSyncedValue(`floatingId`,i),Q(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};uj(c)&&(e.domReferenceElement=c),p.state.positionReference===p.state.referenceElement&&(e.positionReference=c),p.update(e)},[s,i,c,l,p]),p.context.onOpenChange=d,p.context.nested=a,p}var tz,nz=s((()=>{tz=d(m(),1),oN(),Aj(),$R()}));function rz(e,t=!1,n=!1,r=!1){let[i,a]=iz.useState(e&&t?`idle`:void 0),[o,s]=iz.useState(e&&!r);return e&&!o&&(s(!0),a(`starting`)),!e&&o&&i!==`ending`&&!n&&a(`ending`),!e&&!o&&i===`ending`&&a(void 0),Q(()=>{if(!e&&o&&i!==`ending`&&n){let e=wF.request(()=>{a(`ending`)});return()=>{wF.cancel(e)}}},[e,o,i,n]),Q(()=>{if(!e||t)return;let n=wF.request(()=>{a(void 0)});return()=>{wF.cancel(n)}},[t,e]),Q(()=>{if(!e||!t)return;e&&o&&i!==`idle`&&a(`starting`);let n=wF.request(()=>{a(`idle`)});return()=>{wF.cancel(n)}},[t,e,o,i]),{mounted:o,setMounted:s,transitionStatus:i}}var iz,az=s((()=>{iz=d(m(),1),oN(),TF()}));function oz(e){if(!lz){let e=[];lz=e,queueMicrotask(()=>{lz=null,cz.flushSync(()=>{for(let t of e)t()})})}lz.push(e)}function sz(e,t=!1,n=!1){let r=bF();return $((i,a=null)=>{r.cancel();let o=tR(e);if(o==null)return;let s=o,c=()=>{n?oz(()=>{a?.aborted||i()}):cz.flushSync(i)};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(s.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||c()},()=>{a?.aborted||(s.getAnimations().some(e=>e.pending||e.playState!==`finished`)?l():c())})}if(t){let e=UN;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})}else r.request(l)})}var cz,lz,uz=s((()=>{cz=d(g(),1),TF(),yF(),nR(),GN(),lz=null}));function dz(e){let{enabled:t=!0,open:n,ref:r,batch:i=!1,onComplete:a}=e,o=$(a),s=sz(r,n,i);fz.useEffect(()=>{if(!t)return;let e=new AbortController;return s(o,e.signal),()=>{e.abort()}},[t,n,o,s])}var fz,pz=s((()=>{fz=d(m(),1),yF(),uz()}));function mz(e){return t=>t!==`touch`||e.current}function hz(e,t=!1){let n=jI(),r=QL()!=null,i=LM(()=>e(n,r)).current;return ez({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:i.setOpen}),i}function gz({handle:e,store:t}){return Q(()=>e.attachStore(t),[e,t]),null}function _z(e){let t=e.context.triggerElements.size;e.select(`open`)&&e.state.triggerCount!==t&&e.set(`triggerCount`,t)}function vz(e,t){let n=Ez.useRef(null);return $(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),_z(a))}r!==null&&e!==void 0&&(n.current={store:t,id:e,element:r},t.context.triggerElements.add(e,r),_z(t))})}function yz(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}}function bz(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function xz(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=vz(e,n),o=$(t=>{let i=n.select(`open`),a=n.select(`activeTriggerId`);if(a===e){let e={activeTriggerElement:t,...i?r:null};n.update(e)}else if(a==null&&i){let i={activeTriggerId:e??null,activeTriggerElement:t,...r};n.update(i)}}),s=$(e=>{a(e),e&&o(e)});return Q(()=>(s(t.current),()=>s(null)),[s,t,n,e]),Q(()=>{if(i){let e={activeTriggerElement:t.current,...r};n.update(e)}},[i,n,t,...Object.values(r)]),{registerTrigger:s,isMountedByThisTrigger:i}}function Sz(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=Ez.useRef(null),i=e.useState(`open`),a=e.useState(`triggerCount`),o=e.useState(`activeTriggerId`),s=e.useState(`activeTriggerElement`);Q(()=>{if(!i){r.current=null,e.state.triggerCount!==0&&e.set(`triggerCount`,0);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&&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=XP(AP);e.setOpen(!1,t),t.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[i,e,a,o,s,n])}function Cz(e,t,n,r){let{mounted:i,setMounted:a,transitionStatus:o}=rz(e,!1,!1,r),s=t.useState(`preventUnmountingOnClose`),c=!e&&s;t.useSyncedValues({mounted:i,transitionStatus:o,preventUnmountingOnClose:c});let l=$(()=>{a(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return dz({enabled:i&&!e&&!c,open:e,ref:t.context.popupRef,onComplete(){e||l()}}),{forceUnmount:l,transitionStatus:o}}function wz(e,t){e.useSyncedValues(t),Q(()=>()=>{e.update({activeTriggerProps:YM,inactiveTriggerProps:YM,popupProps:YM})},[e])}function Tz(e,t){Q(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),Q(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var Ez,Dz,Oz=s((()=>{Ez=d(m(),1),g(),XM(),FI(),yF(),oN(),BM(),HN(),eR(),nz(),az(),pz(),ZP(),YP(),Dz={tabIndex:-1,[IN]:``}})),kz,Az=s((()=>{kz=class{constructor(){this.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}}}));function jz(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new QR({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,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:YM,inactiveTriggerProps:YM,popupProps:YM}}function Mz(e,t){return t!==void 0&&Fz(e)&&Pz(e)===t}function Nz(e,t){return Mz(e,t)?!0:t!==void 0&&Fz(e)&&Pz(e)==null&&e.triggerCount===1}var Pz,Fz,Iz,Lz,Rz=s((()=>{XM(),$R(),Pz=e=>e.triggerIdProp??e.activeTriggerId,Fz=e=>e.openProp??e.open,Iz=e=>(e.popupElement?.id??e.floatingId)||void 0,Lz={open:Fz,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:Pz,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:Iz,isTriggerActive:(e,t)=>t!==void 0&&Pz(e)===t,isOpenedByTrigger:(e,t)=>Mz(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&Pz(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>Nz(e,t)?Iz(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement}}));function zz(e){let t=Bz.useCallback(t=>e===void 0?qM:e.subscribeStore(t),[e]),n=Bz.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,Vz.useSyncExternalStore)(t,n,()=>e?.serverStore)}var Bz,Vz,Hz=s((()=>{Bz=d(m(),1),Vz=Wd(),XM()})),Uz=s((()=>{AR(),jR(),Oz(),Az(),Rz(),Hz()}));function Wz(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=jI(),a=QL()!=null,o=LM(()=>new QR({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new kz,floatingId:i,syncOnly:!1,nested:a})).current;return Q(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=uj(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}var Gz=s((()=>{Aj(),FI(),oN(),BM(),Uz(),eR(),$R()}));function Kz(e){return qz(e,e.rootContext)}function qz(e,t){let{nodeId:n,externalTree:r}=e,i=t.useState(`referenceElement`),a=t.useState(`floatingElement`),o=t.useState(`domReferenceElement`),s=t.useState(`open`),c=t.useState(`floatingId`),[l,u]=Jz.useState(null),[d,f]=Jz.useState(void 0),[p,m]=Jz.useState(void 0),h=Jz.useRef(null),g=$L(r),_=Jz.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),v=Ene({...e,elements:{..._,...l&&{reference:l}}}),y=uj(d)?d:null,b=p===void 0?t.state.floatingElement:p;t.useSyncedValue(`referenceElement`,d??null),t.useSyncedValue(`domReferenceElement`,d===void 0?o:y),t.useSyncedValue(`floatingElement`,b);let x=Jz.useCallback(e=>{let t=uj(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),v.refs.setReference(t)},[v.refs]),S=Jz.useCallback(e=>{(uj(e)||e===null)&&(h.current=e,f(e)),(uj(v.refs.reference.current)||v.refs.reference.current===null||e!==null&&!uj(e))&&v.refs.setReference(e)},[v.refs,f]),C=Jz.useCallback(e=>{m(e),v.refs.setFloating(e)},[v.refs]),w=Jz.useMemo(()=>({...v.refs,setReference:S,setFloating:C,setPositionReference:x,domReference:h}),[v.refs,S,C,x]),T=Jz.useMemo(()=>({...v.elements,domReference:o}),[v.elements,o]),E=Jz.useMemo(()=>({...v,dataRef:t.context.dataRef,open:s,onOpenChange:t.setOpen,events:t.context.events,floatingId:c,refs:w,elements:T,nodeId:n,rootStore:t}),[v,w,T,n,t,s,c]);return Q(()=>{o&&(h.current=o)},[o]),Q(()=>{t.context.dataRef.current.floatingContext=E;let e=g?.nodesRef.current.find(e=>e.id===n);e&&(e.context=E)}),Jz.useMemo(()=>({...v,context:E,refs:w,elements:T,rootStore:t}),[v,w,T,E,t])}var Jz,Yz=s((()=>{Jz=d(m(),1),oN(),kR(),Aj(),eR()}));function Xz(e,t={}){let{enabled:n=!0,delay:r}=t,i=`rootStore`in e?e.rootStore:e,{events:a,dataRef:o}=i.context,s=Zz.useRef(!1),c=Zz.useRef(null),l=Zz.useRef(!0),u=eN();Zz.useEffect(()=>{let e=i.select(`domReferenceElement`);if(!n)return;let t=sj(e);function r(){let e=i.select(`domReferenceElement`);!i.select(`open`)&&dj(e)&&e===MN(EF(e))&&(s.current=!0,c.current=e)}function a(){l.current=!0}function o(){l.current=!1}return eF(QP(t,`blur`,r),Qz&&QP(t,`keydown`,a,!0),Qz&&QP(t,`pointerdown`,o,!0))},[i,n]),Zz.useEffect(()=>{if(!n)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=i.select(`domReferenceElement`);uj(e)&&(c.current=e,s.current=!0)}}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[a,n,i]);let d=Zz.useMemo(()=>{function e(){s.current=!1,c.current=null}return{onMouseLeave(){e()},onFocus(t){let n=t.currentTarget;if(s.current){if(c.current===n)return;e()}let a=PN(t.nativeEvent);if(uj(a)){if(Qz&&!t.relatedTarget){if(!l.current&&!vP(a))return}else if(!xP(a))return}let o=hP(t.relatedTarget,i.context.triggerElements),{nativeEvent:d,currentTarget:f}=t,p=typeof r==`function`?r():r;i.select(`open`)&&o||p===0||p===void 0?i.setOpen(!0,XP(NP,d,f)):u.start(p,()=>{s.current||i.setOpen(!0,XP(NP,d,f))})},onBlur(t){e();let n=t.relatedTarget,r=t.nativeEvent,a=uj(n)&&n.hasAttribute(fI(`focus-guard`))&&n.getAttribute(`data-type`)===`outside`;u.start(0,()=>{let e=i.select(`domReferenceElement`),t=MN(EF(e));!n&&t===e||NN(o.current.floatingContext?.refs.floating.current,t)||NN(e,t)||a||hP(n??t,i.context.triggerElements)||i.setOpen(!1,XP(NP,r))})}}},[o,r,i,u]);return Zz.useMemo(()=>n?{reference:d,trigger:d}:{},[n,d])}var Zz,Qz,$z=s((()=>{Zz=d(m(),1),$P(),TN(),tF(),DF(),rN(),Aj(),pI(),CP(),ZP(),YP(),Qz=gN&&yN}));function eB(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&iB.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),iB.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function tB(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=iB.get(n);a&&a!==e&&eB(a),eB(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,iB.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function nB(e){let t=e.context.dataRef.current,n=LM(()=>t.hoverInteractionState??rB.create()).current;return t.hoverInteractionState||=n,ZM(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}var rB,iB,aB=s((()=>{$M(),BM(),rN(),XR(),rB=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new nN,this.restTimeout=new nN,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},iB=new WeakMap}));function oB(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=`rootStore`in e?e.rootStore:e,o=a.useState(`open`),s=a.useState(`floatingElement`),c=a.useState(`domReferenceElement`),{dataRef:l}=a.context,u=$L(),d=QL(),f=nB(a),p=eN(),m=$(()=>DP(l.current.openEvent?.type,f.interactedInside)),h=$(()=>OP(l.current.openEvent?.type)),g=$(()=>{eB(f)});Q(()=>{o||(f.pointerType=void 0,f.restTimeoutPending=!1,f.interactedInside=!1,g())},[o,f,g]),sB.useEffect(()=>g,[g]),Q(()=>{if(n&&o&&f.handleCloseOptions?.blockPointerEvents&&h()&&uj(c)&&s){let e=c,t=s,n=EF(s),r=u?.nodesRef.current.find(e=>e.id===d)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=f.pointerEventsScopeElement===t?null:f.pointerEventsScopeElement,a=r===t?null:r,o=f.handleCloseOptions?.getScope?.()??i??a??e.closest(`[data-rootownerid]`)??n.body;return tB(f,{scopeElement:o,referenceElement:e,floatingElement:t}),()=>{g()}}},[n,o,c,s,f,h,u,d,g]),sB.useEffect(()=>{if(!n)return;function e(){return!!(u&&d&&lI(u.nodesRef.current,d).length>0)}function t(e){let t=TP(r,`close`,f.pointerType),n=()=>{a.setOpen(!1,XP(MP,e)),u?.events.emit(`floating.closed`,e)};t?f.openChangeTimeout.start(t,n):(f.openChangeTimeout.clear(),n())}function o(e){let t=PN(e);yP(t)?f.interactedInside=t?.closest(`[aria-haspopup]`)!=null:f.interactedInside=!1}function c(){f.openChangeTimeout.clear(),p.clear(),u?.events.off(`floating.closed`,v),g()}function _(n){if(e()&&u){u.events.on(`floating.closed`,v);return}if(hP(n.relatedTarget,a.context.triggerElements))return;let r=l.current.floatingContext?.nodeId??i,o=n.relatedTarget;u&&r&&uj(o)&&lI(u.nodesRef.current,r,!1).some(e=>NN(e.context?.elements.floating,o))||(f.handler?f.handler(n):(g(),h()&&!m()&&t(n)))}function v(t){u&&d&&!e()&&p.start(0,()=>{u.events.off(`floating.closed`,v),a.setOpen(!1,XP(MP,t)),u.events.emit(`floating.closed`,t)})}let y=s;return eF(y&&QP(y,`mouseenter`,c),y&&QP(y,`mouseleave`,_),y&&QP(y,`pointerdown`,o,!0),()=>{u?.events.off(`floating.closed`,v)})},[n,s,a,l,r,i,h,m,g,f,u,d,p])}var sB,cB=s((()=>{sB=d(m(),1),$P(),tF(),oN(),DF(),yF(),rN(),Aj(),ZP(),YP(),eR(),CP(),dI(),aB(),kP()}));function lB(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=fB,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p,guardStaleOpen:m=!1}=t,h=`rootStore`in e?e.rootStore:e,{dataRef:g,events:_}=h.context,v=$L(l),y=nB(h),b=uB.useRef(!1),x=lF(i),S=lF(r),C=lF(o),w=lF(n),T=lF(p),E=lF(f),D=$(()=>DP(g.current.openEvent?.type,y.interactedInside)),O=$(()=>T.current?.()!==!1),k=$((e,t,n)=>{let r=h.context.triggerElements;if(r.hasElement(t))return!e||!NN(e,t);if(!uj(n))return!1;let i=n;return r.hasMatchingElement(e=>NN(e,i))&&(!e||!NN(e,i))}),A=$(()=>{y.handler&&=(EF(h.select(`domReferenceElement`)).removeEventListener(`mousemove`,y.handler),void 0)}),j=$(()=>{eB(y)});return u&&(y.handleCloseOptions=i?.__options),uB.useEffect(()=>A,[A]),uB.useEffect(()=>{if(!n)return;function e(e){e.open?b.current=!1:(b.current=e.reason===MP,A(),y.openChangeTimeout.clear(),y.restTimeout.clear(),y.blockMouseMove=!0,y.restTimeoutPending=!1)}return _.on(`openchange`,e),()=>{_.off(`openchange`,e)}},[n,_,y,A]),uB.useEffect(()=>{if(!n)return;function e(e,t=!0){let n=TP(S.current,`close`,y.pointerType);n?y.openChangeTimeout.start(n,()=>{h.setOpen(!1,XP(MP,e)),v?.events.emit(`floating.closed`,e)}):t&&(y.openChangeTimeout.clear(),h.setOpen(!1,XP(MP,e)),v?.events.emit(`floating.closed`,e))}let t=c.current??(u?h.select(`domReferenceElement`):null);if(!uj(t))return;function r(e){if(y.openChangeTimeout.clear(),y.blockMouseMove=!1,a&&!AN(y.pointerType))return;let t=EP(C.current),n=TP(S.current,`open`,y.pointerType),r=PN(e),i=e.currentTarget??null,o=h.select(`domReferenceElement`),s=i;if(uj(r)&&!h.context.triggerElements.hasElement(r)){for(let e of h.context.triggerElements.elements())if(NN(e,r)){s=e;break}}uj(i)&&uj(o)&&!h.context.triggerElements.hasElement(i)&&NN(i,o)&&(s=o);let c=s!=null&&k(o,s,r),l=h.select(`open`),u=E.current?.()??h.select(`transitionStatus`)===`ending`,d=!l&&u&&b.current,f=!c&&uj(s)&&uj(o)&&NN(o,s)&&d,p=t>0&&!n,m=c&&(l||d)||f,g=!l||c;m?O()&&h.setOpen(!0,XP(MP,e,s)):p||(n?y.openChangeTimeout.start(n,()=>{g&&O()&&h.setOpen(!0,XP(MP,e,s))}):g&&O()&&h.setOpen(!0,XP(MP,e,s)))}function i(t){if(D()){j();return}A();let n=EF(h.select(`domReferenceElement`));y.restTimeout.clear(),y.restTimeoutPending=!1;let r=g.current.floatingContext??d?.();if(!hP(t.relatedTarget,h.context.triggerElements)){if(x.current&&r){h.select(`open`)||y.openChangeTimeout.clear();let i=c.current;y.handler=x.current({...r,tree:v,x:t.clientX,y:t.clientY,onClose(){j(),A(),w.current&&!D()&&i===h.select(`domReferenceElement`)&&e(t,!0)}}),n.addEventListener(`mousemove`,y.handler),y.handler(t)}else y.pointerType===`touch`&&NN(h.select(`floatingElement`),t.relatedTarget)||e(t)}}function o(e){NN(t,e.relatedTarget)||(y.openChangeTimeout.clear(),y.restTimeout.clear(),y.restTimeoutPending=!1)}let l=m?QP(t,`mouseout`,o):void 0;return s?eF(QP(t,`mousemove`,r,{once:!0}),QP(t,`mouseenter`,r),QP(t,`mouseleave`,i),l):eF(QP(t,`mouseenter`,r),QP(t,`mouseleave`,i),l)},[A,j,g,S,h,n,x,y,u,k,D,a,s,C,c,v,w,d,E,O,m]),uB.useMemo(()=>{if(!n)return;function e(e){y.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,n=e.currentTarget,r=h.select(`domReferenceElement`),i=h.select(`open`),o=k(r,n,e.target);if(a&&!AN(y.pointerType))return;if(i&&o&&y.handleCloseOptions?.blockPointerEvents){let e=h.select(`floatingElement`);if(e){let t=y.handleCloseOptions?.getScope?.()??n.ownerDocument.body;tB(y,{scopeElement:t,referenceElement:n,floatingElement:e})}}let s=EP(C.current);if(i&&!o||s===0||!o&&y.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;y.restTimeout.clear();function c(){if(y.restTimeoutPending=!1,D())return;let e=h.select(`open`);!y.blockMouseMove&&(!e||o)&&O()&&h.setOpen(!0,XP(MP,t,n))}y.pointerType===`touch`?dB.flushSync(()=>{c()}):o&&i?c():(y.restTimeoutPending=!0,y.restTimeout.start(s,c))}}},[n,y,D,k,a,h,C,O])}var uB,dB,fB,pB=s((()=>{uB=d(m(),1),dB=d(g(),1),$P(),tF(),DF(),yF(),dF(),Aj(),ZP(),YP(),eR(),CP(),jN(),aB(),kP(),fB={current:null}}));function mB(e){return yN&&e.movementX===0&&e.movementY===0}function hB(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function gB(e,t){return hB(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function _B(e,t,n){return hB(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function vB(e,t,n){return hB(t,n?e===RN:e===zN,e===VN)}function yB(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===SB:hB(t,n?e===zN:e===RN,e===BN)}function bB(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:a=!0,selectedIndex:o=null,allowEscape:s=!1,loopFocus:c=!1,nested:l=!1,rtl:u=!1,virtual:d=!1,focusItemOnOpen:f=`auto`,focusItemOnHover:p=!0,openOnArrowKeyDown:m=!0,disabledIndices:h=void 0,orientation:g=`vertical`,parentOrientation:_,id:v,resetOnPointerLeave:y=!0,externalTree:b,grid:x}=t,S=x!=null,C=`rootStore`in e?e.rootStore:e,w=C.useState(`open`),T=C.useState(`floatingElement`),E=C.useState(`domReferenceElement`),D=C.context.dataRef,O=SP(T),k=bP(E),A=lF(O),j=QL(),M=$L(b),N=xB.useRef(f),P=xB.useRef(o??-1),F=xB.useRef(null),I=xB.useRef(!0),L=$(e=>{i(P.current===-1?null:P.current,e)}),R=xB.useRef(!!T),z=xB.useRef(w),B=xB.useRef(!1),V=xB.useRef(!1),H=xB.useRef(null),U=lF(h),W=lF(w),G=lF(o),ee=lF(y),te=bF(),ne=bF(),K=$(()=>{function e(e){d?M?.events.emit(`virtualfocus`,e):H.current=mI(e,{sync:B.current,preventScroll:!0})}let t=n.current[P.current],r=V.current;t&&e(t),(B.current?e=>e():e=>te.request(e))(()=>{let i=n.current[P.current]||t;i&&(t||e(i),se&&(r||!I.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});Q(()=>{D.current.orientation=g},[D,g]),Q(()=>{a&&(w&&T?(P.current=o??-1,N.current&&o!=null&&(V.current=!0,L())):R.current&&(P.current=-1,L()))},[a,w,T,o,L]),Q(()=>{if(a){if(!w)B.current=!1;else if(T){if(r==null){if(B.current=!1,G.current!=null)return;if(R.current&&(P.current=-1,K()),(!z.current||!R.current)&&N.current&&(F.current!=null||N.current===!0&&F.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>ne.request(e):queueMicrotask)(t),e+=1):(P.current=F.current==null||_B(F.current,g,u)||l?RF(n):zF(n),F.current=null,L())};t()}}else LF(n.current,r)||(P.current=r,K(),V.current=!1)}}},[a,w,T,r,G,l,n,g,u,L,K,ne]),Q(()=>{if(!a||T||!M||d||!R.current)return;let e=M.nodesRef.current,t=e.find(e=>e.id===j)?.context?.elements.floating,n=MN(EF(E??t??null)),r=e.some(e=>e.context&&NN(e.context.elements.floating,n));t&&!r&&I.current&&t.focus({preventScroll:!0})},[a,T,E,M,j,d]),Q(()=>{z.current=w,R.current=!!T}),Q(()=>{w||(F.current=null,N.current=f)},[w,f]);let re=r!=null,q=$(e=>{if(!W.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(P.current!==t||r!==t)&&(P.current=t,L(e))}),ie=$(()=>_??M?.nodesRef.current.find(e=>e.id===j)?.context?.dataRef?.current.orientation),ae=$(()=>RF(n,U.current)),oe=$(e=>{if(I.current=!1,B.current=!0,e.which===229||!W.current&&e.currentTarget===A.current)return;if(l&&yB(e.key,g,u,S)){gB(e.key,ie())||EN(e),C.setOpen(!1,XP(HP,e.nativeEvent)),dj(E)&&(d?M?.events.emit(`virtualfocus`,E):E.focus());return}let t=P.current,r=RF(n,h),i=zF(n,h);if(k||(e.key===`Home`&&(EN(e),P.current=r,L(e)),e.key===`End`&&(EN(e),P.current=i,L(e))),x!=null){let t=x(e,P.current,n,g,c,u,h,r,i);if(t!=null&&(P.current=t,L(e)),g===`both`)return}if(gB(e.key,g)){if(EN(e),w&&!d&&MN(e.currentTarget.ownerDocument)===e.currentTarget){P.current=_B(e.key,g,u)?r:i,L(e);return}_B(e.key,g,u)?c?t>=i?s&&t!==n.current.length?P.current=-1:(B.current=!1,P.current=r):P.current=BF(n.current,{startingIndex:t,disabledIndices:h}):P.current=Math.min(i,BF(n.current,{startingIndex:t,disabledIndices:h})):c?t<=r?s&&t!==-1?P.current=n.current.length:(B.current=!1,P.current=i):P.current=BF(n.current,{startingIndex:t,decrement:!0,disabledIndices:h}):P.current=Math.max(r,BF(n.current,{startingIndex:t,decrement:!0,disabledIndices:h})),LF(n.current,P.current)&&(P.current=-1),L(e)}}),se=xB.useMemo(()=>({onFocus(e){B.current=!0,q(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){mB(e)||(B.current=!0,V.current=!1,p&&q(e))},onPointerLeave(e){if(!W.current||!I.current||e.pointerType===`touch`)return;B.current=!0;let t=e.relatedTarget;if(p&&!n.current.includes(t)&&ee.current&&(H.current?.(),H.current=null,P.current=-1,L(e),!d)){let e=A.current,t=MN(EF(e));e&&NN(e,t)&&e.focus({preventScroll:!0})}}}),[q,W,A,p,n,L,ee,d]),ce=xB.useMemo(()=>d&&w&&re&&{"aria-activedescendant":`${v}-${r}`},[d,w,re,v,r]),le=xB.useMemo(()=>({...k?{}:ce,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&w&&!d){let t=PN(e.nativeEvent);if(t&&!NN(A.current,t))return;EN(e),C.setOpen(!1,XP(BP,e.nativeEvent)),dj(E)&&E.focus()}else oe(e)},onPointerMove(e){mB(e)||(I.current=!0)}}),[ce,oe,A,k,C,w,d,E]),ue=xB.useMemo(()=>{function e(e){C.setOpen(!0,XP(HP,e.nativeEvent,e.currentTarget))}function t(e){f===`auto`&&ON(e.nativeEvent)&&(N.current=!d)}function n(e){N.current=f,f===`auto`&&kN(e.nativeEvent)&&(N.current=!0)}return{onKeyDown(t){let n=C.select(`open`);I.current=!1;let r=t.key.startsWith(`Arrow`),i=vB(t.key,ie(),u),a=gB(t.key,g),o=(l?i:a)||t.key===`Enter`||t.key.trim()===``;if(d&&n)return oe(t);if(n||m||!r){if(o){let e=gB(t.key,ie());F.current=l&&e?null:t.key}l?i&&(EN(t),n?(P.current=ae(),L(t)):e(t)):a&&(G.current!=null&&(P.current=G.current),EN(t),!n&&m?e(t):oe(t),n&&L(t))}},onFocus(e){C.select(`open`)&&!d&&(P.current=-1,L(e))},onPointerDown:n,onPointerEnter:n,onMouseDown:t,onClick:t}},[oe,f,ae,l,L,C,m,g,ie,u,G,d]),de=xB.useMemo(()=>({...ce,...ue}),[ce,ue]);return xB.useMemo(()=>a?{reference:de,floating:le,item:se,trigger:ue}:{},[a,de,le,ue,se])}var xB,SB,CB=s((()=>{xB=d(m(),1),TF(),oN(),DF(),yF(),dF(),TN(),Aj(),ZP(),YP(),eR(),UF(),HN(),CP(),gI(),jN(),SB=`Escape`}));function wB(e,t){let{listRef:n,elementsRef:r,activeIndex:i,onMatch:a,disabledIndices:o,onTyping:s,enabled:c=!0,resetMs:l=750,selectedIndex:u=null}=t,d=`rootStore`in e?e.rootStore:e,f=d.useState(`open`),p=eN(),m=TB.useRef(``),h=TB.useRef(u??i??-1),g=TB.useRef(null),_=$(e=>{function t(e){return r?.current[e]}function c(e){let n=t(e);return n&&!HF(n)||n?.matches(`:disabled`)?!1:o==null||!VF(JM,e,o)}function d(e,t,n=0){if(e.length===0)return-1;let r=(n%e.length+e.length)%e.length,i=t.toLowerCase();for(let t=0;t<e.length;t+=1){let n=(r+t)%e.length;if(e[n]?.toLowerCase().startsWith(i)&&c(n))return n}return-1}let _=n.current;if(m.current.length>0&&e.key===` `&&(EN(e),s?.(!0)),m.current.length>0&&m.current[0]!==` `&&d(_,m.current)===-1&&e.key!==` `&&s?.(!1),_==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;f&&e.key!==` `&&(EN(e),s?.(!0));let v=m.current===``;v&&(h.current=u??i??-1),_.every((e,t)=>e&&c(t)?e[0]?.toLowerCase()!==e[1]?.toLowerCase():!0)&&m.current===e.key&&(m.current=``,h.current=g.current),m.current+=e.key,p.start(l,()=>{m.current=``,h.current=g.current,s?.(!1)});let y=((v?u??i??-1:h.current)??0)+1,b=d(_,m.current,y);b===-1?e.key!==` `&&(m.current=``,s?.(!1)):(a?.(b),g.current=b)}),v=$(e=>{let t=e.relatedTarget,n=d.select(`domReferenceElement`),r=d.select(`floatingElement`);NN(n,t)||NN(r,t)||(p.clear(),m.current=``,h.current=g.current,s?.(!1))});Q(()=>{(f||u===null)&&(p.clear(),g.current=null,m.current!==``&&(m.current=``))},[f,u,p]);let y=TB.useMemo(()=>({onKeyDown:_,onBlur:v}),[_,v]);return TB.useMemo(()=>c?{reference:y,floating:y}:{},[c,y])}var TB,EB=s((()=>{TB=d(m(),1),oN(),yF(),rN(),XM(),UF(),CP(),jN()}));function DB(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function OB(e,t,n,r,i,a,o,s,c,l){let u=!1;return DB(e,t,n,r,i,a)&&(u=!u),DB(e,t,i,a,o,s)&&(u=!u),DB(e,t,o,s,c,l)&&(u=!u),DB(e,t,c,l,n,r)&&(u=!u),u}function kB(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function AB(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 jB(e={}){let{blockPointerEvents:t=!1}=e,n=new nN,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*NB;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=PN(r),g=r.type===`mouseleave`,_=NN(u,h),v=NN(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&uj(r.relatedTarget)&&NN(u,r.relatedTarget))return;function y(){return!!(s&&lI(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=AB(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=AB(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=AB(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=AB(d,f,x.right-1,A,S.left+1,k)}if(j)return;if(l&&!kB(d,f,x)||!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?PB/2:PB*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+PB+1,o=C||T?S.bottom-PB:S.top,s=C?T?S.bottom-PB:S.top:S.bottom-PB;M=OB(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?PB/2:PB*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-PB,o=C||T?S.top+PB:S.bottom,s=C?T?S.top+PB:S.bottom:S.top+PB;M=OB(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?PB/2:PB*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+PB+1,o=w||E?S.right-PB:S.left,s=w?E?S.right-PB:S.left:S.right-PB;M=OB(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?PB/2:PB*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-PB,o=w||E?S.left+PB:S.right,s=w?E?S.left+PB:S.right:S.left+PB;M=OB(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}var MB,NB,PB,FB=s((()=>{Aj(),rN(),CP(),dI(),MB=.1,NB=MB*MB,PB=.5})),IB=s((()=>{rN(),oN(),kP(),ZP(),YP(),xne(),BL(),eR(),WL(),Sne(),yF(),Aj(),CP(),jN(),Tne(),Yz(),Gz(),nz(),$z(),cB(),pB(),DF(),dF(),CB(),EB(),FB(),kR()}));function LB(e){let t=RB.useContext(zB);if(t===void 0&&!e)throw Error(LI(47));return t}var RB,zB,BB=s((()=>{RI(),RB=d(m(),1),zB=RB.createContext(void 0)}));function VB(e,t,n,r=!1){let i={...jz(t,n,r),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return i.open&&e?.mounted===void 0&&(i.mounted=!0),i}function HB(e){return{popupRef:UB.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:UB.createRef(),beforeContentFocusGuardRef:UB.createRef(),stickIfOpenTimeout:new nN,triggerElements:e}}var UB,WB,GB,KB,qB=s((()=>{UB=d(m(),1),WB=d(g(),1),YR(),rN(),YP(),Uz(),jL(),GB={...Lz,disabled:e=>e.disabled,instantType:e=>e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,modal:e=>e.modal,focusManagerModal:e=>e.focusManagerModal,stickIfOpen:e=>e.stickIfOpen,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},KB=class extends KR{constructor(e,t,n){let r=new kz;super(VB(e,r,t,n),HB(r),GB)}setOpen=(e,t)=>{let n=t.reason===MP,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=bz(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=yz(this.state,e,t.trigger,a());n.openChangeReason=t.reason,this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),WB.flushSync(s)):s();let c;r?c=`click`:i?c=`dismiss`:t.reason===`focus-out`&&(c=`focus`),this.set(`instantType`,c)}}}));function JB(e){return LB(!0)?(0,QB.jsx)($B,{props:e}):(0,QB.jsx)(qL,{children:(0,QB.jsx)($B,{props:e})})}function YB(e,t){let n=hz((e,n)=>new KB(t,e,n));return ZB.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function XB({store:e,modal:t}){let n=mR(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),r=n.reference,i=n.floating;return wz(e,{activeTriggerProps:r,inactiveTriggerProps:r,popupProps:i}),null}var ZB,QB,$B,eV=s((()=>{ZB=d(m(),1),KM(),IB(),BB(),qB(),ZP(),YP(),Uz(),QB=d(O(),1),$B=VM(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=YB(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),Tz(u,d),Sz(u);let{forceUnmount:m}=Cz(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});u.useSyncedValues({modal:o}),ZB.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]),ZB.useImperativeHandle(e.actionsRef,()=>({unmount:m,close:()=>u.setOpen(!1,XP(qP))}),[m,u]);let h=d||f;return(0,QB.jsxs)(zB.Provider,{value:u,children:[s&&(0,QB.jsx)(gz,{handle:s,store:u}),h&&(0,QB.jsx)(XB,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})})}));function tV(e=!1){let t=nV.useContext(rV);if(t===void 0&&!e)throw Error(LI(16));return t}var nV,rV,iV=s((()=>{RI(),nV=d(m(),1),rV=nV.createContext(void 0)}));function aV(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:oV.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])}}var oV,sV=s((()=>{oV=d(m(),1)}));function cV(e,t,{detail:n=0}={}){e.dispatchEvent(new(sj(e)).PointerEvent(`click`,{bubbles:!0,cancelable:!0,composed:!0,detail:n,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}var lV=s((()=>{DF()}));function uV(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=pV.useRef(null),s=tV(!0),c=a??s!==void 0,{props:l}=aV({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=pV.useCallback(()=>{let e=o.current;dV(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return Q(u,[u]),{getButtonProps:pV.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return $I({onClick(e){t?e.preventDefault():n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(uL(e),o?.(e),e.baseUIHandlerPrevented))return;let n=e.target===e.currentTarget,r=e.currentTarget,a=dV(r),s=!i&&fV(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(),cV(r,e))}else!l||i||!d&&!u?n&&s&&d&&e.preventDefault():e.defaultPrevented||(e.preventDefault(),u&&(e.preventBaseUIHandler(),cV(r,e)))},onKeyUp(e){t||(uL(e),a?.(e),e.target===e.currentTarget&&i&&c&&dV(e.currentTarget)&&e.key===` `?e.preventDefault():e.baseUIHandlerPrevented||e.target!==e.currentTarget||i||c||e.defaultPrevented||e.key!==` `||(e.preventBaseUIHandler(),cV(e.currentTarget,e)))},onPointerDown(e){t?e.preventDefault():s?.(e)}},i?{type:`button`}:{role:`button`},l,u)},[t,l,c,i]),buttonRef:$(e=>{o.current=e,u()})}}function dV(e){return dj(e)&&e.tagName===`BUTTON`}function fV(e){return dj(e)&&e.tagName===`A`&&!!e.href}var pV,mV=s((()=>{pV=d(m(),1),Aj(),yF(),oN(),hL(),iV(),sV(),lV()})),hV=s((()=>{}));function gV(e){return jI(e,`base-ui`)}var _V=s((()=>{FI()}));function vV(e,t){let n=yV.useRef(null);function r(t){bV.flushSync(()=>{e.setOpen(!1,XP(BP,t.nativeEvent,t.currentTarget))}),_ne(n.current)?.focus()}function i(n){let r=e.select(`positionerElement`);if(r&&aI(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{bV.flushSync(()=>{e.setOpen(!1,XP(BP,n.nativeEvent,n.currentTarget))});let i=gne(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&NN(r,i);){let e=i;if(i=nI(i),i===e)break}i?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}var yV,bV,xV=s((()=>{yV=d(m(),1),bV=d(g(),1),XR(),ZP(),YP()}));function SV(e){let t=CV.useRef(``),n=CV.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:CV.useCallback(n=>{n.detail===0?e(n,`keyboard`):(`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``)},[e]),onPointerDown:n}}var CV,wV=s((()=>{CV=d(m(),1)}));function TV(e,t){let n=EV.useRef(e),r=$(t);Q(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}var EV,DV=s((()=>{EV=d(m(),1),oN(),yF()}));function OV(e,t){let{onClick:n,onPointerDown:r}=SV($((n,r)=>{(typeof e==`function`?e():e)||t(r||(pN?`touch`:``))}));return AV.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function kV(e){let[t,n]=AV.useState(null),r=OV(e,n);return TV(e,t=>{t&&!e&&n(null)}),AV.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}var AV,jV=s((()=>{AV=d(m(),1),yF(),wV(),TN(),DV()})),MV,NV,PV,FV=s((()=>{RI(),MV=d(m(),1),KM(),BB(),mV(),fP(),TL(),jL(),IB(),hV(),_V(),FF(),YP(),Uz(),xV(),jV(),NV=d(O(),1),PV=HM(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=LB(!0),h=zz(s)??m;if(!h)throw Error(LI(74));let g=gV(f),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=MV.useRef(null),{registerTrigger:S,isMountedByThisTrigger:C}=xz(g,x,h,{payload:c,disabled:a,openOnHover:l,closeDelay:d}),w=h.useState(`openChangeReason`),T=h.useState(`stickIfOpen`),E=h.useState(`openMethod`),D=h.useState(`focusManagerModal`),O=lB(v,{enabled:!a&&l&&(E!==`touch`||w!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:jB(),restMs:u,delay:{close:d},triggerElementRef:x,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),k=fR(v,{stickIfOpen:T}),A=OV(()=>h.select(`open`),e=>{h.set(`openMethod`,e)}),j=h.useState(`triggerProps`,C),{getButtonProps:M,buttonRef:N}=uV({disabled:a,native:o}),P={open(e){return e&&w===`trigger-press`?lP.open(e):cP.open(e)}},{preFocusGuardRef:F,handlePreFocusGuardFocus:I,handleFocusTargetFocus:L}=vV(h,x),R=gL(`button`,e,{state:{disabled:a,open:y},ref:[N,t,S,x],props:[k.reference,O,j,A,{[DL]:``,id:g,"aria-haspopup":`dialog`,"aria-expanded":y,"aria-controls":b},p,M],stateAttributesMapping:P}),z=(0,NV.jsx)(MV.Fragment,{children:R},g);return C&&!D?(0,NV.jsxs)(MV.Fragment,{children:[(0,NV.jsx)(PF,{ref:F,onFocus:I}),z,(0,NV.jsx)(PF,{ref:h.context.triggerFocusTargetRef,onFocus:L})]}):z})}));function IV(){let e=LV.useContext(RV);if(e===void 0)throw Error(LI(45));return e}var LV,RV,zV=s((()=>{RI(),LV=d(m(),1),RV=LV.createContext(void 0)})),BV,VV,HV,Dne=s((()=>{BV=d(m(),1),IB(),BB(),zV(),VV=d(O(),1),HV=BV.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return LB().useState(`mounted`)||n?(0,VV.jsx)(RV.Provider,{value:n,children:(0,VV.jsx)(zL,{ref:t,...r})}):null})}));function UV(e){return zI(19)?e:e?`true`:void 0}var WV=s((()=>{VI()}));function One(){let e=GV.useContext(KV);if(!e)throw Error(LI(46));return e}var GV,KV,qV=s((()=>{RI(),GV=d(m(),1),KV=GV.createContext(void 0)}));function JV(){return YV.useContext(XV)?.direction??`ltr`}var YV,XV,ZV=s((()=>{YV=d(m(),1),XV=YV.createContext(void 0)})),QV,$V,kne=s((()=>{KA(),QV=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,offsetParent:d=`real`}=bA(e,t)||{};if(l==null)return{};let f=PA(u),p={x:n,y:r},m=EA(i),h=wA(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];w&&await o.isElement?.(C)||(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=yA(k,j,A),N=!c.arrow&&SA(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),$V=(e,t)=>{let{name:n,fn:r}=QV(e);return{name:n,fn:r,options:[e,t]}}})),eH,Ane=s((()=>{eH={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}}}}})),tH,nH=s((()=>{tH={sideX:`left`,sideY:`top`}})),rH,iH,aH,oH,sH,cH=s((()=>{rH=`--available-width`,iH=`--available-height`,aH=`--anchor-width`,oH=`--anchor-height`,sH=`--transform-origin`}));function lH(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 uH(e,t,n){let{rects:r,placement:i}=e;return{side:lH(t,xA(i),n),align:SA(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function dH(e){return jne(e,Kz)}function jne(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,w]=pH.useState(null);!g&&C!==null&&w(null);let T=_.side||`flip`,E=_.align||`flip`,D=_.fallbackAxisSide||`end`,O=v?.crossAxis??!1,k=v?.rootBoundary,A=typeof n==`function`?n:void 0,j=$(A),M=A?j:n,N=lF(n),P=lF(g),F=JV()===`rtl`,I=C||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":F?`left`:`right`,"inline-start":F?`right`:`left`}[i],L=o===`center`?I:`${I}-${o}`,R=l;typeof R==`number`?R={top:R,right:R,bottom:R,left:R}:R&&={top:R.top||0,right:R.right||0,bottom:R.bottom||0,left:R.left||0};let z=+(i===`bottom`),B=+(i===`top`),V=+(i===`right`),H=+(i===`left`),U={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:R},W=pH.useRef(null),G=lF(a),ee=lF(s),te=typeof a==`function`?0:a,ne=typeof s==`function`?0:s,K=[];p&&K.push(p),K.push(wR(e=>{let t=uH(e,i,F),n=typeof G.current==`function`?G.current(t):G.current,r=typeof ee.current==`function`?ee.current(t):ee.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[te,ne,F,i]));let re=E===`none`&&T!==`shift`,q=!re&&(u||O||T===`shift`),ie=T===`none`?null:DR({...U,padding:{top:R.top+1+z,right:R.right+1+H,bottom:R.bottom+1+B,left:R.left+1+V},mainAxis:!O&&T===`flip`,crossAxis:E===`flip`&&`alignment`,fallbackAxisSideDirection:D}),ae=re?null:TR({...U,rootBoundary:k,mainAxis:E!==`none`,crossAxis:q,limiter:u||O?void 0:ER(e=>{if(!W.current)return{};let{width:t,height:n}=W.current.getBoundingClientRect(),r=TA(xA(e.placement)),i=r===`y`?t:n,a=r===`y`?R.left+R.right:R.top+R.bottom;return{offset:i/2+a/2}})},[U,u,O,k,R,E]);T===`shift`||E===`shift`||o===`center`?K.push(ae,ie):K.push(ie,ae),K.push(OR({...U,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!P.current)return;let i=e.style;i.setProperty(mH,`${t}px`),i.setProperty(hH,`${n}px`);let a=sj(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(aH,`${u}px`),i.setProperty(oH,`${d}px`)}}),$V(e=>({element:W.current||EF(e.elements.floating).createElement(`div`),padding:W.current?d:0,offsetParent:`floating`}),[d]),{name:`transformOrigin`,fn(e){let{elements:{floating:t},middlewareData:n,placement:r,platform:o,rects:s,y:c}=e,l=xA(r),u=SA(r),d=TA(l)===`y`,f=W.current,p=typeof a==`function`?a(uH(e,i,F)):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 q&&d&&Math.abs(n.shift?.y||0)>p&&(h=`${s.reference.y+s.reference.height/2-c}px`),t.style.setProperty(sH,d?`${m} ${h}`:`${h} ${m}`),{}}},eH,b),Q(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let oe=pH.useMemo(()=>({ancestorScroll:!f,elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:se,elements:ce,x:le,y:ue,middlewareData:de,update:fe,placement:pe,context:me,isPositioned:J,floatingStyles:he}=t({rootContext:h,open:m?g:void 0,placement:L,middleware:K,strategy:r,whileElementsMounted:m?void 0:(...e)=>tM(...e,oe),nodeId:y,externalTree:S}),{sideX:ge,sideY:_e}=de.adaptiveOrigin||tH,ve=J?r:`fixed`,ye=pH.useMemo(()=>{let e;return e=J?b?{position:ve,[ge]:le,[_e]:ue}:{...he,position:ve}:{position:ve,top:0,left:0},e[mH]=`100vw`,e[hH]=`100vh`,J||(e.opacity=0),e},[b,ve,ge,le,_e,ue,he,J]),be=pH.useRef(null);Q(()=>{if(!g)return;let e=N.current,t=typeof e==`function`?e():e,n=(fH(t)?t.current:t)||null;n!==be.current&&(se.setPositionReference(n),be.current=n)},[g,se,M,N]),pH.useEffect(()=>{if(!g)return;let e=N.current;typeof e!=`function`&&fH(e)&&e.current!==be.current&&(se.setPositionReference(e.current),be.current=e.current)},[g,se,M,N]),pH.useEffect(()=>{if(m&&g&&ce.reference&&ce.floating)return tM(ce.reference,ce.floating,fe,oe)},[m,g,ce,fe,oe]);let xe=xA(pe),Se=lH(i,xe,F),Ce=SA(pe)||`center`,we=!!de.hide?.referenceHidden;Q(()=>{x&&g&&J&&xe!==I&&w(xe)},[x,g,J,xe,I]);let Te=pH.useMemo(()=>({position:`absolute`,top:de.arrow?.y,left:de.arrow?.x}),[de.arrow]),Ee=de.arrow?.centerOffset!==0;return pH.useMemo(()=>({positionerStyles:ye,arrowStyles:Te,arrowRef:W,arrowUncentered:Ee,side:Se,align:Ce,physicalSide:xe,anchorHidden:we,refs:se,context:me,isPositioned:J,update:fe}),[ye,Te,W,Ee,Se,Ce,xe,we,se,me,J,fe])}function fH(e){return e!=null&&`current`in e}var pH,mH,hH,gH=s((()=>{pH=d(m(),1),KA(),DF(),oN(),dF(),yF(),IB(),Yz(),ZV(),kne(),Ane(),nH(),cH(),mH=rH,hH=iH})),_H,vH,yH,bH=s((()=>{_H=d(m(),1),vH=d(O(),1),yH=_H.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,vH.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})})}));function xH(e){return e===`starting`?EL:YM}var SH=s((()=>{XM(),jL()}));function CH(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),gL(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},xH(r),i],stateAttributesMapping:uP})}var wH=s((()=>{fP(),TL(),SH()}));function TH(e,t){return pj(e)?e:t}function EH(e,t,n){return/hidden|clip/.test(e.getComputedStyle(TH(t,n)).overflowY)}function Mne(e){if(typeof document>`u`)return!1;let t=EF(e);return sj(t).innerWidth-t.documentElement.clientWidth>0}function Nne(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=EF(e),n=t.documentElement,r=t.body,i=TH(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 Pne(e){let t=EF(e),n=t.documentElement,r=t.body,i=TH(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 Fne(e){let t=EF(e),n=t.documentElement,r=t.body,i=sj(n),a=0,o=0,s=!1,c=wF.create();if(yN&&(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,OH={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},AH=n.style.scrollBehavior,kH={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=TH(n,r);s=Nne(e),s?(n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`):(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,OH),Object.assign(r.style,kH),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=AH)}function d(){u(),c.request(l)}l();let f=QP(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}function DH(e=!0,t=null){Q(()=>{if(e)return MH.acquire(t)},[e,t])}var OH,kH,AH,jH,MH,NH=s((()=>{Aj(),$P(),TN(),DF(),oN(),rN(),TF(),OH={},kH={},AH=``,jH=class{lockCount=0;restore=null;timeoutLock=nN.create();timeoutUnlock=nN.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=EF(e),n=t.documentElement,r=t.body,i=sj(n);if(EH(i,n,r)){let t=new i.MutationObserver(()=>{EH(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=pN||!Mne(e);this.restore=a?Pne(e):Fne(e)}},MH=new jH}));function PH(e,t,n,r){let[i,a]=FH.useState(!1);Q(()=>{if(!e||!t||n==null){a(!1);return}let r=EF(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-IH)},[e,t,n]),DH(e&&(!t||i),r)}var FH,IH,LH=s((()=>{FH=d(m(),1),DF(),NH(),oN(),IH=20})),RH,zH,BH,Ine=s((()=>{RH=d(m(),1),WV(),oN(),IB(),BB(),qV(),gH(),zV(),bH(),YP(),jL(),uz(),wH(),LH(),zH=d(O(),1),BH=RH.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=kL,..._}=e,v=LB(),y=IV(),b=GL(),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=v.useState(`adaptiveOrigin`),M=RH.useRef(null),N=sz(O),P=dH({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:j}),F=x.useState(`domReferenceElement`);Q(()=>{let e=F,t=M.current;if(e&&(M.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return N(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[F,N,v]);let I=E===!0&&w!==`trigger-hover`;PH(C&&I,D===`touch`,O,T);let L=v.useStateSetter(`positionerElement`),R=CH(e,{open:C,side:P.side,align:P.align,anchorHidden:P.anchorHidden,instant:k},{styles:P.positionerStyles,transitionStatus:A,props:_,refs:[t,L],hidden:!S,inert:!C});return(0,zH.jsxs)(KV.Provider,{value:P,children:[S&&I&&(0,zH.jsx)(yH,{inert:UV(!C),cutout:T}),(0,zH.jsx)(KL,{id:b,children:R})]})})})),VH,HH,UH,WH,GH,KH,qH=s((()=>{XR(),VH=`ArrowUp`,HH=`ArrowDown`,UH=`ArrowLeft`,WH=`ArrowRight`,GH=`Home`,KH=new Set([VH,HH,UH,WH,GH,`End`])}));function JH(e){let t=YH.useContext(XH);if(t===void 0&&!e)throw Error(LI(69));return t}var YH,XH,ZH=s((()=>{RI(),YH=d(m(),1),XH=YH.createContext(void 0)}));function Lne(){let[e,t]=QH.useState(0),n=$(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:QH.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}var QH,$H,eU=s((()=>{QH=d(m(),1),yF(),$H=QH.createContext(void 0)})),tU,nU,rU,Rne=s((()=>{tU=d(m(),1),Aj(),IB(),BB(),qV(),fP(),pz(),TL(),YP(),qH(),ZH(),SH(),eU(),Uz(),nU=d(O(),1),rU=tU.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=LB(),l=One(),u=JH(!0)!=null,{context:d,hasClosePart:f}=Lne(),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`);dz({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}}),oB(w,{enabled:D&&!E,closeDelay:O});let k=a===void 0?mz(c.context.popupRef):a,A=b!==!1&&f;c.useSyncedValue(`focusManagerModal`,A);let j=c.useStateSetter(`popupElement`),M=gL(`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`,...Dz,"aria-labelledby":v,"aria-describedby":y,onKeyDown(e){u&&KH.has(e.key)&&e.stopPropagation()}},xH(g),s],stateAttributesMapping:dP});return(0,nU.jsx)(sR,{context:w,openInteractionType:m,modal:A,disabled:!x||S===`trigger-hover`,initialFocus:k,returnFocus:o,restoreFocus:`popup`,previousFocusableElement:dj(C)?C:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,nU.jsx)($H.Provider,{value:d,children:M})})})})),iU=s((()=>{mV()}));function zne(e){let[t,n]=aU.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}var aU,oU=s((()=>{aU=d(m(),1)})),Bne=s((()=>{eV(),FV(),Dne(),Ine(),Rne(),qV(),BB(),fP(),TL(),YP(),_V(),iU(),ZP(),eU(),WV(),TF(),oU(),oN(),yF(),DF(),uz(),XM(),KA(),Aj(),cH(),ZV(),nH(),qB(),jR()})),sU=s((()=>{Bne()}));function cU(e){return{contextElement:e,getBoundingClientRect:()=>{let t=ws(e);return{x:t.left,y:t.top,top:t.top,left:t.left,right:t.right,bottom:t.bottom,width:t.width,height:t.height,toJSON:()=>t}}}}function lU(){return{x:0,y:0,get width(){return Ts().width},get height(){return Ts().height}}}var uU=s((()=>{Os()}));function dU(e){let t=fU.useContext(pU);if(t===void 0&&!e)throw Error(LI(33));return t}var fU,pU,mU=s((()=>{RI(),fU=d(m(),1),pU=fU.createContext(void 0)}));function hU(e){let t=gU.useContext(_U);if(t===void 0&&!e)throw Error(LI(36));return t}var gU,_U,vU=s((()=>{RI(),gU=d(m(),1),_U=gU.createContext(void 0)}));function yU(e=!0){let t=bU.useContext(xU);if(t===void 0&&!e)throw Error(LI(25));return t}var bU,xU,SU=s((()=>{RI(),bU=d(m(),1),xU=bU.createContext(void 0)}));function CU({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=wU.useRef(e!==void 0),[a,o]=wU.useState(t);return[i&&e!==void 0?e:a,wU.useCallback(e=>{i||o(e)},[])]}var wU,TU=s((()=>{wU=d(m(),1)}));function EU(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,{events:l}=a.useState(`floatingTreeRoot`),u=a.useState(`open`),d=yU(!0),f=d!==void 0;return DU.useMemo(()=>({id:r,role:`menuitem`,tabIndex:u&&n?0:-1,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&l.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&l.emit(`close`,{domEvent:e,reason:FP})},onMouseUp(e){if(d){let t=d.initialCursorPointRef.current;if(d.initialCursorPointRef.current=null,f&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||f&&!gN&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!f||e.button===2)&&c.type===`regular-item`&&cV(s.current,e,{detail:1})}}),[t,n,r,l,i,u,a,o,s,d,f,c])}var DU,OU=s((()=>{DU=d(m(),1),TN(),YP(),SU(),lV()}));function kU(e){let{closeOnClick:t,disabled:n,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:s,itemMetadata:c,nodeId:l}=e,u=AU.useRef(null),{getButtonProps:d,buttonRef:f}=uV({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=EU({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=AU.useCallback(e=>$I(p,{onMouseEnter(){c.type===`submenu-trigger`&&c.setActive()}},e,d),[p,d,c]),h=nF(u,f);return AU.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var AU,jU,MU=s((()=>{AU=d(m(),1),cF(),iU(),hL(),OU(),jU={type:`regular-item`}}));function NU(){return PU.useContext(FU)}var PU,FU,IU=s((()=>{PU=d(m(),1),FU=PU.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}})}));function LU(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=NU(),u=RU.useRef(-1),[d,f]=RU.useState(a==null&&t?()=>{if(u.current===-1){let e=l.current;l.current+=1,u.current=e}return u.current}:-1),p=a??d,m=RU.useRef(null),h=RU.useCallback(e=>{let t=m.current;t&&s(t),m.current=e,e&&o(e,{metadata:r??null,index:a??null,label:n,textRef:i})},[a,o,s,r,n,i]);return Q(()=>{if(a==null)return c(e=>{let t=m.current?e.get(m.current)?.index:null;t!=null&&f(t)})},[a,c]),{ref:h,index:p}}var RU,zU=s((()=>{RU=d(m(),1),oN(),IU()}));function BU(){let e=VU.useContext(HU);if(e===void 0)throw Error(LI(31));return e}var VU,HU,UU=s((()=>{RI(),VU=d(m(),1),HU=VU.createContext(void 0)})),WU,GU,KU,qU=s((()=>{WU=d(m(),1),TL(),UU(),GU=d(O(),1),KU=WU.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=WU.useState(void 0),c=gL(`div`,e,{ref:t,props:{role:`group`,"aria-labelledby":o,...a}});return(0,GU.jsx)(HU.Provider,{value:s,children:c})})})),JU,YU,XU=s((()=>{JU=d(m(),1),oN(),TL(),_V(),UU(),YU=JU.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=gV(a),c=BU();return Q(()=>(c(s),()=>{c(e=>e===s?void 0:e)}),[c,s]),gL(`div`,e,{ref:t,props:{id:s,"aria-hidden":!0,...o}})})})),ZU,QU,$U=s((()=>{ZU=d(m(),1),MU(),vU(),TL(),_V(),zU(),mU(),QU=ZU.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,style:l,...u}=e,d=LU({guess:!0,label:a}),f=dU(!0),p=gV(i),{store:m}=hU(),h=m.useState(`disabled`),g=s||h,_=m.useState(`isActive`,d.index),v=m.useState(`itemProps`),{getItemProps:y,itemRef:b}=kU({closeOnClick:c,disabled:g,highlighted:_,id:p,store:m,nativeButton:o,nodeId:f?.context.nodeId,itemMetadata:jU});return gL(`div`,e,{state:{disabled:g,highlighted:_},props:[v,u,y],ref:[b,t,d.ref]})})})),eW,tW,nW,rW=s((()=>{eW=d(m(),1),IB(),vU(),mU(),TL(),fP(),pz(),ZP(),YP(),ZH(),qH(),SH(),tW=d(O(),1),nW=eW.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s}=hU(),{side:c,align:l}=dU(),u=JH(!0)!=null,d=s.useState(`open`),f=s.useState(`transitionStatus`),p=s.useState(`popupProps`),m=s.useState(`mounted`),h=s.useState(`instantType`),g=s.useState(`activeTriggerElement`),_=s.useState(`parent`),v=s.useState(`lastOpenChangeReason`),y=s.useState(`rootId`),b=s.useState(`floatingRootContext`),x=s.useState(`floatingTreeRoot`),S=s.useState(`closeDelay`),C=s.useState(`hoverEnabled`),w=s.useState(`disabled`),T=s.useState(`openMethod`),E=_.type===`context-menu`;dz({open:d,ref:s.context.popupRef,onComplete(){d&&s.context.onOpenChangeComplete?.(!0)}}),eW.useEffect(()=>{function e(e){s.setOpen(!1,XP(e.reason,e.domEvent))}return x.events.on(`close`,e),()=>{x.events.off(`close`,e)}},[x.events,s]),oB(b,{enabled:C&&!w&&!E&&_.type!==`menubar`,closeDelay:S});let D=s.useStateSetter(`popupElement`),O=gL(`div`,e,{state:{transitionStatus:f,side:c,align:l,open:d,nested:_.type===`menu`,instant:h},ref:[t,s.context.popupRef,D],stateAttributesMapping:dP,props:[p,{onKeyDown(e){u&&KH.has(e.key)&&e.stopPropagation()}},xH(f),o,{"data-rootownerid":y}]}),k=_.type===void 0||E;return(g||_.type===`menubar`&&v!==`outside-press`)&&(k=!0),(0,tW.jsx)(sR,{context:b,openInteractionType:T,modal:E,disabled:!m,returnFocus:a===void 0?k:a,initialFocus:_.type!==`menu`,restoreFocus:!0,externalTree:_.type===`menubar`?void 0:x,previousFocusableElement:g,nextFocusableElement:_.type===void 0?s.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:_.type===void 0?s.context.beforeContentFocusGuardRef:void 0,children:O})})}));function iW(){let e=aW.useContext(oW);if(e===void 0)throw Error(LI(32));return e}var aW,oW,sW=s((()=>{RI(),aW=d(m(),1),oW=aW.createContext(void 0)})),cW,lW,uW,dW=s((()=>{cW=d(m(),1),IB(),vU(),sW(),lW=d(O(),1),uW=cW.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i,parent:a}=hU();if(!(i.useState(`mounted`)||n))return null;let o=a.type===`menu`||a.type===`menubar`?`group`:void 0;return(0,lW.jsx)(oW.Provider,{value:n,children:(0,lW.jsx)(zL,{ref:t,...r,portalOwnerRole:o})})})}));function fW(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=$(i),[,o]=yW.useState(!1),s=LM(mW).current,c=LM(pW).current,l=yW.useRef(0),u=yW.useRef(!0),d=yW.useRef(null),f=yW.useRef(null),p=$(()=>{u.current||(u.current=!0,o(e=>!e))}),m=$((e,t)=>{c.set(e,t),p()}),h=$(e=>{c.delete(e),p()}),g=$(e=>{let t=new Map;return n.current.length=0,r&&(r.current.length=0),e.forEach(e=>{t.set(e.element,{...e.registration.metadata??{},index:e.index}),n.current[e.index]=e.element,r&&(r.current[e.index]=e.registration.label===void 0?e.registration.textRef?.current?.textContent??e.element.textContent:e.registration.label)}),l.current=n.current.length,t});function _(e){if(f.current?.disconnect(),f.current=null,typeof MutationObserver!=`function`||e.length<2)return;let t=new MutationObserver(n=>{if(!_W(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&vW(r,n)>0){t.disconnect(),p();return}r=n}});f.current=t;let n=new Set;for(let t=1;t<e.length;t+=1){let r=gW(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let v=$(()=>{let[e,t]=hW(c),n=g(e),r=d.current,i=!r||r.length!==e.length||e.some((e,t)=>{let n=r[t];return e.index!==n.index||e.element!==n.element||e.registration.index!==n.registration.index||e.registration.metadata!==n.registration.metadata});_(t),d.current=e,u.current=!1,i&&(s.forEach(e=>e(n)),a(n))});Q(()=>(!u.current&&d.current&&g(d.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,g]),Q(()=>{u.current&&v()}),Q(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let y=$(e=>(s.add(e),()=>{s.delete(e)})),b=yW.useMemo(()=>({register:m,unregister:h,subscribeMapChange:y,nextIndexRef:l}),[m,h,y,l]);return(0,bW.jsx)(FU.Provider,{value:b,children:t})}function pW(){return new Map}function mW(){return new Set}function hW(e){let t=new Set,n=[],r=[];e.forEach((e,i)=>{if(!i.isConnected)return;let a=e.index,o={index:a??-1,element:i,registration:e};a===null?r.push(o):a>=0&&(t.add(a),n.push(o))});let i=0;return r.sort((e,t)=>vW(e.element,t.element)),r.forEach(e=>{for(;t.has(i);)i+=1;e.index=i,n.push(e),i+=1}),t.size>0&&n.sort((e,t)=>e.index-t.index),[n,r.map(e=>e.element)]}function gW(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function _W(e){for(let t of e)for(let e=0;e<t.removedNodes.length;e+=1)if(t.removedNodes[e].isConnected)return!0;return!1}function vW(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}var yW,bW,xW=s((()=>{yW=d(m(),1),BM(),yF(),oN(),IU(),bW=d(O(),1)})),SW,CW,wW,TW=s((()=>{SW=d(m(),1),WV(),oN(),rN(),IB(),mU(),vU(),gH(),xW(),bH(),sW(),jL(),SU(),ZP(),YP(),uz(),wH(),LH(),CW=d(O(),1),wW=SW.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=OL,style:g,..._}=e,{store:v}=hU(),y=iW(),b=yU(!0),x=v.useState(`parent`),S=v.useState(`floatingRootContext`),C=v.useState(`floatingTreeRoot`),w=v.useState(`mounted`),T=v.useState(`open`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`activeTriggerElement`),k=v.useState(`transitionStatus`),A=v.useState(`positionerElement`),j=v.useState(`instantType`),M=v.useState(`adaptiveOrigin`),N=v.useState(`lastOpenChangeReason`),P=v.useState(`floatingNodeId`),F=v.useState(`floatingParentNodeId`),I=S.useState(`domReferenceElement`),L=SW.useRef(null),R=sz(A),z=n,B=c,V=l,H=s,U=h;x.type===`context-menu`&&(z=n??x.context?.anchor,H??=`start`,!o&&H!==`center`&&(V=e.alignOffset??2,B=e.sideOffset??-5));let W=o,G=H;x.type===`menu`?(W??=`inline-end`,G??=`start`,U=e.collisionAvoidance??kL):x.type===`menubar`&&(W??=x.context.orientation===`vertical`?`inline-end`:`bottom`,G??=`start`);let ee=x.type===`context-menu`,te=dH({anchor:z,floatingRootContext:S,positionMethod:b?`fixed`:r,mounted:w,side:W,sideOffset:B,align:G,alignOffset:V,arrowPadding:ee?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:P,keepMounted:y,disableAnchorTracking:m,collisionAvoidance:U,shift:ee?{crossAxis:!(`side`in U&&U.side===`flip`),rootBoundary:`layoutViewport`}:void 0,externalTree:C,adaptiveOrigin:M});SW.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===P&&v.set(`hoverEnabled`,!1),e.nodeId!==P&&e.parentNodeId===v.select(`floatingParentNodeId`)&&v.setOpen(!1,XP(KP)))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[v,C.events,P]),SW.useEffect(()=>{if(v.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==v.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;v.setOpen(!1,XP(t))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[C.events,v]);let ne=eN();SW.useEffect(()=>{T||ne.clear()},[T,ne]),SW.useEffect(()=>{function e(e){if(T&&e.nodeId===v.select(`floatingParentNodeId`)){if(e.target&&O&&O!==e.target){let e=v.select(`closeDelay`);e>0?ne.isStarted()||ne.start(e,()=>{v.setOpen(!1,XP(KP))}):v.setOpen(!1,XP(KP))}else ne.clear()}}return C.events.on(`itemhover`,e),()=>{C.events.off(`itemhover`,e)}},[C.events,T,O,v,ne]),SW.useEffect(()=>{let e={open:T,nodeId:P,parentNodeId:F,reason:v.select(`lastOpenChangeReason`)};C.events.emit(`menuopenchange`,e)},[C.events,T,v,P,F]),Q(()=>{let e=I,t=L.current;if(e&&(L.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return R(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[I,R,v]);let K={open:T,side:te.side,align:te.align,anchorHidden:te.anchorHidden,nested:x.type===`menu`,instant:j},re=x.type===`menubar`&&x.context.modal;PH(T&&(re||E&&N!==`trigger-hover`),D===`touch`,A,O);let q=CH(e,K,{styles:te.positionerStyles,transitionStatus:k,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!w,inert:!T}),ie=w&&x.type!==`menu`&&(x.type!==`menubar`&&E&&N!==`trigger-hover`||x.type===`menubar`&&x.context.modal),ae=null;return x.type===`menubar`?ae=x.context.contentElement:x.type===void 0&&(ae=O),(0,CW.jsxs)(pU.Provider,{value:te,children:[ie&&(0,CW.jsx)(yH,{ref:x.type===`context-menu`||x.type===`nested-context-menu`?x.context.internalBackdropRef:null,inert:UV(!T),cutout:ae}),(0,CW.jsx)(KL,{id:P,children:(0,CW.jsx)(fW,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:q})})]})})}));function EW(e){let t=DW.useContext(OW);if(t===null&&!e)throw Error(LI(5));return t}var DW,OW,kW=s((()=>{RI(),DW=d(m(),1),OW=DW.createContext(null)}));function AW(e){return{positionerRef:MW.createRef(),popupRef:MW.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:MW.createRef(),beforeContentFocusGuardRef:MW.createRef(),onOpenChangeComplete:void 0,triggerElements:e}}function jW(e,t,n=!1,r){return{...jz(e,t,n),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new UL,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:YM,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...r}}var MW,NW,PW,FW=s((()=>{MW=d(m(),1),YR(),XM(),WL(),Uz(),NW={...Lz,disabled:e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled,modal:e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0),openMethod:e=>e.openMethod,allowMouseEnter:e=>e.allowMouseEnter,highlightItemOnHover:e=>e.highlightItemOnHover,parent:e=>e.parent,rootId:e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId,activeIndex:e=>e.activeIndex,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType,lastOpenChangeReason:e=>e.openChangeReason,floatingTreeRoot:e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot,floatingNodeId:e=>e.floatingNodeId,floatingParentNodeId:e=>e.floatingParentNodeId,itemProps:e=>e.itemProps,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin,keyboardEventRelay:e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)}},PW=class extends KR{constructor(e,t,n=!1){let r=new kz,i=jW(r,t,n,e);super(i,AW(r),NW),this.unsubscribeParentListener=this.observe(`parent`,e=>{if(this.unsubscribeParentListener?.(),e.type===`menu`){let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);this.unsubscribeParentListener=e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);(t!==i||n!==a||r!==o)&&(t=i,n=a,r=o,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef}else e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}unsubscribeParentListener=null}}));function IW(){return LW.useContext(RW)}var LW,RW,zW=s((()=>{LW=d(m(),1),RW=LW.createContext(void 0)}));function BW(e,t,n){return LM(()=>new PW(e,t,n)).current}var VW,HW,UW,WW=s((()=>{VW=d(m(),1),rN(),yF(),FI(),oN(),BM(),XM(),KM(),IB(),vU(),kW(),jL(),ZV(),jV(),ZP(),YP(),SU(),hL(),uz(),FW(),Uz(),zW(),HW=d(O(),1),UW=VM(function(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:a=!1,disabled:o=!1,modal:s,loopFocus:c=!0,orientation:l=`vertical`,actionsRef:u,closeParentOnEsc:d=!1,handle:f,triggerId:p,defaultTriggerId:m=null,highlightItemOnHover:h=!0}=e,g=yU(!0),_=hU(!0),v=EW(!0),y=IW(),b=VW.useMemo(()=>y&&_?{type:`menu`,store:_.store}:v?{type:`menubar`,context:v}:g&&!_?{type:`context-menu`,context:g}:{type:void 0},[g,_,v,y]),x=jI(),S=jI(),C=QL(),w=b.type===`menu`?b.store:void 0,T=(n??a)&&w?.state.transitionStatus===`starting`,E=LM(()=>T?w?.state.instantType:void 0).current,D=BW({open:a,openProp:n,activeTriggerId:m,triggerIdProp:p,parent:b,disabled:o,highlightItemOnHover:h,modal:b.type===void 0?s:void 0,rootId:x,instantType:E},S,C!=null);D.useControlledProp(`openProp`,n),D.useControlledProp(`triggerIdProp`,p),D.useContextCallback(`onOpenChangeComplete`,i);let O=D.useState(`floatingTreeRoot`),k=GL(O),A=D.useState(`open`),j=D.useState(`activeTriggerElement`),M=D.useState(`positionerElement`),N=D.useState(`hoverEnabled`),P=D.useState(`disabled`),F=D.useState(`lastOpenChangeReason`),I=D.useState(`parent`),L=D.useState(`activeIndex`),R=D.useState(`payload`),z=D.useState(`floatingParentNodeId`),B=VW.useRef(null),V=VW.useRef(I.type!==`context-menu`),H=eN(),U=VW.useRef(!0),W=eN(),G=z!=null,{openMethod:ee,triggerProps:te}=kV(A);D.useSyncedValues({disabled:o,highlightItemOnHover:h,modal:I.type===void 0?s:void 0,openMethod:ee,rootId:x}),Sz(D);let{forceUnmount:ne,transitionStatus:K}=Cz(A,D,()=>{D.set(`allowMouseEnter`,!1)},T),re=sz(D.context.popupRef);VW.useEffect(()=>{if(E===void 0)return;let e=()=>{D.state.instantType===E&&D.set(`instantType`,void 0)};if(!A){e();return}if(K!==void 0)return;if(D.context.popupRef.current==null){e();return}let t=new AbortController;return re(e,t.signal),()=>{t.abort()}},[E,A,K,re,D]),Q(()=>{g&&!_?D.update({parent:{type:`context-menu`,context:g},floatingNodeId:k,floatingParentNodeId:C}):_&&D.update({floatingNodeId:k,floatingParentNodeId:C})},[g,_,k,C,D]),VW.useEffect(()=>{A||(B.current=null),I.type===`context-menu`&&(A?H.start(500,()=>{V.current=!0}):(H.clear(),V.current=!1))},[H,A,I.type]),Q(()=>{!A&&!N&&D.set(`hoverEnabled`,!0)},[A,N,D]);let q=$((e,t)=>{let n=t.reason;if(!e&&!D.select(`open`)||A===e&&t.trigger===j&&F===n)return;let i=bz(t);if(!e&&t.trigger==null&&(t.trigger=j??void 0),r?.(e,t),t.isCanceled)return;D.state.floatingRootContext.dispatchOpenChange(e,t);let a=t.event;if(e===!1&&a?.type===`click`&&a.pointerType===`touch`&&!U.current)return;e&&n===`trigger-focus`?(U.current=!1,W.start(300,()=>{U.current=!0})):(U.current=!0,W.clear());let o=(n===`trigger-press`||n===`item-press`)&&a.detail===0,s=!e&&(n===`escape-key`||n==null);B.current=t.event;let c=yz(D.state,e,t.trigger,i());c.openChangeReason=n,c.instantType=I.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?`group`:o||s?o?`click`:`dismiss`:void 0,D.update(c)}),ie=ez({popupStore:D,floatingRootContext:D.state.floatingRootContext,floatingId:S,nested:C!=null,onOpenChange:q}),ae=ie.context.events;Q(()=>{let e=({open:e,eventDetails:t})=>q(e,t);return ae.on(`setOpen`,e),()=>{ae?.off(`setOpen`,e)}},[ae,q]);let oe=VW.useCallback(()=>{D.setOpen(!1,XP(qP))},[D]);VW.useImperativeHandle(u,()=>({unmount:ne,close:oe}),[ne,oe]);let se;I.type===`context-menu`&&(se=I.context),VW.useImperativeHandle(se?.positionerRef,()=>M,[M]),VW.useImperativeHandle(se?.actionsRef,()=>({setOpen:q}),[q]);let ce=mR(ie,{enabled:!P,bubbles:{escapeKey:d&&I.type===`menu`},outsidePress(){return I.type!==`context-menu`||B.current?.type===`contextmenu`||V.current},externalTree:G?O:void 0}),le=JV(),ue=VW.useCallback(e=>{D.select(`activeIndex`)!==e&&D.set(`activeIndex`,e)},[D]),de=bB(ie,{enabled:!P,listRef:D.context.itemDomElements,activeIndex:L,nested:I.type!==void 0,loopFocus:c,orientation:l,parentOrientation:I.type===`menubar`?I.context.orientation:void 0,rtl:le===`rtl`,disabledIndices:JM,onNavigate:ue,openOnArrowKeyDown:I.type!==`context-menu`,externalTree:G?O:void 0,focusItemOnHover:h}),fe=VW.useCallback(e=>{D.context.typingRef.current=e},[D]),pe=wB(ie,{enabled:!P,listRef:D.context.itemLabels,elementsRef:D.context.itemDomElements,activeIndex:L,resetMs:500,onMatch:e=>{A&&e!==L&&D.set(`activeIndex`,e)},onTyping:fe}),me=VW.useMemo(()=>{let e=$I(pe.reference,de.reference,ce.reference,{onMouseMove(){D.set(`allowMouseEnter`,!0)}},te);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=A,e},[D,pe.reference,de.reference,ce.reference,te,A]),J=VW.useMemo(()=>{let e=$I(de.trigger,ce.trigger,te);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[de.trigger,ce.trigger,te]);LM(()=>(D.update({inactiveTriggerProps:J}),null)),wz(D,{floatingRootContext:ie,activeTriggerProps:me,inactiveTriggerProps:J,popupProps:VW.useMemo(()=>$I(Dz,{id:S,role:`menu`,"aria-orientation":l===`horizontal`?`horizontal`:void 0,"aria-labelledby":j?.id,onMouseMove(){D.set(`allowMouseEnter`,!0),I.type===`menu`&&D.set(`hoverEnabled`,!1)},onClick(){D.select(`hoverEnabled`)&&D.set(`hoverEnabled`,!1)},onKeyDown(e){let t=D.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},pe.floating,de.floating,ce.floating),[j,S,l,I.type,D,pe.floating,de.floating,ce.floating]),itemProps:de.item??YM});let he=VW.useMemo(()=>({store:D,parent:b}),[D,b]),ge=(0,HW.jsxs)(_U.Provider,{value:he,children:[f&&(0,HW.jsx)(gz,{handle:f,store:D}),typeof t==`function`?t({payload:R}):t]});return I.type===void 0||I.type===`context-menu`?(0,HW.jsx)(qL,{externalTree:O,children:ge}):ge})}));function GW(e,t){let n=KW(t);return e.clientX>=n.left-qW&&e.clientX<=n.right+qW&&e.clientY>=n.top-qW&&e.clientY<=n.bottom+qW}function KW(e){let t=e.getBoundingClientRect(),n=sj(e);if(CN)return t;let r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(r.content===`none`&&i.content===`none`)return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}var qW,JW=s((()=>{DF(),TN(),qW=5}));function YW(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=tV(),{ref:i,index:a}=LU(e),o=n===a,s=XW.useRef(null),c=nF(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}var XW,ZW=s((()=>{XW=d(m(),1),cF(),iV(),zU()}));function QW(e){let{render:t,className:n,style:r,state:i=YM,props:a=JM,refs:o=JM,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=YW({metadata:s});return gL(l,e,{state:i,ref:[f,...o],props:[d,...a,u],stateAttributesMapping:c})}var $W=s((()=>{XM(),TL(),ZW()}));function eG(e){if(dj(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`);if(!yj(e))return eG(Sj(e))}var tG=s((()=>{Aj()}));function nG(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=rG.useRef(!1);return rG.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,EF(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:YM,[t,n,r])}var rG,iG=s((()=>{rG=d(m(),1),DF(),XM()}));function aG(e,t){let n=eN(),[r,i]=sG.useState(!1);return Q(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function oG(){let e=EW(!0);return sG.useMemo(()=>e?{type:`menubar`,context:e}:{type:void 0},[e])}var sG,cG,lG,uG=s((()=>{RI(),sG=d(m(),1),rN(),DF(),KM(),yF(),oN(),XM(),IB(),WL(),XR(),vU(),fP(),TL(),mV(),JW(),$W(),iV(),tG(),Uz(),xV(),_V(),YP(),iG(),kW(),jL(),FF(),hL(),cG=d(O(),1),lG=HM(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,openOnHover:c,delay:l=100,closeDelay:u=0,handle:d,payload:f,...p}=e,m=hU(!0),h=zz(d)??m?.store;if(!h)throw Error(LI(85));let g=gV(s),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=sG.useRef(null),S=oG(),C=tV(!0),w=$L(),T=sG.useMemo(()=>w??new UL,[w]),{registerTrigger:E,isMountedByThisTrigger:D}=xz(g,x,h,{payload:f,closeDelay:u,parent:S,floatingTreeRoot:T,floatingNodeId:GL(T),floatingParentNodeId:QL(),keyboardEventRelay:C?.relayKeyboardEvent}),O=S.type===`menubar`,k=h.useState(`disabled`),A=a||k||O&&S.context.disabled,{getButtonProps:j,buttonRef:M}=uV({disabled:A,native:o});sG.useEffect(()=>{!y&&S.type===void 0&&(h.context.allowMouseUpTriggerRef.current=!1)},[h,y,S.type]);let N=sG.useRef(null),P=eN(),F=$(e=>{if(!N.current)return;P.clear(),h.context.allowMouseUpTriggerRef.current=!1;let t=e.target;NN(N.current,t)||NN(h.select(`positionerElement`),t)||t===N.current||t!=null&&eG(t)===h.select(`rootId`)||GW(e,N.current)||T.events.emit(`close`,{domEvent:e,reason:GP})});sG.useEffect(()=>{y&&h.select(`lastOpenChangeReason`)===`trigger-hover`&&EF(N.current).addEventListener(`mouseup`,F,{once:!0})},[y,F,h]);let I=O&&S.context.hasSubmenuOpen,L=lB(v,{enabled:(c??I)&&!A&&(!O||I&&!D),handleClose:jB({blockPointerEvents:!O}),mouseOnly:!0,move:!1,restMs:S.type===void 0?l:void 0,delay:{close:u},triggerElementRef:x,externalTree:T,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),R=aG(y,h.select(`lastOpenChangeReason`)),z=fR(v,{enabled:!A,event:y&&O?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:S.type===void 0&&R}),B=Xz(v,{enabled:!A&&I}),V=nG({open:y,enabled:O,mouseDownAction:`open`}),H=sG.useMemo(()=>$I(B.reference,z.reference),[B.reference,z.reference]),U=h.useState(`triggerProps`,D),{preFocusGuardRef:W,handlePreFocusGuardFocus:G,handleFocusTargetFocus:ee}=vV(h,x),te={disabled:A,open:y},ne=[N,t,M,E,x],K=[H,L??YM,U,{"aria-haspopup":`menu`,"aria-controls":b,id:g,onMouseDown:e=>{h.select(`open`)||(P.start(200,()=>{h.context.allowMouseUpTriggerRef.current=!0}),EF(e.currentTarget).addEventListener(`mouseup`,F,{once:!0}))}},O?{role:`menuitem`}:{},V,p,j],re=gL(`button`,e,{enabled:!O,stateAttributesMapping:lP,state:te,ref:ne,props:K});return O?(0,cG.jsx)(QW,{tag:`button`,render:n,className:r,style:i,state:te,refs:ne,props:K,stateAttributesMapping:lP}):y?(0,cG.jsxs)(sG.Fragment,{children:[(0,cG.jsx)(PF,{ref:W,onFocus:G},`${g}-pre-focus-guard`),(0,cG.jsx)(sG.Fragment,{children:re},g),(0,cG.jsx)(PF,{ref:h.context.triggerFocusTargetRef,onFocus:ee},`${g}-post-focus-guard`)]}):(0,cG.jsx)(sG.Fragment,{children:re},g)})})),dG,fG,pG=s((()=>{dG=d(m(),1),TL(),fG=dG.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return gL(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})})}));function mG(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}var hG=s((()=>{})),gG=s((()=>{mU(),vU(),TL(),fP(),SU(),YP(),TU(),XM(),RI(),MU(),zU(),_V(),YN(),ZP(),az(),pz(),qU(),XU(),$U(),OU(),iU(),hL(),rW(),dW(),TW(),yF(),UU(),WW(),zW(),uG(),WV(),TF(),oU(),oN(),DF(),uz(),KA(),Aj(),cH(),ZV(),nH(),pG(),mF(),TN(),IB(),Uz(),FW(),jR()})),_G=s((()=>{gG()})),vG,yG,bG=s((()=>{m(),vG=()=>void 0,yG=()=>vG()}));function xG(){OG||typeof document>`u`||(OG=!0,document.addEventListener(`keydown`,()=>DG=`keyboard`,{capture:!0,passive:!0}),document.addEventListener(`pointerdown`,()=>DG=`pointer`,{capture:!0,passive:!0}))}function SG(){return xG(),DG===`program`?`pointer`:DG}function CG(e){return e?typeof KeyboardEvent<`u`&&e instanceof KeyboardEvent?`keyboard`:e.type===`click`&&e.detail===0?SG():typeof MouseEvent<`u`&&e instanceof MouseEvent||typeof TouchEvent<`u`&&e instanceof TouchEvent?`pointer`:SG():`program`}function wG(e,t){let n=t&&`nativeEvent`in t?t.nativeEvent:t;return n?{reason:e,source:CG(n),event:n}:{reason:e,source:`program`}}function TG(e){return{reason:e,source:SG()}}function EG(e,t){let n=e.reason===`none`?t:e.reason,r=e.event?.type===`base-ui`?void 0:e.event;return r?{reason:n,source:CG(r),event:r}:{reason:n,source:`program`}}var DG,OG,kG=s((()=>{DG=`program`,OG=!1,xG()}));function AG(e,t,n){return FG[e]=t,(r=>{let i=(0,NG.useContext)(IG)[e],a=(0,NG.useRef)(r);a.current=r;let o=(0,NG.useRef)({});return(0,NG.createElement)(i??t,i&&n?jG(r,n,a,o.current):r)})}function jG(e,t,n,r){let i=e;for(let[a,[o,s]]of Object.entries(t))typeof e[a]==`function`&&(i===e&&(i={...e}),i[a]=r[a]??=(...e)=>{let t=n.current[a];if(typeof t==`function`)return e[o]=MG(e[o],s),t(...e)});return i}function MG(e,t){let n=TG(t);if(typeof e!=`object`||!e)return n;let r=e;if(r.source!==void 0)return e;let i=typeof r.reason==`string`&&r.reason!==`none`?r.reason:t,a=r.event instanceof Event?r.event.type===`base-ui`?`program`:CG(r.event):n.source;return Object.isExtensible(e)?(Object.assign(r,{reason:i,source:a}),e):{...r,reason:i,source:a}}var NG,PG,FG,IG,LG=s((()=>{NG=d(m()),kG(),PG={},FG={},IG=(0,NG.createContext)(PG)}));function RG({intent:e=`secondary`,size:t=`default`,block:n=!1,className:r=``}={}){return[`btn`,HG[e],t==="default"?``:`btn-${t}`,n?`btn-block`:``,r].filter(Boolean).join(` `)}function zG({intent:e=`secondary`,size:t=`default`,busy:n=!1,busyLabel:r,block:i=!1,type:a=`button`,className:o,onClick:s,children:c,ref:l,...u}){let d=e=>{n?e.preventDefault():s?.(e)};return(0,VG.jsx)(`button`,{...u,ref:l,type:a,className:RG({intent:e,size:t,block:i,className:o}),"aria-disabled":n||u[`aria-disabled`]||void 0,"data-busy":n||void 0,onClick:d,children:n&&r!==void 0?r:c})}function BG({intent:e,size:t,block:n,className:r,...i}){return(0,VG.jsx)(`a`,{...i,className:RG({intent:e,size:t,block:n,className:r})})}var VG,HG,UG,WG,GG=s((()=>{LG(),VG=d(O(),1),HG={primary:`primary btn-primary`,secondary:`ghost btn-secondary`,quiet:`btn-quiet`,danger:`danger btn-danger`},UG=AG(`Button`,zG),WG=AG(`ButtonLink`,BG)}));function KG({className:e,triggerClassName:t=RG(),triggerTitle:n,triggerLabel:r,label:i,popupClassName:a=`dd-list`,side:o=`bottom`,align:s=`end`,sideOffset:c=4,open:l,onOpenChange:u,finalFocus:d,children:f}){let p=(0,XG.useRef)(null),[m,h]=(0,XG.useState)(null);(0,XG.useEffect)(()=>{h(p.current?.closest(`dialog, [role="dialog"]`))},[]);let[g,_]=(0,XG.useState)(!1),v=l??g;return(0,ZG.jsx)(`div`,{className:e||void 0,children:(0,ZG.jsxs)(UW,{open:v,onOpenChange:(e,t)=>{!e&&t.reason===`escape-key`&&d===void 0&&p.current?.focus({preventScroll:!0}),_(e),u?.(e,EG(t,`implicit`))},children:[(0,ZG.jsx)(lG,{render:(0,ZG.jsx)(`button`,{type:`button`,className:t,title:n,"aria-label":r,ref:p}),children:i}),(0,ZG.jsx)(uW,{container:m??yG(),children:(0,ZG.jsx)(wW,{anchor:()=>p.current?cU(p.current):null,positionMethod:`fixed`,side:o,align:s,sideOffset:c,collisionBoundary:lU(),collisionPadding:8,style:{zIndex:90},children:(0,ZG.jsx)(nW,{className:a,finalFocus:d,children:f})})})]})})}function qG({className:e,labelClassName:t,label:n,children:r}){return(0,ZG.jsxs)(KU,{className:e,children:[(0,ZG.jsx)(YU,{className:t,children:n}),r]})}function JG({className:e=`dd-divider`}){return(0,ZG.jsx)(fG,{className:e})}function YG({className:e=`dd-option`,disabled:t,closeOnClick:n,onClick:r,title:i,children:a,ref:o}){return(0,ZG.jsx)(QU,{render:(0,ZG.jsx)(`button`,{type:`button`,className:e,title:i,ref:o}),nativeButton:!0,disabled:t,closeOnClick:n,onClick:r,children:a})}var XG,ZG,QG,$G,eK=s((()=>{XG=d(m(),1),_G(),uU(),bG(),GG(),kG(),LG(),ZG=d(O(),1),QG=AG(`DropMenu`,KG,{onOpenChange:[1,`implicit`]}),AG(`DropGroup`,qG),AG(`DropSeparator`,JG),$G=AG(`DropItem`,YG)})),tK,nK=s((()=>{Ya(),tK=Va({formatting:`Formatting for {label}`,bold:`Bold`,boldMark:`B`,italicMark:`I`,strikeMark:`S`,italic:`Italic`,strike:`Strikethrough`,textStyle:`Text style`,paragraph:`Paragraph`,heading:`Heading {level}`,quote:`Quote`,codeBlock:`Code block`,inlineCode:`Code`,bulletList:`Bulleted list`,orderedList:`Numbered list`,taskList:`Checklist`,link:`Link`,linkAddress:`Link address`,linkPlaceholder:`https://`,linkApply:`Apply`,linkRemove:`Remove link`,linkInvalid:`A link is a web address (https://…) or mailto:.`,table:`Table`,tableInsert:`Insert table`,tableRowAfter:`Add row below`,tableColumnAfter:`Add column right`,tableRowDelete:`Delete row`,tableColumnDelete:`Delete column`,tableDelete:`Delete table`,picture:`Add picture`,pictureAdding:`Adding picture…`,noPeople:`No one by that name`,people:`People`,group:`Team`})})),rK=s((()=>{})),iK=l({RichTextEditor:()=>lK,cleanPastedHtml:()=>aK});function aK(e){return e.replace(/<!--\[if[\s\S]*?<!\[endif\]-->/gi,``).replace(/<!--[\s\S]*?-->/g,``).replace(/<\/?(?:o|w|m|v):[^>]*>/gi,``).replace(/<(style|xml|title)\b[\s\S]*?<\/\1\s*>/gi,``).replace(/<(?:meta|link)\b[^>]*>/gi,``).replace(/<b\b[^>]*id="docs-internal-guid[^"]*"[^>]*>([\s\S]*)<\/b>/i,`$1`)}function oK(e){let t=e.getHTML().replace(/(?:<p><\/p>)+$/,``);return jr(t)||/<img\b/i.test(t)?t:``}function sK(e){let t=(0,dK.useRef)(e);return t.current=e,t}function cK({label:e,active:t,disabled:n,onClick:r,children:i}){return(0,fK.jsx)(`button`,{type:`button`,className:`rich-tool${t?` is-active`:``}`,title:e,"aria-label":e,"aria-pressed":t,disabled:n,onMouseDown:e=>e.preventDefault(),onClick:r,children:i})}function lK({id:e,value:t,onChange:n,label:r,describedBy:i,invalid:a,disabled:o=!1,autoFocus:s,placeholder:c,mentions:l,pictures:u,onKey:d,onProblem:f,onPopupChange:p}){let[m,h]=(0,dK.useState)(),[g,_]=(0,dK.useState)(),[v,y]=(0,dK.useState)(!1),[b,x]=(0,dK.useState)(0),S=sK({onChange:n,mentions:l,pictures:u,onKey:d,onProblem:f,suggesting:m}),C=(0,dK.useRef)({query:``,count:1}),w=(0,dK.useRef)(null),T=(0,dK.useRef)(null),E=(0,dK.useRef)({html:``,edited:!1}),D=(e,t,n)=>{let r=S.current.pictures,i=t.filter(e=>e.type.startsWith(`image/`));if(!r||!i.length)return!1;for(let t of i)x(e=>e+1),r(t).then(r=>{let i=e.chain().focus();(n===void 0?i:i.setTextSelection(n)).setImage({src:r,alt:t.name}).run()}).catch(e=>S.current.onProblem?.(e.message)).finally(()=>x(e=>e-1));return!0},O=sC({immediatelyRender:!0,shouldRerenderOnTransaction:!0,editable:!o,autofocus:s?`end`:!1,content:t||``,extensions:[xO.configure({heading:{levels:[2,3,4]},horizontalRule:!1,link:{openOnClick:!1,autolink:!0,defaultProtocol:`https`,protocols:[`mailto`],isAllowedUri:e=>Or(e)!==void 0,HTMLAttributes:{rel:`noopener noreferrer`,target:`_blank`}}}),ED,TD.configure({nested:!0}),vA.configure({resizable:!1}),mA,pA,fA,IM.configure({inline:!1,allowBase64:!1}),...c?[gO.configure({placeholder:c})]:[],...l?[NM.extend({addAttributes(){return{...this.parent?.(),kind:{default:null,parseHTML:e=>e.getAttribute(`data-kind`)===`group`?`group`:null,renderHTML:()=>({})},label:{default:null,parseHTML:e=>(e.textContent??``).replace(/^@/,``)||null,renderHTML:()=>({})}}}}).configure({renderText:({node:e})=>`@${e.attrs.label??e.attrs.id}`,renderHTML:({node:e})=>[`span`,{"data-type":`mention`,"data-id":e.attrs.id,...e.attrs.kind===`group`?{"data-kind":`group`}:{}},`@${e.attrs.label??e.attrs.id}`],suggestion:{allowSpaces:!0,allow:({state:e,range:t})=>{if(!e.doc.resolve(t.from).parent.type.contentMatch.matchType(e.schema.nodes.mention))return!1;let n=e.doc.textBetween(t.from+1,t.to);if(!/\s/.test(n))return!0;if(/^\s|\s\s/.test(n)||n.trim().split(/\s+/).length+ +!!/\s$/.test(n)>2)return!1;let r=C.current;return r.count>0||!n.startsWith(r.query)},items:async({query:e})=>{try{return(await S.current.mentions?.(e)??[]).slice(0,8)}catch{return[]}},render:()=>{let e=e=>{if(e.loading||(C.current={query:e.query,count:e.items.length}),!e.loading&&!e.items.length&&/\s/.test(e.query))return h(void 0);h(t=>({items:e.items,index:t&&t.items===e.items?t.index:0,box:()=>e.clientRect?.()??null,pick:t=>e.command({id:t.id,label:t.label,kind:t.kind??null})}))};return{onStart:e,onUpdate:e,onExit:()=>h(void 0),onKeyDown:({event:e})=>{let t=S.current.suggesting;if(!t||!t.items.length)return e.key===`Escape`&&(h(void 0),!0);if(e.key===`ArrowDown`||e.key===`ArrowUp`){let n=e.key===`ArrowDown`?1:-1;return h({...t,index:(t.index+n+t.items.length)%t.items.length}),!0}return e.key===`Enter`||e.key===`Tab`?(t.pick(t.items[t.index]),!0):e.key===`Escape`&&(h(void 0),!0)}}}}})]:[]],editorProps:{attributes:{class:`rich-text rich-text-editable`,role:`textbox`,"aria-multiline":`true`,"aria-label":r,...e?{id:e}:{},...i?{"aria-describedby":i}:{},...a?{"aria-invalid":`true`}:{}},transformPastedHTML:aK,handleKeyDown:(e,t)=>S.current.onKey?.(t)??!1,handlePaste:(e,t)=>{let n=[...t.clipboardData?.files??[]];return n.length>0&&T.current?D(T.current,n):!1},handleDrop:(e,t)=>{let n=[...t.dataTransfer?.files??[]];if(!n.length||!T.current)return!1;let r=e.posAtCoords({left:t.clientX,top:t.clientY})?.pos;return D(T.current,n,r)}},onCreate:({editor:e})=>{E.current={html:oK(e),edited:!1}},onUpdate:({editor:e})=>{let t=oK(e);(E.current.edited||t!==E.current.html)&&(E.current.edited=!0,S.current.onChange(t))}});T.current=O;let k=!!m;if((0,dK.useEffect)(()=>{p?.(k)},[k]),(0,dK.useEffect)(()=>{O&&t!==oK(O)&&(O.commands.setContent(t||``,{emitUpdate:!1}),E.current={html:oK(O),edited:!1})},[O,t]),(0,dK.useEffect)(()=>{O?.setEditable(!o)},[O,o]),!O)return null;let A=e=>()=>e(O.chain().focus()).run(),j=O.isActive(`heading`,{level:2})?tK(`heading`,{level:2}):O.isActive(`heading`,{level:3})?tK(`heading`,{level:3}):O.isActive(`heading`,{level:4})?tK(`heading`,{level:4}):O.isActive(`codeBlock`)?tK(`codeBlock`):tK(`paragraph`),M=O.isActive(`table`),N=()=>{let e=(g??``).trim();e?Or(e)?(O.chain().focus().extendMarkRange(`link`).setLink({href:e}).run(),_(void 0)):y(!0):(O.chain().focus().extendMarkRange(`link`).unsetLink().run(),_(void 0))},P=()=>{y(!1),_(O.getAttributes(`link`).href??``)};return(0,fK.jsxs)(`div`,{className:`rich-editor${a?` is-invalid`:``}${o?` is-disabled`:``}`,children:[(0,fK.jsxs)(`div`,{className:`rich-toolbar`,role:`toolbar`,"aria-label":tK(`formatting`,{label:r}),children:[(0,fK.jsx)(cK,{label:tK(`bold`),active:O.isActive(`bold`),disabled:o,onClick:A(e=>e.toggleBold()),children:(0,fK.jsx)(`strong`,{children:tK(`boldMark`)})}),(0,fK.jsx)(cK,{label:tK(`italic`),active:O.isActive(`italic`),disabled:o,onClick:A(e=>e.toggleItalic()),children:(0,fK.jsx)(`em`,{children:tK(`italicMark`)})}),(0,fK.jsx)(cK,{label:tK(`strike`),active:O.isActive(`strike`),disabled:o,onClick:A(e=>e.toggleStrike()),children:(0,fK.jsx)(`s`,{children:tK(`strikeMark`)})}),(0,fK.jsx)(`span`,{className:`rich-tool-gap`,"aria-hidden":`true`}),(0,fK.jsxs)(QG,{className:`rich-tool-menu`,triggerClassName:`rich-tool rich-tool-wide`,triggerTitle:tK(`textStyle`),triggerLabel:`${tK(`textStyle`)}: ${j}`,label:(0,fK.jsxs)(fK.Fragment,{children:[j,(0,fK.jsx)(`span`,{className:`rich-tool-caret`,"aria-hidden":`true`,children:`▾`})]}),popupClassName:`page-actions-popup rich-menu`,align:`start`,children:[(0,fK.jsx)($G,{className:`page-actions-item`,onClick:A(e=>e.setParagraph()),children:tK(`paragraph`)}),[2,3,4].map(e=>(0,fK.jsx)($G,{className:`page-actions-item rich-menu-h${e}`,onClick:A(t=>t.setHeading({level:e})),children:tK(`heading`,{level:e})},e)),(0,fK.jsx)($G,{className:`page-actions-item`,onClick:A(e=>e.toggleBlockquote()),children:tK(`quote`)}),(0,fK.jsx)($G,{className:`page-actions-item`,onClick:A(e=>e.toggleCodeBlock()),children:tK(`codeBlock`)})]}),(0,fK.jsx)(`span`,{className:`rich-tool-gap`,"aria-hidden":`true`}),(0,fK.jsx)(cK,{label:tK(`bulletList`),active:O.isActive(`bulletList`),disabled:o,onClick:A(e=>e.toggleBulletList()),children:`•≡`}),(0,fK.jsx)(cK,{label:tK(`orderedList`),active:O.isActive(`orderedList`),disabled:o,onClick:A(e=>e.toggleOrderedList()),children:`1≡`}),(0,fK.jsx)(cK,{label:tK(`taskList`),active:O.isActive(`taskList`),disabled:o,onClick:A(e=>e.toggleTaskList()),children:`☑`}),(0,fK.jsx)(`span`,{className:`rich-tool-gap`,"aria-hidden":`true`}),(0,fK.jsx)(cK,{label:tK(`link`),active:O.isActive(`link`),disabled:o,onClick:P,children:`↗`}),(0,fK.jsx)(cK,{label:tK(`inlineCode`),active:O.isActive(`code`),disabled:o,onClick:A(e=>e.toggleCode()),children:`</>`}),(0,fK.jsxs)(QG,{className:`rich-tool-menu`,triggerClassName:`rich-tool`,triggerTitle:tK(`table`),triggerLabel:tK(`table`),label:`⊞`,popupClassName:`page-actions-popup rich-menu`,align:`start`,children:[(0,fK.jsx)($G,{className:`page-actions-item`,disabled:M,onClick:A(e=>e.insertTable({rows:3,cols:3,withHeaderRow:!0})),children:tK(`tableInsert`)}),(0,fK.jsx)($G,{className:`page-actions-item`,disabled:!M,onClick:A(e=>e.addRowAfter()),children:tK(`tableRowAfter`)}),(0,fK.jsx)($G,{className:`page-actions-item`,disabled:!M,onClick:A(e=>e.addColumnAfter()),children:tK(`tableColumnAfter`)}),(0,fK.jsx)($G,{className:`page-actions-item`,disabled:!M,onClick:A(e=>e.deleteRow()),children:tK(`tableRowDelete`)}),(0,fK.jsx)($G,{className:`page-actions-item`,disabled:!M,onClick:A(e=>e.deleteColumn()),children:tK(`tableColumnDelete`)}),(0,fK.jsx)($G,{className:`page-actions-item`,disabled:!M,onClick:A(e=>e.deleteTable()),children:tK(`tableDelete`)})]}),u&&(0,fK.jsxs)(fK.Fragment,{children:[(0,fK.jsx)(cK,{label:tK(b?`pictureAdding`:`picture`),disabled:o,onClick:()=>w.current?.click(),children:`▣`}),(0,fK.jsx)(`input`,{ref:w,type:`file`,accept:`image/*`,hidden:!0,onChange:e=>{let t=[...e.target.files??[]];e.target.value=``,D(O,t)}})]})]}),g!==void 0&&(0,fK.jsxs)(`div`,{className:`rich-link-bar`,children:[(0,fK.jsx)(`input`,{className:`field-control`,type:`url`,autoFocus:!0,"aria-label":tK(`linkAddress`),"aria-invalid":v||void 0,placeholder:tK(`linkPlaceholder`),value:g,onChange:e=>{_(e.target.value),y(!1)},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),N()):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),_(void 0),O.commands.focus())}}),(0,fK.jsx)(`button`,{type:`button`,className:`rich-tool rich-tool-wide`,onClick:N,children:tK(`linkApply`)}),O.isActive(`link`)&&(0,fK.jsx)(`button`,{type:`button`,className:`rich-tool rich-tool-wide`,onClick:()=>{O.chain().focus().extendMarkRange(`link`).unsetLink().run(),_(void 0)},children:tK(`linkRemove`)}),v&&(0,fK.jsx)(`span`,{className:`insert-missing`,role:`alert`,children:tK(`linkInvalid`)})]}),(0,fK.jsx)(bC,{editor:O,className:`rich-editor-body`,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),P())}}),m&&(0,fK.jsx)(uK,{suggesting:m,onPick:e=>m.pick(e)})]})}function uK({suggesting:e,onPick:t}){return(0,fK.jsx)(JB,{open:!0,modal:!1,children:(0,fK.jsx)(HV,{container:ja(),children:(0,fK.jsx)(BH,{anchor:{getBoundingClientRect:()=>{let t=e.box(),n=Cs(),r=(t?.top??0)/n,i=(t?.left??0)/n,a=(t?.width??0)/n,o=(t?.height??0)/n;return{x:i,y:r,top:r,left:i,width:a,height:o,right:i+a,bottom:r+o,toJSON:()=>({})}}},positionMethod:`fixed`,side:`bottom`,align:`start`,sideOffset:4,collisionBoundary:lU(),collisionPadding:8,style:{zIndex:95},children:(0,fK.jsx)(rU,{className:`rich-mentions`,initialFocus:!1,finalFocus:!1,children:(0,fK.jsx)(`div`,{role:`listbox`,"aria-label":tK(`people`),children:e.items.length?e.items.map((n,r)=>(0,fK.jsxs)(`div`,{role:`option`,"aria-selected":r===e.index,className:`rich-mention-option${r===e.index?` is-active`:``}`,onMouseDown:e=>{e.preventDefault(),t(n)},children:[(0,fK.jsx)(`span`,{children:n.label}),n.kind===`group`?(0,fK.jsx)(`span`,{className:`rich-mention-kind`,children:tK(`group`)}):n.handle&&(0,fK.jsxs)(`span`,{className:`rich-mention-handle`,children:[`@`,n.handle]})]},`${n.kind??`person`}:${n.id}`)):(0,fK.jsx)(`div`,{className:`rich-mention-none`,children:tK(`noPeople`)})})})})})})}var dK,fK,pK=s((()=>{dK=d(m()),jC(),SO(),DD(),Qte(),$te(),ene(),yO(),sU(),zr(),tc(),uU(),eK(),nK(),rK(),Pa(),fK=d(O())}));function mK(e,t){let n=e.labelColumn??e.by,r=e=>e==null?``:String(e);if(!nt(n))return r(t[n]);let i=Ye(n);return`problem`in i?``:i.parts.map(e=>`text`in e?e.text:[e.path,...(e.or??[]).map(e=>e.path)].map(e=>r(t[e])).find(Boolean)??``).join(``).replace(/\s+/g,` `).trim()}function hK(e,t,n,r=[]){let i=Br(e.labelColumn??e.by),a=`problem`in i?[e.by]:i.columns,o=e=>n?.find(t=>t.name===e),s=[...new Set([...a,e.by])].filter(e=>gK(o(e))),c=t.trim().split(/\s+/).filter(Boolean).slice(0,s.length>4?1:_K),l=s.length?c.map(e=>`(${s.flatMap(t=>[`${t} startswith ${wn(e)}`,`${t} contains ${wn(` ${e}`)}`]).join(` or `)})`):[];return[e.from,l.join(` and `),`show ${[...new Set([e.by,...a,...r])].join(`, `)}`,`sort ${a.join(`, `)}`].filter(Boolean).join(` `)}var gK,_K,vK=s((()=>{St(),sr(),ot(),Vr(),zr(),gK=e=>!e?.type||ht(e.type)===`text`&&!/uuid|json/i.test(e.type),_K=2})),yK=l({mentionRows:()=>SK});function bK(e){if(!e.through)return;let t=Ys(e.from),n=(Xs(e.through)??[]).find(e=>e.to.table===t?.id&&e.from.columns.length===1);return n&&{column:n.from.columns[0],team:n.to.columns[0]}}async function xK(e,t,n){let r=bK(e);if(!r)return t;let i=[...new Set(t.map(e=>e[r.team]).filter(e=>typeof e==`string`||typeof e==`number`))];if(!i.length)return[];let a=`${e.through} ${r.column} in (${i.map(wn).join(`, `)}) show ${r.column}`,o=await Ns(`/api/run`,{...ao(n??null),q:a,limit:500,offset:0,count:`none`}),s=new Set((o.rows??[]).map(e=>String(e[r.column])));return t.filter(e=>s.has(String(e[r.team])))}async function SK(e,t,n,r){let i=Ys(e.from),a=r===`group`?bK(e):void 0,o=hK(e,t,i?.columns,a?[a.team]:[]),s=await Ns(`/api/run`,{...ao(n??null),q:o,limit:a?24:8,offset:0,count:`none`});return(a?(await xK(e,s.rows??[],n)).slice(0,8):s.rows??[]).flatMap(t=>{let n=t[e.by],i=typeof n==`string`&&Pr.test(n)?n:typeof n==`number`&&Number.isSafeInteger(n)?String(n):void 0;if(i===void 0)return[];let a=mK(e,t)||i;return[{id:i,label:a,...r||!CK(e,i,a)?{}:{handle:i},...r?{kind:r}:{}}]})}function CK(e,t,n){return!Ys(e.from)?.columns?.some(t=>t.name===e.by&&t.primaryKey)&&t!==n&&!/^\d+$/.test(t)&&!wK.test(t)&&!t.includes(`@`)}var wK,TK=s((()=>{tc(),uo(),zr(),vK(),sr(),wK=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i})),EK,DK,OK,kK,AK,jK=s((()=>{EK=d(m(),1),DK=d(O(),1),OK=EK.createContext(void 0),kK=e=>{let t=EK.useContext(OK);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},AK=({client:e,children:t})=>(EK.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,DK.jsx)(OK.Provider,{value:e,children:t}))}));function MK(e){setTimeout(e,0)}var NK,PK,FK,IK=s((()=>{NK={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},PK=class{#e=NK;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},FK=new PK}));function LK(){}function RK(e,t){return typeof e==`function`?e(t):e}function zK(e){return typeof e==`number`&&e>=0&&e!==1/0}function BK(e,t){return Math.max(e+(t||0)-Date.now(),0)}function VK(e,t){return typeof e==`function`?e(t):e}function HK(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==WK(o,t.options))return!1}else if(!KK(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function UK(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(GK(t.options.mutationKey)!==GK(a))return!1}else if(!KK(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function WK(e,t){return(t?.queryKeyHashFn||GK)(e)}function GK(e){return JSON.stringify(e,(e,t)=>XK(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function KK(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n<t.length;n++)if(!KK(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!KK(e[r],t[r]))return!1;return!0}return!1}function qK(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=YK(e)&&YK(t);if(!r&&!(XK(e)&&XK(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:oq.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=qK(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function JK(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function YK(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function XK(e){if(!ZK(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!ZK(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function ZK(e){return Object.prototype.toString.call(e)===`[object Object]`}function QK(e){return new Promise(t=>{FK.setTimeout(t,e)})}function $K(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:qK(e,t)}function eq(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function tq(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}function nq(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===sq?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function rq(e,t){return typeof e==`function`?e(...t):!!e}function iq(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r||(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0})),i)}),e}var aq,oq,sq,cq=s((()=>{IK(),aq=typeof window>`u`||`Deno`in globalThis,oq=Object.prototype.hasOwnProperty,sq=Symbol()})),lq,uq,dq=s((()=>{cq(),lq=()=>aq,uq=()=>lq()})),fq,pq=s((()=>{fq=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}}})),mq,hq,gq=s((()=>{pq(),mq=class extends fq{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},hq=new mq}));function _q(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=vq,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var vq,yq,bq=s((()=>{IK(),vq=MK,yq=_q()})),xq,Sq,Cq=s((()=>{pq(),xq=class extends fq{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}},Sq=new xq}));function wq(e){return Math.min(1e3*2**e,3e4)}function Tq(e){return(e??`online`)!==`online`||Sq.isOnline()}function Eq(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(LK);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new Dq(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>hq.isFocused()&&(e.networkMode===`always`||Sq.isOnline())&&e.canRun(),p=()=>Tq(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(uq()?0:3),a=e.retryDelay??wq,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);t||!s?h(r):(n++,e.onFail?.(n,r),QK(o).then(()=>f()?void 0:g()).then(()=>{t?h(r):_()}))})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g().then(_),s)}}var Dq,Oq=s((()=>{cq(),dq(),gq(),Cq(),Dq=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}}})),kq,Aq=s((()=>{IK(),cq(),dq(),kq=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),zK(this.gcTime)&&(this.#e=FK.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(uq()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(FK.clearTimeout(this.#e),this.#e=void 0)}}}));function jq(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{iq(e,()=>t.signal,()=>n=!0)},u=nq(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?tq:eq;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?Nq:Mq,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Mq(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function Mq(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Nq(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Pq=s((()=>{cq()}));function Fq(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Tq(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Iq(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Lq(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Rq,zq=s((()=>{cq(),bq(),Oq(),Aq(),Pq(),Rq=class extends kq{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Lq(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Lq(this.options);e.data!==void 0&&(this.setState(Iq(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=$K(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(LK).catch(LK):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>VK(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===sq||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>VK(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!BK(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=nq(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?jq(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=Eq({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Dq&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Dq){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Fq(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Iq(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),yq.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}}}));function Bq(e,t){return VK(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||VK(t.retryOnMount,e)!==!1)}function Vq(e,t){return Bq(e,t)||e.state.data!==void 0&&Hq(e,t,t.refetchOnMount)}function Hq(e,t,n){if(VK(t.enabled,e)!==!1&&VK(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Wq(e,t)}return!1}function Uq(e,t,n,r){return(e!==t||VK(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Wq(e,n)}function Wq(e,t){return VK(t.enabled,e)!==!1&&e.isStaleByTime(VK(t.staleTime,e))}var Gq,Kq=s((()=>{IK(),cq(),dq(),pq(),gq(),bq(),zq(),Gq=class extends fq{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Vq(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Hq(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Hq(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof VK(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!JK(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Uq(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||VK(this.options.enabled,this.#t)!==VK(t.enabled,this.#t)||VK(this.options.staleTime,this.#t)!==VK(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||VK(this.options.enabled,this.#t)!==VK(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return JK(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(LK)),t}#h(e){return!uq()&&VK(this.options.enabled,this.#t)!==!1&&zK(e)}#g(){this.#b();let e=VK(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=BK(this.#r.dataUpdatedAt,e)+1;this.#u=FK.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=FK.setInterval(()=>{(this.options.refetchIntervalInBackground||hq.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(FK.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(FK.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Vq(e,t),o=i&&Uq(e,n,t,r);(a||o)&&(l={...l,...Fq(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=$K(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=$K(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Wq(e,t),refetch:this.refetch,isEnabled:VK(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),JK(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();yq.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}}}));function qq(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Jq,Yq=s((()=>{bq(),Oq(),Aq(),Jq=class extends kq{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||qq(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=Eq({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),yq.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}}}));function Xq(e){return e.options.scope?.id}var Zq,Qq=s((()=>{cq(),pq(),bq(),Yq(),Zq=class extends fq{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new Jq({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Xq(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Xq(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Xq(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=Xq(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){yq.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>UK(t,e))}findAll(e={}){return this.getAll().filter(t=>UK(e,t))}notify(e){yq.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return yq.batch(()=>Promise.all(e.map(e=>e.continue().catch(LK))))}}}));function $q(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var eJ,tJ=s((()=>{cq(),pq(),bq(),Kq(),eJ=class extends fq{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,yq.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!JK(e,n)});(o||s)&&(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&($q(e,n).forEach(e=>{e.destroy()}),$q(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){let n=new Set;return t.map((r,i)=>{let a=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?a:r.observer.trackResult(a,e=>{n.has(e)||(n.add(e),t.forEach(t=>{t.observer.trackProp(e)}))})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=qK(this.#a,t(e))),this.#a}return e}#f(){return!this.#r?.combine||this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new Gq(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=this.#t.slice(),this.#t[n]=t,this.#h())}#h(){if(this.hasListeners()){let e=this.#f(),t=this.#a,n=e?t:this.#d(this.#u(this.#t,this.#l),this.#r?.combine);(e||t!==n)&&yq.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}}})),nJ,rJ=s((()=>{cq(),pq(),bq(),zq(),nJ=class extends fq{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??WK(r,t),a=this.get(i);return a||(a=new Rq({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){yq.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>HK(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>HK(e,t)):t}notify(e){yq.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){yq.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){yq.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}}})),iJ,aJ=s((()=>{cq(),gq(),bq(),Cq(),Qq(),rJ(),iJ=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new nJ,this.#t=e.mutationCache||new Zq,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=hq.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Sq.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(VK(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=RK(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return yq.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;yq.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return yq.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=yq.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(LK).catch(LK)}invalidateQueries(e,t={}){return yq.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=yq.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(LK)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(LK)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(VK(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(VK(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(LK).catch(LK)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(LK).catch(LK)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Sq.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(GK(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{KK(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(GK(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{KK(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=WK(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===sq&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}}})),oJ=s((()=>{cq(),bq(),Kq(),tJ(),rJ(),aJ()})),sJ,cJ,lJ,uJ=s((()=>{sJ=d(m(),1),cJ=sJ.createContext(!1),lJ=()=>sJ.useContext(cJ),cJ.Provider}));function dJ(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var fJ,pJ,mJ,hJ=s((()=>{fJ=d(m(),1),O(),pJ=fJ.createContext(dJ()),mJ=()=>fJ.useContext(pJ)})),gJ,_J,vJ,yJ,bJ=s((()=>{gJ=d(m(),1),oJ(),_J=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?rq(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},vJ=e=>{gJ.useEffect(()=>{e.clearReset()},[e])},yJ=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||rq(n,[e.error,r]))})),xJ,SJ,CJ,wJ=s((()=>{xJ=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},SJ=(e,t)=>e?.suspense&&t.isPending,CJ=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()})}));function TJ({queries:e,...t},n){let r=kK(n),i=lJ(),a=mJ(),o=t.subscribed!==!1,s=EJ.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:o?`optimistic`:void 0,t}),[e,r,i,o]);s.forEach(e=>{xJ(e);let t=r.getQueryCache().get(e.queryHash);_J(e,a,t)}),vJ(a);let[c]=EJ.useState(()=>new eJ(r,s,t)),[l,u,d]=c.getOptimisticResult(s,t.combine),f=!i&&o;EJ.useSyncExternalStore(EJ.useCallback(e=>f?c.subscribe(yq.batchCalls(e)):LK,[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),EJ.useEffect(()=>{c.setQueries(s,t)},[s,t,c]);let p=l.some((e,t)=>SJ(s[t],e))?l.flatMap((e,t)=>{let n=s[t];if(n&&SJ(n,e)){let e=new Gq(r,n);return CJ(n,e,a)}return[]}):[];if(p.length>0)throw Promise.all(p);let m=l.find((e,t)=>{let n=s[t];return n&&yJ({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(m)throw m.error;return u(d())}var EJ,Vne=s((()=>{jK(),uJ(),hJ(),bJ(),wJ(),EJ=d(m(),1),oJ()}));function Hne(e,t,n){let r=lJ(),i=mJ(),a=kK(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,xJ(o),_J(o,i,s),vJ(i);let[l]=DJ.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(DJ.useSyncExternalStore(DJ.useCallback(e=>{let t=d?l.subscribe(yq.batchCalls(e)):LK;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),DJ.useEffect(()=>{l.setOptions(o)},[o,l]),SJ(o,u))throw CJ(o,l,i);if(yJ({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}var DJ,Une=s((()=>{jK(),uJ(),hJ(),bJ(),wJ(),DJ=d(m(),1),oJ()}));function OJ(e,t){return Hne(e,Gq,t)}var Wne=s((()=>{Une(),oJ()})),kJ=s((()=>{jK(),Vne(),Wne(),oJ()}));function Gne(){return(0,AJ.useSyncExternalStore)(La,Ia,Ia)}var AJ,Kne=s((()=>{AJ=d(m()),Ya()}));function qne(e){return Ea(window,`online`,e),Ea(window,`offline`,e),()=>{Da(window,`online`,e),Da(window,`offline`,e)}}function jJ({text:e,retry:t,crashed:n=!1}){Gne();let r=(0,NJ.useSyncExternalStore)(qne,IJ,()=>!0),i=(0,NJ.useContext)(OK),a=(0,NJ.useContext)(FJ),o=(0,NJ.useId)(),s=!n&&!r?Ba(`problem.offline`):e;a&&!a.has(s)&&a.set(s,o);let c=!a||a.get(s)===o;if((0,NJ.useEffect)(()=>()=>{a?.get(s)===o&&a.delete(s)},[a,s,o]),!c&&!n)return(0,PJ.jsx)(`p`,{className:`problem problem-repeat`,children:Ba(`problem.sameAbove`)});let l=()=>{t?.(),i?.refetchQueries({type:`active`,predicate:e=>e.state.status===`error`})};return(0,PJ.jsxs)(`div`,{className:`problem`,role:`alert`,...n?{"data-section-error":``}:{},children:[(0,PJ.jsx)(Pe,{name:`warning`,className:`problem-mark`}),(0,PJ.jsx)(`p`,{className:`problem-text`,children:s}),(0,PJ.jsx)(UG,{size:`compact`,className:`problem-retry`,onClick:l,children:Ba(`problem.retry`)})]})}function Jne({mark:e,text:t,detail:n,action:r,className:i,role:a}){return(0,PJ.jsxs)(`div`,{className:i,...a?{role:a}:{},children:[e?(0,PJ.jsx)(Pe,{name:e,className:`empty-note-mark`}):null,(0,PJ.jsxs)(`p`,{className:`empty-note-text`,children:[t,n?(0,PJ.jsxs)(PJ.Fragment,{children:[` `,(0,PJ.jsx)(`span`,{className:`empty-note-detail`,children:n})]}):null]}),r?(0,PJ.jsx)(`div`,{className:`empty-note-action`,children:r}):null]})}function MJ({text:e,detail:t,action:n,className:r=``,mark:i=`tray`}){return(0,PJ.jsx)(Jne,{mark:i,text:e,detail:t,action:n,className:`empty-note${r?` ${r}`:``}`})}var NJ,PJ,FJ,IJ,LJ=s((()=>{NJ=d(m()),kJ(),Ya(),GG(),Fe(),Kne(),Pa(),PJ=d(O()),FJ=(0,NJ.createContext)(null),IJ=()=>typeof navigator>`u`||navigator.onLine!==!1}));function RJ({label:e,hint:t,problem:n,required:r=!1,id:i,group:a=!1,check:o=!1,size:s=`default`,kind:c,optional:l,labelAside:u,labelHidden:d=!1,reserve:f=!1,className:p=``,children:m}){let h=(0,zJ.useId)(),g=i??`field-${h}`,_=t?`${g}-hint`:void 0,v=`${g}-problem`,y=n!=null&&n!==!1&&n!==``,b=`${g}-label`,x=d?`form-field-label form-field-label-hidden`:`form-field-label`,S=a?(0,BJ.jsx)(`span`,{id:b,className:x,children:e}):(0,BJ.jsx)(`label`,{id:b,htmlFor:g,className:x,children:e}),C=l&&!r?(0,BJ.jsx)(`span`,{className:`form-field-optional-word`,children:l}):null,w={id:g,..._||y?{"aria-describedby":[_,y?v:void 0].filter(Boolean).join(` `)}:{},...y?{"aria-invalid":!0}:{},...r?{"aria-required":!0}:{},...a?{"aria-labelledby":b}:{}},T=typeof m==`function`?m(w):(0,zJ.isValidElement)(m)?(0,zJ.cloneElement)(m,{...w,...Yne(m.props,w)}):m;return(0,BJ.jsxs)(`div`,{"data-kind":c,className:[`form-field`,s===`compact`?`form-field-compact`:``,o?`form-field-check`:``,f?`form-field-reserve`:``,r?`is-required`:``,y?`is-invalid`:``,p].filter(Boolean).join(` `),children:[o?(0,BJ.jsxs)(`div`,{className:`form-field-check-row`,children:[T,(0,BJ.jsx)(`label`,{id:b,htmlFor:g,className:`form-field-label`,children:e}),C]}):(0,BJ.jsxs)(BJ.Fragment,{children:[u||C?(0,BJ.jsxs)(`div`,{className:`form-field-label-row`,children:[S,C,u]}):S,T]}),t?(0,BJ.jsx)(`p`,{id:_,className:`form-field-hint`,children:t}):null,(0,BJ.jsx)(`p`,{id:v,className:`form-field-problem`,"aria-live":`polite`,hidden:!y&&!f,children:y?n:null})]})}function Yne(e,t){let n=[typeof e[`aria-describedby`]==`string`?e[`aria-describedby`]:``,t[`aria-describedby`]].filter(Boolean).join(` `);return n?{"aria-describedby":n}:{}}var zJ,BJ,VJ=s((()=>{zJ=d(m(),1),BJ=d(O(),1)})),HJ,UJ,Xne=s((()=>{HJ=d(m()),UJ=(0,HJ.createContext)(void 0)}));function WJ(e){let t=GJ.useContext(KJ);if(!e&&t===void 0)throw Error(LI(27));return t}var GJ,KJ,qJ=s((()=>{RI(),GJ=d(m(),1),KJ=GJ.createContext(void 0)})),JJ,YJ,Zne=s((()=>{JJ=d(m(),1),qJ(),TL(),fP(),YJ=JJ.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,s=WJ(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return gL(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:dP,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})})}));function Qne(){let e=XJ.useContext(ZJ);if(e===void 0)throw Error(LI(26));return e}var XJ,ZJ,QJ=s((()=>{RI(),XJ=d(m(),1),ZJ=XJ.createContext(void 0)})),$J,$ne=s((()=>{$J=`--nested-dialogs`})),eY,ere=s((()=>{fP(),eY=`data-nested-dialog-open`})),tY,nY=s((()=>{YN(),fP(),ere(),tY={...uP,...JN,nestedDialogOpen(e){return e?{[eY]:``}:null}}})),rY,iY,aY,tre=s((()=>{rY=d(m(),1),IB(),qJ(),TL(),QJ(),pz(),qH(),Uz(),$ne(),nY(),iY=d(O(),1),aY=rY.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,c=WJ(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),y=c.useState(`titleElementId`),b=c.useState(`transitionStatus`),x=c.useState(`role`),S=d.useState(`floatingId`);Qne(),dz({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let C=o===void 0?mz(c.context.popupRef):o,w=g>0,T=c.useStateSetter(`popupElement`),E=gL(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:w},props:[f,{id:S,"aria-labelledby":y,"aria-describedby":l,role:x,...Dz,hidden:!m,onKeyDown(e){KH.has(e.key)&&e.stopPropagation()},style:{[$J]:g}},s],ref:[t,c.context.popupRef,T],stateAttributesMapping:tY});return(0,iY.jsx)(sR,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:C,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:E})})})),oY,sY,cY,nre=s((()=>{oY=d(m(),1),WV(),IB(),qJ(),QJ(),bH(),sY=d(O(),1),cY=oY.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=WJ(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,sY.jsx)(ZJ.Provider,{value:n,children:(0,sY.jsxs)(zL,{ref:t,...r,children:[a&&o===!0&&(0,sY.jsx)(yH,{ref:i.context.internalBackdropRef,inert:UV(!s)}),e.children]})}):null})}));function rre({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`disablePointerDismissal`),a=e.useState(`modal`),o=e.useState(`popupElement`),s=e.useState(`floatingRootContext`),[c,l]=lY.useState(0),[u,d]=lY.useState(0),f=c===0,p=mR(s,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:a===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0)return!1;if(`touches`in t){if(t.type===`touchend`){if(t.changedTouches.length!==1||t.touches.length!==0)return!1}else if(t.touches.length!==1)return!1}let n=PN(t);if(f&&!i){if(a){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||NN(n,o)&&!n?.hasAttribute(`data-base-ui-portal`):!0}return!0}return!1},escapeKey:f});return DH(r&&a===!0,o),e.useContextCallback(`onNestedDialogOpen`,(e,t)=>{l(e),d(t)}),Q(()=>(t?.onNestedDialogOpen&&(r?t.onNestedDialogOpen(c+1,u+ +!!n):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,c,u,t]),wz(e,{activeTriggerProps:p.reference,inactiveTriggerProps:p.trigger,popupProps:p.floating,nestedOpenDialogCount:c,nestedOpenDrawerCount:u}),null}var lY,ire=s((()=>{lY=d(m(),1),oN(),NH(),IB(),XR(),Uz()}));function are(e,t,n,r=!1){return{...jz(t,n,r),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}function ore(e){return{popupRef:uY.createRef(),backdropRef:uY.createRef(),internalBackdropRef:uY.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}var uY,dY,fY,pY=s((()=>{uY=d(m(),1),YR(),Uz(),dY={...Lz,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role},fY=class extends KR{constructor(e,t,n){let r=new kz,i=are(e,r,t,n);super(i,ore(r),dY)}setOpen=(e,t)=>{t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),!t.isCanceled&&(this.state.floatingRootContext.dispatchOpenChange(e,t),this.update(yz(this.state,e,t.trigger)))}}}));function sre(e,t){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:s=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:d,defaultTriggerId:f=null}=t,p=e===`drawer`,m=e===`alert-dialog`,h=m?!0:c,g=m||s,_=m?`alertdialog`:`dialog`,v=WJ(!0),y={modal:h,disablePointerDismissal:g,nested:v!=null,role:_},b=hz((e,t)=>new fY({open:i,openProp:r,activeTriggerId:f,triggerIdProp:d,...y},e,t),!0);b.useControlledProp(`openProp`,r),b.useControlledProp(`triggerIdProp`,d),b.useSyncedValues(y),b.useContextCallback(`onOpenChange`,a),b.useContextCallback(`onOpenChangeComplete`,o);let x=b.useState(`open`),S=b.useState(`mounted`),C=b.useState(`payload`);Tz(b,x),Sz(b);let{forceUnmount:w}=Cz(x,b);mY.useImperativeHandle(l,()=>({unmount:w,close:()=>b.setOpen(!1,XP(qP))}),[w,b]);let T=x||S;return(0,hY.jsxs)(KJ.Provider,{value:b,children:[u&&(0,hY.jsx)(gz,{handle:u,store:b}),T&&(0,hY.jsx)(rre,{store:b,parentContext:v?.context,isDrawer:p}),typeof n==`function`?n({payload:C}):n]})}var mY,hY,cre=s((()=>{mY=d(m(),1),ire(),qJ(),pY(),ZP(),YP(),Uz(),hY=d(O(),1)})),gY,lre=s((()=>{KM(),cre(),gY=VM(function(e){return sre(`dialog`,e)})})),ure=s((()=>{Zne(),qJ(),TL(),iU(),ZP(),YP(),_V(),tre(),nre(),lre(),QJ(),nY(),RI(),KM(),mV(),fP(),jL(),Uz(),IB(),jV(),pY(),jR()})),dre=s((()=>{ure()}));function fre({className:e=``,onClose:t,closeDisabled:n=!1,beforeClose:r,children:i,initialFocus:a,finalFocus:o,ariaLabel:s,plain:c=!1,backdrop:l=!0,fullscreen:u=`mobile`,ref:d}){let f=(0,_Y.useContext)(UJ),[p,m]=(0,_Y.useState)(!0),h=(0,_Y.useRef)(!1),g=()=>h.current||n||r?.()===!1?!1:(h.current=!0,m(!1),t(),!0);(0,_Y.useImperativeHandle)(d,()=>({close:g}));let _=(0,_Y.useId)(),[v,y]=(0,_Y.useState)(),b=(0,_Y.useCallback)(e=>{if(s||!e)return;let t=e.querySelector(`h1, h2, h3`);t&&(t.id||=_,y(t.id))},[s,_]),x=e.split(/\s+/)[0],S=x?`modal-backdrop ${x}-backdrop`:`modal-backdrop`,C=u?` modal-fullscreen${u===`mobile`?`-mobile`:``}`:``;return(0,vY.jsx)(gY,{modal:!0,open:p,onOpenChange:(e,t)=>{e||g()||t.cancel()},children:(0,vY.jsxs)(cY,{container:yG(),children:[l?(0,vY.jsx)(YJ,{className:c?S.replace(`modal-backdrop `,``):S}):null,(0,vY.jsx)(aY,{"data-component":f,className:`${c?e:`modal ${e}`.trim()}${C}`,initialFocus:a,...o?{finalFocus:o}:{},ref:b,"aria-label":s,"aria-labelledby":s?void 0:v,"aria-modal":`true`,children:i})]})})}var _Y,vY,yY,bY=s((()=>{_Y=d(m(),1),Xne(),dre(),bG(),LG(),vY=d(O(),1),yY=AG(`Modal`,fre)}));function xY(e,t){let n=e.lastIndexOf(`.`),r=n>0?e.slice(n+1).toLowerCase():``,i=(t??``).toLowerCase();if(SY.test(r)||/^image\/(png|jpeg|gif|webp|avif|bmp)$/.test(i))return`image`;if(r===`pdf`||i===`application/pdf`)return`pdf`;if(CY.test(r)||i.startsWith(`video/`))return`video`;if(wY.test(r)||i.startsWith(`audio/`))return`audio`;if(TY.test(r)||i.startsWith(`text/`)||i===`application/json`)return`text`}var SY,CY,wY,TY,EY=s((()=>{SY=/^(png|jpe?g|gif|webp|avif|bmp)$/,CY=/^(mp4|m4v|mov|webm|ogv)$/,wY=/^(mp3|m4a|wav|ogg|oga|opus|flac)$/,TY=/^(txt|text|md|markdown|csv|tsv|json|log|xml|ya?ml|ini|toml|sql|ts|js|css|html?)$/})),DY,pre=s((()=>{Ya(),DY=Va({download:`Download`,isOverTheLimit:`“{name}” is over the {maxBytes} limit for a file.`,attached:`Attached “{attached}”`,attachedFiles:{one:`Attached {count} file`,other:`Attached {count} files`},attaching:`Attaching…`,orDropFilesHere:`or drop files here`,preview:`Preview {name}`,downloadName:`Download {name}`,more:`More for {name}`,detailsItem:`Details`,removeMore:`Remove…`,aFileNeedsAName:`A file needs a name.`,fileName:`File name`,removeName:`Remove {name}?`,removeQuotedNameQuestion:`Remove “{name}”?`,theFileIsDeleted:`The file is deleted for everyone who can see this record, and Undo cannot bring it back.`,keep:`Keep`,removing:`Removing…`})})),mre=s((()=>{})),OY,hre=s((()=>{Ya(),OY=Va({thisFileIsNoLonger:`This file is no longer here.`,thisFileCouldNotBeRead:`This file could not be read.`,thisFileIsNamed:`This file is named as a PDF, but it is not one.`,thisFileIsNotText:`This file is not text, so it can only be downloaded.`,thisFileIsNotPlayable:`This file is not a recording this browser can play, so it can only be downloaded.`,tooLargeToPlay:`Recordings over {size} are not played here. Download the file to play it.`,tooLargeToShow:`PDFs over {size} are not shown here. Download the file to open it.`,opening:`Opening {name}…`,showingTheFirstDownload:`Showing the first {size}. Download the file for the rest.`,previewOf:`Preview of {name}`,download:`Download`})})),kY=l({FilePreview:()=>vre,mediaType:()=>AY});function AY(e,t){if(!(e.length<12)){if(IY(e,4,4)===`ftyp`)return t===`video`?`video/mp4`:`audio/mp4`;if(e[0]===26&&e[1]===69&&e[2]===223&&e[3]===163)return`${t}/webm`;if(IY(e,0,4)===`OggS`)return`${t}/ogg`;if(t===`audio`){if(IY(e,0,4)===`RIFF`&&IY(e,8,4)===`WAVE`)return`audio/wav`;if(IY(e,0,4)===`fLaC`)return`audio/flac`;if(IY(e,0,3)===`ID3`||e[0]===255&&(e[1]&224)==224)return`audio/mpeg`}}}async function gre(e,t,n,r){if(!e.body){let r=new Uint8Array(await e.arrayBuffer());return r.length>t?{bytes:n?r.subarray(0,t):new Uint8Array,over:!0}:{bytes:r,over:!1}}let i=e.body.getReader(),a=()=>void i.cancel().catch(()=>void 0);r.addEventListener(`abort`,a,{once:!0});let o=[],s=0,c=!1;try{for(;;){let{done:e,value:r}=await i.read();if(e)break;let a=t-s;if(r.length>a){c=!0,n&&a>0&&o.push(r.subarray(0,a));break}o.push(r),s+=r.length}}finally{r.removeEventListener(`abort`,a),c?await i.cancel().catch(()=>void 0):i.releaseLock()}if(c&&!n)return{bytes:new Uint8Array,over:c};let l=new Uint8Array(o.reduce((e,t)=>e+t.length,0)),u=0;for(let e of o)l.set(e,u),u+=e.length;return{bytes:l,over:c}}async function _re(e,t){let n=await fetch(e.href,{credentials:`same-origin`,signal:t});if(!n.ok)return{state:`failed`,why:n.status===404?OY(`thisFileIsNoLonger`):OY(`thisFileCouldNotBeRead`)};let r=e.kind===`video`||e.kind===`audio`||e.kind===`pdf`,i=()=>({state:`refused`,why:OY(e.kind===`pdf`?`tooLargeToShow`:`tooLargeToPlay`,{size:Yi(NY)})});if(r&&Number(n.headers.get(`content-length`))>NY)return n.body?.cancel().catch(()=>void 0),i();let{bytes:a,over:o}=await gre(n,r?NY:PY,!r,t);if(r&&o)return i();if(e.kind===`video`||e.kind===`audio`){let t=AY(a,e.kind);return t?{state:`media`,url:URL.createObjectURL(new Blob([a],{type:t}))}:{state:`refused`,why:OY(`thisFileIsNotPlayable`)}}return e.kind===`pdf`?FY(a)?{state:`pdf`,url:URL.createObjectURL(new Blob([a],{type:`application/pdf`}))}:{state:`refused`,why:OY(`thisFileIsNamed`)}:a.includes(0)?{state:`refused`,why:OY(`thisFileIsNotText`)}:{state:`text`,text:new TextDecoder(`utf-8`).decode(a),cut:o}}function vre({file:e,onClose:t,finalFocus:n}){let r=(0,jY.useRef)(null),i=(0,jY.useRef)(null),[a,o]=(0,jY.useState)({state:`loading`}),[s,c]=(0,jY.useState)(0);(0,jY.useEffect)(()=>{if(e.kind===`image`)return;let t=new AbortController,n;return o({state:`loading`}),_re(e,t.signal).then(e=>{(e.state===`pdf`||e.state===`media`)&&(n=e.url),t.signal.aborted?n&&URL.revokeObjectURL(n):o(e)},e=>{t.signal.aborted||o({state:`failed`,why:e.message||OY(`thisFileCouldNotBeRead`)})}),()=>{t.abort(),n&&URL.revokeObjectURL(n)}},[e.href,e.kind,s]);let l=e.kind===`image`?(0,MY.jsx)(`figure`,{className:`lightbox-figure`,children:(0,MY.jsx)(`img`,{className:`lightbox-image`,src:e.inline??e.href,alt:e.name,draggable:!1})}):a.state===`loading`?(0,MY.jsx)(`p`,{className:`file-preview-note`,role:`status`,children:OY(`opening`,{name:e.name})}):a.state===`pdf`?(0,MY.jsx)(`iframe`,{className:`file-preview-frame`,src:a.url,title:e.name}):a.state===`media`?e.kind===`video`?(0,MY.jsx)(`video`,{className:`file-preview-media`,src:a.url,controls:!0,"aria-label":e.name}):(0,MY.jsx)(`audio`,{className:`file-preview-media is-audio`,src:a.url,controls:!0,"aria-label":e.name}):a.state===`text`?(0,MY.jsxs)(`div`,{className:`file-preview-text`,children:[(0,MY.jsx)(`pre`,{tabIndex:0,"aria-label":e.name,children:a.text}),a.cut&&(0,MY.jsx)(`p`,{className:`file-preview-note`,children:OY(`showingTheFirstDownload`,{size:Yi(PY)})})]}):(0,MY.jsx)(`div`,{className:`file-preview-message`,children:a.state===`refused`?(0,MY.jsx)(MJ,{text:a.why}):(0,MY.jsx)(jJ,{text:a.why,retry:()=>c(e=>e+1)})});return(0,MY.jsx)(yY,{className:`lightbox file-preview`,plain:!0,ref:r,ariaLabel:OY(`previewOf`,{name:e.name}),initialFocus:i,onClose:t,...n?{finalFocus:n}:{},children:(0,MY.jsxs)(`div`,{className:`lightbox-body`,children:[(0,MY.jsxs)(`div`,{className:`lightbox-bar`,children:[(0,MY.jsx)(`span`,{className:`file-preview-name`,children:e.name}),(0,MY.jsxs)(`span`,{className:`file-preview-actions`,children:[(0,MY.jsx)(`a`,{className:`lightbox-close file-preview-download`,href:e.href,download:e.name,children:OY(`download`)}),(0,MY.jsx)(`button`,{type:`button`,ref:i,className:`lightbox-close`,onClick:()=>r.current?.close(),children:OY(`common.close`)})]})]}),(0,MY.jsx)(`div`,{className:`lightbox-stage file-preview-stage is-${e.kind}`,children:l})]})})}var jY,MY,NY,PY,FY,IY,LY=s((()=>{jY=d(m()),mre(),bY(),LJ(),xa(),hre(),MY=d(O()),NY=67108864,PY=262144,FY=e=>e.length>=5&&String.fromCharCode(...e.subarray(0,5))===`%PDF-`,IY=(e,t,n)=>String.fromCharCode(...e.subarray(t,t+n))})),yre=l({AttachmentList:()=>xre,fileToBase64:()=>bre});async function bre(e){let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));return btoa(n)}function xre({items:e,emptyText:t,empty:n,upload:r}){let[i,a]=(0,RY.useState)(!1),[o,s]=(0,RY.useState)(!1),[c,l]=(0,RY.useState)(),u=(0,RY.useRef)(null),[d,f]=(0,RY.useState)(),[p,m]=(0,RY.useState)(),[h,g]=(0,RY.useState)(),_=(0,RY.useRef)(null),v=async e=>{if(!r||o||!e.length)return;s(!0),l(void 0);let t=[],n=[];for(let i of e){if(i.size>r.maxBytes){n.push(DY(`isOverTheLimit`,{name:i.name,maxBytes:Yi(r.maxBytes)}));continue}let e=await r.send(i);e?n.push(e):t.push(i.name)}s(!1),n.length?l({text:n.join(` `),error:!0}):l({text:t.length===1?DY(`attached`,{attached:t[0]}):DY(`attachedFiles`,{count:t.length}),error:!1})},y=e=>e.includes(`Files`),b=e=>{if(e.save)return;let t=xY(e.name,e.type);return t?{name:e.name,kind:t,href:e.href,...e.inline?{inline:e.inline}:{}}:void 0};return(0,zY.jsxs)(`div`,{className:`attachments${i?` is-over`:``}`,onDragOver:r?e=>{y([...e.dataTransfer.types])&&(e.preventDefault(),a(!0))}:void 0,onDragLeave:r?e=>{e.currentTarget.contains(e.relatedTarget)||a(!1)}:void 0,onDrop:r?e=>{e.preventDefault(),a(!1),v([...e.dataTransfer.files])}:void 0,children:[r&&(0,zY.jsxs)(`div`,{className:`attachments-add`,children:[(0,zY.jsx)(UG,{intent:`secondary`,size:`compact`,busy:o,busyLabel:DY(`attaching`),onClick:()=>u.current?.click(),children:`+ ${r.label}`}),(0,zY.jsx)(`input`,{ref:u,type:`file`,multiple:!0,hidden:!0,"aria-label":r.label,onChange:e=>{let t=[...e.target.files??[]];e.target.value=``,v(t)}}),(0,zY.jsx)(`span`,{className:`attachments-hint`,children:DY(`orDropFilesHere`)}),c&&(0,zY.jsx)(`span`,{role:c.error?`alert`:`status`,className:c.error?`attachments-error`:`attachments-said`,children:c.text})]}),e.length?(0,zY.jsx)(`ul`,{className:`attachments-list`,children:e.map(e=>{let t=b(e);return(0,zY.jsxs)(`li`,{className:`attachments-item`,children:[(0,zY.jsx)(`span`,{className:`attachments-badge`,"aria-hidden":`true`,children:HY(e.name)}),p===e.id&&e.rename?(0,zY.jsx)(Sre,{item:e,onDone:()=>m(void 0)}):(0,zY.jsxs)(zY.Fragment,{children:[(0,zY.jsxs)(`span`,{className:`attachments-text`,children:[t?(0,zY.jsx)(`button`,{type:`button`,className:`attachments-name`,title:DY(`preview`,{name:e.name}),onClick:e=>{_.current=e.currentTarget,f(t)},children:e.name}):(0,zY.jsx)(`a`,{className:`attachments-name`,href:e.href,download:e.name,onClick:VY(e),children:e.name}),e.meta.length>0&&(0,zY.jsx)(`span`,{className:`attachments-meta`,children:e.meta.join(` · `)})]}),(0,zY.jsxs)(`span`,{className:`attachments-actions`,children:[(0,zY.jsx)(WG,{intent:`quiet`,size:`compact`,className:`attachments-download`,href:e.href,download:e.name,onClick:VY(e),"aria-label":DY(`downloadName`,{name:e.name}),children:DY(`download`)}),(e.onOpen||e.rename||e.remove)&&(0,zY.jsxs)(QG,{className:`row-actions-menu`,triggerClassName:`ghost row-actions-trigger`,triggerTitle:DY(`more`,{name:e.name}),triggerLabel:DY(`more`,{name:e.name}),label:`⋯`,popupClassName:`page-actions-popup`,align:`end`,children:[e.onOpen&&(0,zY.jsx)($G,{className:`page-actions-item`,onClick:e.onOpen,children:DY(`detailsItem`)}),e.rename&&(0,zY.jsx)($G,{className:`page-actions-item`,onClick:()=>m(e.id),children:DY(`common.rename`)}),e.remove&&(0,zY.jsx)($G,{className:`page-actions-item is-danger`,onClick:()=>g(e),children:DY(`removeMore`)})]})]})]})]},e.id)})}):n??(0,zY.jsx)(MJ,{className:`attachments-empty`,text:t}),d&&(0,zY.jsx)(BY,{file:d,onClose:()=>f(void 0),finalFocus:_}),h&&(0,zY.jsx)(Cre,{item:h,onClose:()=>g(void 0)})]})}function Sre({item:e,onDone:t}){let[n,r]=(0,RY.useState)(e.name),[i,a]=(0,RY.useState)(!1),[o,s]=(0,RY.useState)(``),c=async()=>{let r=n.trim();if(!r){s(DY(`aFileNeedsAName`));return}if(r===e.name){t();return}a(!0);let i=await e.rename(r);a(!1),i?s(i):t()};return(0,zY.jsxs)(`form`,{className:`attachments-rename`,onSubmit:e=>{e.preventDefault(),c()},onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),t())},children:[(0,zY.jsx)(RJ,{label:DY(`fileName`),size:`compact`,problem:o,children:(0,zY.jsx)(`input`,{type:`text`,value:n,autoFocus:!0,onChange:e=>{r(e.target.value),s(``)}})}),(0,zY.jsxs)(`span`,{className:`attachments-rename-actions`,children:[(0,zY.jsx)(UG,{intent:`primary`,size:`compact`,type:`submit`,busy:i,busyLabel:DY(`common.saving`),children:DY(`common.save`)}),(0,zY.jsx)(UG,{intent:`secondary`,size:`compact`,onClick:t,children:DY(`common.cancel`)})]})]})}function Cre({item:e,onClose:t}){let n=(0,RY.useRef)(null),r=(0,RY.useRef)(null),[i,a]=(0,RY.useState)(!1),[o,s]=(0,RY.useState)(``),c=async()=>{a(!0);let t=await e.remove();a(!1),t?s(t):n.current?.close()};return(0,zY.jsxs)(yY,{className:`confirm attachments-confirm`,ref:n,fullscreen:!1,initialFocus:r,closeDisabled:i,ariaLabel:DY(`removeName`,{name:e.name}),onClose:t,children:[(0,zY.jsx)(`h2`,{children:DY(`removeQuotedNameQuestion`,{name:e.name})}),(0,zY.jsx)(`p`,{children:DY(`theFileIsDeleted`)}),o&&(0,zY.jsx)(`p`,{className:`attachments-error`,role:`alert`,children:o}),(0,zY.jsxs)(`div`,{className:`confirm-actions`,children:[(0,zY.jsx)(UG,{ref:r,intent:`secondary`,disabled:i,onClick:()=>n.current?.close(),children:DY(`keep`)}),(0,zY.jsx)(UG,{intent:`danger`,busy:i,busyLabel:DY(`removing`),onClick:()=>void c(),children:DY(`common.remove`)})]})]})}var RY,zY,BY,VY,HY,wre=s((()=>{RY=d(m()),xa(),tc(),LJ(),GG(),VJ(),bY(),eK(),EY(),wc(),pre(),zY=d(O()),BY=vc(()=>Promise.resolve().then(()=>(LY(),kY)),`FilePreview`,{quiet:!0}),VY=e=>e.save?t=>{t.preventDefault(),e.save().catch(e=>Ws(e.message,`error`))}:void 0,HY=e=>{let t=e.lastIndexOf(`.`);return(t>0?e.slice(t+1).slice(0,4).toUpperCase():``)||`FILE`}}));function Tre(e){return(0,UY.jsx)(`div`,{className:`rich-field`,children:(0,UY.jsx)(WY,{...e})})}function Ere(e,t){return async n=>{let r=n.trim(),{mentionRows:i}=await Promise.resolve().then(()=>(TK(),yK)),[a,o]=await Promise.all([i(e,r,t),e.groups?i(e.groups,r,t,`group`).catch(()=>[]):Promise.resolve([])]);return o.length?[...a.slice(0,8-Math.min(o.length,3)),...o].slice(0,8):a}}function Dre(e,t,n){if(!e||!t||!Ys(e))return;let r=Xs(e).find(e=>e.to.table===t.table&&e.from.columns.length===1&&Object.hasOwn(t.key,e.to.columns[0]));if(!r)return;let i={[r.from.columns[0]]:t.key[r.to.columns[0]]};return async t=>{let{fileToBase64:r}=await Promise.resolve().then(()=>(wre(),yre)),a=await Ns(`/api/file/upload`,{table:e,values:i,...ao(n??null),file:{name:t.name||`picture`,type:t.type,data:await r(t)}});if(a.errors?.length)throw Error(a.errors[0].message);if(typeof a.error==`string`)throw Error(a.error);if(!a.key)throw Error(Tc(`pictureUnread`));return kr(e,a.key)}}var UY,WY,Ore=s((()=>{tc(),uo(),zr(),wc(),Ec(),UY=d(O(),1),WY=vc(()=>Promise.resolve().then(()=>(pK(),iK)),`RichTextEditor`,{quiet:!0})}));function GY(e){let t=KY.useRef(!0);t.current&&(t.current=!1,e())}var KY,qY=s((()=>{KY=d(m(),1)}));function JY(){let e=ZY.useContext(QY);if(e===void 0)throw Error(LI(60));return e}function YY(){let e=ZY.useContext($Y);if(e===void 0)throw Error(LI(101));return e}function XY(){let e=ZY.useContext(eX);if(e===void 0)throw Error(LI(61));return e}var ZY,QY,$Y,eX,tX=s((()=>{RI(),ZY=d(m(),1),QY=ZY.createContext(void 0),$Y=ZY.createContext(void 0),eX=ZY.createContext(void 0)})),nX=s((()=>{XM()})),rX,iX,kre=s((()=>{rX=`data-valid`,iX=`data-invalid`})),aX,oX,sX,cX,lX=s((()=>{kre(),aX={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},oX={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},sX={disabled:!1,...oX},cX={valid(e){return e===null?null:e?{[rX]:``}:{[iX]:``}}}}));function uX(e=!0){let t=dX.useContext(pX);if(t.setValidityData===qM&&!e)throw Error(LI(28));return t}var dX,fX,pX,mX=s((()=>{RI(),dX=d(m(),1),XM(),nX(),lX(),fX={invalid:void 0,name:void 0,validityData:{state:aX,errors:[],error:``,value:``,initialValue:null},setValidityData:qM,disabled:void 0,setTouched:qM,setDirty:qM,setFilled:qM,setFocused:qM,validationMode:`onSubmit`,shouldValidateOnChange:()=>!1,state:sX,registerFieldControl:qM,validation:{getValidationProps:(e,t=YM)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:qM,getInputControl:()=>null,commit:async()=>{},change:qM}},pX=dX.createContext(fX)}));function hX(e,t,n,r,i=!0,a){let{registerFieldControl:o}=uX(),s=LM(()=>Symbol());Q(()=>{let c=s.current;i?o(c,{controlRef:e,getValue:r,id:t,name:a,value:n}):o(c,void 0)},[e,i,r,t,a,o,s,n]),Q(()=>{let e=s.current;return()=>{o(e,void 0)}},[o,s])}var gX=s((()=>{oN(),BM(),mX()}));function _X(){return vX.useContext(yX)}var vX,yX,bX=s((()=>{vX=d(m(),1),nX(),yX=vX.createContext({controlId:void 0,registerControlId:qM,resetControlId:qM,labelId:void 0,setLabelId:qM,messageIds:[],setMessageIds:qM,getDescriptionProps:e=>e})}));function xX(e={}){let{id:t,enabled:n=!0}=e,{controlId:r,registerControlId:i,resetControlId:a}=_X(),o=gV(),s=LM(()=>Symbol()),c=SX.useRef(!1),l=SX.useRef(!1),u=$(()=>{c.current&&i!==qM&&(c.current=!1,i(s.current,void 0))});return Q(()=>{if(!n||i===qM){u();return}let e;if(t!==void 0)l.current=!0,e=t;else if(l.current)e=o;else{a();return}e===void 0?u():(c.current=!0,i(s.current,e))},[t,n,i,a,o,s,u]),Q(()=>u,[u]),(n?r:void 0)??t??o}var SX,CX=s((()=>{SX=d(m(),1),oN(),yF(),BM(),nX(),_V(),bX()}));function Are(e,t,n=Object.is){let{length:r}=e;if(r!==t.length)return!1;for(let i=0;i<r;i+=1)if(!n(e[i],t[i]))return!1;return!0}var jre=s((()=>{}));function wX(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function TX(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!Are(e,t,(e,t)=>wX(e,t,n)):e!==t}function EX(e,t,n){return e?e.some(e=>e!==void 0&&wX(t,e,n)):!1}function DX(e,t,n){return e?e.findIndex(e=>e!==void 0&&wX(e,t,n)):-1}function Mre(e,t){if(t!==jX)return n=>EX(e,n,t);let n=new Set(e);return n.delete(void 0),t=>n.has(t)&&(t!==0||e.some(e=>Object.is(t,e)))}function OX(e,t,n,r){let i=r&&Array.isArray(t)?e.findIndex(Mre(t,n)):DX(e,t,n);return i===-1?null:i}function kX(e,t,n,r,i,a){return EX(r,t,i)?a!=null&&e>a&&EX(r,n[a],i)?a:e:e===a?OX(n,r,i,!0):a}function AX(e,t,n){return e.filter(e=>!wX(t,e,n))}var jX,MX=s((()=>{jre(),jX=(e,t)=>Object.is(e,t)}));function NX(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}var PX=s((()=>{}));function FX(e){return typeof e==`object`&&!!e&&Array.isArray(e.items)}function IX(e){return FX(e?.[0])}function LX(e){return IX(e)?e.flatMap(e=>e.items):e}function RX(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(IX(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function zX(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return NX(e)}function BX(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?NX(e.value):NX(e)}var VX=s((()=>{m(),PX(),O()})),HX,UX=s((()=>{MX(),VX(),HX={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:BX(t,r)!==``},hasNullItemLabel:(e,t)=>t?RX(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(e=>wX(t,e,n)):wX(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows}}));function WX(){return GX.useContext(KX)}var GX,KX,qX=s((()=>{GX=d(m(),1),nX(),KX=GX.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:qM,validationMode:`onSubmit`,submitCountRef:{current:0}})}));function JX(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}var YX=s((()=>{}));function XX(e,t){return Math.max(0,e-t)}function ZX(e,t){if(t<=0)return 0;let n=JX(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}var QX=s((()=>{YX()}));function $X(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,form:l,autoComplete:u,disabled:d=!1,readOnly:f=!1,required:p=!1,modal:m=!0,actionsRef:h,inputRef:g,onOpenChangeComplete:_,items:v,multiple:y=!1,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S=jX,highlightItemOnHover:C=!0,children:w}=e,{clearErrors:T}=WX(),{setDirty:E,setTouched:D,setFocused:O,validityData:k,setFilled:A,name:j,disabled:M,validation:N,validationMode:P}=uX(),F=xX({id:t}),I=M||d,L=j??c,[R,z]=CU({controlled:n,default:y?r??JM:r,name:`Select`,state:`value`}),[B,V]=CU({controlled:a,default:o,name:`Select`,state:`open`}),H=eZ.useRef([]),U=eZ.useRef([]),W=eZ.useRef(null),G=eZ.useRef(null),ee=eZ.useRef(0),te=eZ.useRef(null),ne=eZ.useRef([]),K=eZ.useRef(!1),re=eZ.useRef(null),q=eZ.useRef(null),ie=eZ.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),ae=eZ.useRef(!1),oe=eZ.useRef(R),{mounted:se,setMounted:ce,transitionStatus:le}=rz(B),{openMethod:ue,triggerProps:de}=kV(B),fe=LM(()=>new KR({id:F,labelId:void 0,modal:m,multiple:y,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S,value:R,open:B,mounted:se,transitionStatus:le,items:v,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:YM,triggerProps:YM,triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:qM,setOpen:qM,handleScrollArrowVisibility:qM,onOpenChangeComplete:qM,listRef:H,popupRef:W,scrollHandlerRef:G,scrollArrowsMountedCountRef:ee,valueRef:te,valuesRef:ne,labelsRef:U,typingRef:K,selectionRef:ie,firstItemTextRef:re,selectedItemTextRef:q,alignItemWithTriggerActiveRef:ae,initialValueRef:oe},HX)).current,pe=fe.useState(`activeIndex`),me=fe.useState(`selectedIndex`),J=fe.useState(`triggerElement`),he=fe.useState(`positionerElement`),ge=zne(ue),_e=ue??ge,ve=eZ.useMemo(()=>y?``:BX(R,x),[y,R,x]),ye=eZ.useMemo(()=>y&&Array.isArray(R)?R.map(e=>BX(e,x)):BX(R,x),[y,R,x]);hX(lF(J),F,R,$(()=>ye),!I,c);let be=y?Array.isArray(R)&&R.length>0:R!=null&&ve!==``;Q(()=>{A(be)},[be,A]),Q(function(){let e=OX(ne.current,R,S,y);e===null&&(q.current=null),!B&&fe.set(`selectedIndex`,e)},[y,B,R,S,fe]),TV(R,()=>{T(L),E(TX(R,k.initialValue,S)),N.change(R)});let xe=$((e,t)=>{s?.(e,t),!t.isCanceled&&(V(e),e||t.reason!==`focus-out`&&t.reason!==`outside-press`||(D(!0),O(!1),P===`onBlur`&&N.commit(R)))}),Se=$(()=>{ce(!1),fe.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),_?.(!1)});dz({enabled:!h,open:B,ref:W,onComplete(){B||Se()}}),eZ.useImperativeHandle(h,()=>({unmount:Se}),[Se]);let Ce=$((e,t)=>{i?.(e,t),!t.isCanceled&&z(e)}),we=$(e=>{let t=XX(e.scrollHeight,e.clientHeight),n=ZX(e.scrollTop,t),r=n>0,i=n<t;fe.set(`scrollUpArrowVisible`,r),fe.set(`scrollDownArrowVisible`,i)}),Te=Wz({open:B,onOpenChange:xe,elements:{reference:J,floating:he}}),Ee=fR(Te,{enabled:!I,event:`mousedown`}),De=mR(Te),Oe=bB(Te,{enabled:!I,listRef:H,activeIndex:pe,selectedIndex:me,disabledIndices:JM,onNavigate(e){(e!==null||B)&&fe.set(`activeIndex`,e)},focusItemOnHover:C}),ke=wB(Te,{enabled:!I&&(B||!f&&!y),listRef:U,activeIndex:pe,selectedIndex:me,disabledIndices:e=>mG(H.current[e]),onMatch(e){B?fe.set(`activeIndex`,e):Ce(ne.current[e],XP(AP))},onTyping(e){K.current=e}}),Ae=eZ.useMemo(()=>$I(ke.reference,Oe.reference,De.reference,Ee.reference,de),[Ee.reference,ke.reference,Oe.reference,De.reference,de]),je=eZ.useMemo(()=>$I(Dz,ke.floating,Oe.floating,De.floating),[ke.floating,Oe.floating,De.floating]),Me=Oe.item??YM;fe.useContextCallback(`setValue`,Ce),fe.useContextCallback(`setOpen`,xe),fe.useContextCallback(`handleScrollArrowVisibility`,we),fe.useContextCallback(`onOpenChangeComplete`,_),GY(()=>{fe.update({popupProps:je,triggerProps:Ae})}),fe.useSyncedValues({id:F,modal:m,multiple:y,value:R,open:B,mounted:se,transitionStatus:le,popupProps:je,triggerProps:Ae,items:v,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S,openMethod:_e});let Ne=eZ.useMemo(()=>({disabled:I,readOnly:f,required:p,multiple:y,highlightItemOnHover:C,itemProps:Me}),[I,f,p,y,C,Me]),Pe=nF(g,N.inputRef),Fe=y?void 0:L,Ie=eZ.useMemo(()=>!y||!Array.isArray(R)||!L?null:R.map(e=>{let t=BX(e,x);return(0,tZ.jsx)(`input`,{type:`hidden`,form:l,name:L,value:t,disabled:I},t)}),[y,R,l,L,x,I]);return(0,tZ.jsxs)(QY.Provider,{value:fe,children:[(0,tZ.jsx)($Y.Provider,{value:Ne,children:(0,tZ.jsx)(eX.Provider,{value:Te,children:w})}),(0,tZ.jsx)(`input`,{...N.getValidationProps(I,{onFocus(){fe.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented||I||f)return;let t=e.currentTarget.value,n=XP(AP,e.nativeEvent);function r(){if(y)return;let e=t.toLowerCase(),r=ne.current.findIndex(t=>BX(t,x).toLowerCase()===e||zX(t,b).toLowerCase()===e);r===-1&&(r=ne.current.findIndex((t,n)=>{let r=U.current[n];return r!=null&&r.toLowerCase()===e}));let i=ne.current[r];i!=null&&Ce(i,n)}fe.set(`forceMount`,!0),queueMicrotask(r)}}),id:F&&Fe==null?`${F}-hidden-input`:void 0,form:l,name:Fe,autoComplete:u,value:ve,disabled:I,required:p&&!(y&&be),readOnly:f,ref:Pe,style:L?AF:kF,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Ie]})}var eZ,tZ,nZ=s((()=>{eZ=d(m(),1),jF(),cF(),BM(),qY(),oU(),hG(),TU(),oN(),yF(),dF(),YR(),XM(),IB(),tX(),mX(),gX(),CX(),az(),UX(),ZP(),YP(),pz(),qX(),VX(),MX(),DV(),jV(),QX(),Uz(),hL(),nX(),tZ=d(O(),1)}));function rZ(e,t){return e??t}var iZ=s((()=>{})),aZ,oZ=s((()=>{fP(),aZ=`data-popup-side`})),sZ,cZ,lZ,uZ,dZ=s((()=>{sZ=d(m(),1),DF(),rN(),dF(),tX(),mX(),bX(),fP(),lX(),TL(),JW(),XR(),hL(),iU(),ZP(),YP(),CX(),iZ(),oZ(),cZ=400,lZ={...lP,...cX,popupSide:e=>e?{[aZ]:e}:null,value:()=>null},uZ=sZ.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{setTouched:l,setFocused:u,validationMode:d,validation:f,state:p,disabled:m}=uX(),{labelId:h}=_X(),g=JY(),{readOnly:_,required:v,disabled:y}=YY(),b=m||y||a,x=g.useState(`open`),S=g.useState(`mounted`),C=g.useState(`value`),w=g.useState(`triggerProps`),T=g.useState(`positionerElement`),E=g.useState(`listElement`),D=g.useState(`popupSide`),O=g.useState(`id`),k=g.useState(`labelId`),A=g.useState(`hasSelectedValue`),j=S&&T?D:null,M=i??O,N=rZ(h,k);xX({id:i});let P=lF(T),F=sZ.useRef(null),{getButtonProps:I,buttonRef:L}=uV({disabled:b,native:o}),R=g.useStateSetter(`triggerElement`),z=eN(),B=eN(),V=eN();sZ.useEffect(()=>{if(x)return V.start(cZ,()=>{g.context.selectionRef.current.allowUnselectedMouseUp=!0,g.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{V.clear()};g.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},B.clear()},[x,g,B,V]);let H=$I(w,{id:M,role:`combobox`,"aria-expanded":x,"aria-haspopup":`listbox`,"aria-controls":x?E?.id??SP(T)?.id:void 0,"aria-labelledby":N,"aria-readonly":_||void 0,"aria-required":v||void 0,tabIndex:b?-1:0,onFocus(e){u(!0),x&&g.context.alignItemWithTriggerActiveRef.current&&g.context.setOpen(!1,XP(AP,e.nativeEvent)),z.start(0,()=>{g.set(`forceMount`,!0)})},onBlur(e){NN(T,e.relatedTarget)||(l(!0),u(!1),d===`onBlur`&&f.commit(C))},onMouseDown(e){if(x)return;let t=EF(e.currentTarget);function n(e){if(!F.current)return;let t=e.target;NN(F.current,t)||NN(P.current,t)||GW(e,F.current)||g.context.setOpen(!1,XP(GP,e))}B.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},c,I),U=f.getValidationProps(b,H);U.role=`combobox`;let W={...p,open:x,disabled:b,value:C,readOnly:_,popupSide:j,placeholder:!A};return gL(`button`,e,{ref:[t,F,L,R],state:W,stateAttributesMapping:lZ,props:U})})})),fZ,pZ,mZ,hZ=s((()=>{fZ=d(m(),1),IB(),tX(),pZ=d(O(),1),mZ=fZ.forwardRef(function(e,t){let n=JY(),r=n.useState(`mounted`),i=n.useState(`forceMount`);return r||i?(0,pZ.jsx)(zL,{ref:t,...e}):null})}));function gZ(){let e=_Z.useContext(vZ);if(!e)throw Error(LI(59));return e}var _Z,vZ,yZ=s((()=>{RI(),_Z=d(m(),1),vZ=_Z.createContext(void 0)}));function bZ(e,t){e&&Object.assign(e.style,t)}var xZ,SZ=s((()=>{xZ={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`}})),CZ,wZ,TZ,EZ,DZ=s((()=>{CZ=d(m(),1),WV(),oN(),yF(),tX(),xW(),gH(),yZ(),bH(),jL(),SZ(),ZP(),YP(),MX(),wH(),LH(),wZ=d(O(),1),TZ={position:`fixed`},EZ=CZ.forwardRef(function(e,t){let{anchor:n,className:r,render:i,positionMethod:a,side:o,align:s,sideOffset:c,alignOffset:l,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f,sticky:p,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:g=OL,style:_,...v}=e,y=JY(),b=XY(),x=y.useState(`open`),S=y.useState(`mounted`),C=y.useState(`modal`),w=y.useState(`value`),T=y.useState(`openMethod`),E=y.useState(`positionerElement`),D=y.useState(`triggerElement`),O=y.useState(`isItemEqualToValue`),k=y.useState(`transitionStatus`),A=CZ.useRef(null),j=CZ.useRef(null),[M,N]=CZ.useState(h),P=S&&M&&T!==`touch`;!S&&M!==h&&N(h),CZ.useImperativeHandle(y.context.alignItemWithTriggerActiveRef,()=>P),PH((P||C)&&x,T===`touch`,E,D);let F=dH({anchor:n,floatingRootContext:b,positionMethod:a,mounted:S,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??P,collisionAvoidance:g,keepMounted:!0}),I=P?`none`:F.side,L=P?TZ:F.positionerStyles,R={open:x,side:I,align:F.align,anchorHidden:F.anchorHidden};Q(()=>{y.set(`popupSide`,F.side)},[y,F.side]);let z=CH(e,R,{styles:L,transitionStatus:k,props:v,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!S,inert:!x}),B=CZ.useRef(0),V=$(e=>{if(y.context.valuesRef.current.length===0)return;let t=B.current;B.current=e.size;let n=XP(AP);if(t!==0&&!y.state.multiple&&w!==null&&DX(y.context.valuesRef.current,w,O)===-1){let e=y.context.initialValueRef.current,t=e!=null&&DX(y.context.valuesRef.current,e,O)!==-1?e:null;y.context.setValue(t,n),t===null&&(y.set(`selectedIndex`,null),y.context.selectedItemTextRef.current=null)}if(t!==0&&y.state.multiple&&Array.isArray(w)){let e=w.filter(e=>DX(y.context.valuesRef.current,e,O)!==-1);e.length!==w.length&&(y.context.setValue(e,n),e.length===0&&(y.set(`selectedIndex`,null),y.context.selectedItemTextRef.current=null))}if(x&&P){y.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};bZ(E,e),bZ(y.context.popupRef.current,e)}}),H=CZ.useMemo(()=>({...F,side:I,alignItemWithTriggerActive:P,setControlledAlignItemWithTrigger:N,scrollUpArrowRef:A,scrollDownArrowRef:j}),[F,I,P,N]);return(0,wZ.jsx)(fW,{elementsRef:y.context.listRef,labelsRef:y.context.labelsRef,onMapChange:V,children:(0,wZ.jsxs)(vZ.Provider,{value:H,children:[S&&C&&(0,wZ.jsx)(yH,{inert:UV(!x),cutout:D}),z]})})})})),OZ,kZ,AZ,jZ=s((()=>{OZ=d(O(),1),kZ=`base-ui-disable-scrollbar`,AZ={className:kZ,getElement(e){return(0,OZ.jsx)(`style`,{nonce:e,href:kZ,precedence:`base-ui:low`,children:`.${kZ}{scrollbar-width:none}.${kZ}::-webkit-scrollbar{display:none}`})}}}));function MZ(){return NZ.useContext(PZ)??FZ}var NZ,PZ,FZ,IZ=s((()=>{NZ=d(m(),1),PZ=NZ.createContext(void 0),FZ={disableStyleElements:!1}})),LZ,RZ=s((()=>{LZ=`--transform-origin`}));function zZ(e){let t=e.maxHeight;return t.endsWith(`px`)&&parseFloat(t)||1/0}function BZ(e){return XX(e.scrollHeight,e.clientHeight)}function VZ(e){return aM.getScale(e)}function HZ(e,t,n){return e/n[t]}function UZ(e,t){return FA({x:HZ(e.x,`x`,t),y:HZ(e.y,`y`,t),width:HZ(e.width,`x`,t),height:HZ(e.height,`y`,t)})}function WZ(e){let{style:t}=e,n={};for(let[e,r]of YZ)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of YZ){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var GZ,KZ,qZ,JZ,YZ,XZ=s((()=>{GZ=d(m(),1),KA(),$P(),TN(),yF(),DF(),oN(),TF(),YX(),IB(),tX(),fP(),yZ(),jZ(),YN(),pz(),TL(),SZ(),ZP(),YP(),ZH(),qH(),SH(),QX(),IZ(),ZV(),RZ(),KZ=d(O(),1),qZ={...uP,...JN},JZ=GZ.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,s=JY(),{multiple:c,readOnly:l,highlightItemOnHover:u}=YY(),d=XY(),{side:f,align:p,alignItemWithTriggerActive:m,isPositioned:h,setControlledAlignItemWithTrigger:g}=gZ(),_=JH(!0)!=null,v=JV(),{nonce:y,disableStyleElements:b}=MZ(),x=s.useState(`id`),S=s.useState(`open`),C=s.useState(`openMethod`),w=s.useState(`mounted`),T=s.useState(`popupProps`),E=s.useState(`transitionStatus`),D=s.useState(`triggerElement`),O=s.useState(`positionerElement`),k=s.useState(`listElement`),A=GZ.useRef(!1),j=GZ.useRef(!1),M=GZ.useRef({}),N=bF(),P=$(e=>{if(!O||!s.context.popupRef.current||!j.current)return;let t=O.style.top===`0px`,n=O.style.bottom===`0px`;if(A.current||!m||!t&&!n){s.context.handleScrollArrowVisibility(e);return}let r=VZ(O),i=HZ(O.getBoundingClientRect().height,`y`,r),a=EF(O),o=sj(O),c=o.getComputedStyle(O),l=parseFloat(c.marginTop),u=parseFloat(c.marginBottom),d=zZ(o.getComputedStyle(s.context.popupRef.current)),f=Math.min(a.documentElement.clientHeight-l-u,d),p=e.scrollTop,h=BZ(e),g=null,_=e=>{O.style.height=`${e}px`},v=t?h-p:p,y=Math.min(i+v,f);if(v<=1){let n=JX(v,0,f-i);n>0&&_(i+n),e.scrollTop=t?h:0,f-(i+n)<=1&&(A.current=!0),s.context.handleScrollArrowVisibility(e);return}f-y>1?g=t?1/0:0:n&&p<h&&(g=p-(v-(i+v-f)));let b=Math.ceil(y);if(b!==0&&_(b),g!=null){let t=JX(g,0,BZ(e));Math.abs(e.scrollTop-t)>1&&(e.scrollTop=t)}b>=f-1&&(A.current=!0),s.context.handleScrollArrowVisibility(e)});GZ.useImperativeHandle(s.context.scrollHandlerRef,()=>P,[P]),dz({open:S,ref:s.context.popupRef,onComplete(){S&&s.context.onOpenChangeComplete(!0)}});let F={open:S,transitionStatus:E,side:f,align:p};Q(()=>{O&&s.context.popupRef.current&&!Object.keys(M.current).length&&(M.current={top:O.style.top||`0`,left:O.style.left||`0`,right:O.style.right,height:O.style.height,bottom:O.style.bottom,minHeight:O.style.minHeight,maxHeight:O.style.maxHeight,marginTop:O.style.marginTop,marginBottom:O.style.marginBottom})},[s,O]),Q(()=>{S||m||(j.current=!1,A.current=!1,bZ(O,M.current))},[S,m,O]),Q(()=>{let e=s.context.popupRef.current;if(!S||!D||!O||!e||m&&!h||s.state.transitionStatus===`ending`)return;if(j.current=!0,e.style.removeProperty(LZ),!m){N.request(()=>s.context.handleScrollArrowVisibility(k||e));return}let t=WZ(e);try{let t=s.context.selectedItemTextRef.current;t?.isConnected||(t=!s.select(`hasSelectedValue`)&&s.context.firstItemTextRef.current?.isConnected?s.context.firstItemTextRef.current:null);let n=s.context.valueRef.current,r=sj(O),i=r.getComputedStyle(O),a=r.getComputedStyle(e),o=EF(D),c=VZ(D),l=UZ(D.getBoundingClientRect(),c),d=UZ(O.getBoundingClientRect(),c),f=l.height,p=k||e,m=p.scrollHeight,h=parseFloat(a.borderBottomWidth),_=parseFloat(i.marginTop)||10,y=parseFloat(i.marginBottom)||10,b=parseFloat(i.minHeight)||100,x=zZ(a),S=o.documentElement.clientHeight-_-y,C=o.documentElement.clientWidth,w=S-l.bottom+f,T,E=v===`rtl`?l.right-d.width:l.left,j=0;if(t&&n){let e=UZ(n.getBoundingClientRect(),c);T=UZ(t.getBoundingClientRect(),c),E=d.left+(v===`rtl`?e.right-T.right:e.left-T.left);let r=e.top-l.top+e.height/2;j=T.top-d.top+T.height/2-r}let N=w+j+y+h,P=Math.min(S,N),F=S-_-y,I=N-P,L=C-5;O.style.left=`${JX(E,5,L-d.width)}px`,O.style.height=`${P}px`,O.style.maxHeight=`none`,O.style.marginTop=`${_}px`,O.style.marginBottom=`${y}px`,e.style.height=`100%`;let R=BZ(p),z=I>=R-1;z&&(P=Math.min(S,d.height)-(I-R));let B=l.top<20||l.bottom>S-20||Math.ceil(P)+1<Math.min(m,b),V=(r.visualViewport?.scale??1)!==1&&yN;if(B||V){bZ(O,M.current),g(!1);return}let H=Math.max(b,P);if(z){let e=Math.max(0,S-N);O.style.top=d.height>=F?`0`:`${e}px`,O.style.height=`${P}px`,p.scrollTop=BZ(p)}else O.style.bottom=`0`,p.scrollTop=I;if(T){let t=d.top,n=d.height,r=T.top+T.height/2,i=JX(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(LZ,`50% ${i}%`)}(H===S||P>=x)&&(A.current=!0),s.context.handleScrollArrowVisibility(p),u&&s.state.selectedIndex===null&&s.state.activeIndex===null&&s.context.listRef.current[0]!=null&&s.set(`activeIndex`,0)}finally{t()}},[s,S,O,D,m,g,N,k,u,v,h]),GZ.useEffect(()=>{if(!m||!O||!S)return;let e=sj(O);function t(e){s.context.setOpen(!1,XP(JP,e))}return QP(e,`resize`,t)},[s,m,O,S]);let I={...k?{role:`presentation`}:{role:`listbox`,"aria-multiselectable":c||void 0,"aria-readonly":l||void 0,id:`${x}-list`},onKeyDown(e){_&&KH.has(e.key)&&e.stopPropagation()},onScroll(e){k||P(e.currentTarget)},...m&&{style:k?{height:`100%`}:xZ},className:!k&&m?AZ.className:void 0},L=gL(`div`,e,{ref:[t,s.context.popupRef],state:F,stateAttributesMapping:qZ,props:[T,I,xH(E),o]});return(0,KZ.jsxs)(GZ.Fragment,{children:[!b&&AZ.getElement(y),(0,KZ.jsx)(sR,{context:d,modal:!1,disabled:!w,openInteractionType:C,returnFocus:a,restoreFocus:!0,children:L})]})}),YZ=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]]})),ZZ,QZ,$Z=s((()=>{ZZ=d(m(),1),tX(),yZ(),TL(),jZ(),SZ(),QZ=ZZ.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=JY(),{multiple:s,readOnly:c}=YY(),{alignItemWithTriggerActive:l}=gZ(),u=o.useState(`hasScrollArrows`),d=o.useState(`openMethod`),f={id:`${o.useState(`id`)}-list`,role:`listbox`,"aria-multiselectable":s||void 0,"aria-readonly":c||void 0,onScroll(e){o.context.scrollHandlerRef.current?.(e.currentTarget)},...l&&{style:xZ},className:u&&d!==`touch`?AZ.className:void 0};return gL(`div`,e,{ref:[t,o.useStateSetter(`listElement`)],props:[f,a]})})})),eQ,tQ,nQ=s((()=>{eQ=d(m(),1),tQ=eQ.createContext(void 0)})),rQ,iQ,aQ,oQ=s((()=>{rQ=d(m(),1),oN(),tX(),zU(),TL(),nQ(),iU(),ZP(),YP(),MX(),jN(),iQ=d(O(),1),aQ=rQ.memo(rQ.forwardRef(function(e,t){let{render:n,className:r,style:i,value:a=null,label:o,disabled:s=!1,nativeButton:c=!1,...l}=e,u=rQ.useRef(null),d=LU({guess:!0,label:o,textRef:u}),f=JY(),{itemProps:p,multiple:m,disabled:h,readOnly:g}=YY(),_=h||s,v=f.useState(`isActive`,d.index),y=f.useState(`open`),b=f.useState(`isSelected`,a),x=f.useState(`isSelectedByFocus`,d.index),S=f.useState(`isItemEqualToValue`),C=d.index,w=rQ.useRef(null);Q(()=>{let e=f.context.valuesRef.current;return e[C]=a,()=>{delete e[C]}},[C,a,f]),Q(()=>{let e=f.state.value,t=f.state.selectedIndex,n=t,r;m&&Array.isArray(e)?(n=kX(C,a,f.context.valuesRef.current,e,S,t),r=n===C,C===t&&!r&&(f.context.selectedItemTextRef.current=null)):(r=e!==void 0&&wX(a,e,S),r&&(n=C)),f.set(`selectedIndex`,n),r&&u.current&&(f.context.selectedItemTextRef.current=u.current)},[C,m,S,f,a]);let T=rQ.useRef(`mouse`),E=rQ.useRef(!1),{getButtonProps:D,buttonRef:O}=uV({disabled:_,focusableWhenDisabled:!0,native:c,composite:!0}),k={disabled:_,selected:b,highlighted:v};function A(e){if(h||g)return;let t=f.state.value;if(m){let n=Array.isArray(t)?t:[],r=b?AX(n,a,S):[...n,a];f.context.setValue(r,XP(FP,e))}else f.context.setValue(a,XP(FP,e)),f.context.setOpen(!1,XP(FP,e))}function j(){f.context.selectionRef.current.dragY=0}let M={role:`option`,"aria-selected":b,tabIndex:y&&v?0:-1,onKeyDown(e){f.set(`activeIndex`,C),e.key===` `&&f.context.typingRef.current&&e.preventDefault()},onClick(e){let t=T.current!==`touch`,n=e.nativeEvent.pointerType,r=t&&ON(e.nativeEvent)&&(n!==void 0||v),i=t&&!r&&!E.current;E.current=!1,!(_||i)&&A(e.nativeEvent)},onPointerEnter(e){T.current=e.pointerType},onPointerMove(e){if(e.pointerType===`mouse`&&e.buttons===1){let t=f.context.selectionRef.current;t.dragY+=e.movementY,t.dragY**2>=64&&(t.allowUnselectedMouseUp=!0)}},onPointerDown(e){T.current=e.pointerType,E.current=!0,j()},onMouseUp(){if(j(),_||T.current===`touch`||E.current)return;let e=!f.context.selectionRef.current.allowSelectedMouseUp&&b,t=!f.context.selectionRef.current.allowUnselectedMouseUp&&!b;e||t||(E.current=!0,w.current?.click(),E.current=!1)}},N=gL(`div`,e,{ref:[O,t,d.ref,w],state:k,props:[p,M,l,D]}),P=rQ.useMemo(()=>({selected:b,index:C,textRef:u,selectedByFocus:x}),[b,C,u,x]);return(0,iQ.jsx)(tQ.Provider,{value:P,children:N})}))})),sQ=s((()=>{nZ(),TL(),mX(),lX(),Aj(),DF(),yF(),XR(),oN(),_V(),bX(),tX(),dZ(),VX(),fP(),hZ(),YN(),DZ(),XZ(),$Z(),oQ(),nQ(),az(),pz(),yZ(),rN(),QX(),RI()})),cQ=s((()=>{sQ()}));function lQ(e){return(0,pQ.jsx)(dQ,{...e})}function uQ(e){return(0,pQ.jsx)(dQ,{...e,multiple:!0})}function dQ(e){let{items:t,ariaLabel:n,ariaInvalid:r,ariaDescribedBy:i,ariaLabelledBy:a,id:o,buttonRef:s,popupRef:c,onOpenChange:l,disabled:u,readOnly:d,valueClassName:f,actions:p=[],buttonClassName:m,listClassName:h,valueId:g,placeholder:_}=e,v=e.multiple===!0,y=(0,fQ.useId)(),b=(0,fQ.useId)(),x=o??y,S=e.multiple===!0?e.value:[e.value],C=t.find(e=>e.value===S[0]),w=v?t.filter(e=>S.includes(e.value)).map(e=>e.label).join(`, `):C?.label??``,T=(0,fQ.useRef)(null),[E,D]=(0,fQ.useState)(null);(0,fQ.useEffect)(()=>{D(T.current?.closest(`dialog, [role="dialog"]`))},[]);let O=(0,fQ.useRef)(null);return(0,pQ.jsx)(`div`,{className:`dd`,ref:T,children:(0,pQ.jsxs)($X,{multiple:v||void 0,value:v?S:C?C.value:null,disabled:u,readOnly:d,onOpenChange:l&&((e,t)=>l(e,EG(t,`implicit`))),items:t.map(e=>({value:e.value,label:e.label})),onValueChange:(n,r)=>{let i=EG(r,r.event?.type===`base-ui`?`sync`:`autofill`);if(e.multiple===!0){if(!Array.isArray(n))return;let r=n.find(e=>typeof e==`string`&&e.startsWith(mQ));r?p[Number(r.slice(9))]?.onSelect():e.onChange(t.map(e=>e.value).filter(e=>n.includes(e)),i)}else typeof n==`string`&&(n.startsWith(mQ)?p[Number(n.slice(9))]?.onSelect():n!==e.value&&e.onChange(n,i))},children:[(0,pQ.jsxs)(uZ,{render:(0,pQ.jsx)(`button`,{type:`button`,role:`button`,id:x,className:m?`dd-button ${m}`:`dd-button`,ref:e=>{O.current=e,typeof s==`function`?s(e):s&&(s.current=e)},"aria-label":a?void 0:n,"aria-labelledby":a??(n?`${x} ${g??b}`:void 0),"aria-invalid":r||void 0,"aria-describedby":i,title:C?.detail??``}),children:[C?.swatches&&(0,pQ.jsx)(`span`,{className:`dd-swatches`,"aria-hidden":`true`,children:C.swatches.map((e,t)=>(0,pQ.jsx)(`span`,{style:{background:e}},t))}),(0,pQ.jsx)(`span`,{id:g??b,className:`dd-value${f?` ${f}`:``}${w?``:` is-empty`}`,children:w||_||`—`}),(0,pQ.jsx)(`span`,{className:`dd-caret`,"aria-hidden":`true`,children:`▾`})]}),(0,pQ.jsx)(mZ,{container:E??yG(),children:(0,pQ.jsx)(EZ,{anchor:()=>O.current?cU(O.current):null,alignItemWithTrigger:!1,positionMethod:`fixed`,side:`bottom`,align:`start`,sideOffset:4,collisionBoundary:lU(),collisionPadding:8,style:{zIndex:40},children:(0,pQ.jsx)(JZ,{ref:c,className:`dd-popup`,children:(0,pQ.jsxs)(QZ,{className:[`dd-list`,v?`dd-list-multi`:``,h].filter(Boolean).join(` `),"aria-label":n,"aria-labelledby":n?void 0:a?.split(` `)[0],children:[t.map(t=>(0,pQ.jsxs)(aQ,{value:t.value,label:t.label,disabled:t.disabled,className:e=>`dd-option${e.selected?` selected`:``}${t.disabled?` disabled`:``}${t.tone?` dd-tone-${t.tone}`:``}${e.highlighted?` active`:``}`,children:[v?(0,pQ.jsx)(`span`,{className:`dd-box`,"aria-hidden":`true`}):(0,pQ.jsx)(`span`,{className:`dd-check`,"aria-hidden":`true`,children:t.value===e.value?`✓`:``}),t.swatches&&(0,pQ.jsx)(`span`,{className:`dd-swatches`,"aria-hidden":`true`,children:t.swatches.map((e,t)=>(0,pQ.jsx)(`span`,{style:{background:e}},t))}),(0,pQ.jsxs)(`span`,{className:`dd-text`,children:[(0,pQ.jsx)(`span`,{className:`dd-label`,children:t.label}),t.detail&&(0,pQ.jsx)(`span`,{className:`dd-detail`,children:t.detail})]}),t.badge&&(0,pQ.jsx)(`span`,{className:`dd-badge`,children:t.badge})]},t.value)),p.length?(0,pQ.jsx)(`div`,{className:`dd-divider`,role:`presentation`}):null,p.map((e,t)=>(0,pQ.jsxs)(aQ,{value:`${mQ}${t}`,label:e.label,className:e=>`dd-option dd-action${e.highlighted?` active`:``}`,children:[(0,pQ.jsx)(`span`,{className:`dd-check`,"aria-hidden":`true`}),(0,pQ.jsx)(`span`,{className:`dd-text`,children:(0,pQ.jsx)(`span`,{className:`dd-label`,children:e.label})})]},e.label))]})})})})]})})}var fQ,pQ,mQ,hQ,gQ,_Q=s((()=>{fQ=d(m(),1),cQ(),uU(),bG(),kG(),LG(),pQ=d(O(),1),mQ=`~~action:`,hQ={onChange:[1,`item-press`],onOpenChange:[1,`implicit`]},gQ=AG(`Dropdown`,lQ,hQ),AG(`MultiDropdown`,uQ,hQ)})),vQ,yQ=s((()=>{Ya(),vQ=Va({select:`Select`})}));function bQ(e){return!/[??]/.test(e)&&e.trim().split(/\s+/).length<=2}function xQ(e){return(0,SQ.jsx)(gQ,{...e,ariaLabel:e.ariaLabel??vQ(`select`)})}var SQ,CQ=s((()=>{_Q(),yQ(),SQ=d(O(),1)}));function wQ(e){if(typeof e!=`string`||!/^\d{4}-\d{2}-\d{2}$/.test(e))return!1;let t=new Date(`${e}T00:00:00Z`);return!Number.isNaN(t.getTime())&&t.toISOString().slice(0,10)===e}function TQ(e,t){let n=JSON.stringify([e??null,t]),r=YQ.get(n);return r||(r=new Intl.DateTimeFormat(e,t),YQ.set(n,r)),r}function EQ(e){return wQ(e)&&e>=`0001-01-01`&&e<=`9999-12-31`}function DQ(e){if(!EQ(e))throw RangeError(`Expected an existing ISO date from 0001-01-01 through 9999-12-31.`);return{year:Number(e.slice(0,4)),month:Number(e.slice(5,7)),day:Number(e.slice(8,10))}}function OQ({year:e,month:t,day:n}){let r=new Date(0);return r.setUTCFullYear(e,t-1,n),r}function kQ(e){return`${String(e.getUTCFullYear()).padStart(4,`0`)}-${String(e.getUTCMonth()+1).padStart(2,`0`)}-${String(e.getUTCDate()).padStart(2,`0`)}`}function AQ(e){if(!Number.isSafeInteger(e))throw RangeError(`Calendar steps must be safe integers.`)}function jQ(e,t){if(AQ(e),AQ(t),e<1||e>9999||t<1||t>12)throw RangeError(`Invalid calendar month.`);return[31,e%4==0&&(e%100!=0||e%400==0)?29:28,31,30,31,30,31,31,30,31,30,31][t-1]}function MQ(e,t){let n=OQ(DQ(e));AQ(t);let r=OQ(DQ(qQ)).getTime(),i=OQ(DQ(JQ)).getTime();return kQ(new Date(Math.min(i,Math.max(r,n.getTime()+t*864e5))))}function NQ(e,t){let n=DQ(e);AQ(t);let r=Math.min(119987,Math.max(0,(n.year-1)*12+n.month-1+t)),i=Math.floor(r/12)+1,a=r%12+1;return kQ(OQ({year:i,month:a,day:Math.min(n.day,jQ(i,a))}))}function PQ(e,t){let n=e&&wQ(e)&&e<`0001-01-01`?qQ:e||`0001-01-01`,r=t||`9999-12-31`;if(DQ(n),DQ(r),n>r)throw RangeError(`Minimum date must not exceed maximum date.`);return{min:n,max:r}}function FQ(e,t){return EQ(e)&&e>=t.min&&e<=t.max}function IQ(e,t){return DQ(e),e<t.min?t.min:e>t.max?t.max:e}function LQ(e,t=1,n=PQ()){if(AQ(t),t<0||t>6)throw RangeError(`First weekday must be between 0 (Sunday) and 6.`);let r=DQ(e),i=OQ({...r,day:1}),a=(i.getUTCDay()-t+7)%7;return Array.from({length:42},(e,t)=>{let o=new Date(i.getTime()+(t-a)*864e5);if(o.getUTCFullYear()<1||o.getUTCFullYear()>9999)return{date:null,inMonth:!1,disabled:!0};let s=kQ(o);return{date:s,inMonth:o.getUTCMonth()+1===r.month,disabled:!FQ(s,n)}})}function RQ(e,t){return TQ(t,{calendar:`gregory`,timeZone:`UTC`,month:`long`,year:`numeric`}).format(OQ(DQ(e)))}function zQ(e,t=1){if(AQ(t),t<0||t>6)throw RangeError(`First weekday must be between 0 (Sunday) and 6.`);let n=TQ(e,{calendar:`gregory`,timeZone:`UTC`,weekday:`short`}),r=TQ(e,{calendar:`gregory`,timeZone:`UTC`,weekday:`long`});return Array.from({length:7},(e,i)=>{let a=OQ({year:2023,month:1,day:1+(t+i)%7});return{short:n.format(a),long:r.format(a)}})}function BQ(e){return typeof e==`string`&&XQ.test(e)}function VQ(e){return e.search(/[T ]/)===10?{date:e.slice(0,10),time:e.slice(11)}:null}function HQ(e){let t=typeof e==`string`?VQ(e):null;return!!(t&&EQ(t.date)&&BQ(t.time))}function UQ(e,t){let n=VQ(e)?.time;return`${t} ${n&&BQ(n)?n:`00:00`}`}function WQ(e){if(!HQ(e))return null;let{date:t,time:n}=VQ(e),[r,i=`00`]=[n.slice(0,5),n.slice(6)],[a=`00`,o=``]=i.split(`.`);return`${t}T${r}:${a.padEnd(2,`0`)}.${o.padEnd(3,`0`)}`}function GQ(e,t,n){let r=WQ(e);if(r===null)return!1;let i=t?WQ(t):null,a=n?WQ(n):null;return(i===null||r>=i)&&(a===null||r<=a)}function KQ(e,t){let n=TQ(`en-US`,{calendar:`gregory`,numberingSystem:`latn`,timeZone:t,year:`numeric`,month:`2-digit`,day:`2-digit`}).formatToParts(e),r=e=>n.find(t=>t.type===e).value,i=`${r(`year`).padStart(4,`0`)}-${r(`month`)}-${r(`day`)}`;return DQ(i),i}var qQ,JQ,YQ,XQ,ZQ=s((()=>{qQ=`0001-01-01`,JQ=`9999-12-31`,YQ=new Map,XQ=/^([01]\d|2[0-3]):[0-5]\d(:[0-5]\d(\.\d{1,3})?)?$/}));function QQ(e){let t;try{t=TQ(e,{year:`numeric`,month:`2-digit`,day:`2-digit`,timeZone:`UTC`,calendar:`gregory`}).formatToParts(Date.UTC(2006,10,22))}catch{t=[]}let n=t.filter(e=>[`year`,`month`,`day`].includes(e.type)).map(e=>e.type);if(n.length!==3)return{order:[`year`,`month`,`day`],sep:`-`,hint:`YYYY-MM-DD`};let r=t.find(e=>e.type===`literal`)?.value.trim()||`/`,i={year:`YYYY`,month:`MM`,day:`DD`};return{order:n,sep:r,hint:n.map(e=>i[e]).join(r)}}function $Q(e,t){let{year:n,month:r,day:i}=DQ(e),a={year:String(n).padStart(4,`0`),month:String(r).padStart(2,`0`),day:String(i).padStart(2,`0`)};return t.order.map(e=>a[e]).join(t.sep)}function e$(e,t){if(i$(e))return e;let n=e.trim().match(/^(\d{1,4})\D(\d{1,2})\D(\d{1,4})$/);if(!n)return;let r={};if(t.order.forEach((e,t)=>r[e]=n[t+1]),r.year.length!==4)return;let i=`${r.year}-${r.month.padStart(2,`0`)}-${r.day.padStart(2,`0`)}`;return EQ(i)?i:void 0}function t$({id:e,words:t,calendarIcon:n,value:r,onChange:i,onBlur:a,onKeyDown:o,disabled:s,required:c,min:l,max:u,locale:d,timezone:f,now:p,firstDay:m=1,className:h=``,name:g,inputRef:_,placeholder:v,withTime:y=!1,popupRef:b,onOpenChange:x,"aria-label":S,"aria-invalid":C,"aria-describedby":w}){let T=y?VQ(r)?.date??r.slice(0,10):r,E=(0,n$.useMemo)(()=>{try{return PQ(y?l?.slice(0,10):l,y?u?.slice(0,10):u)}catch{return null}},[l,u,y]),D=E??PQ(),O=KQ(p??new Date,f),k=()=>IQ(EQ(T)?T:O,D),[A,j]=(0,n$.useState)(k),[M,N]=(0,n$.useState)(!1),P=(0,n$.useRef)(x);(0,n$.useLayoutEffect)(()=>{P.current=x});let F=(e,t)=>{N(e),P.current?.(e,t)},[I,L]=(0,n$.useState)(null),R=(0,n$.useRef)(null),z=(0,n$.useRef)(null),B=(0,n$.useRef)(null);(0,n$.useImperativeHandle)(_,()=>B.current,[]);let V=(0,n$.useRef)(null),H=(0,n$.useCallback)(e=>{V.current=e,b?.(e)},[b]),U=(0,n$.useRef)(!1),W=(0,n$.useRef)(!1),G=(0,n$.useRef)(void 0),ee=(0,n$.useRef)(!1),te=(0,n$.useRef)(a);(0,n$.useLayoutEffect)(()=>{te.current=a});let ne=(0,n$.useId)(),K=(0,n$.useId)(),re=(0,n$.useMemo)(()=>QQ(d),[d]),[q,ie]=(0,n$.useState)(null),ae=y?r:q??(EQ(r)?$Q(r,re):r),oe=y?t.dateTimePattern:re.hint;(0,n$.useEffect)(()=>{q!==null&&r!==(e$(q,re)??q)&&ie(null)},[r]);let se=LQ(A,m,D),ce=zQ(d,m);(0,n$.useEffect)(()=>(L(z.current?.closest(`dialog, [role="dialog"]`)),()=>{clearTimeout(G.current)}),[]);let le=!E||r!==``&&(y?!HQ(r)||!FQ(T,D)||!GQ(r,l,u):!FQ(r,D));(0,n$.useEffect)(()=>{B.current?.setCustomValidity(le?y?t.enterDateAndTime:t.enterDate(re.hint):``)},[le,y,re]),(0,n$.useLayoutEffect)(()=>{if(!M)return;if(!E||s){F(!1,wG(`disabled`));return}let e=IQ(EQ(T)?T:A,E);e!==A&&(W.current=!!V.current?.querySelector(`[data-date]:focus`),j(e))},[r,l,u,s]),(0,n$.useLayoutEffect)(()=>{M&&W.current&&(V.current?.querySelector(`[data-date="${A}"]`)?.focus(),W.current=!1)},[A,M]);let ue=e=>!!(e&&(R.current?.contains(e)||V.current?.contains(e))),de=()=>{U.current&&(U.current=!1,ie(null),te.current?.())},fe=()=>{clearTimeout(G.current),G.current=setTimeout(()=>{ue(document.activeElement)||de()},0)},pe=e=>{e.relatedTarget?(clearTimeout(G.current),ue(e.relatedTarget)||de()):fe()},me=(e,t)=>{e&&(ee.current=!1,j(k())),F(e,t),e||fe()},J=()=>{let e=z.current;e?.isConnected&&(!I||I.isConnected&&!I.hasAttribute(`data-closed`))&&e.focus({preventScroll:!0})},he=(e,t)=>{let n=wG(`day-press`,t);ee.current=!0,ie(null),J(),i(y&&e?UQ(r,e):e,n),me(!1,n)},ge=e=>{W.current=!0,j(IQ(e,D))},_e=e=>{let t=se.findIndex(e=>e.date===A)%7,n={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7,Home:-t,End:6-t};Object.hasOwn(n,e.key)?(e.preventDefault(),e.stopPropagation(),ge(MQ(A,n[e.key]))):(e.key===`PageUp`||e.key===`PageDown`)&&(e.preventDefault(),e.stopPropagation(),ge(NQ(A,(e.key===`PageUp`?-1:1)*(e.shiftKey?12:1))))},ve=e=>{let t=DQ(e),n=new Date(0);return n.setUTCFullYear(t.year,t.month-1,t.day),TQ(d,{calendar:`gregory`,timeZone:`UTC`,dateStyle:`full`}).format(n)},ye=NQ(A,-1),be=NQ(A,1);return(0,r$.jsx)(JB,{open:M&&!s&&!!E,onOpenChange:(e,t)=>{ee.current=!e&&t.reason===`escape-key`,ee.current&&J(),me(e,EG(t,`implicit`))},children:(0,r$.jsxs)(`span`,{ref:R,className:y?`date-field with-time`:`date-field`,onFocus:()=>{U.current=!0},onBlur:pe,children:[(0,r$.jsx)(`input`,{ref:B,id:e,name:g,type:`text`,value:ae,className:`date-field-input ${h}`,placeholder:v??(y?t.dateTimePattern:re.hint),autoComplete:`off`,spellCheck:!1,disabled:s,required:c,"aria-required":c,"aria-label":S,"aria-invalid":C||le||void 0,"aria-describedby":[w,K].filter(Boolean).join(` `),onChange:e=>{let t=e.target.value,n=wG(`input-change`,e);if(y)return i(t,n);ie(t),i(e$(t,re)??t,n)},onKeyDown:e=>{e.altKey&&e.key===`ArrowDown`?(e.preventDefault(),e.stopPropagation(),E&&me(!0,wG(`open-key`,e))):o?.(e)}}),(0,r$.jsxs)(`span`,{id:K,className:`date-field-hint`,children:[y?t.dateAndTimeFormat:t.dateFormat(oe),` `,t.openWithKeys]}),(0,r$.jsx)(PV,{render:(0,r$.jsx)(`button`,{ref:z,type:`button`,className:`date-field-trigger`,disabled:s||!E,"aria-label":t.chooseDate(S||void 0)}),children:n}),(0,r$.jsx)(HV,{container:I??yG(),children:(0,r$.jsx)(BH,{anchor:()=>z.current?cU(z.current):null,positionMethod:`fixed`,side:`bottom`,align:`end`,sideOffset:6,collisionBoundary:lU(),collisionPadding:8,style:{zIndex:45},children:(0,r$.jsxs)(rU,{ref:H,finalFocus:()=>{let e=z.current,t=document.activeElement;return ee.current&&e?.isConnected&&(!I||I.isConnected&&!I.hasAttribute(`data-closed`))&&(t===e||t===document.body||t===I)?e:!1},className:`date-field-popup`,"aria-label":t.calendar(S||void 0),initialFocus:()=>V.current?.querySelector(`[data-date="${A}"]`)??!0,children:[(0,r$.jsxs)(`div`,{className:`date-field-head`,children:[(0,r$.jsx)(`button`,{type:`button`,"aria-label":t.previousMonth,disabled:ye.slice(0,7)===A.slice(0,7)||ye.slice(0,7)<D.min.slice(0,7),onClick:()=>j(IQ(ye,D)),children:`←`}),(0,r$.jsx)(`span`,{id:ne,"aria-live":`polite`,"aria-atomic":`true`,children:RQ(A,d)}),(0,r$.jsx)(`button`,{type:`button`,"aria-label":t.nextMonth,disabled:be.slice(0,7)===A.slice(0,7)||be.slice(0,7)>D.max.slice(0,7),onClick:()=>j(IQ(be,D)),children:`→`})]}),(0,r$.jsxs)(`table`,{className:`date-field-calendar`,role:`grid`,"aria-labelledby":ne,children:[(0,r$.jsx)(`thead`,{children:(0,r$.jsx)(`tr`,{children:ce.map(e=>(0,r$.jsx)(`th`,{scope:`col`,"aria-label":e.long,children:e.short},e.long))})}),(0,r$.jsx)(`tbody`,{children:Array.from({length:6},(e,t)=>(0,r$.jsx)(`tr`,{children:se.slice(t*7,t*7+7).map((e,t)=>(0,r$.jsx)(`td`,{"aria-selected":e.date===T,children:e.date&&(0,r$.jsx)(`button`,{type:`button`,"data-date":e.date,"data-outside":!e.inMonth||void 0,"data-selected":e.date===T||void 0,"aria-current":e.date===O?`date`:void 0,disabled:e.disabled,tabIndex:e.date===A?0:-1,"aria-label":ve(e.date),onKeyDown:_e,onClick:t=>he(e.date,t),children:Number(e.date.slice(8))})},e.date??t))},t))})]}),(0,r$.jsxs)(`div`,{className:`date-field-foot`,children:[(0,r$.jsx)(`button`,{type:`button`,onClick:e=>he(``,e),children:t.clear}),(0,r$.jsx)(`button`,{type:`button`,disabled:!FQ(O,D),onClick:e=>he(O,e),children:t.today})]})]})})})]})})}var n$,r$,i$,a$,o$=s((()=>{n$=d(m(),1),sU(),uU(),ZQ(),kG(),bG(),LG(),r$=d(O(),1),i$=e=>EQ(e),a$=AG(`DateField`,t$,{onChange:[1,`input-change`],onOpenChange:[1,`implicit`]})})),s$,c$=s((()=>{Ya(),s$=Va({enterADateAndTime:`Enter a date and time as YYYY-MM-DD HH:MM within the allowed range.`,enterADateInYyyy:`Enter a date as {format} within the allowed range.`,yyyyMmDdHh:`YYYY-MM-DD HH:MM`,dateAndTimeFormat:`Date and time format: YYYY-MM-DD HH:MM.`,dateFormatIs:`Date format: {format}.`,altAndDownArrow:`Alt and Down arrow opens the calendar.`,chooseDateFor:`Choose date for {label}`,chooseDate:`Choose date`,calendar:`Calendar for {label}`,previousMonth:`Previous month`,nextMonth:`Next month`})}));function l$(e){return(0,u$.jsx)(a$,{...e,words:d$(),calendarIcon:(0,u$.jsx)(Pe,{name:`calendar-blank`,size:18})})}var u$,d$,f$=s((()=>{o$(),Fe(),c$(),Ya(),u$=d(O(),1),d$=()=>({dateTimePattern:Fa(`mistri.form.dateTimeHint`,s$(`yyyyMmDdHh`)),enterDateAndTime:s$(`enterADateAndTime`),enterDate:e=>s$(`enterADateInYyyy`,{format:e}),dateAndTimeFormat:s$(`dateAndTimeFormat`),dateFormat:e=>s$(`dateFormatIs`,{format:e}),openWithKeys:s$(`altAndDownArrow`),chooseDate:e=>e?s$(`chooseDateFor`,{label:e}):s$(`chooseDate`),calendar:e=>e?s$(`calendar`,{label:e}):s$(`chooseDate`),previousMonth:s$(`previousMonth`),nextMonth:s$(`nextMonth`),clear:s$(`common.clear`),today:s$(`common.today`)})})),p$,m$,h$=s((()=>{Li(),p$={activeApp:()=>Mi().app(),inAppMode:()=>Mi().inApp()},m$=p$}));function g$({className:e,load:t,couldNotLoad:n,threw:r}){let i=new Map,a=new Set,o=new Set,s=0;function c(e,t){i.set(e,t),s+=1;for(let e of o)e()}function l(e,r){a.has(r)||(a.add(r),t(e).then(e=>c(r,e),t=>{n(e,t),c(r,null)}))}let u=e=>(o.add(e),()=>{o.delete(e)}),d=()=>s;class f extends _$.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e){i.get(this.props.slot)!==null&&(r(this.props.id,e),c(this.props.slot,null))}render(){return this.state.failed?this.props.fallback:this.props.children}}function p({id:t,fallback:n,props:r}){(0,_$.useSyncExternalStore)(u,d,d);let a=Mi().components.useKey(t);(0,_$.useEffect)(()=>{l(t,a)},[t,a]);let o=i.get(a);return o?(0,v$.jsx)(f,{id:t,slot:a,fallback:n,children:(0,v$.jsx)(`span`,{className:e,"data-component":t,children:(0,_$.createElement)(o,r)})}):(0,v$.jsx)(v$.Fragment,{children:n})}return p}var _$,v$,y$=s((()=>{_$=d(m()),Li(),v$=d(O())}));function b$(e,t){let n=m$.activeApp()?.resources,r=n?.[e]?.inputs;if(r&&Object.hasOwn(r,t))return r[t].id;let i=n?.[e]?.display,a=i&&Object.hasOwn(i,t)?i[t]:void 0;return a?.slider?`${C$}slider`:a?.scan?`${C$}scan`:a?.signature&&typeof a.signature==`object`?`${C$}signature`:a?.format&&E$.has(a.format)?`${C$}${a.format}`:void 0}function x$({component:e,fallback:t,...n}){return(0,S$.jsx)(T$,{id:e,fallback:t,props:n})}var S$,C$,w$,T$,E$,D$=s((()=>{h$(),Li(),y$(),S$=d(O(),1),C$=`mistri:`,w$=e=>`${C$}${e}`,T$=g$({className:`custom-input`,load:e=>e.startsWith(C$)?Mi().components.builtIn(e.slice(7)):Mi().components.load(e),couldNotLoad:(e,t)=>console.error(`the input "${e}" could not be loaded; its field is the platform's control.`,t),threw:(e,t)=>console.error(`the input "${e}" threw; its field is the platform's control.`,t)}),E$=new Set([`rating`,`color`,`time`,`month`,`year`,`json`])})),O$,k$=s((()=>{Ya(),O$=Va({addRow:`Add row`,anEmailAddress:`an email address`,aWebAddressStarting:`a web address, starting https://`,aPhoneNumber:`a phone number`,aColor:`a color, such as #1d6a5a`,theFormHasAnInput:`The form has an input it does not ask for.`,isRequired:`{label} is required.`,requiredWord:`(required)`,optionalWord:`(optional)`,checkThisBoxTo:`Check this box to continue.`,mustBeAtLeast:`{label} must be at least {minLength} characters.`,mustBeCharactersOrFewer:`{label} must be {maxLength} characters or fewer.`,must:`{label} must be {value}.`,isNotInTheForm:`{label} is not in the form it takes.`,mustBeBefore:`{label} must be before {other}.`,mustBeLessThan:`{label} must be less than {other}.`,mustBeAfter:`{label} must be after {other}.`,mustBeMoreThan:`{label} must be more than {other}.`,hasCharactersAForm:`{label} has characters a form does not take.`,mustBeASafe:`{label} must be a safe whole number.`,hasMoreDecimalsThanTheCurrency:`{label} has more decimal places than the currency takes.`,mustBeOnOrAfter:`{label} must be on or after {min}.`,labelMustBeAt:`{label} must be at least {min}.`,mustBeOnOrBefore:`{label} must be on or before {max}.`,mustBeAtMost:`{label} must be at most {max}.`,chooseLabel:`Choose {label}.`,takesAtMostRows:`{label} takes at most {max} rows.`,mustBeANumber:`{label} must be a number.`,mustBeYes:`{label} must be yes or no.`,mustBeADate:`{label} must be a date.`,mustBeADateAndTime:`{label} must be a date and time.`,mustBeATime:`{label} must be a time of day.`,isNotInAForm:`{label} is not in a form it takes.`,choosePlaceholder:`Choose {label}`,chooseOne:`Choose one`,groupRow:`{label}, row {index}`,rowLabel:`Row`,removeRow:`Remove row {index} of {label}`,addRowTo:`Add row to {label}`,needsAtLeastRows:{one:`{label} needs at least {count} row.`,other:`{label} needs at least {count} rows.`},rowMatch:`row {match}`,needsAtLeastFiles:{one:`{label} needs at least {count} file.`,other:`{label} needs at least {count} files.`},takesAtMostFiles:{one:`{label} takes at most {count} file.`,other:`{label} takes at most {count} files.`},inTheFormItTakes:`in the form it takes`,chooseAlone:`Choose {label} on its own, or another.`})}));function A$({id:e,options:t,value:n,describedBy:r,required:i,invalid:a,disabled:o,onChange:s}){let c=t.findIndex(e=>e.value===n);return(0,j$.jsx)(`div`,{className:`command-choices`,role:`radiogroup`,id:e,"aria-labelledby":`${e}-label`,"aria-describedby":r,"aria-required":i||void 0,"aria-invalid":a||void 0,children:t.map((t,n)=>(0,j$.jsxs)(`label`,{className:`command-choice`,children:[(0,j$.jsx)(`input`,{type:`radio`,name:e,checked:n===c,disabled:o,onChange:()=>s(t.value)}),t.label]},`${typeof t.value}:${t.value}`))})}var j$,M$=s((()=>{j$=d(O())}));function N$(e,t){F$.set(e,t)}function P$(e){let t=F$.get(e);t?.url&&URL.revokeObjectURL(t.url),F$.delete(e)}var F$,I$,L$=s((()=>{F$=new Map,I$=e=>F$.get(e)}));function R$(e,t){let n=TQ(`en-US`,{...H$,timeZone:t}).formatToParts(new Date(e)),r=e=>Number(n.find(t=>t.type===e)?.value??0);return{year:r(`year`),month:r(`month`),day:r(`day`),hour:r(`hour`),minute:r(`minute`),second:r(`second`)}}function z$(e,t,n,r,i,a,o=0){let s=new Date(0);return s.setUTCFullYear(e,t-1,n),s.setUTCHours(r,i,a,o),s.getTime()}function B$(e,t){if(!HQ(e))return;let{date:n,time:r}=VQ(e),[i,a,o=`0`]=r.split(`:`),[s,c=``]=o.split(`.`),l=z$(Number(n.slice(0,4)),Number(n.slice(5,7)),Number(n.slice(8,10)),Number(i),Number(a),Number(s),Number(c.padEnd(3,`0`))),u=864e5,d=[l-U$(l-u,t),l-U$(l+u,t)],f=l-(l%1e3+1e3)%1e3,p=d.filter(e=>{let n=R$(e,t);return z$(n.year,n.month,n.day,n.hour,n.minute,n.second)===f});return new Date(p.length?Math.min(...p):Math.max(...d)).toISOString()}function V$(e,t){let n=Date.parse(e);if(!/[zZ]|[+-]\d{2}(?::?\d{2})?$/.test(e)||!Number.isFinite(n))return;let r=R$(n,t),i=e=>String(e).padStart(2,`0`),a=r.second?`:${i(r.second)}`:``;return`${String(r.year).padStart(4,`0`)}-${i(r.month)}-${i(r.day)} ${i(r.hour)}:${i(r.minute)}${a}`}var H$,U$,W$=s((()=>{ZQ(),H$={calendar:`gregory`,numberingSystem:`latn`,hourCycle:`h23`,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`},U$=(e,t)=>{let n=R$(e,t);return z$(n.year,n.month,n.day,n.hour,n.minute,n.second)-(e-(e%1e3+1e3)%1e3)}})),G$=l({DateTimeInput:()=>K$});function K$({value:e,onChange:t,min:n,max:r,...i}){let a=zi(),o=e=>e&&(V$(e,a)??e),[s,c]=(0,q$.useState)(()=>o(e)??``),[l,u]=(0,q$.useState)(e);return e!==l&&(u(e),c(o(e)??``)),(0,J$.jsx)(l$,{...i,withTime:!0,min:o(n),max:o(r),locale:Ri(),timezone:a,now:Vi(),value:s,onChange:e=>{c(e);let n=e.trim(),r=n?B$(n,a)??e:``;u(r),t(r)}})}var q$,J$,Y$=s((()=>{q$=d(m()),f$(),xa(),W$(),J$=d(O())})),X$=l({ActionBar:()=>e1,Columns:()=>t1,HelpTip:()=>Z$,ProgressBar:()=>Q$,ReviewList:()=>n1,StepHeader:()=>$$});function Z$({text:e,label:t,icon:n}){let[r,i]=(0,r1.useState)(!1),a=(0,r1.useId)(),o=(0,r1.useRef)(null);return(0,r1.useEffect)(()=>{if(!r)return;let e=e=>{o.current&&!o.current.contains(e.target)&&i(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[r]),(0,i1.jsxs)(`span`,{className:`help-tip`,ref:o,children:[(0,i1.jsx)(`button`,{type:`button`,className:`help-tip-button`,"aria-label":t,"aria-expanded":r,"aria-describedby":r?a:void 0,onClick:()=>i(!r),onKeyDown:e=>{e.key===`Escape`&&r&&(e.stopPropagation(),i(!1))},children:n??(0,i1.jsx)(`span`,{"aria-hidden":`true`,children:`i`})}),r?(0,i1.jsx)(`span`,{role:`tooltip`,id:a,className:`help-tip-text`,children:e}):null]})}function Q$({value:e,max:t,min:n=0,label:r,decorative:i}){return(0,i1.jsx)(`div`,{className:`progress-bar`,...i?{"aria-hidden":!0}:{role:`progressbar`,"aria-label":r,"aria-valuemin":n,"aria-valuemax":t,"aria-valuenow":e},children:(0,i1.jsx)(`span`,{className:`progress-bar-fill`,style:{width:`${t>0?Math.min(100,e/t*100):0}%`}})})}function $$({title:e,lead:t,mark:n,level:r=1,id:i}){return(0,i1.jsxs)(`header`,{className:`step-header`,children:[(0,i1.jsxs)(r===1?`h1`:`h2`,{className:`step-title`,id:i,tabIndex:-1,children:[n?(0,i1.jsx)(`span`,{className:`step-mark`,"aria-hidden":`true`,children:n}):null,e]}),t?(0,i1.jsx)(`p`,{className:`step-lead`,children:t}):null]})}function e1({back:e,primary:t,className:n}){return(0,i1.jsxs)(`footer`,{className:n?`action-bar ${n}`:`action-bar`,children:[e?(0,i1.jsxs)(UG,{intent:`quiet`,size:`large`,className:`action-bar-back`,onClick:e.onClick,children:[e.icon,e.label]}):null,(0,i1.jsxs)(UG,{intent:`primary`,size:`large`,className:`action-bar-primary`,disabled:t.disabled,busy:t.busy,busyLabel:t.busyLabel,onClick:t.onClick,children:[t.label,t.icon]})]})}function t1({cols:e,children:t}){return(0,i1.jsx)(`div`,{className:`form-columns`,style:e?{"--form-columns":e}:void 0,children:t})}function n1({label:e,children:t}){return(0,i1.jsx)(`div`,{className:`review-list`,role:`group`,"aria-label":e,children:t})}var r1,i1,a1=s((()=>{r1=d(m(),1),GG(),i1=d(O(),1)}));function o1(e){return{label:e.label,hint:e.hint,problem:e.problem,required:e.required,labelHidden:e.labelHidden,id:e.id,kind:e.kind,className:e.className,optional:e.optional,labelAside:e.tip?(0,s1.jsx)(Z$,{...e.tip}):void 0,reserve:e.reserve??!0}}var s1,c1=s((()=>{a1(),s1=d(O())}));function l1(e){let t=(0,m1.useId)();return(0,h1.jsx)(RJ,{...o1(e),group:!0,children:n=>(0,h1.jsx)(`div`,{className:`choice-pair`,role:`radiogroup`,"aria-labelledby":n[`aria-labelledby`],"aria-describedby":n[`aria-describedby`],"aria-invalid":n[`aria-invalid`],children:[`yes`,`no`].map(n=>(0,h1.jsxs)(`label`,{className:`choice-pick${e.value===n?` is-on`:``}`,children:[(0,h1.jsx)(`input`,{type:`radio`,name:t,className:`choice-input`,checked:e.value===n,onChange:t=>e.onChange(n,wG(`select`,t))}),e[n]]},n))})})}function u1(e){let t=(0,m1.useId)(),n=(t,n,r)=>{let i=wG(`select`,r);if(!e.multiple||t===e.exclusive)return e.onChange(n?[t]:[],i);let a=e.value.filter(n=>n!==t&&n!==e.exclusive);e.onChange(n?e.options.map(e=>e.value).filter(e=>e===t||a.includes(e)):a,i)};return e.multiple?(0,h1.jsx)(RJ,{...o1(e),group:!0,children:t=>(0,h1.jsx)(g1,{"aria-labelledby":t[`aria-labelledby`],"aria-describedby":t[`aria-describedby`],"aria-invalid":t[`aria-invalid`],cards:e.options.map(t=>({key:t.value,label:t.label,icon:t.icon,on:e.value.includes(t.value)})),onToggle:(t,r,i)=>n(e.options[t].value,r,i.event)})}):(0,h1.jsx)(RJ,{...o1(e),group:!0,children:r=>(0,h1.jsx)(`div`,{className:`choice-cards`,role:`radiogroup`,"aria-labelledby":r[`aria-labelledby`],"aria-describedby":r[`aria-describedby`],"aria-invalid":r[`aria-invalid`],children:e.options.map(r=>{let i=e.value.includes(r.value);return(0,h1.jsxs)(`label`,{className:`choice-card${i?` is-on`:``}`,children:[r.icon?(0,h1.jsx)(`span`,{className:`choice-card-icon`,"aria-hidden":`true`,children:r.icon}):null,(0,h1.jsx)(`span`,{className:`choice-card-label`,children:r.label}),(0,h1.jsx)(`input`,{type:`radio`,name:t,className:`choice-input`,checked:i,onChange:e=>n(r.value,e.target.checked,e.nativeEvent)}),(0,h1.jsx)(`span`,{className:`choice-box`,"aria-hidden":`true`})]},r.value)})})})}function d1(e){let{cards:t}=e,[n,r]=(0,m1.useState)(void 0),i=(0,m1.useRef)([]),a=t.findIndex(e=>e.on),o=n!==void 0&&n<t.length?n:Math.max(a,0),s=e=>{let n=(e+t.length)%t.length;r(n),i.current[n]?.focus()},c=(n,r)=>{let i=n.key===`ArrowDown`||n.key===`ArrowRight`?r+1:n.key===`ArrowUp`||n.key===`ArrowLeft`?r-1:n.key===`Home`?0:n.key===`End`?t.length-1:void 0;i===void 0?n.key===` `&&(n.preventDefault(),e.disabled||e.onToggle(r,!t[r].on,wG(`toggle`,n))):(n.preventDefault(),s(i))};return(0,h1.jsx)(`div`,{className:`choice-cards`,role:`group`,"data-fit":e.fit,id:e.id,"aria-labelledby":e[`aria-labelledby`],"aria-describedby":e[`aria-describedby`],"aria-invalid":e[`aria-invalid`],children:t.map((t,n)=>(0,h1.jsxs)(`div`,{ref:e=>{i.current[n]=e},role:`checkbox`,"aria-checked":t.on,"aria-disabled":e.disabled||void 0,tabIndex:n===o?0:-1,className:`choice-card${t.on?` is-on`:``}`,onClick:i=>{r(n),e.disabled||e.onToggle(n,!t.on,wG(`toggle`,i))},onFocus:()=>r(n),onKeyDown:e=>c(e,n),children:[t.icon?(0,h1.jsx)(`span`,{className:`choice-card-icon`,"aria-hidden":`true`,children:t.icon}):null,(0,h1.jsxs)(`span`,{className:`choice-card-label`,children:[t.label,t.help?(0,h1.jsx)(`span`,{className:`choice-card-help`,children:t.help}):null]}),(0,h1.jsx)(`span`,{className:`choice-box`,"aria-hidden":`true`})]},t.key))})}function f1(e){return(0,h1.jsx)(RJ,{...o1(e),check:!0,children:t=>(0,h1.jsx)(`input`,{...t,type:`checkbox`,className:`field-check`,checked:e.checked,disabled:e.disabled,onChange:t=>e.onChange(t.target.checked,wG(`toggle`,t))})})}function p1(e){return(0,h1.jsx)(_1,{...e,className:[`form-field-consent`,e.className].filter(Boolean).join(` `)})}var m1,h1,g1,_1,v1=s((()=>{m1=d(m(),1),VJ(),c1(),kG(),LG(),h1=d(O(),1),AG(`YesNo`,l1,{onChange:[1,`select`]}),AG(`ChoiceCards`,u1,{onChange:[1,`select`]}),g1=AG(`CheckCards`,d1,{onToggle:[2,`toggle`]}),_1=AG(`Checkbox`,f1,{onChange:[1,`toggle`]}),AG(`Consent`,p1,{onChange:[1,`toggle`]})}));function y1(e,t,n,r,i,a,o,s,c,l=2){let u=une(n.current,{event:e,orientation:r,loopFocus:i,rtl:a,cols:l,disabledIndices:o,minIndex:s,maxIndex:c,prevIndex:t>c?s:t,stopEvent:!0});return LF(n.current,u)?void 0:u}var b1=s((()=>{UF()}));function x1(){let e=E1.useContext(D1);if(!e)throw Error(LI(22));return e}function S1(){let e=E1.useContext(O1);if(!e)throw Error(LI(23));return e}function C1(){let e=E1.useContext(k1);if(!e)throw Error(LI(24));return e}function w1(){return E1.useContext(j1)}function T1(){return E1.useContext(A1)}var E1,D1,O1,k1,A1,j1,M1=s((()=>{RI(),E1=d(m(),1),D1=E1.createContext(void 0),O1=E1.createContext(void 0),k1=E1.createContext(void 0),A1=E1.createContext(!1),j1=E1.createContext(``)})),N1,P1=s((()=>{MX(),VX(),N1={id:e=>e.id,labelId:e=>e.labelId,items:e=>e.items,selectedValue:e=>e.selectedValue,hasSelectionChips:e=>{let t=e.selectedValue;return Array.isArray(t)&&t.length>0},hasSelectedValue:e=>{let{selectedValue:t,selectionMode:n}=e;return t==null?!1:n===`multiple`&&Array.isArray(t)?t.length>0:!0},hasNullItemLabel:(e,t)=>t?RX(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMounted:e=>e.forceMounted,inline:e=>e.inline,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.selectedValue;return Array.isArray(r)?r.some(e=>wX(t,e,n)):wX(t,r,n)},transitionStatus:e=>e.transitionStatus,popupProps:e=>e.popupProps,listProps:e=>e.listProps,inputProps:e=>e.inputProps,triggerProps:e=>e.triggerProps,itemProps:e=>e.itemProps,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupId:e=>e.popupId,triggerElement:e=>e.triggerElement,inputElement:e=>e.inputElement,inputGroupElement:e=>e.inputGroupElement,popupSide:e=>e.popupSide,openMethod:e=>e.openMethod,inputInsidePopup:e=>e.inputInsidePopup,inputOwnsFormValue:e=>e.inputOwnsFormValue,selectionMode:e=>e.selectionMode,name:e=>e.name,form:e=>e.form,disabled:e=>e.disabled,readOnly:e=>e.readOnly,required:e=>e.required,grid:e=>e.grid,virtualized:e=>e.virtualized,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,modal:e=>e.modal,autoHighlight:e=>e.autoHighlight}}));function F1(e){return e==null?void 0:`${e}-popup`}function I1(e,t){return(n,r)=>n!=null&&e.contains(n,r,t)}var L1=s((()=>{}));function R1(e){return Array.isArray(e)?e.map(e=>R1(e)).join(`,`):e==null?``:String(e)}var z1=s((()=>{}));function B1(e={}){let t={usage:`search`,sensitivity:`base`,ignorePunctuation:!0,...e},n=`${R1(e.locale)}|${JSON.stringify(t)}`,r=V1.get(n);if(r)return r;let i=new Intl.Collator(e.locale,t),a={contains(e,t,n){if(!t)return!0;let r=zX(e,n);for(let e=0;e<=r.length-t.length;e+=1)if(i.compare(r.slice(e,e+t.length),t)===0)return!0;return!1},startsWith(e,t,n){if(!t)return!0;let r=zX(e,n);return i.compare(r.slice(0,t.length),t)===0},endsWith(e,t,n){if(!t)return!0;let r=zX(e,n),a=t.length;return r.length>=a&&i.compare(r.slice(r.length-a),t)===0}};return V1.set(n,a),a}var V1,H1=s((()=>{z1(),VX(),V1=new Map})),U1,W1=s((()=>{m(),H1(),U1=B1}));function G1(e,t=!1){let{overflowY:n}=bj(e);return n!==`auto`&&n!==`scroll`?!1:t?e.clientHeight>0:e.scrollHeight>e.clientHeight}var K1=s((()=>{Aj()})),q1,J1,Y1=s((()=>{q1=Symbol(`none`),J1={value:q1,index:-1}}));function X1(e,t,n){let r=e.get(t);if(r!==void 0||n===jX)return r;for(let[r,i]of e)if(wX(r,t,n))return i}var Z1=s((()=>{MX()}));function Q1(e){let{id:t,onOpenChangeComplete:n,defaultSelectedValue:r=null,selectedValue:i,onSelectedValueChange:a,defaultInputValue:o,inputValue:s,open:c,defaultOpen:l=!1,selectionMode:u,onItemHighlighted:d,name:f,form:p,disabled:m=!1,readOnly:h=!1,required:g=!1,inputRef:_,grid:v=!1,items:y,filteredItems:b,filter:x,filterQuery:S,openOnInputClick:C=!0,autoHighlight:w=!1,keepHighlight:T=!1,highlightItemOnHover:E=!0,loopFocus:D=!0,itemToStringLabel:O,itemToStringValue:k,isItemEqualToValue:A=jX,virtualized:j=!1,inline:M=!1,fillInputOnItemPress:N=!0,modal:P=!1,limit:F=-1,autoComplete:I=`list`,formAutoComplete:L,locale:R,submitOnItemClick:z=!1}=e,{clearErrors:B}=WX(),{setDirty:V,validityData:H,setFilled:U,name:W,disabled:G,setTouched:ee,setFocused:te,validationMode:ne,validation:K}=uX(),re=JV(),q=xX({id:t}),ie=U1({locale:R}),ae=Array.isArray(y)?null:y;if(ae&&typeof ae.label!=`function`)throw Error(LI(100));let oe=ae?ae.data:y,se=ae?.value,ce=se?void 0:oe,le=$1.useMemo(()=>{if(!b||!se)return;let e=LX(b),t=e.map(se),n;return{values:t,findItem(r,i){if(!n){n=new Map;for(let r=0;r<t.length;r+=1)n.has(t[r])||n.set(t[r],e[r])}return X1(n,r,i)}}},[b,se]),ue=$1.useMemo(()=>ae?e=>ae.label(e,A,e=>{let t=le?.findItem(e,A);return t==null?zX(e,O):ae.itemLabel(t)}):O,[ae,O,le,A]),de=$1.useMemo(()=>ae?Object.assign(e=>ae.itemLabel(e),{selected:e=>zX(e,ue)}):O,[ae,ue,O]);function fe(e){return zX(e,ue)}let[pe,me]=$1.useState(!1),[J,he]=$1.useState(null),ge=$1.useRef(J),_e=$1.useRef([]),ve=$1.useRef([]),ye=$1.useRef(null),be=$1.useRef(null),xe=$1.useRef(null),Se=$1.useRef(null),Ce=$1.useRef(null),we=$1.useRef(!0),Te=$1.useRef(!1),Ee=$1.useRef(null),De=$1.useRef(null),Oe=$1.useRef(null),ke=$1.useRef(J1),Ae=$1.useRef(null),je=$1.useRef([]),Me=$1.useRef(null),Ne=G||m,Pe=W??f,Fe=u===`multiple`,Ie=u===`single`,Le=s!==void 0||o!==void 0,Re=oe!==void 0,ze=b!==void 0,Be;Be=w===`always`?`always`:w?`input-change`:!1;let[Ve,He]=CU({controlled:i,default:Fe?r??JM:r,name:`Combobox`,state:`selectedValue`}),Ue=$1.useMemo(()=>x===null?()=>!0:x===void 0?I1(ie,de):x,[x,ie,de]),We=LM(()=>Le?o??``:Ie?fe(Ve):``).current,[Ge,Ke]=CU({controlled:s,default:We,name:`Combobox`,state:`inputValue`}),[qe,Je]=CU({controlled:c,default:l,name:`Combobox`,state:`open`}),Ye=IX(oe),Xe=!qe&&J!==null?J:String(Ge).trim(),Ze=Ie?fe(Ve):``,Qe=Ie&&!pe&&Xe!==``&&Ze.length===Xe.length&&ie.contains(Ze,Xe),$e=Qe?``:S??Xe,et=Re&&ze&&Qe&&(!ae||ae.hasValue(Ve,A)),tt=$1.useMemo(()=>oe?LX(oe):JM,[oe]),nt=$1.useMemo(()=>{if(b&&!et)return b;if(!oe)return JM;if(Ye){let e=oe,t=[],n=0;for(let r of e){if(F>-1&&n>=F)break;let e=F>-1?F-n:1/0,i=$e===``?r.items.slice(0,e):[];if($e!==``)for(let t of r.items){if(i.length>=e)break;Ue(t,$e,de)&&i.push(t)}if(i.length>0){let e={...r,items:i};t.push(e),n+=i.length}}return t}if($e===``)return F>-1?tt.slice(0,F):tt;let e=[];for(let t of tt){if(F>-1&&e.length>=F)break;Ue(t,$e,de)&&e.push(t)}return e},[b,et,oe,Ye,$e,F,Ue,de,tt]),rt=$1.useMemo(()=>{if(le&&nt===b)return le.values;let e=LX(nt);return se?e.map(e=>se(e)):e},[nt,b,le,se]),it=LM(()=>{let e=null;return M&&qe&&Re&&u!==`none`&&(e=OX(rt,Ve,A,Fe)),new KR({id:q,labelId:void 0,selectedValue:Ve,open:qe,items:ce,selectionMode:u,name:Pe,form:p,disabled:Ne,readOnly:h,required:g,grid:v,virtualized:j,openOnInputClick:C,itemToStringLabel:ue,isItemEqualToValue:A,modal:P,autoHighlight:Be,submitOnItemClick:z,hasInputValue:Le,mounted:!1,forceMounted:!1,transitionStatus:`idle`,inline:M,activeIndex:null,selectedIndex:e,popupProps:{},listProps:{},inputProps:{},triggerProps:{},itemProps:YM,positionerElement:null,listElement:null,popupId:void 0,triggerElement:null,inputElement:null,inputGroupElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,inputOwnsFormValue:u===`none`},{onOpenChangeComplete:qM,setOpen:qM,setInputValue:qM,setSelectedValue:qM,setIndices:qM,handleSelection:qM,forceMount:qM,requestSubmit:qM,listRef:_e,labelsRef:ve,popupRef:ye,emptyRef:Ce,inputRef:be,startDismissRef:xe,endDismissRef:Se,keyboardActiveRef:we,chipsContainerRef:Ee,clearRef:De,valuesRef:je,pointerDownItemRef:Me,selectionEventRef:Oe},N1)}).current,at=u===`none`?Ge:Ve,ot=$1.useMemo(()=>u===`none`?at:Array.isArray(Ve)?Ve.map(e=>BX(e,k)):BX(Ve,k),[at,k,u,Ve]),st=$(d),ct=$(n),lt=it.useState(`activeIndex`),ut=it.useState(`selectedIndex`),dt=it.useState(`positionerElement`),ft=it.useState(`listElement`),pt=it.useState(`triggerElement`),mt=it.useState(`inputElement`),ht=it.useState(`inputGroupElement`),gt=it.useState(`inline`),_t=it.useState(`inputInsidePopup`),vt=it.useState(`inputOwnsFormValue`),yt=Ie&&!_t&&Ge===Ze,bt=lF(pt),{mounted:xt,setMounted:St,transitionStatus:Ct}=rz(qe),{openMethod:wt,triggerProps:Tt}=kV(qe),Et=$(()=>ot);hX(_t?bt:be,q,at,Et,!Ne,f);let Dt=$(()=>{oe?ve.current=rt.map(fe):it.set(`forceMounted`,!0)}),Ot=$((e,t,n)=>{if(t===-1){if(ke.current===J1)return;ke.current=J1}else ke.current={value:e,index:t};st(e,lne(n,void 0,{index:t}))}),kt=$(e=>{let t={};e.activeIndex!==void 0&&(t.activeIndex=e.activeIndex),e.selectedIndex!==void 0&&(t.selectedIndex=e.selectedIndex),it.update(t);let n=e.activeIndex;if(n===void 0)return;let r=e.type||`none`;n===null?Ot(void 0,-1,r):Ot(je.current[n],n,r)}),At=$((t,n)=>{if(e.onInputValueChange?.(t,n),!n.isCanceled){if(Te.current=n.reason===RP,n.reason===`input-change`){qe&&J!==null&&he(null);let e=n.event,r=e.inputType;if(e.type===`compositionend`||r!=null&&r!==``&&r!==`insertReplacementText`){let e=t.trim()!==``;e&&me(!0),Ae.current={hasQuery:e};let n=it.state.listElement;if(!it.state.virtualized&&n){let e=ye.current;for(let t of wj(n.firstElementChild??n)){if(!dj(t)||(e?!NN(e,t):t.getAttribute(`role`)===`dialog`))break;if(G1(t)){t.scrollTop=0;break}}}e&&Be&&it.state.activeIndex==null&&(qe||gt)&&it.set(`activeIndex`,0)}}else n.reason===`input-clear`&&t===``&&it.state.inputInsidePopup&&(Ae.current={hasQuery:!1,selection:!0});Ke(t)}}),jt=$(e=>{let t=!e&&_t&&!gt&&Ge!==``&&(String(Ge).trim()===J||Ge===Ze);!e&&(t||Ge===``||yt)&&me(!1),he(null),t&&At(``,XP(RP))}),Mt=$((t,n)=>{if(qe!==t&&(n.reason===`escape-key`&&Re&&rt.length===0&&!Ce.current&&n.allowPropagation(),e.onOpenChange?.(t,n),!n.isCanceled&&(t&&J!==null&&jt(n.reason===LP),!t&&pe&&(Ie?(gt||he(Xe),Xe===``&&me(!1)):Fe&&(gt||he(Xe),_t&&kt({activeIndex:null}),(!_t||gt)&&At(``,XP(RP,n.event,void 0,{isItemPress:n.reason===FP})))),Je(t),!t&&_t&&(n.reason===`focus-out`||n.reason===`outside-press`)&&(ee(!0),te(!1),ne===`onBlur`)))){let e=u===`none`?Ge:Ve;K.commit(e)}}),Nt=$((e,t)=>{a?.(e,t),!t.isCanceled&&(He(e),(u===`none`&&ye.current&&N||Ie&&!it.state.inputInsidePopup)&&At(fe(e),XP(t.reason,t.event)))}),Pt=$((e,t)=>{let n=PN(e),r=Oe.current??e;Oe.current=null;let i=XP(FP,r),a=n?.closest(`a`)?.getAttribute(`href`);if(a)a.startsWith(`#`)&&Mt(!1,i);else if(Fe){let e=Array.isArray(Ve)?Ve:[],n=EX(e,t,A),r=n?AX(e,t,A):[...e,t];if(Nt(r,i),i.isCanceled||!(be.current&&be.current.value.trim()!==``))return;if(it.state.inputInsidePopup){At(``,XP(RP,i.event,void 0,{isItemPress:!0}));let e=Ae.current;e&&!n&&(e.toggledValue=t)}else Mt(!1,i)}else{if(Nt(t,i),i.isCanceled)return;Mt(!1,i)}}),Ft=$(()=>{let e=K.inputRef.current?.form??it.state.inputElement?.form;e&&typeof e.requestSubmit==`function`&&e.requestSubmit()}),It=$(()=>{if(St(!1),ct?.(!1),me(!1),he(null),kt(u===`none`?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),Fe&&be.current&&be.current.value!==``&&!Te.current&&At(``,XP(RP)),Ie){if(it.state.inputInsidePopup)be.current&&be.current.value!==``&&At(``,XP(RP));else{let e=fe(Ve);be.current&&be.current.value!==e&&At(e,XP(e===``?RP:AP))}}}),Lt=$1.useMemo(()=>gt&&dt?{current:dt.closest(`[role="dialog"]`)}:ye,[gt,dt]);dz({enabled:!e.actionsRef,open:qe,ref:Lt,onComplete(){qe||It()}}),$1.useImperativeHandle(e.actionsRef,()=>({unmount:It}),[It]),Q(function(){let e=ge.current!==null&&J===null;if(ge.current=J,qe&&(!e||!Re)||(qe||(Me.current=null),u===`none`))return;let t=Re?rt:je.current;kt({selectedIndex:OX(t,Ve,A,Fe)})},[qe,J,Ve,u,Fe,Re,rt,A,kt]),Q(()=>{oe&&(je.current=rt,_e.current.length=rt.length)},[oe,rt]),Q(()=>{let e=Ae.current;if(e){let t=qe||gt||it.state.positionerElement?.hidden===!1;if(e.hasQuery)Be&&t&&it.set(`activeIndex`,0),Ae.current=null;else if(String(Ge).trim()===``&&(Ae.current=null,t)){let t=e.selection;Be===`always`&&!t&&it.state.selectionMode===`none`&&it.set(`activeIndex`,0),queueMicrotask(()=>{if(!it.state.open&&!it.state.inline||be.current&&be.current.value.trim()!==``)return;let n=it.state.selectedValue,r=it.state.selectionMode===`multiple`;if(r&&Array.isArray(n)?n.length>0:it.state.selectionMode!==`none`&&n!=null){let t=Re||ze?rt:je.current,i=DX(t,e.toggledValue,it.state.isItemEqualToValue);it.set(`activeIndex`,i===-1?OX(t,n,it.state.isItemEqualToValue,r):i)}else t?it.set(`activeIndex`,null):Be===`always`&&it.set(`activeIndex`,0)})}}if(!qe&&!gt)return;let t=Re||ze?rt:je.current,n=it.state.activeIndex;if(n==null){if(Be===`always`&&t.length>0){it.set(`activeIndex`,0);return}Ot(void 0,-1,AP);return}if(n>=t.length){Ot(void 0,-1,AP),it.set(`activeIndex`,null);return}let r=t[n],i=ke.current.value,a=i!==q1&&wX(r,i,it.state.isItemEqualToValue);ke.current.index===n&&a||Ot(r,n,AP)},[lt,Be,Ot,ze,Re,rt,gt,qe,it,Ge]),Q(()=>{U(u===`none`?String(Ge)!==``:Fe?Array.isArray(Ve)&&Ve.length>0:Ve!=null)},[U,u,Ge,Ve,Fe]),$1.useEffect(()=>{Re&&Be&&rt.length===0&&kt({activeIndex:null})},[Re,Be,rt.length,kt]);function Rt(){qe&&Xe!==``&&Xe!==String(We)&&!yt&&me(!0)}function zt(){qe&&J!==null&&jt(!1)}let Bt=!1;function Vt(){!Bt&&Ge!==Ze&&(Bt=!0,At(Ze,XP(AP)))}function Ht(){u!==`none`&&(B(Pe),V(TX(Ve,H.initialValue,A)),K.change(Ve),Ie&&!Le&&!_t&&Vt())}function Ut(){Ie&&!Le&&!_t&&!pe&&Vt()}function Wt(){u===`none`&&(B(Pe),V(Ge!==H.initialValue),K.change(Ge))}TV(Xe,Rt),TV(qe,zt),TV(Ve,Ht),TV(Ze,Ut),TV(oe,Ut),TV(Ge,Wt);let Gt=Wz({open:gt?!0:qe,onOpenChange:Mt,elements:{reference:_t?pt:mt,floating:dt}}),Kt=v?`grid`:`listbox`,qt=qe||gt,Jt=qt?`true`:`false`,Yt=$1.useMemo(()=>{let e=mt?.tagName===`INPUT`,t=mt==null||e,n=t||qt,r=t?{autoComplete:`off`,spellCheck:`false`,autoCorrect:`off`,autoCapitalize:`none`}:{};return n&&(r.role=`combobox`,r[`aria-expanded`]=Jt,r[`aria-haspopup`]=Kt,r[`aria-controls`]=qt?ft?.id:void 0,r[`aria-autocomplete`]=h?`none`:I),{reference:r,floating:{role:`presentation`}}},[mt,qt,Jt,Kt,ft?.id,I,h]),Xt=fR(Gt,{enabled:!Ne&&C,event:`mousedown-only`,toggle:!1,touchOpenDelay:_t?0:100,reason:zP}),Zt=mR(Gt,{enabled:!Ne&&!gt,outsidePressEvent:{mouse:`sloppy`,touch:`intentional`},bubbles:gt?!0:void 0,outsidePress(e){let t=PN(e);return!NN(pt,t)&&!NN(De.current,t)&&!NN(Ee.current,t)&&!NN(ht,t)}}),Qt=bB(Gt,{enabled:!Ne,id:q,listRef:_e,activeIndex:lt,selectedIndex:ut,virtual:!0,loopFocus:D,allowEscape:D&&!Be,focusItemOnOpen:pe||u===`none`&&!Be?!1:`auto`,focusItemOnHover:E,resetOnPointerLeave:!T,orientation:v?`horizontal`:void 0,rtl:re===`rtl`,disabledIndices:JM,grid:v?y1:void 0,onNavigate(e,t){(t||qe)&&Ct!==`ending`&&kt(t?{activeIndex:e,type:we.current?UP:WP}:{activeIndex:e})}}),$t=$1.useMemo(()=>$I(Qt.reference,{onKeyDown(e){v&&it.state.activeIndex==null&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&e.preventBaseUIHandler()}},Zt.reference,Xt.reference,Yt.reference),[Qt.reference,Zt.reference,Xt.reference,Yt.reference,v,it]),en=$1.useMemo(()=>$I(Dz,Zt.floating),[Zt.floating]),tn=$1.useMemo(()=>$I(Qt.floating,Yt.floating),[Qt.floating,Yt.floating]),nn=$1.useMemo(()=>{let e=Qt.item;return e?{...e,onFocus:void 0}:YM},[Qt.item]);it.useContextCallback(`setOpen`,Mt),it.useContextCallback(`setInputValue`,At),it.useContextCallback(`setSelectedValue`,Nt),it.useContextCallback(`setIndices`,kt),it.useContextCallback(`handleSelection`,Pt),it.useContextCallback(`forceMount`,Dt),it.useContextCallback(`requestSubmit`,Ft),it.useContextCallback(`onOpenChangeComplete`,n),GY(()=>{it.update({inline:M,popupProps:en,listProps:tn,inputProps:$t,triggerProps:Tt,itemProps:nn})});let rn={id:q,selectedValue:Ve,open:qe,mounted:xt,transitionStatus:Ct,items:ce,inline:M,popupProps:en,listProps:tn,inputProps:$t,triggerProps:Tt,itemProps:nn,openMethod:wt,selectionMode:u,name:Pe,form:p,disabled:Ne,readOnly:h,required:g,grid:v,virtualized:j,openOnInputClick:C,itemToStringLabel:ue,modal:P,autoHighlight:Be,isItemEqualToValue:A,submitOnItemClick:z,hasInputValue:Le};Q(()=>{it.update({...rn,inputOwnsFormValue:u===`none`&&(M||!it.state.inputInsidePopup)})},[it,...Object.values(rn)]);let an=nF(_,K.inputRef),on=$1.useMemo(()=>({query:Xe,hasItems:Re,filteredItems:nt,flatFilteredValues:rt}),[Xe,Re,nt,rt]),sn=$1.useMemo(()=>Array.isArray(at)?``:BX(at,k),[at,k]),cn=Fe&&Array.isArray(Ve)&&Ve.length>0,ln=Fe||u===`none`&&vt?void 0:Pe,un=$1.useMemo(()=>!Fe||!Array.isArray(Ve)||!Pe?null:Ve.map(e=>{let t=BX(e,k);return(0,e0.jsx)(`input`,{type:`hidden`,form:p,name:Pe,value:t,disabled:Ne},t)}),[Fe,Ve,p,Pe,k,Ne]),dn=(0,e0.jsxs)($1.Fragment,{children:[e.children,(0,e0.jsx)(`input`,{...K.getValidationProps(Ne,{onFocus(){_t?pt?.focus():(be.current||pt)?.focus()},onChange(e){if(e.nativeEvent.defaultPrevented||Ne||h)return;let t=e.currentTarget.value,n=t.toLowerCase(),r=XP(AP,e.nativeEvent),i=()=>je.current.findIndex(e=>BX(e,k).toLowerCase()===n||fe(e).toLowerCase()===n);function a(){if(Fe)return;if(u===`none`){At(t,r);return}let e=i();e===-1&&(e=je.current.findIndex((e,t)=>{let r=ve.current[t];return r!=null&&r.toLowerCase()===n}));let a=e===-1?void 0:je.current[e];a!=null&&Nt?.(a,r)}Ie&&(Dt(),oe&&i()===-1&&it.set(`forceMounted`,!0)),queueMicrotask(a)}}),id:q&&ln==null?`${q}-hidden-input`:void 0,form:p,name:ln,autoComplete:L,disabled:Ne,required:g&&!cn,readOnly:h,value:sn,ref:an,style:ln?AF:kF,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),un]});return(0,e0.jsx)(D1.Provider,{value:it,children:(0,e0.jsx)(O1.Provider,{value:Gt,children:(0,e0.jsx)(A1.Provider,{value:Re,children:(0,e0.jsx)(k1.Provider,{value:on,children:(0,e0.jsx)(j1.Provider,{value:Ge,children:dn})})})})})}var $1,e0,t0=s((()=>{RI(),$1=d(m(),1),TU(),oN(),qY(),yF(),cF(),dF(),jF(),BM(),YR(),XM(),Aj(),IB(),b1(),XR(),ZP(),YP(),M1(),P1(),pz(),mX(),gX(),qX(),CX(),L1(),W1(),az(),jV(),K1(),DV(),nX(),Uz(),hL(),VX(),MX(),Y1(),ZV(),Z1(),e0=d(O(),1)}));function n0(e){let{openOnInputClick:t=!1,value:n,defaultValue:r,onValueChange:i,mode:a=`list`,itemToStringValue:o,...s}=e,c=(a===`inline`||a===`both`)&&!e.readOnly,l=a===`inline`||a===`none`,u=n!==void 0,[d,f]=r0.useState(r??``),[p,m]=r0.useState(``);r0.useEffect(()=>{(u||!c)&&m(``)},[n,u,c]);let h;h=c&&p!==``?p:u?n??``:d;let g=U1({locale:s.locale}),_=String((u?n:d)??``).trim(),v=l||s.filter===null?null:s.filter??g.contains;function y(e,t){m(``),u||f(e),i?.(e,t)}function b(t,n){e.onItemHighlighted?.(t,n),n.reason!==`pointer`&&m(c&&t!=null?zX(t,o):``)}return(0,i0.jsx)(Q1,{...s,itemToStringLabel:o,openOnInputClick:t,selectionMode:`none`,fillInputOnItemPress:!0,filter:v,filterQuery:a===`both`?_:void 0,autoComplete:a,inputValue:h,defaultInputValue:r,onInputValueChange:y,onItemHighlighted:b})}var r0,i0,a0=s((()=>{r0=d(m(),1),t0(),W1(),VX(),YP(),i0=d(O(),1)})),o0,s0,c0=s((()=>{fP(),o0=`data-popup-side`,s0=`data-list-empty`})),l0,u0=s((()=>{fP(),lX(),c0(),l0={...lP,...cX,popupSide:e=>e?{[o0]:e}:null,listEmpty:e=>e?{[s0]:``}:null}}));function d0(e){let t=e.useState(`mounted`),n=e.useState(`popupSide`),r=e.useState(`positionerElement`);return t&&r?n:null}function f0(){return C1().filteredItems.length===0}function p0(e){return e===`rtl`?[`ArrowRight`,`ArrowLeft`]:[`ArrowLeft`,`ArrowRight`]}function m0(e,t){let n=e>=t-1?t-2:e;return n>=0?n:void 0}function h0(e,t,n){let r=e.context.listRef.current[t];r&&(e.context.selectionEventRef.current=n,r.click(),e.context.selectionEventRef.current=null)}var g0=s((()=>{M1()}));function _0(){return v0.useContext(y0)}var v0,y0,b0=s((()=>{v0=d(m(),1),y0=v0.createContext(void 0)}));function x0(e){let t=S0.useContext(C0);if(t===void 0&&!e)throw Error(LI(21));return t}var S0,C0,w0=s((()=>{RI(),S0=d(m(),1),C0=S0.createContext(void 0)})),T0,E0,D0,O0=s((()=>{T0=d(m(),1),cF(),jF(),iU(),ZP(),YP(),M1(),E0=d(O(),1),D0=T0.forwardRef(function(e,t){let n=x1(),{buttonRef:r,getButtonProps:i}=uV({native:!1}),a=nF(t,r);function o(e){n.context.setOpen(!1,XP(IP,e.nativeEvent,e.currentTarget))}let s=i({onClick:o});return(0,E0.jsx)(`span`,{ref:a,...s,"aria-label":`Dismiss`,tabIndex:void 0,style:AF})})})),k0,A0,j0,M0=s((()=>{k0=d(m(),1),yF(),TN(),_V(),TL(),M1(),u0(),mX(),lX(),bX(),b0(),XR(),w0(),ZP(),YP(),ZV(),O0(),g0(),A0=d(O(),1),j0=k0.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,id:a,style:o,...s}=e,{state:c,disabled:l,setTouched:u,setFocused:d,validationMode:f,validation:p}=uX(),{labelId:m}=_X(),h=_0(),g=!!x0(!0),_=x1(),v=w1(),y=JV(),b=_.useState(`required`),x=_.useState(`disabled`),S=_.useState(`readOnly`),C=_.useState(`name`),w=_.useState(`form`),T=_.useState(`selectionMode`),E=_.useState(`autoHighlight`),D=_.useState(`inputProps`),O=_.useState(`triggerProps`),k=_.useState(`open`),A=_.useState(`mounted`),j=_.useState(`selectedValue`),M=_.useState(`id`),N=_.useState(`inline`),P=_.useState(`modal`),F=!!E,I=d0(_),L=l||x||i,R=f0(),z=g||N,B=!z||P,V=gV(a??(z?void 0:M)),H=g?oX:c,[U,W]=k0.useState(null),G=k0.useRef(!1),ee=k0.useRef(null),te=k0.useRef(!1),ne=T===`none`&&!g,K=$(e=>{let t=g||_.state.inline;t&&!_.state.hasInputValue&&_.context.setInputValue(``,XP(AP)),_.update({inputElement:e,inputInsidePopup:t,inputOwnsFormValue:ne})}),re=g?s:p.getValidationProps(L,s);function q(){_.context.setIndices({activeIndex:null,selectedIndex:null,type:_.context.keyboardActiveRef.current?UP:WP})}function ie(){_.context.keyboardActiveRef.current=!1}let ae={...H,open:k,disabled:L,readOnly:S,popupSide:I,listEmpty:R};function oe(e){if(!h)return;let t,{highlightedChipIndex:n}=h,r=h.chipsRef.current.length,[i,a]=p0(y);return n===void 0?(e.key===i&&(e.currentTarget.selectionStart??0)===0&&j.length>0&&(e.preventDefault(),t=r>0?r-1:void 0),t):(e.key===i?(e.preventDefault(),t=n>0?n-1:void 0):e.key===a?(e.preventDefault(),t=n<r-1?n+1:void 0):(e.key===`Backspace`||e.key===`Delete`)&&(e.preventDefault(),t=m0(n,j.length),q()),t)}let se=gL(`input`,e,{state:ae,ref:[t,_.context.inputRef,K],props:[D,O,{value:U??v,"aria-readonly":S||void 0,"aria-required":b||void 0,"aria-labelledby":m,disabled:L,readOnly:S,required:T===`none`?b:void 0,form:w,...ne&&C&&{name:C},id:V,onFocus(){if(d(!0),!N||!te.current)return;te.current=!1;let e=ee.current;e!=null&&Object.hasOwn(_.context.valuesRef.current,e)&&_.context.setIndices({activeIndex:e})},onBlur(){u(!0),d(!1);let e=_.state.activeIndex;if(N&&e!==null&&E!==`always`&&(ee.current=e,te.current=!0,_.context.setIndices({activeIndex:null})),f===`onBlur`){let e=T===`none`?v:j;p.commit(e)}},onCompositionStart(e){hN||(G.current=!0,W(e.currentTarget.value))},onCompositionEnd(e){G.current=!1;let t=e.currentTarget.value;W(null),_.context.setInputValue(t,XP(LP,e.nativeEvent))},onChange(e){let t=e.nativeEvent,n=t.inputType,r=!n||n===`insertReplacementText`,i=G.current||!r;function a(e){!S&&!L&&e&&i&&(_.context.setOpen(!0,XP(LP,t)),F||q())}if(G.current){let n=e.currentTarget.value;W(n),n===``&&!_.state.openOnInputClick&&!_.state.inputInsidePopup&&_.context.setOpen(!1,XP(RP,t));let r=n.trim(),i=F&&r!==``;a(r),k&&_.state.activeIndex!==null&&!i&&q();return}let o=XP(LP,t);if(_.context.setInputValue(e.currentTarget.value,o),o.isCanceled)return;let s=e.currentTarget.value===``,c=XP(RP,t);s&&!_.state.inputInsidePopup&&(T===`single`&&_.context.setSelectedValue(null,c),_.state.openOnInputClick||_.context.setOpen(!1,c)),a(e.currentTarget.value.trim()),k&&_.state.activeIndex!==null&&!F&&q()},onKeyDown(e){if(e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)return;if(_.context.keyboardActiveRef.current=!0,L||S){S&&e.key===`Enter`&&k&&_.state.activeIndex!==null&&EN(e);return}let t=e.currentTarget,n=t.scrollWidth-t.clientWidth,r=y===`rtl`;if(e.key===`Home`){EN(e);let n=bN&&r?t.value.length:0;t.setSelectionRange(n,n),t.scrollLeft=0;return}if(e.key===`End`){EN(e);let i=bN&&r?0:t.value.length;t.setSelectionRange(i,i),t.scrollLeft=r?-n:n;return}if(!A&&e.key===`Escape`){let t=T===`multiple`&&Array.isArray(j)?j.length===0:j===null,n=XP(VP,e.nativeEvent),r=T===`multiple`?[]:null;_.context.setInputValue(``,n),_.context.setSelectedValue(r,n),t||_.state.inline||n.isPropagationAllowed||e.stopPropagation();return}if(h&&e.key===`Backspace`&&t.value===``&&h.highlightedChipIndex===void 0&&Array.isArray(j)&&j.length>0){let t=h.chipsRef.current.length,n=t>0?t-1:j.length-1,r=j.filter((e,t)=>t!==n);q(),_.context.setSelectedValue(r,XP(AP,e.nativeEvent));return}let i=h?.highlightedChipIndex!==void 0,a=oe(e);if(h?.setHighlightedChipIndex(a),a===void 0?i&&_.context.inputRef.current?.focus():h?.chipsRef.current[a]?.focus(),e.which!==229&&e.key===`Enter`&&k){let t=_.state.activeIndex,n=e.nativeEvent;if(t===null){if(N)return;_.context.setOpen(!1,XP(AP,n));return}EN(e),h0(_,t,n)}},onPointerMove:ie,onPointerDown:ie},re],stateAttributesMapping:l0}),ce=g?(0,A0.jsx)(pX.Provider,{value:fX,children:se}):se;return(0,A0.jsxs)(k0.Fragment,{children:[k&&B&&(0,A0.jsx)(D0,{ref:_.context.startDismissRef}),ce]})})}));function N0(){return P0.useContext(F0)}var P0,F0,I0=s((()=>{P0=d(m(),1),O(),F0=P0.createContext(null)}));function L0(e){let{children:t}=e,{filteredItems:n}=C1(),r=N0(),i=r?r.items:n;return(0,z0.jsx)(R0.Fragment,{children:i.map(t)})}var R0,z0,B0=s((()=>{R0=d(m(),1),M1(),I0(),z0=d(O(),1)})),V0,H0,U0,W0=s((()=>{V0=d(m(),1),yF(),TL(),M1(),w0(),B0(),xW(),XR(),g0(),H0=d(O(),1),U0=V0.forwardRef(function(e,t){var n;let{render:r,className:i,style:a,children:o,...s}=e,c=x1(),l=S1(),u=!!x0(!0),{filteredItems:d,hasItems:f}=C1(),p=c.useState(`selectionMode`),m=c.useState(`grid`),h=c.useState(`readOnly`),g=c.useState(`listProps`),_=c.useState(`virtualized`),v=c.useState(`forceMounted`),y=p===`multiple`,b=d.length===0,x=$(e=>{c.set(`positionerElement`,e)}),S=$(e=>{c.set(`listElement`,e)}),C=V0.useMemo(()=>typeof o==`function`?n||=(0,H0.jsx)(L0,{children:o}):o,[o]),w={empty:b},T=l.useState(`floatingId`),E=gL(`div`,e,{state:w,ref:[t,S,u?null:x],props:[g,{children:C,tabIndex:-1,id:T,role:m?`grid`:`listbox`,"aria-multiselectable":y?`true`:void 0,"aria-readonly":!m&&h?!0:void 0,onKeyDown(e){if(!(c.state.disabled||c.state.readOnly)&&e.key===`Enter`){let t=c.state.activeIndex;if(t==null)return;EN(e),h0(c,t,e.nativeEvent)}},onKeyDownCapture(){c.context.keyboardActiveRef.current=!0},onPointerMoveCapture(){c.context.keyboardActiveRef.current=!1}},s]});if(_)return E;let D=f&&!v?void 0:c.context.labelsRef;return(0,H0.jsx)(fW,{elementsRef:c.context.listRef,labelsRef:D,children:E})})}));function G0(e){let t=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=null;for(;t.nextNode();){let e=t.currentNode;e.nodeValue!==``&&(n=e)}return n}function K0(){let e=eN(),t=q0.useRef(null);return q0.useEffect(()=>{if(pN)return;let n=t.current;if(n==null)return;let r=G0(n);if(r==null)return;let i=r.data,a=`${i}${J0}`;return r.nodeValue=a,e.start(200,()=>{r.nodeValue===a&&(r.nodeValue=i)}),()=>{e.clear(),r.nodeValue===a&&(r.nodeValue=i)}},[t,e]),t}var q0,J0,Y0=s((()=>{q0=d(m(),1),TN(),rN(),J0=``}));function X0(){let e=Z0.useContext(Q0);if(e===void 0)throw Error(LI(20));return e}var Z0,Q0,$0=s((()=>{RI(),Z0=d(m(),1),Q0=Z0.createContext(void 0)})),e2,t2,n2,r2=s((()=>{e2=d(m(),1),IB(),M1(),$0(),t2=d(O(),1),n2=e2.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=x1(),a=i.useState(`mounted`),o=i.useState(`forceMounted`);return a||n||o?(0,t2.jsx)(Q0.Provider,{value:n,children:(0,t2.jsx)(zL,{ref:t,...r})}):null})})),i2,a2,o2,s2=s((()=>{i2=d(m(),1),oN(),yF(),WV(),M1(),w0(),g0(),gH(),$0(),jL(),bH(),wH(),LH(),a2=d(O(),1),o2=i2.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a,side:o,align:s,sideOffset:c,alignOffset:l,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f,sticky:p,disableAnchorTracking:m=!1,collisionAvoidance:h=OL,style:g,..._}=e,v=x1(),y=S1(),b=X0(),x=v.useState(`modal`),S=v.useState(`open`),C=v.useState(`mounted`),w=v.useState(`openMethod`),T=v.useState(`positionerElement`),E=v.useState(`triggerElement`),D=v.useState(`inputElement`),O=v.useState(`inputGroupElement`),k=v.useState(`inputInsidePopup`),A=v.useState(`transitionStatus`),j=f0(),M=dH({anchor:i??(k?E:O??D),floatingRootContext:y,positionMethod:a,mounted:C,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m,keepMounted:b,collisionAvoidance:h,lazyFlip:!0});PH(S&&x,w===`touch`,T,E);let N={open:S,side:M.side,align:M.align,anchorHidden:M.anchorHidden,empty:j};Q(()=>{v.set(`popupSide`,M.side)},[v,M.side]);let P=$(e=>{v.set(`positionerElement`,e)}),F=CH(e,N,{styles:M.positionerStyles,transitionStatus:A,props:_,refs:[t,P],hidden:!C,inert:!S});return(0,a2.jsxs)(C0.Provider,{value:M,children:[C&&x&&(0,a2.jsx)(yH,{inert:UV(!S),cutout:O??D??E}),F]})})})),c2,l2,u2,d2,f2=s((()=>{c2=d(m(),1),oN(),IB(),TL(),M1(),fP(),w0(),pz(),YN(),XR(),SH(),O0(),L1(),g0(),l2=d(O(),1),u2={...uP,...JN},d2=c2.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=x1(),l=x0(),u=S1(),d=c.useState(`mounted`),f=c.useState(`open`),p=c.useState(`openMethod`),m=c.useState(`popupProps`),h=c.useState(`transitionStatus`),g=c.useState(`inputInsidePopup`),_=c.useState(`inputElement`),v=c.useState(`modal`),y=c.useState(`id`),b=f0(),x=s.id??(g?F1(y):void 0);Q(()=>(c.set(`popupId`,c.context.popupRef.current?.id||x),()=>{c.set(`popupId`,void 0)}),[c,x]),dz({open:f,ref:c.context.popupRef,onComplete(){f&&c.context.onOpenChangeComplete(!0)}});let S=gL(`div`,e,{state:{open:f,side:l.side,align:l.align,anchorHidden:l.anchorHidden,transitionStatus:h,empty:b},ref:[t,c.context.popupRef],props:[m,{id:x,role:g?`dialog`:`presentation`,onFocus(e){let t=PN(e.nativeEvent);p!==`touch`&&(NN(c.state.listElement,t)||t===e.currentTarget)&&c.context.inputRef.current?.focus()}},xH(h),s],stateAttributesMapping:u2}),C=a===void 0?g?e=>e===`touch`?c.context.popupRef.current:_:!1:a,w;w=o??(g?void 0:!1);let T=!g||v;return(0,l2.jsx)(sR,{context:u,disabled:!d,modal:T,openInteractionType:p,initialFocus:C,returnFocus:w,getInsideElements:()=>[c.context.startDismissRef.current,c.context.endDismissRef.current],children:(0,l2.jsxs)(c2.Fragment,{children:[S,T&&(0,l2.jsx)(D0,{ref:c.context.endDismissRef})]})})})})),p2,m2,h2=s((()=>{p2=d(m(),1),m2=p2.createContext(void 0)}));function g2(){return _2.useContext(v2)}var _2,v2,y2=s((()=>{_2=d(m(),1),v2=_2.createContext(!1)}));function b2(e){let{componentProps:t,forwardedRef:n,virtualized:r,indexFromFilter:i}=e,{render:a,className:o,style:s,value:c=null,index:l,disabled:u=!1,nativeButton:d=!1,...f}=t,p=S2.useRef(null),m=LU({guess:!0,index:l,textRef:p}),h=x1(),g=g2(),_=T1(),v=h.useState(`selectionMode`),y=h.useState(`disabled`),b=h.useState(`readOnly`),x=h.useState(`isItemEqualToValue`),S=y||u,C=v!==`none`,w=l??i??m.index,T=w!==-1,E=h.useState(`id`),D=h.useState(`isActive`,w),O=h.useState(`isSelected`,c),k=h.useState(`itemProps`),A=S2.useRef(null),j=E!=null&&T?`${E}-${w}`:void 0,M=O&&C;Q(()=>{if(!T||!r&&l==null)return;let e=h.context.listRef.current;return e[w]=A.current,()=>{delete e[w]}},[T,r,w,l,h]),Q(()=>{if(!T||_)return;let e=h.context.valuesRef.current;return e[w]=c,()=>{delete e[w]}},[T,_,w,c,h]),Q(()=>{if(!T||_)return;let e=h.state.selectedValue,t=h.state.selectedIndex;h.state.selectionMode===`multiple`&&Array.isArray(e)?t=kX(w,c,h.context.valuesRef.current,e,x,t):wX(c,e,x)&&(t=w),h.set(`selectedIndex`,t)},[T,_,h,w,c,x]);let{getButtonProps:N,buttonRef:P}=uV({disabled:S,focusableWhenDisabled:!0,native:d,composite:!0}),F={disabled:S,selected:M,highlighted:D};function I(e){function t(){h.context.handleSelection(e,c)}h.state.submitOnItemClick?(C2.flushSync(t),h.context.requestSubmit()):t()}let L={id:j,role:g?`gridcell`:`option`,"aria-selected":C?M:void 0,tabIndex:void 0,onPointerDownCapture(e){e.isPrimary&&(h.context.pointerDownItemRef.current=e.currentTarget),e.preventDefault()},onMouseDown(e){e.preventDefault()},onClick(e){S||b||I(e.nativeEvent)},onMouseUp(e){let t=h.context.pointerDownItemRef.current===e.currentTarget;h.context.pointerDownItemRef.current=null,!(S||b||e.button!==0||t||!D)&&I(e.nativeEvent)}},R=gL(`div`,t,{ref:[P,n,m.ref,A],state:F,props:[k,L,f,N]}),z=S2.useMemo(()=>({selected:M,textRef:p}),[M,p]);return(0,w2.jsx)(m2.Provider,{value:z,children:R})}function x2(e){let{componentProps:t,forwardedRef:n}=e,r=x1().useState(`isItemEqualToValue`),{flatFilteredValues:i}=C1(),a=DX(i,t.value??null,r);return(0,w2.jsx)(b2,{componentProps:t,forwardedRef:n,virtualized:!0,indexFromFilter:a})}var S2,C2,w2,T2,E2=s((()=>{S2=d(m(),1),C2=d(g(),1),oN(),M1(),zU(),TL(),h2(),iU(),y2(),MX(),w2=d(O(),1),T2=S2.memo(S2.forwardRef(function(e,t){let n=x1().useState(`virtualized`);return n&&e.index==null?(0,w2.jsx)(x2,{componentProps:e,forwardedRef:t}):(0,w2.jsx)(b2,{componentProps:e,forwardedRef:t,virtualized:n,indexFromFilter:void 0})}))})),D2,O2=s((()=>{E2(),D2=T2})),k2,A2,j2=s((()=>{k2=d(m(),1),TL(),M1(),Y0(),A2=k2.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,{filteredItems:s}=C1(),c=x1(),l=K0(),u=s.length===0?a:null;return gL(`div`,e,{ref:[t,c.context.emptyRef,l],props:[{children:u,role:`status`,"aria-live":`polite`,"aria-atomic":!0},o]})})})),M2=s((()=>{a0(),M1(),yF(),rN(),DF(),TL(),iU(),u0(),mX(),bX(),XR(),JW(),ZP(),YP(),IB(),CX(),L1(),g0(),M0(),Aj(),CP(),az(),YN(),pz(),fP(),W0(),Y0(),r2(),s2(),f2(),w0(),RI(),I0(),oN(),_V(),O2(),y2(),B0(),j2(),W1()})),N2=s((()=>{M2()}));function P2({text:e,onText:t,items:n,itemKey:r,itemLabel:i,itemClassName:a,renderItem:o,onPick:s,open:c,onOpenChange:l,inputProps:u,inputRef:d,popupRef:f,anchorRef:p,fit:m=`min-width`,popupClassName:h,listClassName:g,empty:_,emptyClassName:v,portal:y=`dialog`,autoHighlight:b=!0,onHighlight:x}){let S=(0,F2.useRef)(null),[C,w]=(0,F2.useState)(null);(0,F2.useEffect)(()=>{w(y===`body`?null:S.current?.closest(`dialog, [role="dialog"]`))},[y]);let[T,E]=(0,F2.useState)(null);(0,F2.useLayoutEffect)(()=>{let e=p?.current??S.current;if(!c||m!==`width`||!e)return;let t=()=>{let t=ws(e).width;E(t>0?t:null)};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[c,m,p]);let D=e=>{S.current=e,typeof d==`function`?d(e):d&&(d.current=e)},[O,k]=(0,F2.useState)(),A=u[`aria-label`]!==void 0||u[`aria-labelledby`]!==void 0;(0,F2.useEffect)(()=>{if(A)return;let e=[...S.current?.labels??[]].map(e=>(e.textContent??``).replace(/\s+/g,` `).trim()).filter(Boolean).join(` `);k(e||u.title||void 0)});let j={label:A?u[`aria-label`]:O,labelledBy:u[`aria-labelledby`]},{onKeyDown:M,onFocus:N,...P}=u;return(0,I2.jsxs)(n0,{items:n,filteredItems:n,itemToStringValue:i,value:e,onValueChange:(e,n)=>{n.reason!==`item-press`&&t(String(e??``),EG(n,`input-change`))},open:c,onOpenChange:(e,t)=>l(e,EG(t,`implicit`)),openOnInputClick:!0,autoHighlight:b,onItemHighlighted:x&&(e=>x(e)),children:[(0,I2.jsx)(j0,{...P,ref:D,onFocus:N,onKeyDown:e=>{if(M?.(e),e.key===`Escape`&&c){if(e.stopPropagation(),e.defaultPrevented)return;e.preventDefault(),l(!1,wG(`escape-key`,e))}}}),(0,I2.jsx)(n2,{container:C??yG(),children:(0,I2.jsx)(o2,{anchor:()=>{let e=p?.current??S.current;return e?cU(e):null},positionMethod:`fixed`,side:`bottom`,align:`start`,sideOffset:4,collisionBoundary:lU(),collisionPadding:8,style:{zIndex:40,...m===`width`?{width:T===null?`var(--anchor-width)`:`${T}px`,maxWidth:`var(--available-width)`}:{}},children:(0,I2.jsxs)(d2,{ref:f,className:h,style:{...m===`width`?{width:`100%`}:{minWidth:`var(--anchor-width)`,maxWidth:`var(--available-width)`}},children:[n.length>0?(0,I2.jsx)(U0,{className:g,"aria-label":j.label,"aria-labelledby":j.labelledBy,children:n.map(e=>(0,I2.jsx)(D2,{value:e,className:t=>a(e,t.highlighted),onClick:()=>s(e),children:o(e)},r(e)))}):null,_===void 0?null:(0,I2.jsx)(`div`,{className:n.length>0?void 0:g,children:(0,I2.jsx)(A2,{className:v,children:_})})]})})})]})}var F2,I2,L2,R2=s((()=>{F2=d(m(),1),N2(),Os(),uU(),bG(),kG(),LG(),I2=d(O(),1),L2=AG(`Typeahead`,P2,{onText:[1,`input-change`],onOpenChange:[1,`implicit`]})}));function z2({typed:e,asked:t,placeholder:n=!1,rows:r,label:i}){let a=e.trim(),o=t===a&&!n;if(o)return{choices:r??[],answered:o};let s=a.toLowerCase();return{choices:(r??[]).filter(e=>i(e).toLowerCase().includes(s)),answered:o}}var B2=s((()=>{})),V2,H2=s((()=>{Ya(),V2=Va({choicesCouldNotBeLoaded:`Choices could not be loaded. Try again.`,loadingChoices:`Loading choices…`,noMatchingChoices:`No matching choices.`,loadingName:`Loading…`,nameCouldNotBeLoaded:`Its name could not be loaded.`,tryAgain:`Try again`,noLongerAvailable:`No longer available. Change this answer.`})}));function U2(e){throw Error(`${e}: invalid form declaration.`)}function W2(e,t){return e===null?null:typeof e==`boolean`||typeof e==`string`&&e.length<=s4||typeof e==`number`&&Number.isFinite(e)&&Math.abs(e)<=2**53-1?e:U2(t)}function G2(e){return Object.freeze(e)}function K2(e,t){return{label:``,dialect:`sqlite`,readAt:``,foreignKeys:[],tables:[{name:e,schema:``,id:e,isView:!1,columns:[...t]}]}}function q2(e){let[t,n,...r]=e.split(`.`);return!r.length&&n!==void 0&&[t,n].every(e=>c4.test(e)&&!l4.has(e))}function J2(e,t,n){if((!c4.test(e.column)||l4.has(e.column))&&(!n||!q2(e.column)))throw Error(n?`${t}: "${e.column}" goes past one reference; a validation reads the record's own columns and, through one reference, that record's (order_id.status).`:`${t}: "${e.column}" is a path; a condition here reads the record's own columns.`);let r=e=>(Array.isArray(e)?e:[e]).map(e=>W2(e,t));if(e.other!==void 0){let n=u4[e.op];return n&&c4.test(e.other)&&!l4.has(e.other)||U2(t),{field:e.column,operator:n,values:[],other:e.other}}if(e.op===`isNull`)return{field:e.column,operator:`eq`,values:[null]};if(e.op===`isNotNull`)return{field:e.column,operator:`ne`,values:[null]};if(e.op===`in`)return{field:e.column,operator:`eq`,values:r(e.value)};if(e.op===`has`)return{field:e.column,operator:`has`,values:r(e.value)};let i=u4[e.op];if(!i)throw Error(`${t}: "${e.op}" matches text, which a condition here cannot; compare with =, !=, <, <=, >, >=, in, has (a list of several choices) or is empty.`);return{field:e.column,operator:i,values:r(e.value)}}function Y2(e,t,n,r=`record`,i=!1){if(typeof e!=`string`||!e.trim()||e.length>2e3)throw Error(`${t}: a condition is query-language text, like "status = shipped".`);let a=zn(`${r} ${e}`,n?{schema:K2(r,n),columnValues:!0}:{});if(a.errors[0]?.message===`me is the signed-in person, and nobody is named here to be it. Quote it ("me") to mean the text.`)throw Error(`${t} compares with me. A form's conditions and a validation read the record's own values, where the session is not; show the field always, or narrow who may write it with roles.`);if(a.errors.length)throw Error(`${t}: ${a.errors[0].message}`);let o=a.query;if(o.orderBy.length||o.columns.length||o.limit!==void 0)throw Error(`${t}: a condition is only a condition — no sort, show or limit.`);if(!o.filter.groups.length)throw Error(`${t}: a condition is query-language text, like "status = shipped".`);let s=o.filter.groups.map(e=>G2(e.map(e=>G2(J2(e,t,i)))));if(s.flat().length>16)throw Error(`${t}: a condition compares at most 16 times.`);return G2(s)}function X2(e){let t=e.type.trim().toLowerCase();if(/^(?:bool|boolean)$/.test(t))return`boolean`;if(/^(?:(?:tiny|small|medium|big)?int(?:eger)?|int[248]|(?:small|big)?serial|numeric|decimal|real|double(?: precision)?|float[48]?)(?:\s*\(\s*\d+(?:\s*,\s*\d+)?\s*\))?(?: unsigned)?$/.test(t))return`number`;if(/^(?:date)$/.test(t))return`date`;if(/^(?:timestamptz(?:\(\d+\))?|timestamp(?:\(\d+\))? with time zone)$/.test(t))return`instant`;if(/^(?:datetime|timestamp)(?:\(\d+\))?(?: without time zone)?$/.test(t))return`datetime`;if(e.allowed||/^(?:text|(?:tiny|medium|long)text|n?varchar|(?:character varying)|n?char|character|uuid|clob)(?:\(\d+\))?$/.test(t)||t.startsWith(`enum(`))return`text`}function Z2(e){if(typeof e==`bigint`&&(e=e.toString()),typeof e==`number`){if(!Number.isFinite(e)||Math.abs(e)>2**53-1)return;e=String(e)}if(typeof e!=`string`||e.length>s4)return;let t=/^([+-]?)(?:(\d+)(?:\.(\d*))?|\.(\d+))(?:[eE]([+-]?\d{1,4}))?$/.exec(e.trim());if(!t)return;let n=Number(t[5]??0);if(Math.abs(n)>s4)return;let r=t[3]??t[4]??``,i=((t[2]??`0`)+r).replace(/^0+/,``)||`0`,a=r.length-n;for(;i.endsWith(`0`)&&i!==`0`;)i=i.slice(0,-1),a--;return{coefficient:BigInt((t[1]===`-`?`-`:``)+i),scale:i===`0`?0:a}}function Q2(e){let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return!1;let[,n,r,i]=t,a=Number(n),o=Number(r),s=Number(i),c=[31,a%4==0&&(a%100!=0||a%400==0)?29:28,31,30,31,30,31,31,30,31,30,31];return a>=1&&o>=1&&o<=12&&s>=1&&s<=c[o-1]}function $2(e,t){if(e instanceof Date&&t===`instant`){let t=Date.prototype.getTime.call(e);if(!Number.isFinite(t))return;e=new Date(t).toISOString()}if(typeof e!=`string`||e.length>64)return;if(t===`date`)return Q2(e)?e:void 0;let n=/^(\d{4}-\d{2}-\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,9}))?)?(Z|[+-]\d{2}(?::?\d{2})?)?$/.exec(e);if(!n||!Q2(n[1])||Number(n[2])>23||Number(n[3])>59||Number(n[4]??0)>59)return;let[,r,i,a,o=`00`,s=``,c]=n;if(t===`datetime`)return c?void 0:`${r}T${i}:${a}:${o}.${s.padEnd(9,`0`)}`;if(!c)return;let l=0;if(c!==`Z`){let e=/^([+-])(\d{2})(?::?(\d{2}))?$/.exec(c),t=Number(e[2]),n=Number(e[3]??0);if(t>14||n>59||t===14&&n!==0)return;l=(t*60+n)*(e[1]===`-`?-1:1)}let u=Date.parse(`${r}T${i}:${a}:${o}Z`)-l*6e4;return String(BigInt(u)*1000000n+BigInt(s.padEnd(9,`0`)))}function e4(e,t){let n=X2(e);if(!n)return;if(t===null)return{kind:`null`};if(n===`number`){let r=Z2(t);return!r||/int|serial/i.test(e.type)&&r.scale>0?void 0:{kind:n,value:r}}if(n===`boolean`)return t===!0||t===1||t===1n||typeof t==`string`&&/^(true|yes|1|t)$/i.test(t.trim())?{kind:n,value:!0}:t===!1||t===0||t===0n||typeof t==`string`&&/^(false|no|0|f)$/i.test(t.trim())?{kind:n,value:!1}:void 0;if(n===`text`)return typeof t==`string`&&t.length<=s4?{kind:n,value:t}:void 0;let r=$2(t,n);return r===void 0?void 0:{kind:n,value:r}}function t4(e,t,n){if(!e||!n)return`unknown`;if(e.kind===`null`||n.kind===`null`){if(t!==`eq`&&t!==`ne`)return`unknown`;let r=e.kind===n.kind;return t===`eq`?r:!r}if(e.kind!==n.kind)return`unknown`;let r;if(e.kind===`number`&&n.kind===`number`){let t=Math.max(e.value.scale,n.value.scale),i=e.value.coefficient*10n**BigInt(t-e.value.scale),a=n.value.coefficient*10n**BigInt(t-n.value.scale);r=i<a?-1:+(i>a)}else if(e.kind===`instant`&&n.kind===`instant`){let t=BigInt(e.value),i=BigInt(n.value);r=t<i?-1:+(t>i)}else if(e.kind===`boolean`&&n.kind===`boolean`){if(t!==`eq`&&t!==`ne`)return`unknown`;r=e.value===n.value?0:1}else if(typeof e.value==`string`&&typeof n.value==`string`){if(e.kind===`text`&&t!==`eq`&&t!==`ne`)return`unknown`;r=e.value<n.value?-1:+(e.value>n.value)}else return`unknown`;switch(t){case`eq`:return r===0;case`ne`:return r!==0;case`lt`:return r<0;case`lte`:return r<=0;case`gt`:return r>0;case`gte`:return r>=0}}function n4(e,t){let n=e.filter(e=>e.name===t);return n.length===1?n[0]:void 0}function r4(e,t){let n=Object.getOwnPropertyDescriptor(e,t);return n&&Object.hasOwn(n,`value`)?n.value:void 0}function i4(e,t,n){let r=n4(n,e.field);if(!r)return`unknown`;if(e.operator===`has`){let n=r4(t,e.field);return Array.isArray(n)?e.values.some(e=>n.some(t=>String(t)===String(e))):`unknown`}if(e.other!==void 0){let i=n4(n,e.other);return!i||X2(r)!==X2(i)?`unknown`:t4(e4(r,r4(t,e.field)),e.operator,e4(i,r4(t,e.other)))}let i=e.operator,a=e.values.map(n=>t4(e4(r,r4(t,e.field)),i,e4(r,n)));return a.includes(`unknown`)?`unknown`:a.some(e=>e===!0)}function a4(e,t,n){let r=e.map(e=>e.map(e=>i4(e,t,n)));return r.flat().includes(`unknown`)?`unknown`:r.some(e=>e.every(e=>e===!0))}function o4(e,t,n){if(n==null||n===``)return null;let r=e.columns.find(e=>e.name===t);if(!r)return null;if(gt(r))return n===!0||n===1||/^(1|true|t|yes|y)$/i.test(String(n));let i=ht(r.type);if(i===`number`){let e=Number(n);return Number.isFinite(e)?e:null}if(i===`date`){let e=String(n);return/^\d{4}-\d{2}-\d{2}$/.test(e)?{day:e}:Number.isNaN(Date.parse(e))?null:{instant:new Date(e)}}return String(n)}var s4,c4,l4,u4,d4=s((()=>{St(),sr(),s4=4096,c4=/^[^\s.\x00-\x1f\x7f]{1,256}$/u,l4=new Set([`__proto__`,`prototype`,`constructor`]),u4={"=":`eq`,"!=":`ne`,"<":`lt`,"<=":`lte`,">":`gt`,">=":`gte`}})),f4=s((()=>{br()})),p4=s((()=>{sr()})),m4=s((()=>{br(),f4(),p4()})),h4=s((()=>{br(),d4(),m4()})),g4,_4=s((()=>{h4(),br(),g4=/^(number|code|sku|ref|reference|stock_ref)$|_(number|code|no|ref|reference)$/i}));function v4(e,t){let n=t.references?ct(e,t.references.table):void 0,r=n&&ft(n);return n&&r&&!pt(n).includes(r)?r:void 0}function y4(e,t,n,r){let i=e=>t.columns.find(t=>t.name===e),a=n?r?.[n]?.subtitle:void 0;if(typeof a==`string`&&a!==n&&i(a))return{path:a,declared:!0};let o=t.columns.filter(e=>e.name!==n&&!e.primaryKey&&!e.references),s=o.find(e=>w4(e)&&g4.test(e.name)&&(t.unique??[]).includes(e.name));if(s)return{path:s.name,declared:!1};let c=o.find(e=>w4(e)&&S4.test(e.name));if(c)return{path:c.name,declared:!1};let l=e?t.columns.find(t=>t.name!==n&&t.references&&!t.nullable&&v4(e,t)):void 0;if(l)return{path:`${l.name}.${v4(e,l)}`,declared:!1};let u=o.find(e=>ht(e.type)===`date`&&C4.test(e.name));return u?{path:u.name,declared:!1}:void 0}function b4(e){if(e==null||e===``)return;let t=String(e);return/^\d{4}-\d{2}-\d{2}[T ]\d{2}:/.test(t)?t.slice(0,10):t}function x4(e){let t=new Set,n=new Set;for(let r of e)(t.has(r)?n:t).add(r);return n}var S4,C4,w4,T4=s((()=>{_4(),St(),S4=/(^|_)e?mail(_address)?$/i,C4=/^(created|opened|started|joined|hired|registered)(_at|_on|_date)?$|^(date_)?(created|opened)$/i,w4=e=>ht(e.type)===`text`}));function E4(e,t,n,r,i){let a=A4(e,t,n,r);k4.delete(a),k4.set(a,i),k4.size>O4&&k4.delete(k4.keys().next().value)}function D4(e,t,n,r){return k4.get(A4(e,t,n,r))}var O4,k4,A4,j4=s((()=>{O4=500,k4=new Map,A4=(e,t,n,r)=>JSON.stringify([n,typeof t==`string`?t:[t.visitor.app,t.visitor.via??``],e.from,e.by,e.labelColumn,e.query??``,typeof r,String(r)])})),M4,N4=s((()=>{Ya(),M4=Va({aFile:`A file`,signed:`Signed`})}));function P4(e,t){let n=``,r=0;for(let i of e){if(r>=t.length)break;L4.test(i)?n+=t[r++]:n+=i}return n}function F4(e,t,n,r){let i=Number.isInteger(e)?0:r?void 0:n===void 0||Number.isInteger(n)?0:2;try{return new Intl.NumberFormat(Ri(),{style:`currency`,currency:t||Hi(),currencyDisplay:`narrowSymbol`,minimumFractionDigits:i,maximumFractionDigits:i}).format(e)}catch{return e.toLocaleString(Ri())}}function I4(e){let t=e||Hi();try{return new Intl.NumberFormat(Ri(),{style:`currency`,currency:t,currencyDisplay:`narrowSymbol`}).formatToParts(0).find(e=>e.type===`currency`)?.value??t}catch{return t}}var L4,R4=s((()=>{xa(),L4=/[0a*]/}));function z4(e){return(e.type===`text`||e.type===`textarea`)&&`sensitive`in e&&!!e.sensitive}function B4(e,t){let n=new Set,r=[...e];for(let e=Math.max(r.length-4,r.length>4?0:r.length);e<r.length;e++)n.add(e);let i=r.map((e,t)=>n.has(t)?e:`•`);if(!t)return i.join(``);let a=0,o=``;for(let e of t){if(a>=i.length)break;o+=e===`0`||e===`a`||e===`*`?i[a++]:e}return o+i.slice(a).join(``)}function V4(e,t,n){if(t==null||t===``)return`—`;if(e.type===`reference`&&n)return(typeof t==`string`||typeof t==`number`?n(e,t):void 0)??`…`;let r=`mask`in e&&typeof e.mask==`string`?e.mask:void 0;if(z4(e))return B4(String(t),e.mask);if(e.type===`boolean`)return t?Fa(`mistri.form.yes`,M4(`common.yes`)):Fa(`mistri.form.no`,M4(`common.no`));if(e.type===`files`){let e=Array.isArray(t)?t:[t];return e.length?e.map(e=>I$(String(e))?.name??M4(`aFile`)).join(`, `):`—`}if(e.type===`signature`)return M4(`signed`);if(e.type===`date`&&/^\d{4}-\d{2}-\d{2}$/.test(String(t)))return new Date(`${String(t)}T00:00:00Z`).toLocaleDateString(Ri(),{timeZone:`UTC`,dateStyle:`medium`});if(e.type===`money`&&Number.isFinite(Number(t)))return F4(Number(t),e.currency,e.step,e.minor);if(r&&typeof t==`string`)return P4(r,t);if(e.type===`choice`)return e.options.find(e=>e.value===t)?.label??String(t);if(e.type===`choices`){let n=Array.isArray(t)?t:[t];return n.length?n.map(t=>e.options.find(e=>e.value===t)?.label??String(t)).join(`, `):`—`}if(e.type===`group`){let r=U4(e,t,n);return r.length?r.join(`; `):`—`}return String(t)}function H4(e,t,n){let r=e.flatMap(e=>{let r=t[e.name];if(!W4(r))return[];if(e.type===`boolean`)return r?[e.label]:[];if(e.type===`reference`){let t=(typeof r==`string`||typeof r==`number`)&&n?n(e,r):void 0;return t===void 0?[]:[t]}return[V4(e,r,n)]});return r.length?r.join(`, `):void 0}function U4(e,t,n){let r=t=>e.fields.flatMap(r=>{let i=t?.[r.name];return W4(i)?[e.fields.length>1?`${r.label}: ${V4(r,i,n)}`:V4(r,i,n)]:[]});return e.repeat?(Array.isArray(t)?t:[]).map(e=>r(e).join(`, `)).filter(Boolean):r(t)}var W4,G4=s((()=>{xa(),Ya(),N4(),R4(),L$(),W4=e=>e!=null&&e!==``&&!(Array.isArray(e)&&!e.length)})),K4=s((()=>{})),q4,J4=s((()=>{Ya(),q4=Va({choose:`Choose…`,loading:`Loading…`,couldNotLoad:`The choices could not be loaded.`,nothingToChoose:`Nothing to choose from.`,noMatches:`Nothing matches.`,firstOnly:`The first {count} only. Type to search.`,path:`Path`})})),Y4=l({TreePicker:()=>X4});function X4({from:e,by:t,labelColumn:n,parent:r,where:i,ask:a,scope:o,value:s,onChange:c,known:l,id:u,ariaLabel:d,listLabel:f,describedBy:p,invalid:m,required:h,disabled:g,placeholder:_,inputRef:v}){let y=kK(),b=(0,Z4.useId)(),x=`${b}-tree`,S=`${b}-trail`,[C,w]=(0,Z4.useState)(new Map),[T,E]=(0,Z4.useState)(new Map),[D,O]=(0,Z4.useState)(new Set),[k,A]=(0,Z4.useState)(new Map),[j,M]=(0,Z4.useState)(new Set),[N,P]=(0,Z4.useState)(!1),[F,I]=(0,Z4.useState)(``),[L,R]=(0,Z4.useState)(!1),[z,B]=(0,Z4.useState)(``),[V,H]=(0,Z4.useState)(),[U,W]=(0,Z4.useState)(),G=(0,Z4.useRef)(C);G.current=C;let ee=(0,Z4.useRef)(new Set),te=JSON.stringify([o,e,t,n,r,i??``]),[ne,K]=(0,Z4.useState)(te);ne!==te&&(K(te),w(new Map),E(new Map),O(new Set),A(new Map),M(new Set),H(void 0),ee.current=new Set);let re=`show ${[...new Set([t,n,r])].join(`, `)}`,q=e=>{let i=e?.[t];if(!(typeof i==`string`||typeof i==`number`&&Number.isSafeInteger(i)))return null;let a=e[r];return{key:String(i),value:i,label:String(e[n]??i),parent:n3(a)?null:String(a)}},ie=e=>{if(!e.length)return;let t=new Map(G.current);for(let n of e)t.set(n.key,n);G.current=t,w(t)},ae=(e,t)=>y.fetchQuery({queryKey:[`tree-picker`,o,e,t],staleTime:3e4,queryFn:async()=>{let n=await a(`/api/run`,{q:e,limit:t,offset:0,count:`none`});if(n.errors?.length||!Array.isArray(n.rows))throw Error(q4(`couldNotLoad`));return n.rows}}),oe=t=>y.fetchQuery({queryKey:[`tree-picker`,o,`branches`,e,r,i??``,t],staleTime:3e4,queryFn:async()=>{let n=await a(`/api/breakdown`,{text:`${e} ${vn(i,`${r} in (${t.map(wn).join(`, `)})`)} count as children by ${r}`,limit:t.length});if(n.errors?.length||!Array.isArray(n.rows))throw Error(q4(`couldNotLoad`));return new Set(n.rows.filter(e=>Number(e.children)>0).map(e=>String(e[r])))}}),se=async t=>{if(ee.current.has(t))return;ee.current.add(t),E(e=>new Map(e).set(t,`loading`));let a=G.current.get(t),o=t===``?`${r} is empty`:`${r} = ${wn(a?a.value:t)}`;try{let r=await ae(`${e} ${vn(i,o)} ${re} sort ${n}`,201),a=r.slice(0,$4).map(q).filter(e=>e!==null);if(ie(a),E(e=>new Map(e).set(t,a.map(e=>e.key))),r.length>$4&&O(e=>new Set(e).add(t)),t!==``&&A(e=>new Map(e).set(t,a.length>0)),!a.length)return;let s=await oe(a.map(e=>e.value)).catch(()=>void 0);s&&A(e=>{let t=new Map(e);for(let e of a)t.has(e.key)&&t.get(e.key)===!1||t.set(e.key,s.has(e.key));return t})}catch{ee.current.delete(t),E(e=>new Map(e).set(t,`error`))}},ce=(e,t=C)=>{let n=[],r=new Set;for(let i=t.get(e);i&&!r.has(i.key)&&n.length<=t3;i=i.parent===null?void 0:t.get(i.parent))r.add(i.key),n.unshift(i);return n},le=async n=>{let r=e=>[...new Set(e.flatMap(e=>e.parent===null||G.current.has(e.parent)?[]:[e.parent]))],i=r(n);for(let n=0;n<t3&&i.length;n++){let n=(await ae(`${e} ${t} in (${i.map(wn).join(`, `)}) ${re}`,i.length)).map(q).filter(e=>e!==null);ie(n),i=r(n)}},ue=n3(s)?void 0:String(s);(0,Z4.useEffect)(()=>{if(s===void 0||s===``)return;let n=!0,r=G.current.get(String(s));return(r?Promise.resolve(r):ae(`${e} ${vn(i,`${t} = ${wn(s)}`)} ${re}`,1).then(e=>{let t=q(e[0]);return t&&n&&ie([t]),t})).then(e=>e&&n?le([e]):void 0).catch(()=>{}),()=>{n=!1}},[s,te]);let de=L&&F.trim()!==``;(0,Z4.useEffect)(()=>{let e=setTimeout(()=>B(F.trim()),150);return()=>clearTimeout(e)},[F]),(0,Z4.useEffect)(()=>{if(!N||!de||!z)return;let t=!0,r=`${n} contains ${JSON.stringify(z)}`;return ae(`${e} ${vn(i,r)} ${re} sort ${n}`,e3).then(async e=>{let n=e.map(q).filter(e=>e!==null);ie(n),await le(n).catch(()=>{}),t&&H({for:z,keys:n.map(e=>e.key)})}).catch(()=>t&&H({for:z,error:!0})),()=>{t=!1}},[N,de,z,te]);let fe=(0,Z4.useRef)(!1);(0,Z4.useEffect)(()=>{if(!N||de){N||(fe.current=!1);return}if(se(``),fe.current||!ue)return;let e=ce(ue);if(!e.length||e[0].parent!==null)return;fe.current=!0;let t=e.slice(0,-1);M(e=>new Set([...e,...t.map(e=>e.key)]));for(let e of t)se(e.key);W(ue)},[N,de,ue,C]);let pe=e=>k.get(e)!==!1,me=[];if(de){let e=V?.for===F.trim()?V:void 0;if(!e)me.push({key:`note:`,depth:1,note:q4(`loading`)});else if(`error`in e)me.push({key:`note:`,depth:1,note:q4(`couldNotLoad`)});else if(!e.keys.length)me.push({key:`note:`,depth:1,note:q4(`noMatches`)});else for(let t of e.keys){let e=C.get(t);e&&me.push({key:t,depth:1,node:e,path:ce(t).slice(0,-1).map(e=>e.label)})}}else{let e=(t,n,r)=>{let i=T.get(t);if(i===void 0||i===`loading`)return void me.push({key:`note:${t}`,depth:n,note:q4(`loading`)});if(i===`error`)return void me.push({key:`note:${t}`,depth:n,note:q4(`couldNotLoad`)});!i.length&&t===``&&me.push({key:`note:`,depth:n,note:q4(`nothingToChoose`)});for(let t of i){let i=C.get(t);i&&!r.has(t)&&(me.push({key:t,depth:n,node:i}),j.has(t)&&pe(t)&&e(t,n+1,new Set(r).add(t)))}D.has(t)&&me.push({key:`more:${t}`,depth:n,note:q4(`firstOnly`,{count:Wi($4)})})};N&&e(``,1,new Set)}let J=me.filter(e=>e.node),he=J.find(e=>e.key===U)??(de?J[0]:void 0),ge=e=>`${b}-${me.indexOf(e)}`;(0,Z4.useEffect)(()=>{N&&he&&Ma(ge(he))?.scrollIntoView?.({block:`nearest`})},[N,he?.key]);let _e=e=>{M(t=>new Set(t).add(e)),se(e)},ve=e=>M(t=>{let n=new Set(t);return n.delete(e),n}),ye=()=>{P(!1),ue!==void 0&&(R(!1),I(``))},be=e=>{c(e.value,e.label),R(!1),I(``),W(e.key),P(!1)},xe=e=>{let t=he?J.indexOf(he):-1,n=e=>e&&W(e.key),r=N&&!de&&he?.node,i={ArrowDown:()=>N?n(J[Math.min(t+1,J.length-1)]):P(!0),ArrowUp:()=>N?n(J[Math.max(t-1,0)]):P(!0),Home:N&&!de?()=>n(J[0]):void 0,End:N&&!de?()=>n(J[J.length-1]):void 0,ArrowRight:r?()=>{let e=he.key,t=T.get(e);j.has(e)?Array.isArray(t)&&t.length&&W(t[0]):pe(e)&&_e(e)}:void 0,ArrowLeft:r?()=>{let e=he.node;j.has(e.key)&&pe(e.key)?ve(e.key):e.parent!==null&&J.some(t=>t.key===e.parent)&&W(e.parent)}:void 0,Enter:N&&he?.node?()=>be(he.node):void 0,Escape:N?()=>{e.stopPropagation(),ye()}:void 0}[e.key];i&&(e.preventDefault(),i())},Se=(0,Z4.useRef)(null),[Ce,we]=(0,Z4.useState)(null),[Te,Ee]=(0,Z4.useState)(null);(0,Z4.useLayoutEffect)(()=>{if(!N||!Se.current)return;let e=Se.current;Ee(e.closest(`dialog, [role="dialog"]`));let t=()=>{let t=ws(e).width;we(t>0?t:null)};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[N]);let De=L?F:ue===void 0?``:C.get(ue)?.label??l??ue,Oe=ue===void 0||L?[]:ce(ue),ke=Oe.length>1;return(0,Q4.jsxs)(`div`,{className:`tree-picker`,children:[(0,Q4.jsxs)(`div`,{className:`picker`,ref:Se,children:[(0,Q4.jsx)(`input`,{ref:v,id:u,className:`picker-input`,role:`combobox`,"aria-label":d,"aria-expanded":N,"aria-controls":x,"aria-haspopup":de?`listbox`:`tree`,"aria-autocomplete":`list`,"aria-activedescendant":N&&he?ge(he):void 0,"aria-describedby":[p,ke?S:void 0].filter(Boolean).join(` `)||void 0,"aria-invalid":m||void 0,required:h,disabled:g,placeholder:_??q4(`choose`),autoComplete:`off`,value:De,onChange:e=>{I(e.target.value),R(!0),W(void 0),P(!0),ue!==void 0&&c(``)},onClick:()=>!g&&P(!0),onBlur:ye,onKeyDown:xe}),(0,Q4.jsx)(JB,{open:N&&!g,modal:!1,onOpenChange:()=>{},children:(0,Q4.jsx)(HV,{container:Te??ja(),children:(0,Q4.jsx)(BH,{anchor:()=>Se.current?cU(Se.current):null,positionMethod:`fixed`,side:`bottom`,align:`start`,sideOffset:4,collisionBoundary:lU(),collisionPadding:8,style:{zIndex:40,width:Ce===null?`var(--anchor-width)`:`${Ce}px`,maxWidth:`var(--available-width)`},children:(0,Q4.jsx)(rU,{role:`presentation`,initialFocus:!1,finalFocus:!1,className:`picker-popup tree-picker-popup`,onMouseDown:e=>e.preventDefault(),children:(0,Q4.jsx)(`ul`,{id:x,role:de?`listbox`:`tree`,"aria-label":d??f,className:`picker-list`,children:me.map(e=>{let t=e.node;if(!t)return(0,Q4.jsx)(`li`,{role:`presentation`,className:`picker-empty`,style:{paddingInlineStart:r3(e.depth)},children:e.note},e.key);let n=e===he,r=!de&&pe(t.key);return(0,Q4.jsxs)(`li`,{id:ge(e),role:de?`option`:`treeitem`,"aria-level":de?void 0:e.depth,"aria-expanded":r?j.has(t.key):void 0,"aria-selected":n,className:`picker-option tree-picker-option${n?` active`:``}${t.key===ue?` chosen`:``}`,style:de?void 0:{paddingInlineStart:r3(e.depth)},onClick:()=>be(t),children:[!de&&(0,Q4.jsx)(`span`,{className:`tree-picker-caret${r?``:` is-leaf`}`,"aria-hidden":`true`,onClick:e=>{e.stopPropagation(),W(t.key),r&&(j.has(t.key)?ve(t.key):_e(t.key))},children:r&&(0,Q4.jsx)(Pe,{name:j.has(t.key)?`caret-down`:`caret-right`,size:12})}),(0,Q4.jsx)(`span`,{className:`picker-option-label`,children:t.label}),e.path&&e.path.length>0&&(0,Q4.jsx)(`span`,{className:`picker-option-detail tree-picker-path`,children:e.path.join(` › `)})]},e.key)})})})})})})]}),ke&&(0,Q4.jsx)(`p`,{id:S,className:`tree-picker-trail`,"aria-label":q4(`path`),children:Oe.map((e,t)=>(0,Q4.jsxs)(Z4.Fragment,{children:[t>0&&(0,Q4.jsx)(`span`,{className:`tree-picker-sep`,"aria-hidden":`true`,children:`›`}),(0,Q4.jsx)(`span`,{children:e.label})]},e.key))})]})}var Z4,Q4,$4,e3,t3,n3,r3,i3=s((()=>{K4(),Z4=d(m(),1),kJ(),sU(),uU(),Os(),Pa(),sr(),Fe(),xa(),J4(),Q4=d(O(),1),$4=200,e3=20,t3=12,n3=e=>e==null||e===``,r3=e=>`calc(var(--space-2) + ${(e-1)*18}px)`})),a3=l({CommandReferenceField:()=>p3,ReferenceName:()=>u3,ReviewNamed:()=>f3,commandChoicePage:()=>_3,commandChoices:()=>g3,readReferenceName:()=>l3,run:()=>o3});async function o3(e,t){return s3(e,`/api/run`,t)}async function s3(e,t,n){if(typeof e==`string`)return Ps(t,{...ao(e),...n});let{app:r,via:i}=e.visitor,a=new URLSearchParams({app:r,...i?{via:i}:{}}),o=await Eo(`${t}?${a}`,{method:`POST`,credentials:`same-origin`,signal:AbortSignal.timeout(15e3),headers:{"content-type":`application/json`,"x-mistri-read":`picker`},body:JSON.stringify(n)});if(!o.ok)throw Error(V2(`choicesCouldNotBeLoaded`));return o.json()}function c3(e,t){if(typeof t!=`string`||!Gs.schema)return;let n=Gs.schema,r=lt(n,e.from);if(!r)return;let i={[e.labelColumn]:Hs(r.id,e.labelColumn)},a=y4(n,r,e.labelColumn,i);return a&&a.path!==e.by?a:void 0}async function l3(e,t,n){let r=c3(e,n),i=r?.declared?r:void 0,a=`${e.by} = ${typeof t==`number`?t:JSON.stringify(t)}`,o=await o3(n,{q:[e.from,vn(yn(e.query??``).head,a),S3(e,i)].join(` `),limit:1,offset:0,count:`none`});if(o.errors?.length||!Array.isArray(o.rows))throw Error(V2(`choicesCouldNotBeLoaded`));let s=o.rows[0],c=C3(s?.[e.labelColumn]);if(!s||c===void 0)return null;let l=i?b4(s[i.path]):void 0;return{label:c,...l?{detail:l}:{}}}function u3({field:e,value:t,source:n,identityEpoch:r}){let i=OJ({queryKey:[`reference-review-name`,r,n,e.from,e.by,e.labelColumn,e.query??``,t],retry:!1,gcTime:0,staleTime:0,refetchOnMount:`always`,queryFn:()=>l3(e,t,n)});return i.isPending?(0,b3.jsx)(`span`,{"aria-busy":`true`,children:V2(`loadingName`)}):i.isError?(0,b3.jsxs)(`span`,{children:[V2(`nameCouldNotBeLoaded`),` `,(0,b3.jsx)(UG,{intent:`quiet`,size:`compact`,onClick:()=>void i.refetch(),children:V2(`tryAgain`)})]}):i.data?(0,b3.jsxs)(b3.Fragment,{children:[i.data.label,i.data.detail&&(0,b3.jsxs)(`span`,{className:`review-detail`,children:[` · `,i.data.detail]})]}):(0,b3.jsx)(`span`,{children:V2(`noLongerAvailable`)})}function d3({field:e,value:t,from:n}){return e.type===`reference`&&(typeof t==`string`||typeof t==`number`)&&t!==``?(0,b3.jsx)(u3,{field:e,value:t,source:n.source,identityEpoch:n.identityEpoch}):(0,b3.jsx)(b3.Fragment,{children:V4(e,t)})}function f3({field:e,value:t,from:n}){if(e.type!==`group`)return(0,b3.jsx)(d3,{field:e,value:t,from:n});let r=t=>e.fields.map(e=>({member:e,held:t?.[e.name]})).filter(({held:e})=>W4(e)),i=e.repeat?(Array.isArray(t)?t:[]).map(r).filter(e=>e.length):r(t).map(e=>[e]);if(!i.length)return(0,b3.jsx)(b3.Fragment,{children:`—`});let a=t=>t.map(({member:t,held:r},i)=>(0,b3.jsxs)(y3.Fragment,{children:[i>0&&`, `,e.fields.length>1&&`${t.label}: `,(0,b3.jsx)(d3,{field:t,value:r,from:n})]},t.name));return i.length===1?(0,b3.jsx)(b3.Fragment,{children:a(i[0])}):(0,b3.jsx)(`ul`,{className:`review-lines`,children:i.map((e,t)=>(0,b3.jsx)(`li`,{children:a(e)},t))})}function p3(e){return e.field.tree?(0,b3.jsx)(m3,{...e}):(0,b3.jsx)(h3,{...e})}function m3({field:e,id:t,describedBy:n,invalid:r,connection:i,identityEpoch:a,value:o,disabled:s,onChange:c,isCurrent:l}){let u=typeof o==`string`||typeof o==`number`?o:``;return(0,b3.jsx)(x3,{from:e.from,by:e.by,labelColumn:e.labelColumn,parent:e.tree,where:yn(e.query??``).head||void 0,ask:(e,t)=>s3(i,e,t),scope:JSON.stringify([a,i]),value:u,known:u===``?void 0:D4(e,i,a,u),onChange:(t,n)=>{l()&&(t!==``&&n!==void 0&&E4(e,i,a,t,n),c(t))},id:t,listLabel:e.label,describedBy:n,invalid:r,required:e.required,disabled:s,placeholder:bQ(e.label)?O$(`choosePlaceholder`,{label:e.label.toLowerCase()}):O$(`chooseOne`)})}function h3({field:e,id:t,describedBy:n,invalid:r,connection:i,identityEpoch:a,value:o,disabled:s,onChange:c,isCurrent:l}){let u=t=>typeof t==`string`||typeof t==`number`?D4(e,i,a,t):void 0,[d,f]=(0,y3.useState)(o===void 0?``:u(o)??String(o)),[p,m]=(0,y3.useState)(o),h=(0,y3.useRef)(o);o!==p&&(m(o),o!==h.current&&f(o===void 0||o===``?``:u(o)??String(o)),h.current=o);let[g,_]=(0,y3.useState)(``),[v,y]=(0,y3.useState)(!1);(0,y3.useEffect)(()=>{let e=setTimeout(()=>_(d.trim()),150);return()=>clearTimeout(e)},[d]);let b=typeof o==`string`||typeof o==`number`?o:void 0,x=OJ({queryKey:[`command-choice-label`,a,i,e.from,e.by,e.labelColumn,e.query??``,b],retry:!1,enabled:b!==void 0&&b!==``&&l(),queryFn:async()=>{let t=await l3(e,b,i);return t&&E4(e,i,a,b,t.label),t?.label??null}});(0,y3.useEffect)(()=>{x.data&&b!==void 0&&d===String(b)&&f(x.data)},[x.data,b,d]);let S=OJ({queryKey:[`command-choices`,a,i,e,g],retry:!1,enabled:v&&!s&&l(),queryFn:async()=>{if(!l())throw Error(O$(`common.thisCommandFormIsNoLonger`));let t=await g3(e,g,i);if(!l())throw Error(O$(`common.thisCommandFormIsNoLonger`));return t}}),{choices:C,answered:w}=z2({typed:d,asked:g,placeholder:S.isPlaceholderData,rows:S.data,label:e=>e.label}),T=x4(C.map(e=>e.label));return(0,b3.jsx)(`div`,{className:`picker`,children:(0,b3.jsx)(L2,{text:d,onText:e=>{f(e),h.current=``,c(``)},open:v&&!s,onOpenChange:y,items:C,itemKey:e=>`${typeof e.value}:${e.value}`,itemLabel:e=>e.label,itemClassName:(e,t)=>`picker-option${t?` active`:``}`,renderItem:e=>(0,b3.jsxs)(b3.Fragment,{children:[(0,b3.jsx)(`span`,{className:`picker-option-label`,children:e.label}),e.detail&&(e.declared||T.has(e.label))&&(0,b3.jsx)(`span`,{className:`picker-option-detail`,children:e.detail})]}),onPick:t=>{l()&&(E4(e,i,a,t.value,t.label),h.current=t.value,c(t.value),f(t.label),y(!1))},inputProps:{id:t,"aria-describedby":n,"aria-invalid":r||void 0,required:e.required,disabled:s,className:`picker-input`,placeholder:bQ(e.label)?O$(`choosePlaceholder`,{label:e.label.toLowerCase()}):O$(`chooseOne`)},fit:`width`,popupClassName:`picker-popup`,listClassName:`picker-list`,emptyClassName:`picker-empty`,empty:S.isError?V2(`choicesCouldNotBeLoaded`):S.isFetching||!w?V2(`loadingChoices`):V2(`noMatchingChoices`)})})}async function g3(e,t,n){return(await v3(e,t,n,20,0)).choices}async function _3(e,t,n,r,i){let a=await v3(e,t,n,i+1,r);return{choices:a.choices.slice(0,i),more:a.rows>i}}async function v3(e,t,n,r,i){let a=vn(yn(e.query??``).head,t?`${e.labelColumn} contains ${JSON.stringify(t)}`:``),o=c3(e,n),s=await o3(n,{q:[e.from,a,S3(e,o),`sort ${e.labelColumn}`].filter(Boolean).join(` `),limit:r,offset:i,count:`none`});if(s.errors?.length||!Array.isArray(s.rows))throw Error(V2(`choicesCouldNotBeLoaded`));return{choices:s.rows.slice(0,r).flatMap(t=>{let n=t[e.by];return typeof n==`string`||typeof n==`number`&&Number.isSafeInteger(n)?[{value:n,label:String(t[e.labelColumn]??n),...o&&b4(t[o.path])?{detail:b4(t[o.path]),declared:o.declared}:{}}]:[]}),rows:s.rows.length}}var y3,b3,x3,S3,C3,w3=s((()=>{y3=d(m()),kJ(),tc(),Do(),uo(),R2(),GG(),B2(),CQ(),wc(),k$(),H2(),sr(),St(),T4(),j4(),G4(),b3=d(O()),x3=vc(()=>Promise.resolve().then(()=>(i3(),Y4)),`TreePicker`,{quiet:!0}),S3=(e,t)=>`show ${[...new Set([e.by,e.labelColumn,...t?[t.path]:[]])].join(`, `)}`,C3=e=>e==null||e===``?void 0:String(e)})),T3=s((()=>{})),E3=s((()=>{}));function D3(e){let t=e.toUpperCase(),n=M3.get(t);if(n===void 0){try{n=new Intl.NumberFormat(`en`,{style:`currency`,currency:t}).resolvedOptions().maximumFractionDigits??2}catch{n=2}M3.set(t,n)}return n}function O3(e,t){let n=/^(-?)0*(\d+)$/.exec(typeof e==`number`?Number.isSafeInteger(e)?String(e):``:typeof e==`string`||typeof e==`bigint`?String(e).trim():``);if(!n)return;let r=D3(t),i=n[2].padStart(r+1,`0`);return(/[1-9]/.test(i)?n[1]:``)+(r?`${i.slice(0,-r)}.${i.slice(-r)}`:i)}function k3(e,t){let n=O3(e,t);if(n!==void 0)return n;let r=typeof e==`number`?e:typeof e==`string`&&e.trim()?Number(e):NaN;return Number.isFinite(r)?r/10**D3(t):void 0}function A3(e,t){if(!e?.currencyColumn)return;let n=t.lastIndexOf(`.`);return n<0?e.currencyColumn:`${t.slice(0,n+1)}${e.currencyColumn}`}function j3(e,t,n,r=``){let i=A3(e,r),a=i&&t?t[i]:void 0;return typeof a==`string`&&/^[A-Za-z]{3}$/.test(a.trim())?a.trim().toUpperCase():e?.currency??n}var M3,N3=s((()=>{M3=new Map})),P3,F3,I3,L3=s((()=>{P3=`house.tray.list.list-checks.kanban.table.calendar.calendar-check.clock.chart-bar.chart-line.chart-pie.gauge.target.flag.user.users.user-circle.address-book.handshake.buildings.storefront.briefcase.package.truck.car.shopping-cart.receipt.currency-dollar.credit-card.wallet.bank.file.file-text.folder.clipboard-text.note.archive.tag.ticket.star.bookmark-simple.bell.envelope.chat-circle.phone.headset.megaphone.globe.map-pin.magnifying-glass.gear.sliders.wrench.bug.shield-check.lock.key.database.stack.lightning.check-circle.warning.info.cell-signal-low.cell-signal-medium.cell-signal-high.cell-signal-full.fire.hourglass.circle-dashed.x-circle.plus-circle.pencil-simple.paper-plane-tilt.arrows-left-right.arrow-circle-down.arrow-circle-up.laptop.monitor.device-mobile.printer.stethoscope.heartbeat.heart.pill.syringe.first-aid-kit.thermometer.flask.test-tube.microscope.bed.hospital.ambulance.tooth.eyeglasses.wheelchair.baby.dna.brain.bandaids.hand-heart.graduation-cap.book-open.student.chalkboard-teacher.factory.warehouse.house-line.plant.leaf.sun.cloud.drop.airplane.bicycle.bus.train.boat.hammer.toolbox.plug.lightbulb.cube.camera.image.trophy.gift.coffee.fork-knife.shopping-bag.basket.barcode.qr-code.scales.gavel.certificate.identification-card.fingerprint.eye.link.paperclip.scissors.palette.code.terminal.users-three.user-plus.caret-left.caret-right.caret-up.caret-down.arrow-left.arrow-right.x.plus.dots-three`.split(`.`),F3=new Set(P3),I3=e=>typeof e==`string`&&F3.has(e)})),R3,z3=s((()=>{Ya(),R3=Va({choosePlaceholder:`Choose {label}`,chooseOne:`Choose one`,showValue:`Show`,hideValue:`Hide`,yesWord:`Yes`,noWord:`No`,monthPlaceholder:`MM/YYYY`})})),B3=l({IntakeControl:()=>Z3,drawnHere:()=>U3});function V3(e,t,n){let r=(e.type===`choice`||e.type===`choices`)&&e.source?e.source:void 0,i=r?.match,a=i?Yr(i,n??{}):void 0,o=i&&a?li(a):void 0,s=r&&(e.type===`choice`||e.type===`choices`)&&(r.served||e.options.length)?e.options:void 0,c=r?qr(r,Ri()):void 0,l=OJ({queryKey:[`command-choices`,typeof t==`string`?t:t?.visitor,r?.from,r?.by,r?.labelColumn,r?.sort?.column,r?.sort?.direction,c?.column,...i?ii(i).map(e=>n?.[e]??null):[]],enabled:r!==void 0&&t!==void 0&&s===void 0&&(!i||a!==void 0),staleTime:6e4,queryFn:async()=>{let e=[...new Set([r.by,r.labelColumn,...c?[c.column]:[]])].join(`, `),n=await o3(t,{q:`${r.from}${o?` ${o}`:``} show ${e} sort ${r.sort?`${r.sort.column} ${r.sort.direction}`:r.labelColumn}`,limit:e6,offset:0,count:`none`});return Jr((Array.isArray(n.rows)?n.rows:[]).filter(e=>typeof e[r.by]==`string`||typeof e[r.by]==`number`),r,c)}});if(r)return i&&!a?[]:s&&i?s.filter(e=>Xr(a,e.row)):s??l.data}function H3(e,t){let{field:n,value:r,onChange:i}=e,a=(n.type===`choice`||n.type===`choices`)&&n.source?.match!==void 0,o=t?.map(e=>String(e.value)).join(`\0`);(0,Q3.useEffect)(()=>{if(!a||!t)return;let e=new Set(t.map(e=>String(e.value)));if(Array.isArray(r)){let t=r.filter(t=>e.has(String(t)));t.length!==r.length&&i(t)}else r!==void 0&&r!==``&&!e.has(String(r))&&i(``)},[a,o,r])}function U3(e){switch(e.type){case`money`:case`month`:case`choices`:return!0;case`number`:return e.as===`slider`;case`text`:return e.mask!==void 0||e.sensitive!==void 0;case`boolean`:return e.as===`buttons`||e.statement!==void 0;case`choice`:return e.as===`cards`||e.as===`buttons`||e.source!==void 0;default:return!1}}function W3(e,t){let n=[...e].filter(e=>L4.test(e)),r=``;for(let e of t){let t=n[r.length];if(!t)break;(t===`0`?/\d/.test(e):t===`a`?/[A-Za-z]/.test(e):/[A-Za-z0-9]/.test(e))&&(r+=e)}return r}function G3(e){let t=e.replace(/\D/g,``).slice(0,6);return t.length===6?`${t.slice(2)}-${t.slice(0,2)}`:t}function K3(e){if(!(e.length<3||e.some(e=>e.label.length>o6)))return e.every(e=>!e.help&&e.label.length<=a6)?`short`:e.every(e=>(e.help?.length??0)<=s6)?`brief`:void 0}function q3(e){let t=V3(e.field,e.source,e.answers);H3(e,t);let{field:n,id:r,value:i,disabled:a,onChange:o}=e;if(n.type!==`choice`&&n.type!==`choices`||!t)return null;let s=t,c={...n,options:s,source:void 0};if(n.type===`choice`&&n.as===`radios`)return(0,$3.jsx)(A$,{id:r,options:s,value:i,describedBy:e[`aria-describedby`],required:n.required,invalid:e[`aria-invalid`]===!0||e[`aria-invalid`]===`true`,disabled:a,onChange:o});if(n.type===`choice`&&n.as!==`cards`&&n.as!==`buttons`&&(n.as===`select`||s.length>t6)){let t=s.findIndex(e=>e.value===i);return(0,$3.jsx)(xQ,{id:r,ariaLabelledBy:`${r}-label`,ariaInvalid:e[`aria-invalid`]===!0||e[`aria-invalid`]===`true`,ariaDescribedBy:e[`aria-describedby`],disabled:a,value:t<0?``:String(t),valueClassName:t<0?`is-empty`:void 0,items:[...t<0?[{value:``,label:bQ(n.label)?R3(`choosePlaceholder`,{label:n.label.toLowerCase()}):R3(`chooseOne`)}]:[],...s.map((e,t)=>({value:String(t),label:e.label}))],onChange:e=>{e!==``&&o(s[Number(e)].value)}})}return(0,$3.jsx)(Z3,{...e,field:c})}function J3(e){let t=String(e??``),n=Number(t);return t.trim()&&Number.isFinite(n)?n.toLocaleString(Ri(),{maximumFractionDigits:20}):t}function Y3(e,t){let n=String(e??``);if(!/^-?\d*\.?\d*$/.test(n.trim())||!/\d/.test(n))return n;try{return new Intl.NumberFormat(Ri(),{minimumFractionDigits:t,maximumFractionDigits:t}).format(n.trim())}catch{return n}}function X3(e,t){let[n,...r]=e.replace(/[^\d.-]/g,``).split(`.`);return t&&r.length?`${n}.${r.join(``).slice(0,t)}`:n}function Z3(e){let{field:t,id:n,value:r,disabled:i,onChange:a}=e,o={"aria-describedby":e[`aria-describedby`],"aria-invalid":e[`aria-invalid`]},[s,c]=(0,Q3.useState)(!1),[l,u]=(0,Q3.useState)(!1);if(t.type===`money`&&t.as!==`slider`){let s=(t.currency||e.currency)??void 0,c=I4(s),d=t.minor?D3(s||Hi()):void 0;return(0,$3.jsxs)(`div`,{className:`intake-money`,children:[(0,$3.jsx)(`span`,{className:`intake-money-symbol`,"aria-hidden":`true`,children:c}),(0,$3.jsx)(`input`,{...o,id:n,className:`field-control`,style:{paddingInlineStart:`calc(var(--money-pad) + ${c.length}ch + var(--space-2))`},type:`text`,inputMode:(d===void 0?t.step!==void 0&&Number.isInteger(t.step):d===0)?`numeric`:`decimal`,enterKeyHint:`next`,autoComplete:`off`,placeholder:t.placeholder,disabled:i,required:t.required,value:l?String(r??``):d===void 0?J3(r):Y3(r,d),onFocus:()=>u(!0),onBlur:()=>u(!1),onChange:e=>a(d===void 0?e.target.value.replace(/[^\d.-]/g,``):X3(e.target.value,d))})]})}if(t.type===`month`)return(0,$3.jsx)(`input`,{...o,id:n,className:`field-control intake-month`,type:`text`,inputMode:`numeric`,enterKeyHint:`next`,autoComplete:`off`,placeholder:Fa(`mistri.form.monthHint`,R3(`monthPlaceholder`)),disabled:i,required:t.required,value:r6(typeof r==`string`?r:``),onChange:e=>a(G3(e.target.value))});if((t.type===`number`||t.type===`money`)&&t.as===`slider`){let s=t.min??0,c=t.max??100,l=typeof r==`number`?r:r===void 0||r===``?s:Number(r),u=c>s?(l-s)/(c-s)*100:0,d=n=>t.type===`money`?F4(n,e.currency,t.step):n.toLocaleString(Ri()),f=d(l);return(0,$3.jsxs)(`div`,{className:`intake-slider`,children:[(0,$3.jsx)(`output`,{className:`field-control field-readout`,htmlFor:n,"aria-hidden":`true`,children:f}),(0,$3.jsx)(`input`,{...o,id:n,type:`range`,className:`field-range`,min:s,max:c,step:t.step??(t.type===`money`||t.integer?1:`any`),value:l,disabled:i,"aria-valuetext":f,style:{"--range-share":`${u}%`},onChange:e=>a(Number(e.target.value))}),(0,$3.jsxs)(`div`,{className:`intake-slider-ends`,"aria-hidden":`true`,children:[(0,$3.jsx)(`span`,{children:d(s)}),(0,$3.jsx)(`span`,{children:d(c)})]})]})}if(t.type===`text`&&t.sensitive){let e=typeof r==`string`?r:``,l=t.mask?P4(t.mask,e):e;return(0,$3.jsxs)(`div`,{className:`field-with-action`,children:[(0,$3.jsx)(`input`,{...o,id:n,className:`field-control${s?``:` field-hidden`}`,type:s?`text`:`password`,inputMode:t.mask?n6(t.mask):`text`,enterKeyHint:`next`,autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`off`,spellCheck:!1,"data-1p-ignore":!0,"data-lpignore":`true`,placeholder:t.placeholder,disabled:i,required:t.required,value:l,onChange:e=>a(t.mask?W3(t.mask,e.target.value):e.target.value)}),(0,$3.jsx)(UG,{intent:`quiet`,"aria-controls":n,"aria-pressed":s,onClick:()=>c(!s),children:R3(s?`hideValue`:`showValue`)})]})}if(t.type===`text`&&t.mask){let e=t.mask;return(0,$3.jsx)(`input`,{...o,id:n,className:`field-control`,type:`text`,inputMode:n6(e),enterKeyHint:`next`,autoComplete:`off`,placeholder:t.placeholder??e.replace(/[0a*]/g,`_`),disabled:i,required:t.required,value:P4(e,typeof r==`string`?r:``),onChange:t=>a(W3(e,t.target.value))})}if(t.type===`boolean`)return t.as===`buttons`?(0,$3.jsx)(`div`,{className:`choice-pair`,role:`radiogroup`,id:n,"aria-labelledby":`${n}-label`,...o,children:[!0,!1].map(e=>(0,$3.jsxs)(`label`,{className:`choice-pick${r===e?` is-on`:``}`,children:[(0,$3.jsx)(`input`,{type:`radio`,name:n,className:`choice-input`,checked:r===e,disabled:i,onChange:()=>a(e)}),e?Fa(`mistri.form.yes`,R3(`yesWord`)):Fa(`mistri.form.no`,R3(`noWord`))]},String(e)))}):(0,$3.jsxs)(`span`,{className:`intake-consent`,children:[(0,$3.jsx)(`input`,{...o,id:n,type:`checkbox`,className:`command-check field-check`,required:t.accept===!0,checked:r===!0,disabled:i,onChange:e=>a(e.target.checked)}),(0,$3.jsx)(`span`,{className:`intake-statement`,children:t.statement})]});if((t.type===`choice`||t.type===`choices`)&&t.source)return(0,$3.jsx)(q3,{...e});if(t.type===`choice`||t.type===`choices`){let s=t.type===`choices`,c=s?Array.isArray(r)?r:[]:r===void 0?[]:[r],l=t.type===`choices`?t.exclusive??[]:[],u=(e,n)=>{if(!s)return a(e.value);if(l.includes(e.value))return a(n?[e.value]:[]);let r=c.filter(t=>t!==e.value&&!l.includes(t));a(t.options.map(e=>e.value).filter(t=>n&&t===e.value||r.includes(t)))},d=t.as===`buttons`;return s?(0,$3.jsx)(g1,{id:n,"aria-labelledby":`${n}-label`,"aria-describedby":e[`aria-describedby`],"aria-invalid":e[`aria-invalid`],disabled:i,fit:K3(t.options),cards:t.options.map(e=>({key:i6(e),label:e.label,icon:e.icon&&I3(e.icon)?(0,$3.jsx)(Pe,{name:e.icon}):void 0,help:e.help,on:c.includes(e.value)})),onToggle:(e,n)=>u(t.options[e],n)}):(0,$3.jsx)(`div`,{className:d?`choice-pair intake-buttons`:`choice-cards`,"data-fit":d?void 0:K3(t.options),role:s?`group`:`radiogroup`,id:n,"aria-labelledby":`${n}-label`,"aria-required":!s&&t.required||void 0,...o,children:t.options.map(e=>{let t=c.includes(e.value);return(0,$3.jsxs)(`label`,{className:`${d?`choice-pick`:`choice-card`}${t?` is-on`:``}`,children:[e.icon&&!d&&I3(e.icon)?(0,$3.jsx)(`span`,{className:`choice-card-icon`,"aria-hidden":`true`,children:(0,$3.jsx)(Pe,{name:e.icon})}):null,(0,$3.jsxs)(`span`,{className:`choice-card-label`,children:[e.label,e.help&&!d?(0,$3.jsx)(`span`,{className:`intake-choice-help`,children:e.help}):null]}),(0,$3.jsx)(`input`,{type:s?`checkbox`:`radio`,name:s?void 0:n,className:`choice-input`,checked:t,disabled:i,onChange:t=>u(e,t.target.checked)}),d?null:(0,$3.jsx)(`span`,{className:`choice-box`,"aria-hidden":`true`})]},i6(e))})})}return null}var Q3,$3,e6,t6,n6,r6,i6,a6,o6,s6,c6=s((()=>{Q3=d(m()),kJ(),CQ(),GG(),v1(),w3(),T3(),E3(),ui(),xa(),N3(),Fe(),L3(),Ya(),z3(),R4(),M$(),$3=d(O()),e6=200,t6=6,n6=e=>[...e].every(e=>!L4.test(e)||e===`0`)?`numeric`:`text`,r6=e=>{let t=/^(\d{4})-(\d{2})$/.exec(e),n=t?`${t[2]}${t[1]}`:e.replace(/\D/g,``);return n.length>2?`${n.slice(0,2)}/${n.slice(2)}`:n},i6=e=>`${typeof e.value}:${e.value}`,a6=14,o6=24,s6=40}));function l6(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(/\s/.test(r)){n++;continue}if(/\d/.test(r)){let r=/\d+(?:\.\d+)?/y;r.lastIndex=n;let i=r.exec(e)[0];t.push({t:`number`,v:i,at:n}),n+=i.length;continue}if(r===`'`){let r=n+1,i=``;for(;;){if(r>=e.length)throw new lr(`a quoted text is not closed.`,n);if(e[r]===`'`){if(e[r+1]===`'`){i+=`'`,r+=2;continue}break}i+=e[r++]}if([...i].some(e=>e===`\\`||e.charCodeAt(0)<32||e.charCodeAt(0)===127))throw new lr(`a quoted text holds a backslash or a control character, which engines read differently.`,n);t.push({t:`text`,v:i,at:n}),n=r+1;continue}let i=e.slice(n,n+2);if([`!=`,`<>`,`<=`,`>=`].includes(i)){t.push({t:`op`,v:i===`<>`?`!=`:i,at:n}),n+=2;continue}if(`=<>+-*/(),`.includes(r)){t.push({t:`op`,v:r,at:n}),n++;continue}g6.lastIndex=n;let a=g6.exec(e);if(a)t.push({t:`word`,v:a[0],at:n}),n+=a[0].length;else throw new lr(`"${r}" is not part of an expression.`,n)}return t.push({t:`end`,v:``,at:e.length}),t}function u6(e,t){let n=l6(e),r=0,i=()=>n[r],a=e=>i().t===`word`&&i().v.toLowerCase()===e,o=()=>n[r++],s=e=>{if(i().t!==`op`||i().v!==e)throw new lr(`expected "${e}"${i().t===`end`?` before the end`:` at "${i().v}"`}.`,i().at);o()},c=()=>{let e=l();for(;a(`or`);)o(),e={k:`op`,op:`or`,left:e,right:l()};return e},l=()=>{let e=u();for(;a(`and`);)o(),e={k:`op`,op:`and`,left:e,right:u()};return e},u=()=>a(`not`)?(o(),{k:`not`,of:u()}):d(),d=()=>{let e=f();if(a(`is`)){o();let t=a(`not`);if(t&&o(),!a(`empty`))throw new lr(`say "is empty" or "is not empty".`,i().at);return o(),{k:`empty`,of:e,negate:t}}let c=a(`not`)&&n[r+1].t===`word`&&n[r+1].v.toLowerCase()===`in`;if(c||a(`in`)){c&&o(),o(),s(`(`);let a=[];for(;;){let c=i(),l=n[r+1];if(a.push(e.k===`path`&&c.t===`word`&&!m6.has(c.v.toLowerCase())&&!c.v.includes(`.`)&&!t(c.v)&&l.t===`op`&&(l.v===`,`||l.v===`)`)?(o(),{k:`text`,value:c.v}):f()),i().t===`op`&&i().v===`,`)o();else{s(`)`);break}}let l=a.map(t=>({k:`op`,op:`=`,left:e,right:t})).reduce((e,t)=>({k:`op`,op:`or`,left:e,right:t}));return c?{k:`not`,of:l}:l}let l=i();if(l.t===`op`&&[`=`,`!=`,`<`,`<=`,`>`,`>=`].includes(l.v)){o();let a=i(),s=(l.v===`=`||l.v===`!=`)&&e.k===`path`&&a.t===`word`&&!m6.has(a.v.toLowerCase())&&!a.v.includes(`.`)&&!t(a.v)&&(n[r+1].t===`end`||n[r+1].t===`word`||n[r+1].t===`op`&&n[r+1].v===`)`)?(o(),{k:`text`,value:a.v}):f();if(l.v===`=`&&s.k===`path`&&/^null$/i.test(s.path))throw new lr(`"= null" is never true; say "is empty".`,a.at);return{k:`op`,op:l.v,left:e,right:s}}return e},f=()=>{let e=p();for(;i().t===`op`&&(i().v===`+`||i().v===`-`);)e={k:`op`,op:o().v,left:e,right:p()};return e},p=()=>{let e=m();for(;i().t===`op`&&(i().v===`*`||i().v===`/`);)e={k:`op`,op:o().v,left:e,right:m()};return e},m=()=>{if(i().t===`op`&&i().v===`-`)return o(),{k:`neg`,of:m()};let e=h();return i().t===`word`&&Object.hasOwn(h6,i().v.toLowerCase())?{k:`span`,of:e,unit:h6[o().v.toLowerCase()]}:e},h=()=>{let e=o();if(e.t===`number`)return{k:`number`,value:Number(e.v)};if(e.t===`text`)return{k:`text`,value:e.v};if(e.t===`op`&&e.v===`(`){let e=c();return s(`)`),e}if(e.t===`word`){let n=e.v.toLowerCase();if(i().t===`op`&&i().v===`(`){if(!f6(n))throw new lr(`"${e.v}" is not a function; an expression calls ${d6.join(`, `)}.`,e.at);o();let t=[];if(i().t!==`op`||i().v!==`)`)for(;t.push(c()),i().t===`op`&&i().v===`,`;)o();s(`)`);let r=n,a=r===`coalesce`||r===`min`||r===`max`;if(r===`concat`?t.length<1:a?t.length<2:r===`round`?t.length<1||t.length>2:t.length!==1)throw new lr(r===`concat`?`concat(…) takes one text or more: concat(first, ' ', last).`:a?`${r}(…) takes two values or more: ${r}(a, b).`:r===`round`?`round(…) takes a number and, if you like, how many places: round(total) or round(total, 2).`:`${r}(…) takes one number.`,e.at);if(r===`round`&&t[1]&&!(t[1].k===`number`&&Number.isInteger(t[1].value)&&t[1].value<=p6))throw new lr(`round(…)'s places are a whole number from 0 to ${p6}, written out: round(total, 2).`,e.at);return{k:`call`,fn:r,args:t}}if(n===`true`||n===`false`)return{k:`bool`,value:n===`true`};if(n===`today`||n===`now`||n===`me`)return{k:n};if(Object.hasOwn(h6,n)&&t(e.v))return{k:`path`,path:e.v};if([`and`,`or`,`not`,`is`,`empty`,`in`].includes(n)||Object.hasOwn(h6,n))throw new lr(`"${e.v}" stands where a value goes.`,e.at);return{k:`path`,path:e.v}}throw new lr(e.t===`end`?`the expression ends where a value goes.`:`"${e.v}" stands where a value goes.`,e.at)},g=c();if(i().t!==`end`)throw new lr(`"${i().v}" follows a complete expression; join two with "and" or "or".`,i().at);return g}var d6,f6,p6,m6,h6,g6,_6=s((()=>{ur(),d6=[`coalesce`,`round`,`min`,`max`,`abs`,`concat`],f6=e=>d6.includes(e),p6=10,m6=new Set([`today`,`now`,`me`,`true`,`false`]),h6={minute:`minute`,minutes:`minute`,hour:`hour`,hours:`hour`,day:`day`,days:`day`,week:`week`,weeks:`week`,month:`month`,months:`month`,year:`year`,years:`year`},g6=/[A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z_$][A-Za-z0-9_$]*)*/y}));function v6(e,t){let n=10**t,r=Number((Math.abs(e)*n).toPrecision(15)),i=Math.round(r)/n;return i===0?0:Math.sign(e)*i}function y6(e,t,n=e=>{throw new lr(`"${e}" is a column, and this expression reads none.`,0)}){let r=e=>({count:Number(l(e.of)),unit:e.unit}),i=(e,t,n)=>{let r=`day`in e?new Date(`${e.day}T00:00:00Z`):new Date(e.instant),i=t.count*n;if(t.unit===`hour`||t.unit===`minute`)return{instant:new Date(r.getTime()+i*(t.unit===`hour`?36e5:6e4))};if(t.unit===`day`||t.unit===`week`)r.setTime(r.getTime()+i*(t.unit===`week`?7:1)*x6);else{let e=t.unit===`year`?i*12:i,n=r.getUTCDate();r.setUTCDate(1),r.setUTCMonth(r.getUTCMonth()+e);let a=new Date(Date.UTC(r.getUTCFullYear(),r.getUTCMonth()+1,0)).getUTCDate();r.setUTCDate(Math.min(n,a))}return`day`in e?{day:S6(r)}:{instant:r}},a=e=>typeof e==`object`&&!!e,o=e=>`day`in e?Date.parse(`${e.day}T00:00:00Z`):e.instant.getTime(),s=e=>a(e)?o(e):e,c=e=>e===null?null:!!e,l=e=>{switch(e.k){case`number`:return e.value;case`text`:return e.value;case`bool`:return e.value;case`today`:return{day:t.today};case`date`:return{day:e.value};case`now`:return{instant:t.now};case`instant`:return{instant:new Date(e.value)};case`me`:return t.me;case`nobody`:return null;case`not`:{let t=c(l(e.of));return t===null?null:!t}case`neg`:{let t=l(e.of);return t===null?null:-Number(t)}case`empty`:{let t=l(e.of);return(t===null||t===``)!==e.negate}case`span`:return Number(l(e.of));case`call`:{let t=e.args.map(l);if(e.fn===`coalesce`)return t.find(e=>e!==null)??null;if(e.fn===`concat`)return t.map(e=>e===null?``:String(e)).join(``);if(t.some(e=>e===null))return null;if(e.fn===`abs`)return Math.abs(Number(t[0]));if(e.fn===`round`)return v6(Number(t[0]),t[1]===void 0?0:Number(t[1]));let n=t[0];for(let r of t.slice(1)){let[t,i]=[s(r),s(n)];(e.fn===`min`?t<i:t>i)&&(n=r)}return n}case`path`:{let t=n(e.path);return t===void 0||t===``?null:t}case`json`:return b6(n(e.column),e.keys);case`op`:{if(e.op===`and`||e.op===`or`){let t=c(l(e.left)),n=c(l(e.right));return e.op===`and`?t===!1||n===!1?!1:t===null||n===null?null:!0:t===!0||n===!0?!0:t===null||n===null?null:!1}let t=l(e.left),n=l(e.right);if(C6.has(e.op)){if(t===null||n===null)return null;let r=s(t),i=s(n);switch(e.op){case`=`:return r===i;case`!=`:return r!==i;case`<`:return r<i;case`<=`:return r<=i;case`>`:return r>i;default:return r>=i}}if(t===null||n===null)return null;if(e.op===`+`||e.op===`-`){let s=e.op===`+`?1:-1;return a(t)&&a(n)&&e.op===`-`?Math.round((o(t)-o(n))/x6):a(t)&&!a(n)?i(t,e.right.k===`span`?r(e.right):{count:Number(n),unit:`day`},s):a(n)&&!a(t)&&e.op===`+`?i(n,e.left.k===`span`?r(e.left):{count:Number(t),unit:`day`},1):Number(t)+s*Number(n)}return e.op===`*`?Number(t)*Number(n):Number(n)===0?null:Number(t)/Number(n)}}},u=l(e);return u===null&&w6(e)?!1:u}function b6(e,t){let n=e;if(typeof n==`string`)try{n=JSON.parse(n)}catch{return null}for(let e of t){if(typeof n!=`object`||!n||Array.isArray(n)||!Object.hasOwn(n,e))return null;n=n[e]}return n==null?null:typeof n==`object`?JSON.stringify(n):String(n)}var x6,S6,C6,w6,T6=s((()=>{ur(),x6=864e5,S6=e=>e.toISOString().slice(0,10),C6=new Set([`=`,`!=`,`<`,`<=`,`>`,`>=`]),w6=e=>e.k===`not`||e.k===`empty`||e.k===`bool`||e.k===`op`&&(e.op===`and`||e.op===`or`||C6.has(e.op))})),E6=s((()=>{})),D6=l({CommandLive:()=>A6,liveFigures:()=>k6});function O6(e,t){let n=`${[...t].join(`,`)}|${e}`;if(!N6.has(n))try{N6.set(n,u6(e,e=>t.has(e)))}catch{N6.set(n,null)}return N6.get(n)}function k6(e,t,n){let r=new Set(t.filter(e=>e.type===`number`||e.type===`money`).map(e=>e.name)),i=[];for(let[t,a]of Object.entries(e.live??{})){let e=O6(a,r);if(!e)continue;let o=!1,s=y6(e,{today:``,now:new Date,me:null},e=>{let t=P6(n[e]);return t===null&&(o=!0),t});!o&&typeof s==`number`&&Number.isFinite(s)&&i.push([t,s])}return i}function A6({field:e,fields:t,values:n,id:r,currency:i=`USD`}){let a=(0,j6.useMemo)(()=>k6(e,t,n),[e,t,n]),o=t=>new Intl.NumberFormat(Ri(),e.type===`money`?{style:`currency`,currency:i,maximumFractionDigits:Math.abs(t)>=1e3?0:2}:{maximumFractionDigits:2}).format(t);return(0,M6.jsx)(`p`,{id:r,className:`command-live`,"aria-live":`polite`,children:a.map(([e,t],n)=>(0,M6.jsxs)(`span`,{children:[n>0&&` · `,o(t),` `,e]},e))})}var j6,M6,N6,P6,F6=s((()=>{ur(),_6(),T6(),xa(),j6=d(m()),E6(),M6=d(O()),N6=new Map,P6=e=>{if(typeof e==`number`)return Number.isFinite(e)?e:null;if(typeof e!=`string`||!e.trim())return null;let t=Number(e.replace(/[,\s]/g,``));return Number.isFinite(t)?t:null}})),I6=l({bindRecord:()=>Nre,boundText:()=>G6,brokenRules:()=>q6,choiceWhere:()=>J6,draftHolds:()=>K6,draftNames:()=>V6,readsRecord:()=>c8,readsTarget:()=>l8,recordComparisons:()=>o8});function L6(e,t){return e.replace(Wt,(e,n,r,i)=>Rt(t,n,Number(r),i))}function R6(e){switch(e.type){case`number`:case`money`:return`NUMERIC`;case`boolean`:return`BOOLEAN`;case`date`:return`DATE`;case`datetime`:return`TIMESTAMPTZ`;case`choice`:return e.options.length&&e.options.every(e=>typeof e.value==`number`)?`NUMERIC`:`TEXT`;case`text`:case`textarea`:case`month`:case`time`:case`reference`:return`TEXT`;case`choices`:return ln;default:return}}function z6(e){return e.flatMap(e=>{let t=R6(e);return!t||e.type===`text`&&e.sensitive?[]:[{name:e.name,type:t,nullable:!0,primaryKey:!1}]})}function B6(e,t,n=new Date,r){let i=L6(e8(e),i8(n)),a=r8(Y2(i,t,void 0,`record`,!0));if(!r)return a;let o=z6(r),s=new Set(o.map(e=>e.name));for(let e of a.flat())for(let t of[e.field,...e.other===void 0?[]:[e.other]])s.has(t)||(s.add(t),o.push({name:e8(t),type:``,nullable:!0,primaryKey:!1}));try{return r8(Y2(i,t,o,`record`,!0))}catch{return a}}function V6(e,t){let n=new Set,r=new Set,i=new Set,a=new Set,o=new Set,s=e.replace(/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/g,`""`);for(let c of B6(e,t).flat()){if(c.operator===`has`&&(c.field.startsWith(Y6)||c.field.startsWith(X6)||c.field.includes(`.`)))throw Error(`${t}: "${t8(c.field)} has …" asks a field of the input; has reads the several answers of a choices field.`);for(let e of[c.field,...c.other===void 0?[]:[c.other]])if(e.startsWith(Y6)){let n=e.slice(7);if(n.split(`.`).length>3)throw Error(`${t}: "${e}" follows more than 2 references; read a nearer column, or judge it in the handler.`);r.add(n)}else if(e.startsWith(X6))i.add(e.slice(7));else if(e.includes(`.`))throw Error(`${t}: "${e}" is a path; a condition here names a field of the input, record.<column> for the record's own, or tenant.<column>.`);else n.add(e),(c.operator===`has`?a:o).add(e);let e=c.other??c.values.find(e=>n8(e)!==void 0||typeof e==`string`&&e.startsWith(Y6)&&RegExp(`(?<![\\w.])${e.replace(/\./g,`\\.`)}(?![\\w.])`).test(s));if(c.field.startsWith(X6)&&e!==void 0)throw Error(`${t}: "${c.field}" is compared with "${t8(e)}"; compare a tenant's value with a literal.`);for(let e of c.values){let n=n8(e);if(n!==void 0){if(!c.field.startsWith(Y6))throw Error(`${t}: "tenant.${n}" is compared with "${c.field}"; the browser is never told a tenant's value, so compare it with a record part (record.<column>) or a literal.`);i.add(n)}}}return{fields:[...n],record:[...r],tenant:[...i],has:[...a],plain:[...o]}}function H6(e,t){return e.map(e=>e.map(e=>e.operator!==`has`&&e.other===void 0&&e.values.length===1&&typeof e.values[0]==`string`&&t.has(e.values[0])&&e.values[0]!==e.field?{field:e.field,operator:e.operator,values:[],other:e.values[0]}:e))}function U6(e){let t=e.field.startsWith(Y6)?e.field.slice(7):e.field;return e.operator===`has`?`${t} has (${e.values.map(a8).join(`, `)})`:e.other===void 0?e.values.length===1&&e.values[0]===null?`${t} ${e.operator===`ne`?`is not empty`:`is empty`}`:e.values.length>1?`${t} in (${e.values.map(a8).join(`, `)})`:`${t} ${{eq:`=`,ne:`!=`,lt:`<`,lte:`<=`,gt:`>`,gte:`>=`}[e.operator]} ${a8(e.values[0])}`:`${t} ${{eq:`=`,ne:`!=`,lt:`<`,lte:`<=`,gt:`>`,gte:`>=`}[e.operator]} ${e.other}`}function W6(e,t){let n=e.field.slice(7),r=t?.[n];if(r===void 0)return!1;if(d8(e))return r===null==(e.operator===`eq`);if(r===null)return!1;let i=[{name:e.field,type:s8(r),nullable:!0,primaryKey:!1}];return a4([[e]],{[e.field]:r},i)===!0}async function Nre(e,t,n,r=new Date,i,a){let o=[];for(let s of B6(e,t,r,i)){let e=[],t=!0;for(let r of s){let i=r.field.startsWith(Y6)?await n(U6(r)):r.field.startsWith(X6)?W6(r,a):void 0;if(i===void 0)e.push(r);else if(!i){t=!1;break}}t&&o.push(e)}return o}function G6(e){return e.length?e.some(e=>!e.length)?!0:e.map(e=>e.map(U6).join(` and `)).join(` or `):!1}function K6(e,t,n,r=new Date){let i=z6(n),a=new Set(i.map(e=>e.name)),o=H6(typeof e==`string`?B6(e,`Condition`,r,n):e,a);if(!o.length)return!1;if(o.some(e=>!e.length))return!0;let s=Object.fromEntries(i.map(e=>[e.name,u8(t[e.name])?null:t[e.name]])),c=e=>!d8(e)&&[e.field,...e.other===void 0?[]:[e.other]].some(e=>s[e]===null)?!1:a4([[e]],s,i)===!0;return o.some(e=>e.every(c))}function q6(e,t,n,r=new Date){let i=[];for(let a of e)V6(a.must,`Rule`).fields.some(e=>t[e]===void 0||t[e]===null||t[e]===``)||a.when!==void 0&&!K6(a.when,t,n,r)||K6(a.must,t,n,r)||i.push({field:f8(a),message:a.message});return i}function J6(e,t,n){let r=e.replace(h8,(e,t,r)=>t!==void 0||r===void 0||m8.has(r.toLowerCase())||!n.has(r)?e:`${p8}${r}`),i=e=>typeof e==`string`&&e.startsWith(p8)?e.slice(10):void 0,a;try{a=Y2(r,t)}catch(e){throw Error(e.message.split(p8).join(``))}let o=new Set,s=new Set;for(let[,t,r]of e.matchAll(h8))t===void 0?r!==void 0&&!m8.has(r.toLowerCase())&&!n.has(r)&&o.add(r):s.add(t.slice(1,-1));for(let e of a.flat())for(let n of e.values)if(typeof n==`string`&&o.has(n)&&!s.has(n))throw Error(`${t}: compares ${i(e.field)??e.field} with "${n}", which is no input of the form; a column is compared with an answer or a value, and text is written in quotes ("${n}")`);return a.map(e=>e.map(e=>{let n=i(e.field)??e.field;if(e.operator===`has`)throw Error(`${t}: "has" asks a list of choices the form answers; a where compares a column of the table with =, !=, <, <=, >, >= or in`);let r=e.values.map(e=>{let t=i(e);return t===void 0?e:{answer:t}});return{column:n,operator:e.operator,values:r}}))}var Y6,X6,Z6,Q6,$6,e8,t8,n8,r8,i8,a8,o8,s8,c8,l8,u8,d8,f8,p8,m8,h8,g8=s((()=>{un(),d4(),sr(),Kt(),ui(),Y6=`record.`,X6=`tenant.`,Z6=`__via__`,Q6=`tenant${Z6}`,$6=/("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')|(?<![\w.])record\.([A-Za-z_]\w*(?:\.[A-Za-z_]\w*)+)|(?<![\w.])tenant\.([A-Za-z_]\w*)(?![\w.])/g,e8=e=>e.replace($6,(e,t,n,r)=>t===void 0?n===void 0?`${Q6}${r}`:`${Y6}${n.split(`.`).join(Z6)}`:e),t8=e=>e.startsWith(Q6)?`${X6}${e.slice(Q6.length)}`:e.split(Z6).join(`.`),n8=e=>typeof e==`string`&&e.startsWith(Q6)?e.slice(Q6.length):void 0,r8=e=>e.map(e=>e.map(e=>({...e,field:t8(e.field),...e.other===void 0?{}:{other:t8(e.other)}}))),i8=e=>e.toISOString().slice(0,10),a8=e=>{let t=n8(e);return t===void 0?wn(e):`${X6}${t}`},o8=e=>B6(e,`Condition`).flat().filter(e=>e.field.startsWith(Y6)).map(U6),s8=e=>typeof e==`boolean`?`BOOLEAN`:typeof e==`number`?`NUMERIC`:/^\d{4}-\d{2}-\d{2}$/.test(String(e))?`DATE`:`TEXT`,c8=e=>B6(e,`Condition`).flat().some(e=>e.field.startsWith(Y6)||e.field.startsWith(X6)),l8=e=>B6(e,`Condition`).flat().some(e=>e.field.startsWith(Y6)),u8=e=>e==null||e===``,d8=e=>e.other===void 0&&e.values.length===1&&e.values[0]===null,f8=e=>V6(e.must,`Rule`).fields[0],p8=`__answer__`,m8=new Set([`and`,`or`,`not`,`in`,`is`,`empty`,`null`,`true`,`false`,`yes`,`no`,`today`,`me`]),h8=/("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')|(?<![\w.])([A-Za-z_]\w*)(?![\w.])/g}));function _8(e,t,n){let r=e.columns.find(e=>e.name===t);if(!r)return`shape`;let i=typeof n==`string`?n.trim():n;if(gt(r))return typeof i==`boolean`?{value:i}:i===1||i===`true`||i===`1`?{value:!0}:i===0||i===`false`||i===`0`?{value:!1}:`type`;if(r.allowed?.length)return r.allowed.includes(String(i))?{value:String(i)}:`choice`;let a=ht(r.type);if(a===`number`){let e=typeof i==`number`?i:typeof i==`string`&&/^-?\d+(\.\d+)?$/.test(i)?Number(i):NaN;return Number.isFinite(e)?{value:e}:`type`}return typeof i==`string`?a===`date`?Hr(i)||Wr(i)!==void 0?{value:i}:`type`:{value:i}:`type`}var v8=s((()=>{ui(),St()}));function y8(e){let t=e.via.lastIndexOf(`.`),n=e.via.slice(t+1);return t<0||n.includes(`+`)?void 0:{table:e.via.slice(0,t),column:n}}function b8(e,t,n,r,i){let a={today:new Date().toISOString().slice(0,10),now:new Date,me:null},o=new Map,s=(e,t,n,r)=>r?y6(r.expr,a,n=>o4(e,n,t[n])):o4(e,n,t[n]),c=n=>{if(o.has(n))return o.get(n);o.set(n,null);let l=null,u=t.rollups?.[n],d=t.computed?.[n];if(u){let t=y8(u),n=t&<(e,t.table),r=(n&&i[n.id])??[];if(n&&!u.of&&!u.filter&&u.fn!==`latest`){let e=r.map(e=>s(n,e,u.column??``,u.expression)).filter(e=>typeof e==`number`&&Number.isFinite(e));l=u.fn===`count`?r.length:u.fn===`sum`?e.reduce((e,t)=>e+t,0):e.length?u.fn===`avg`?e.reduce((e,t)=>e+t,0)/e.length:u.fn===`min`?Math.min(...e):Math.max(...e):null}}else d&&(l=y6(d.expr,a,e=>t.rollups?.[e]||t.computed?.[e]?c(e):o4(t,e,r[e])));return o.set(n,l),l};return Object.fromEntries(n.filter(e=>t.rollups?.[e]||t.computed?.[e]).map(e=>[e,c(e)]))}var Pre=s((()=>{ur(),T6(),St(),d4()}));function Fre(e,t){return!!(e?.primaryKey||e?.references||e?.identifier||C8.test(e?.sourceName??t))}function Ire(e,t,n){let r=n.map(e=>e[t]).filter(e=>e!=null),i=ht(e?.type),a={align:`left`,kind:i,mono:!1},o=r.length>0&&r.every(e=>typeof e==`number`);if(i===`boolean`||e?.flag===!0||o&&x8.test(e?.sourceName??t)&&r.every(e=>e===0||e===1))return{...a,kind:`boolean`,align:`center`};if(i===`number`||o){let t=!!(e?.primaryKey||e?.references||e?.identifier),n=t?0:Math.min(e?.places??6,Math.max(0,...r.map(Lre))),i=!t&&r.some(e=>Math.abs(Number(e))>=1e4);return{...a,kind:`number`,align:`right`,decimals:n,group:i,identifier:t}}if(i===`date`||r.length&&r.every(e=>typeof e==`string`&&S8.test(e))){let e=r.some(e=>/[ T]\d{2}:\d{2}/.test(String(e))&&!/[ T]00:00:00(\.0+)?$/.test(String(e)));return{...a,kind:`date`,mono:!0,showTime:e}}let s=Math.max(0,...r.map(e=>String(e).length));return{...a,kind:`text`,mono:s<=12&&r.length>0,idLike:Fre(e,t)}}function Lre(e){let t=String(e),n=t.indexOf(`.`);return n===-1?0:Math.min(6,t.length-n-1)}var x8,S8,C8,Rre=s((()=>{St(),x8=/^(is|has|can|should|was)_|_(flag|enabled|disabled)$|^(active|enabled|disabled|deleted|archived|verified|published|visible|locked|hidden|default|primary|required|readonly)$/i,S8=/^\d{4}-\d{2}-\d{2}([ T]\d{2}:\d{2}(:\d{2})?)?/,C8=/(^|_)(id|uuid|code|sku|vin|ref|key|token|serial|number|no|hash|slug)$/i}));function w8(e,t){return Ire(e,e?.name??``,t?[t]:[]).kind===`boolean`?/bool/i.test(e?.type??``)?{yes:`true`,no:`false`}:{yes:`1`,no:`0`}:null}var T8=s((()=>{tc(),Rre(),h$()}));function zre(e){let t=new Set;return e.flatMap(e=>[...typeof e?.field==`string`?[{field:e.field,message:e.message}]:[],...Array.isArray(e?.fields)?e.fields:[]]).flatMap(e=>typeof e?.field!=`string`||!/^[^\s.\x00-\x1f\x7f]{1,256}(?:\.[A-Za-z_][A-Za-z0-9_]{0,127})?$/u.test(e.field)||typeof e.message!=`string`||!e.message.trim()||e.message.length>256||t.has(e.field)?[]:(t.add(e.field),[{field:e.field,message:e.message}]))}var Bre=s((()=>{})),E8,Vre=s((()=>{Ya(),E8=Va({updateNotConfirmedTheRecord:`Update not confirmed. The record may already have changed. Check the stored values before editing again.`,anUpdateIsAlready:`An update is already pending for this record.`,theRequestMayStill:`The request may still complete.`,theServerDidNotAcknowledge:`The server did not acknowledge exactly the requested fields on one record.`})}));function Hre(e,t){if(!k8(e)||e.affected!==1||!k8(e.applied)||e.outcome!==void 0&&e.outcome!==`applied`)return;let n=e.applied;if(Object.keys(t).every(e=>Object.hasOwn(n,e))&&Object.values(n).every(e=>e===null||typeof e==`string`||typeof e==`boolean`||typeof e==`number`&&Number.isFinite(e)))return n}function Ure(e=()=>!1){let t=new Map,n=new Set,r=0,i=0,a=()=>{r++;for(let e of n)e()},o=e=>t.get(O8(e));return{get:o,run:async(n,r,s)=>{let c=i,l=e(),u=O8(n);if(t.has(u))return{kind:`blocked`,message:o(n).message||E8(`anUpdateIsAlready`)};let d={...r},f=l?Mi().mutations.start(`update`):void 0;t.set(u,{phase:`pending`,values:d,message:``}),a();let p=e=>{Mi().mutations.unknown(f);let n=D8;return c===i&&(t.set(u,{phase:`uncertain`,values:d,message:n,detail:e}),a()),{kind:`uncertain`,message:n}},m=(e,n=[])=>(Mi().mutations.settle(f),c===i&&(t.delete(u),a()),{kind:`rejected`,message:e,...n.length?{fields:n}:{}}),h=setTimeout(()=>p(E8(`theRequestMayStill`)),3e4),g;try{g=await s()}catch(e){let t=k8(e)?e.status:void 0,n=k8(e)?e.outcome:void 0,r=e instanceof Error?e.message:String(e);return n!==`unknown`&&(n===`rejected`||n===`not_applied`||!l&&typeof t==`number`&&[400,401,403,404,409,422,501].includes(t))?m(r):p(r)}finally{clearTimeout(h)}if(k8(g)&&Array.isArray(g.errors)){let e=k8(g.errors[0])&&typeof g.errors[0].message==`string`?g.errors[0].message:``;return e&&g.outcome===`rejected`?m(e,zre(g.errors.filter(k8))):p(e)}let _=Hre(g,d);if(!_)return p(E8(`theServerDidNotAcknowledge`));Mi().mutations.settle(f),c===i&&(t.delete(u),a());let v=k8(g)?Po(g.undoId,l):void 0;return{kind:`applied`,applied:_,...v===void 0?{}:{undoId:v}}},reset:()=>{i++,t.clear(),a()},hasUnresolved:()=>t.size>0,version:()=>r,subscribe:e=>(n.add(e),()=>{n.delete(e)})}}var D8,O8,k8,A8,Wre=s((()=>{wo(),Fo(),Li(),Bre(),Vre(),Pa(),D8=E8(`updateNotConfirmedTheRecord`),O8=e=>JSON.stringify([e.connection,e.table,Object.keys(e.key).sort().map(t=>[t,String(e.key[t])])]),k8=e=>!!e&&typeof e==`object`&&!Array.isArray(e),A8=Ure(()=>So().tenantRequired===!0),mo(()=>A8.reset()),Ea(window,`beforeunload`,e=>{A8.hasUnresolved()&&(e.preventDefault(),e.returnValue=``)})})),Gre=s((()=>{Ya()})),Kre=s((()=>{Gre()})),qre=s((()=>{Ya()})),Jre=s((()=>{qre()}));function Yre(e,t){let n=typeof e==`number`?Number.isFinite(e)?String(e):``:e.trim(),r=/^([-+]?)(\d*)(?:\.(\d*))?$/.exec(n);if(!r||!r[2]&&!r[3])return;let i=D3(t),a=(r[3]??``).replace(/0+$/,``);if(a.length>i)return;let o=`${r[2]}${a.padEnd(i,`0`)}`.replace(/^0+(?=\d)/,``)||`0`;return r[1]===`-`&&o!==`0`?`-${o}`:o}function Xre(e,t){let n=Yre(e,t);if(n===void 0)return;let r=Number(n);return Number.isSafeInteger(r)?r:void 0}var Zre=s((()=>{N3()})),Qre=s((()=>{Ya()}));function j8(e,t){return e==null||e===``?``:O3(e,t)??e}function M8(e,t){if(e.trim()===``)return``;let n=Xre(e,t);return n===void 0?e:String(n)}function N8({value:e,currency:t,onChange:n,children:r}){let[i,a]=(0,P8.useState)(()=>j8(e,t));return(0,P8.useEffect)(()=>{M8(i,t)!==e&&a(j8(e,t))},[e,t]),(0,F8.jsx)(F8.Fragment,{children:r(i,e=>{a(e),n(M8(e,t))})})}var P8,F8,I8=s((()=>{P8=d(m(),1),N3(),Zre(),Qre(),F8=d(O(),1)})),$re=s((()=>{Ya()}));function L8(e,t){return e&&Object.hasOwn(e.resources,t)?e.resources[t]:void 0}var eie=s((()=>{$re()})),R8,tie=s((()=>{Ya(),R8=Va({remove:`Remove {shownLabel}`,choose:`Choose {name}`,search:`Search {name}…`,nothingToChoose:`Nothing to choose from.`})}));function nie(e){let t=Zs(e);if(t?.startsWith(`$`))return;let n=L8(Mi().app(),e.id)?.display;return y4(Gs.schema??void 0,e,t,n)}async function rie(e,t,n=pt(e)[0],r=Gs.activeConnection,i=``,a=[],o){let s=Zs(e)??n,c=n;if(!c)return[];let l=o&&o.path!==c?[o.path]:[],u=[i,t?`${s} contains ${JSON.stringify(t)}`:``].filter(Boolean).join(` and `);return((await Ns(`/api/run`,{q:[e.id,u,`show ${[...new Set([s,c,...pt(e),...a,...l])].join(`, `)}`,`sort ${s}`].filter(Boolean).join(` `),limit:U8,offset:0,count:`none`,...ao(r)})).rows??[]).map(t=>({value:String(t[c]),label:Qs(e)===void 0?String(t[s]??t[c]):Ls(e,t),...a.length?{row:t}:{},...l.length&&b4(t[l[0]])?{sub:b4(t[l[0]])}:{}}))}function z8(e){return e.editing?(0,H8.jsx)(iie,{...e}):(0,H8.jsx)(B8,{...e})}function iie(e){let t=(0,V8.useSyncExternalStore)(mo,So,So),n=JSON.stringify([t.epoch,Gs.activeConnection,e.table.id,e.valueColumn??pt(e.table)[0],Zs(e.table)]);return(0,H8.jsx)(B8,{...e,scope:n},n)}function B8(e){let{table:t,ariaLabel:n,placeholder:r,app:i,inputRef:a}=e,o=e.editing,s=Gs.activeConnection,c=e.valueColumn??pt(t)[0],l=e.face?void 0:nie(t),u=e.multiple===!0?e.value:e.value?[e.value]:[],[d,f]=(0,V8.useState)(new Map),[p,m]=(0,V8.useState)(new Map),h=e.multiple===!0?void 0:e.known,g=e=>d.get(e)??(h?.value===e?h.label:void 0)??e,[_,v]=(0,V8.useState)(()=>e.multiple!==!0&&e.value?g(e.value):``),[y,b]=(0,V8.useState)(null),x=o&&typeof e.value==`string`?y??(e.value?g(e.value):``):_,S=o&&typeof e.value==`string`?y??``:_,[C,w]=(0,V8.useState)(``),[T,E]=(0,V8.useState)(!1),D=JSON.stringify(u),O=(0,V8.useRef)(D),k=(0,V8.useRef)(null),[A,j]=(0,V8.useState)(D);o&&A!==D&&(j(D),k.current!==D&&(b(null),E(!1),w(``),f(new Map)),k.current=null);let M=!!(o&&y!==null),N=(0,V8.useRef)(null);(0,V8.useLayoutEffect)(()=>{o&&(N.current?.unresolvedReference!==M||N.current?.open!==T)&&(N.current={unresolvedReference:M,open:T},o.onStateChange(N.current))});let P=(0,V8.useRef)(null),F=(0,V8.useRef)(null);(0,V8.useEffect)(()=>{f(new Map)},[s,t.id,c]);let I=e=>{F.current=e,typeof a==`function`?a(e):a&&(a.current=e)};(0,V8.useEffect)(()=>{let e=setTimeout(()=>w(x.trim()),150);return()=>clearTimeout(e)},[x]);let L=OJ({queryKey:[`picker`,s,t.id,c,C,e.scope,o?D:void 0,Zs(t),Qs(t),e.where??``,e.face?.columns.join(),l?.path],queryFn:()=>rie(t,C,c,s,e.where,e.face?.columns,e.face?void 0:l),enabled:T&&!e.disabled,placeholderData:(n,r)=>r&&r.queryKey[1]===s&&r.queryKey[2]===t.id&&r.queryKey[3]===c&&r.queryKey[5]===e.scope&&(!o||r.queryKey[6]===D)&&r.queryKey[7]===Zs(t)&&r.queryKey[8]===Qs(t)&&r.queryKey[9]===(e.where??``)?n:void 0}),{choices:R,answered:z}=z2({typed:S,asked:C,placeholder:L.isPlaceholderData,rows:L.data,label:e=>e.label}),B=OJ({queryKey:[`picker-labels`,s,t.id,c,u,e.scope,Zs(t),Qs(t),l?.path],enabled:!!(c&&u.length),queryFn:async()=>{let n=Zs(t)??c,r=[...new Set([c,n,...pt(t),...e.multiple&&l?[l.path]:[]])];return((r.some(e=>e.includes(`.`))||n.startsWith(`$`)?await Ns(`/api/view/run`,{...ao(s),view:{id:`picker:${t.id}`,name:``,base:t.id,columns:r.map(e=>({path:e})),filter:{groups:[[{path:c,op:`in`,value:u}]]},limit:u.length}}):await Ns(`/api/query`,{...ao(s),table:t.id,columns:r,filter:{groups:[[{column:c,op:`in`,value:u}]]},limit:u.length,offset:0})).rows??[]).map(r=>({value:String(r[c]),label:Qs(t)===void 0?String(r[n]??r[c]):Ls(t,r),...e.multiple&&l&&b4(r[l.path])?{sub:b4(r[l.path])}:{}}))}});(0,V8.useEffect)(()=>{B.data&&f(e=>new Map([...e,...B.data.map(e=>[e.value,e.label])])),B.data?.some(e=>e.sub)&&m(e=>new Map([...e,...B.data.flatMap(e=>e.sub?[[e.value,e.sub]]:[])]))},[B.data]),(0,V8.useEffect)(()=>{if(o)return;let t=O.current!==D;O.current=D;let n=k.current===D;n&&(k.current=null),e.multiple!==!0&&(!T&&!n||t&&!n)&&v(e.value?g(e.value):``)},[D,d,T]);let V=t=>{k.current=JSON.stringify(t),e.multiple===!0?e.onChange(t):e.onChange(t[0]??``)},H=t=>{f(e=>new Map(e).set(t.value,t.label)),t.sub&&m(e=>new Map(e).set(t.value,t.sub)),e.multiple?(V(u.includes(t.value)?u.filter(e=>e!==t.value):[...u,t.value]),v(``)):(b(null),V([t.value]),v(t.label),E(!1))},U=e=>{V(u.filter(t=>t!==e)),F.current?.focus()},W=()=>{b(null),V([]),v(``),F.current?.focus()},G=e=>d.get(e)??e,ee=x4(R.map(e=>e.label)),te=e=>e.sub&&(l?.declared||ee.has(e.label))?e.sub:void 0,ne=x4(u.map(G)),K=e=>ne.has(G(e))&&p.get(e)?`${G(e)} · ${p.get(e)}`:G(e);return(0,H8.jsxs)(`div`,{className:`picker${e.multiple?` picker-multi`:``}`,ref:P,onKeyDownCapture:e=>{o&&T&&e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),o.onCancel?.(),b(null),E(!1))},children:[(0,H8.jsx)(`span`,{className:`picker-chips`,children:e.multiple&&u.map(e=>(0,H8.jsxs)(`span`,{className:`picker-chip`,children:[(0,H8.jsx)(`span`,{children:K(e)}),(0,H8.jsx)(`button`,{type:`button`,className:`picker-chip-x`,"aria-label":R8(`remove`,{shownLabel:K(e)}),onClick:()=>U(e),children:`×`})]},e))}),(0,H8.jsx)(L2,{text:x,onText:t=>{o?b(t):v(t),E(!0),!o&&!e.multiple&&u.length&&V([])},open:T,onOpenChange:E,items:R,itemKey:e=>e.value,itemLabel:e=>e.label,itemClassName:(e,t)=>`picker-option${t?` active`:``}${u.includes(e.value)?` chosen`:``}`,renderItem:t=>e.face&&t.row?e.face.draw(t.row,t.label,R.flatMap(e=>e.row?[e.row]:[])):(0,H8.jsxs)(H8.Fragment,{children:[te(t)?(0,H8.jsxs)(`span`,{className:`picker-option-name`,children:[(0,H8.jsx)(`span`,{className:`picker-option-label`,children:t.label}),(0,H8.jsx)(`span`,{className:`picker-option-sub`,children:te(t)})]}):(0,H8.jsx)(`span`,{className:`picker-option-label`,children:t.label}),!e.hideKey&&t.label!==t.value&&(0,H8.jsx)(`span`,{className:`picker-option-detail`,children:t.value})]}),onPick:H,inputRef:I,popupRef:o?.popupRef,anchorRef:P,fit:`width`,inputProps:{type:`text`,className:`picker-input`,"aria-label":n??R8(`choose`,{name:mr(t.name)}),placeholder:r??(i?R8(`search`,{name:(L8(Mi().app(),t.id)?.noun?.one??mr(t.name)).toLowerCase()}):`→ ${t.name}`),autoComplete:`off`,spellCheck:!1,...e.disabled?{disabled:!0}:{},...e.invalid?{"aria-invalid":!0}:{},...e.describedBy?{"aria-describedby":e.describedBy}:{},onKeyDown:t=>{o&&t.key===`Escape`&&t.preventBaseUIHandler?.(),t.key===`Backspace`&&e.multiple&&!x&&u.length&&V(u.slice(0,-1))}},popupClassName:`picker-popup`,listClassName:`picker-list`,empty:L.isPending||!z?void 0:R8(x?`common.nothingMatches`:`nothingToChoose`),emptyClassName:`picker-empty`}),(0,H8.jsx)(`button`,{type:`button`,className:`picker-clear`,"aria-label":R8(`common.clear`),hidden:u.length===0&&!M,onClick:W,children:`×`})]})}var V8,H8,U8,W8=s((()=>{uo(),V8=d(m(),1),kJ(),tc(),R2(),B2(),St(),br(),Li(),eie(),T4(),wo(),tie(),H8=d(O(),1),U8=20}));function aie(e){return/[^aeiou]ies$/i.test(e)?`${e.slice(0,-3)}${e.at(-3)===`I`?`Y`:`y`}`:/(x|ch|sh|ss|z)es$/i.test(e)?e.slice(0,-2):e.slice(0,-1)}function oie(e){if(K8.test(e))return e.slice(0,-1);if(q8.test(e)&&!/(ss|us|is)$/i.test(e)&&/[aeiouy]/i.test(e.slice(0,-1)))return aie(e)}function sie(e,t){return G8.test(e)?oie(t)??t:t}var G8,K8,q8,cie=s((()=>{G8=/^[-−]?1$/,K8=/^(second|minute|hour|day|night|week|month|year)s$/i,q8=/^(?=[a-z]*[aeiouy][a-z]*s$)[a-z]{3,}s$/i})),J8,lie=s((()=>{Ya(),J8=Va({textOfMax:`{text} of {max}`,starsOf:`{stars} of {outOf} stars`,signed:`Signed`})}));function Y8(e,t){return e.whole?Ki(t,e.currency):Gi(t,e.currency)}function X8(e,t){return gr(e,t)}function uie(e,t){let n=(t,n)=>[t,...n].map(t=>e?.values&&Object.hasOwn(e.values,t)?e.values[t]:void 0).find(Boolean);return{yes:n(t.yes,n5.yes),no:n(t.no,n5.no)}}function Z8(e,t){return t?t===`%`?Ji(e):t.startsWith(`/`)?`${e}${t}`:`${e} ${sie(e,t)}`:e}function Q8(e,t,n){if(!e.tone)return null;let r=Object.hasOwn(e.tone,n)?e.tone[n]:void 0;if(r)return r;let i=Object.hasOwn(e.tone,`*`)?e.tone[`*`]:n.trim()?`neutral`:null,a=Number(t);if(!Number.isFinite(a))return die(e.tone,n)??i;for(let[t,n]of Object.entries(e.tone)){let e=/^(>=|<=|>|<)\s*(-?\d+(?:\.\d+)?)$/.exec(t);if(!e)continue;let r=Number(e[2]);if(e[1]===`>=`?a>=r:e[1]===`<=`?a<=r:e[1]===`>`?a>r:a<r)return n}return i}function die(e,t){let n=Object.keys(e).filter(e=>/^[<>]/.test(e));if(!n.length)return null;let r=sa(t);if(r===null)return null;let i=oa();for(let t of n){let n=Bt(t);if(n&&Vt(n,r,i))return e[t]}return null}function fie(e,t){if(!e||t==null||t===``)return;if(e.masked===!0)return yr;let n=e.masked?.prefix;return n&&String(t).startsWith(n)?`${n}${yr}`:void 0}function pie(e){return e.trim().split(/[\s._-]+/).filter(e=>/[\p{L}\p{N}]/u.test(e)).slice(0,2).map(e=>[...e.replace(/[^\p{L}\p{N}]/gu,``)][0]??``).join(``).toUpperCase()||`?`}function mie(e,t){let n=e<0?`−`:``,r=Math.round(Math.abs(e)),i=[];for(let[e,t,n]of r5){let a=Math.floor(r/t);if(r-=a*t,a&&i.length<2)i.push({unit:e,count:a,mark:n});else if(i.length)break}i.length||i.push({unit:`seconds`,count:0,mark:`s`});let a=Intl.DurationFormat;if(a)try{return n+new a(t,{style:`narrow`}).format(Object.fromEntries(i.map(({unit:e,count:t})=>[e,t])))}catch{}return n+i.map(({count:e,mark:t})=>`${e}${t}`).join(` `)}function hie(e){let t=0;for(let n of e)t=t*31+(n.codePointAt(0)??0)>>>0;return t%8}function gie(e){let t=e;if(typeof e==`string`&&e.trim().startsWith(`[`))try{t=JSON.parse(e)}catch{t=e}return(Array.isArray(t)?t.map(e=>e==null?``:String(e)):String(t).split(/\r?\n|,/)).map(e=>e.trim()).filter(Boolean)}function _ie(e,t){let n=Object.keys(e.values??{}).find(e=>e.trim()!==``&&Number(e)===t);return n===void 0?void 0:e.values?.[n]}function $8(e,t){return e.icons&&Object.hasOwn(e.icons,t)?e.icons[t]:void 0}function vie(e,t){if(!e||t==null)return null;let n=fie(e,t);if(n!==void 0)return{kind:`masked`,text:n};if(e.format===`avatars`){let e=gie(t);return e.length?{kind:`avatars`,names:e.slice(0,i5),more:Math.max(0,e.length-i5),text:e.join(`, `)}:null}e.minor&&e.format===`money`&&(t=k3(t,e.currency||Hi())??t);let r=String(t);if(e.signature&&typeof e.signature==`object`&&r.trim())return{kind:`signature`,src:kr(e.signature.table,{[e.signature.key]:r}),text:J8(`signed`)};let i=xie(e,t,r);if(i!==void 0)return i;let a=Q8(e,t,r),o=Number(t);if(e.bar&&e.max!==void 0&&e.format!==`percent`&&Number.isFinite(o)&&Number.isSafeInteger(Math.trunc(o)))return{kind:`meter`,text:e.format===`money`?Y8(e,o):Wi(o),fill:Math.max(0,Math.min(100,o/e.max*100)),tone:a,title:J8(`textOfMax`,{text:r,max:e.max})};let s=Number.isFinite(o)&&Number.isSafeInteger(Math.trunc(o))||e.format===`money`&&t5(t),c=a?!s||r.trim()===``?!1:e.format===`money`||e.format===`percent`||e.format===`number`||!!e.unit:!1;if(a&&!(c&&a===`neutral`)){let n=!s||r.trim()===``?null:e.format===`money`?Z8(Y8(e,typeof t==`string`?r:o),e.unit):e.format===`percent`?qi(o):e.format===`number`||e.unit?Z8(Wi(o),e.unit):null,i=$8(e,r);return{kind:`tone`,tone:a,text:r,label:n??X8(e,r)??yie(e,t,r)??hr(r),...i?{icon:i}:{},...n===null?{}:{figure:!0}}}let l=$8(e,r);if(l)return{kind:`mark`,icon:l,text:r,label:X8(e,r)??hr(r)};let u=e.format===void 0&&!e.bar&&!e.avatar?X8(e,r):void 0;if(u!==void 0)return{kind:`word`,text:r,label:u};let d=(e.format===`money`||e.format===`number`||e.format===`percent`)&&s&&r.trim()?_ie(e,o):void 0;if(d!==void 0)return{kind:`word`,text:r,label:d};if(e.format===`money`&&s)return{kind:`money`,text:Z8(Y8(e,typeof t==`string`?r:o),e.unit),title:r};if(e.format===`percent`&&s){let t=qi(o),n=Math.max(0,Math.min(100,o));return e.bar?{kind:`percent`,text:t,bar:n}:e.ring?{kind:`percent`,text:t,ring:n}:{kind:`percent`,text:t}}if((e.format===`number`||e.format===void 0&&e.unit)&&s&&r.trim()!==``)return{kind:`number`,text:Z8(Wi(o),e.unit),title:r};if(e.format===`duration`&&s)return{kind:`number`,text:mie(o,Ri()),title:`${r} s`};if(e.format===`richText`)return{kind:`richText`,html:r,text:Mr(r)};if(e.format===`items`){let e=r.split(/\r?\n/).map(e=>e.trim()).filter(Boolean);if(e.length)return{kind:`items`,items:e,text:e.join(`, `)}}if(e.format===`relative`){let t=e5(e,r),n=sa(r),i=e.open===!0&&n!==null&&n<0?{overdue:!0}:{};if(t)return{kind:`relative`,...t,...i}}return e.avatar&&r.trim()?{kind:`avatar`,text:r,initials:pie(r),hue:hie(r)}:null}function e5(e,t){let n=aa(t);if(!n)return null;let r=sa(t);return r!==null&&(e.absolute||Math.abs(r)>14)?{text:Qi(t),title:n}:{text:n,title:t}}function yie(e,t,n){if(typeof t!=`string`||!a5.test(n.trim()))return;if(e.format===`relative`)return e5(e,n.trim())?.text;if(e.format!==void 0)return;let r=bie(n.trim()).text;return r===n?void 0:r}function bie(e){let t=/[ T]00:00(:00(\.0+)?)?$/.test(e),n=ka().classList.contains(`app-mode`)?ca(e,!t):null;if(n)return{text:n.text,title:n.title};let r=t?Qi(e):$i(e);return{text:r,title:r===e?void 0:e}}function xie(e,t,n){switch(e.format){case`rating`:{let r=e.outOf??5,i=Number(t);if(n.trim()===``||!Number.isFinite(i))return null;let a=Math.max(0,Math.min(r,Math.round(i)));return{kind:`rating`,value:a,outOf:r,tone:Q8(e,t,n),text:J8(`starsOf`,{stars:a,outOf:r})}}case`color`:return o5.test(n.trim())?{kind:`color`,hex:n.trim().toLowerCase(),text:n.trim()}:null;case`time`:{let e=s5.exec(n.trim());return!e||Number(e[1])>23||Number(e[2])>59?null:{kind:`number`,text:new Intl.DateTimeFormat(Ri(),{hour:`numeric`,minute:`2-digit`,timeZone:`UTC`}).format(Date.UTC(2e3,0,1,Number(e[1]),Number(e[2]))),title:n}}case`month`:{let e=c5.exec(n.trim());return!e||Number(e[2])<1||Number(e[2])>12?null:{kind:`number`,text:new Intl.DateTimeFormat(Ri(),{month:`short`,year:`numeric`,timeZone:`UTC`}).format(Date.UTC(Number(e[1]),Number(e[2])-1,1)),title:n}}case`date`:case`datetime`:{if(typeof t!=`string`||!n.trim())return null;let r=ra(n,{time:e.format===`datetime`,zone:e.timezone});if(r===n)return null;let i=e.tone?Q8(e,t,n):null;return i&&i!==`neutral`?{kind:`tone`,tone:i,text:n,label:r}:{kind:`date`,text:r,title:n}}case`year`:return/^\d{1,4}$/.test(n.trim())?{kind:`number`,text:n.trim(),title:n}:null;case`json`:{let e=typeof t==`string`?n:JSON.stringify(t),r;try{r=JSON.parse(e)}catch{return null}return!r||typeof r!=`object`?null:{kind:`json`,text:e,excerpt:e.replace(/\s+/g,` `).slice(0,120)}}case`qr`:return n.trim()?{kind:`qr`,text:n}:null;case`address`:{let e=Sie(n);return e.length?{kind:`address`,lines:e,text:e.join(`, `)}:null}}}function Sie(e){return e.split(/\r?\n/).map(e=>e.trim().replace(/\s+/g,` `)).filter(Boolean)}var t5,n5,r5,i5,a5,o5,s5,c5,l5=s((()=>{zr(),br(),xa(),N3(),Kt(),cie(),lie(),Pa(),t5=e=>typeof e==`number`&&Number.isFinite(e)||typeof e==`string`&&/^\s*[+-]?\d+(\.\d+)?\s*$/.test(e),n5={yes:[`true`,`1`,`t`],no:[`false`,`0`,`f`]},r5=[[`days`,86400,`d`],[`hours`,3600,`h`],[`minutes`,60,`m`],[`seconds`,1,`s`]],i5=3,a5=/^\d{4}-\d{2}-\d{2}(?:[ T]\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}(?::?\d{2})?)?)?$/,o5=/^#[0-9a-f]{6}$|^#[0-9a-f]{3}$/i,s5=/^(\d{1,2}):(\d{2})(?::\d{2}(?:\.\d+)?)?$/,c5=/^(\d{4})-(\d{2})(?:-\d{2})?/}));function u5(e,t){return!!t.references&&!Xs(e.id).some(e=>e.from.columns.length>1&&e.from.columns.includes(t.name))}var d5=s((()=>{tc()})),f5,Cie=s((()=>{Ya(),f5=Va({one:`one of: {allowed}`,saved:`Saved {label}.`,edit:`Edit {label}`})}));function wie(e){let t=(0,m5.useId)(),n=b$(e.table.id,e.column.name);return n?(0,h5.jsx)(x$,{component:n,fallback:(0,h5.jsx)(p5,{...e}),value:e.value,onChange:t=>e.onChange(t===null||t===``?e.column.nullable?null:``:String(t)),id:e.id??t,describedBy:e.describedBy,invalid:e.invalid===!0,disabled:!1,required:e.column.nullable===!1,label:e.label,field:{name:e.column.name,resource:e.table.id},context:`edit`}):(0,h5.jsx)(p5,{...e})}function p5({table:e,column:t,value:n,onChange:r,label:i,id:a,row:o,onPickerState:s,describedBy:c,invalid:l,valueLabel:u}){let d=(0,m5.useId)(),f=e=>r(e===``&&t.nullable?null:e),p=t.references&&u5(e,t)?Ys(t.references.table):void 0;if(p)return(0,h5.jsx)(z8,{table:p,valueColumn:t.references.column,value:n??``,onChange:f,ariaLabel:i,app:!0,...u&&n?{known:{value:n,label:u}}:{},editing:{onStateChange:e=>s?.(e)}});let m=w8(t,o);if(t.allowed?.length||m){let r=m?uie(Hs(e.id,t.name),m):{},o=t.allowed?.length?t.allowed.map(e=>({value:e,label:hr(e)||mr(e)})):[{value:m.yes,label:r.yes??f5(`common.yes`)},{value:m.no,label:r.no??f5(`common.no`)}];return n!==null&&!o.some(e=>e.value===n)&&o.unshift({value:n,label:n}),(0,h5.jsx)(xQ,{ariaLabel:i,id:a,value:n??``,ariaInvalid:l,ariaDescribedBy:c,items:[...t.nullable?[{value:``,label:f5(`common.noValue`)}]:[],...o],onChange:f})}if(ht(t.type)===`date`&&!/time/i.test(t.type))return(0,h5.jsx)(l$,{id:a??d,value:n??``,onChange:f,"aria-label":i,"aria-invalid":l||void 0,"aria-describedby":c,locale:Ri(),timezone:zi(),now:Vi()});let h=Hs(e.id,t.name);return h?.format===`money`&&h.minor?(0,h5.jsx)(N8,{value:n??``,currency:j3(h,o,h.currency||Hi()),onChange:f,children:(e,t)=>(0,h5.jsx)(`input`,{id:a,type:`text`,inputMode:`decimal`,className:`cell-edit`,"aria-label":i,"aria-invalid":l||void 0,"aria-describedby":c,value:e,"data-null":String(n===null),onChange:e=>t(e.target.value)})}):(0,h5.jsx)(`input`,{id:a,type:`text`,className:`cell-edit`,"aria-label":i,"aria-invalid":l||void 0,"aria-describedby":c,value:n??``,"data-null":String(n===null),onChange:e=>f(e.target.value),title:t.allowed?.length?f5(`one`,{allowed:t.allowed.join(`, `)}):void 0})}var m5,h5,Tie=s((()=>{m5=d(m(),1),tc(),uo(),St(),br(),T8(),Wre(),Kre(),Jre(),Li(),wo(),xa(),N3(),I8(),CQ(),W8(),f$(),l5(),d5(),D$(),Cie(),h5=d(O(),1)})),Eie=s((()=>{br(),f4()}));function Die(e,t,n,r){return U(`/api/file?${new URLSearchParams({...ao(n??null),table:e,key:JSON.stringify(t),inline:`1`,...r?{variant:r}:{}})}`)}var Oie=s((()=>{W(),uo(),Eie()}));function g5(e,t){let n=Gs.activeConnection??null,r=e.flatMap(e=>{let n=v5(e.display),r=n&&e.photoOwner?Ys(n.from):void 0,i=r?pt(r):[];if(!n||!r||!i.length||!e.photoOwner)return[];let a=[...new Set(t.map(t=>t[e.photoOwner]).filter(e=>e!=null))];if(!a.length)return[];let[o,s=`asc`]=(n.sort??``).split(/\s+/),c=`${r.id} ${n.whose} in (${a.map(y5).join(`, `)}) sort ${n.whose}${o?`, ${o} ${s}`:``} show ${[...new Set([...i,n.whose])].join(`, `)}`;return[{column:e.name,from:r,key:i,whose:n.whose,text:c}]}),i=TJ({queries:r.map(e=>({queryKey:[`run`,n??``,`avatar-photos`,e.text],staleTime:6e4,queryFn:async()=>{let t=await Ns(`/api/run`,{q:e.text,limit:500,offset:0,count:`none`,...ao(n)});return t.errors?.length?[]:t.rows??[]}}))}),a=r.map((e,t)=>`${e.text}@${i[t]?.dataUpdatedAt??0}`).join(`
|
|
209
209
|
`);return(0,_5.useMemo)(()=>{if(!r.length)return b5;let e=new Map;return r.forEach((t,r)=>{let a=new Map;for(let e of i[r]?.data??[]){let r=String(e[t.whose]);a.has(r)||a.set(r,Die(t.from.id,Object.fromEntries(t.key.map(t=>[t,e[t]])),n,`thumb`))}e.set(t.column,a)}),(t,n)=>n==null?void 0:e.get(t)?.get(String(n))},[a])}var _5,v5,y5,b5,kie=s((()=>{_5=d(m(),1),kJ(),tc(),uo(),St(),Oie(),O(),v5=e=>e?.avatar&&typeof e.avatar==`object`?e.avatar:void 0,(0,_5.createContext)(()=>void 0),y5=e=>typeof e==`number`?String(e):Us(String(e)),b5=()=>void 0}));function Aie(e,t,n,r){return{phase:`pending`,touch:e===`touch`,x0:t,y0:n,t0:r}}function jie(e,t,n,r){if(e.phase===`dragging`)return[e,`move`];if(e.phase===`over`)return[e,`none`];let i=S5(e,t,n);return e.touch?i>8?[{...e,phase:`over`},`abandon`]:r-e.t0>=350?[{...e,phase:`dragging`},`lift`]:[e,`none`]:i>4?[{...e,phase:`dragging`},`lift`]:[e,`none`]}function Mie(e,t){return e.phase!==`pending`||!e.touch||t-e.t0<350?[e,`none`]:[{...e,phase:`dragging`},`lift`]}function Nie(e){return e.phase===`dragging`?`drop`:e.phase===`pending`?`click`:`none`}function x5(e,t,n,r=48,i=18){return n-t<=r*2?0:e<t+r?-Math.ceil((t+r-e)/r*i):e>n-r?Math.ceil((e-(n-r))/r*i):0}function Pie(e,t,n,r){return e.map((i,a)=>{if(t===void 0)return n!==void 0&&a>=n?r:0;if(a===t)return n===void 0||n===t?0:n>t?e.slice(t+1,n+1).reduce((e,t)=>e+t,0):-e.slice(n,t).reduce((e,t)=>e+t,0);let o=a<t?a:a-1;return n===void 0?a>t?-r:0:o>=t&&o<n?-r:o>=n&&o<t?r:0})}var S5,Fie=s((()=>{S5=(e,t,n)=>Math.hypot(t-e.x0,n-e.y0)}));function Iie(e,t){let n=e.getBoundingClientRect(),r=document.createElement(`div`);r.className=`drag-ghost`,r.setAttribute(`aria-hidden`,`true`),r.setAttribute(`inert`,``),r.style.width=`${n.width/t}px`,r.style.height=`${n.height/t}px`;let i=e.cloneNode(!0);i.setAttribute(`data-ghost`,``),i.style.removeProperty(`scale`),i.style.removeProperty(`transition`),e instanceof HTMLTableRowElement&&[...e.cells].forEach((e,n)=>{let r=i.children[n];r&&(r.style.width=`${e.getBoundingClientRect().width/t}px`)});let a=i;for(let t=e.parentElement;t&&t!==document.body&&t!==Oa();t=t.parentElement){let e=Lie(t);t.tagName===`TABLE`?Object.assign(e.style,{width:`100%`,height:`100%`,tableLayout:`fixed`,margin:`0`}):/^(TBODY|THEAD|TFOOT)$/.test(t.tagName)||(e.style.display=`contents`),e.appendChild(a),a=e}for(let e of[a,...a.querySelectorAll(`*`)])for(let t of M5)e.removeAttribute(t);return r.appendChild(a),Aa().appendChild(r),r}function Lie(e){if(e.tagName!==`DETAILS`)return e.cloneNode(!1);let t=document.createElement(`div`);for(let{name:n,value:r}of e.attributes)t.setAttribute(n,r);return t}function Rie(e){let t=[];for(let n=e.parentElement;n&&n!==document.body&&n!==Oa();n=n.parentElement){let e=getComputedStyle(n);/(auto|scroll)/.test(`${e.overflowX} ${e.overflowY}`)&&t.push(n)}return t}function zie(e,t){let n=e.getBoundingClientRect(),r=parseFloat(getComputedStyle(e).scrollPaddingLeft)||0,i=[...e.querySelectorAll(`:scope > *, :scope > * > *`)].filter(e=>e.offsetWidth>0&&getComputedStyle(e).scrollSnapAlign.split(` `).some(e=>e!==`none`)).map(i=>Math.round((i.getBoundingClientRect().left-n.left)/t+e.scrollLeft-r));return[...new Set(i)].sort((e,t)=>e-t)}function C5(e){let t=e.parentElement,n=t&&parseFloat(getComputedStyle(t).rowGap)||0;return e.offsetHeight+n}function Bie(e){let t=(0,w5.useRef)(e);t.current=e;let[n,r]=(0,w5.useState)(null),i=(0,w5.useRef)(null);(0,w5.useEffect)(()=>(D5++===0&&Ea(window,`touchmove`,O5,{passive:!1}),()=>{i.current?.cancel(),--D5===0&&Da(window,`touchmove`,O5)}),[]);let a=()=>t.current.items??`[data-drop-item]`,o=(e,t)=>{let n=typeof document.elementsFromPoint==`function`?document.elementsFromPoint(e,t):[];return n.find(e=>!e.closest(`.drag-ghost`))??(n.length?null:document.elementFromPoint(e,t))},s=(e,t)=>k5.get(e)?t-(parseFloat((getComputedStyle(e).translate||``).split(` `)[1]??`0`)||0)*A5:t,c=(e,n)=>{let r=o(e,n),i=r?.closest(`[data-drop-zone]`);if(!i)return null;let c=a(),l=r.closest(c),u=t=>{let r=t.getBoundingClientRect();return{upper:r.height===0||n<r.top+r.height/2,left:r.width===0||e<r.left+r.width/2}},d=!!t.current.gap;if(l&&i.contains(l)&&!(d&&(l.hasAttribute(`data-drag-origin`)||k5.get(l)))||l&&i.contains(l)&&l.getBoundingClientRect().height===0)return{zone:i,item:l,...u(l)};for(let e of i.querySelectorAll(c)){if(e.closest(`[data-drop-zone]`)!==i||d&&e.hasAttribute(`data-drag-origin`))continue;let t=e.getBoundingClientRect();if(n<s(e,t.top)+t.height/2)return{zone:i,item:e,upper:!0,left:!0}}return{zone:i,upper:!1,left:!1}},l=(e,n,o)=>{if(T5||!e.isPrimary||e.pointerType===`mouse`&&e.button!==0||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey)return;let s=e.target?.closest?.(j5);if(s&&o.contains(s))return;let l=e.pointerId,u=Aie(e.pointerType,e.clientX,e.clientY,performance.now()),d=e.clientX,f=e.clientY,p=null,m={x:0,y:0},h=1,g=[],_=0,v=o.closest(a())??o,y=v.closest(`[data-drop-zone]`),b=null,x=new Set,S=new Map,C=new Map,w=new Map,T=!P5(),E=e=>[...e.querySelectorAll(a())].filter(t=>t.closest(`[data-drop-zone]`)===e),D=(e,t)=>{(k5.get(e)??0)!==t&&(T&&!e.style.transition&&(e.style.transition=`translate ${F5}`),e.style.translate=t?L5(t):``,k5.set(e,t),x.add(e))},O=e=>{if(e?.zone===b?.zone&&e?.before===b?.before)return;b=e;let t=C5(v),n=new Set([...x].map(e=>e.closest(`[data-drop-zone]`)).filter(Boolean));y&&n.add(y),e&&n.add(e.zone);for(let r of n){let n=E(r),i=n.indexOf(v),a=n.filter(e=>e!==v),o=e?.zone===r?e.before?a.indexOf(e.before):a.length:void 0,s=e?Pie(n.map(C5),i<0?void 0:i,o!==void 0&&o>=0?o:void 0,t):n.map(()=>0);n.forEach((e,t)=>D(e,s[t]));let c=!!(e&&e.zone===r&&i<0);c&&!S.has(r)?(S.set(r,r.style.paddingBottom),r.style.paddingBottom=`${(parseFloat(getComputedStyle(r).paddingBottom)||0)+t}px`):!c&&S.has(r)&&(r.style.paddingBottom=S.get(r),S.delete(r))}v.style.opacity=e&&e.zone!==y?`0`:``},k=()=>{for(let e of x)e.style.transition=``,e.style.translate=``,k5.delete(e);x.clear();for(let[e,t]of S)e.style.paddingBottom=t;S.clear(),v.style.opacity=``,b=null},A=()=>{if(!p)return;p.style.transform=`translate(${(d-m.x)/h}px, ${(f-m.y)/h}px)`;let e=t.current.over(n,c(d,f));t.current.gap&&O(e||null)},j=()=>{let e=!1,t=performance.now();for(let n of g){let r=n.getBoundingClientRect(),i=n.scrollWidth>n.clientWidth?x5(d,r.left,r.right):0,a=n.scrollHeight>n.clientHeight?x5(f,r.top,r.bottom):0,[o,s]=[n.scrollLeft,n.scrollTop];if(i&&C.has(n)){if(t-(w.get(n)??0)>600){let e=zie(n,h),r=i>0?e.find(e=>e>o+2):e.filter(e=>e<o-2).at(-1);r!==void 0&&n.scrollTo({left:r,behavior:T?`smooth`:`auto`}),w.set(n,t)}}else i&&(n.scrollLeft+=i);a&&(n.scrollTop+=a),e||=n.scrollLeft!==o||n.scrollTop!==s}let n=x5(f,0,window.innerHeight);if(n){let t=window.scrollY;window.scrollBy(0,n),e||=window.scrollY!==t}e&&A(),_=requestAnimationFrame(j)},M=()=>{U(),h=A5=N5();let e=o.getBoundingClientRect();m={x:u.x0-e.left,y:u.y0-e.top},g=Rie(o);let t=g.filter(e=>{let t=getComputedStyle(e).scrollSnapType;return!!t&&!t.startsWith(`none`)});p=Iie(o,h);for(let e of t)C.set(e,e.style.scrollSnapType),e.style.scrollSnapType=`none`;o.setAttribute(`data-lifted`,``),v.setAttribute(`data-drag-origin`,``),window.getSelection()?.removeAllRanges(),E5=u.touch,r(()=>n),_=requestAnimationFrame(j)},N=([e,t])=>{u=e,t===`abandon`?G():(t===`lift`&&M(),(t===`lift`||t===`move`)&&A())},P=e=>{e.pointerId===l&&(d=e.clientX,f=e.clientY,N(jie(u,d,f,performance.now())))},F=e=>{if(e.pointerId!==l)return;if(d=e.clientX,f=e.clientY,Nie(u)!==`drop`){G();return}let r=c(d,f),i=new Map([...x].map(e=>[e,e.getBoundingClientRect().top])),a=G(!0),o=e=>{e.preventDefault(),e.stopPropagation()};Ea(window,`click`,o,!0),setTimeout(()=>Da(window,`click`,o,!0),0),t.current.drop(n,r),t.current.end?.(n);let s=t.current.locate;ee(a,s?s(n):null,i)},I=e=>{e.pointerId===l&&te()},L=e=>{e.key===`Escape`&&(p&&(e.preventDefault(),e.stopPropagation()),te())},R=e=>{u.touch&&e.preventDefault()},z=e=>e.preventDefault(),B=e=>{p&&e.preventDefault()},V=u.touch?window.setTimeout(()=>N(Mie(u,performance.now())),350):0;u.touch&&Oa().classList.add(`is-pressing`);let H=!1;u.touch&&T&&(H=!0,o.style.transition=`scale ${F5}`,requestAnimationFrame(()=>{H&&(o.style.scale=`0.97`)}));function U(){H&&(H=!1,o.style.removeProperty(`scale`),o.style.removeProperty(`transition`))}let W=[[`pointermove`,P,!1],[`pointerup`,F,!1],[`pointercancel`,I,!1],[`keydown`,L,!0],[`contextmenu`,R,!0],[`dragstart`,z,!0],[`selectstart`,B,!0],[`blur`,()=>te(),!1]];for(let[e,t,n]of W)Ea(window,e,t,n);function G(e=!1){window.clearTimeout(V),cancelAnimationFrame(_),U();for(let[e,t,n]of W)Da(window,e,t,n);let t=p;p=null,e||t?.remove(),k();for(let[e,t]of C)e.style.scrollSnapType=t;return C.clear(),e||o.removeAttribute(`data-lifted`),v.removeAttribute(`data-drag-origin`),Oa().classList.remove(`is-pressing`),E5=!1,T5=i.current=null,t&&r(null),t}function ee(e,t,n){let r=o;if(!e){r.removeAttribute(`data-lifted`);return}let i=()=>{e.remove(),r.removeAttribute(`data-lifted`),t&&t.style.removeProperty(`opacity`)},a=t?.isConnected?t.getBoundingClientRect():null;if(!T||!t||!a||a.width===0&&a.height===0)i();else{for(let[e,r]of n){if(!e.isConnected||e===v||e.contains(t))continue;let n=(r-e.getBoundingClientRect().top)/h;Math.abs(n)<.5||(e.style.transition=`none`,e.style.translate=L5(n),requestAnimationFrame(()=>{e.style.transition=`translate ${F5}`,e.style.translate=``,setTimeout(()=>e.style.removeProperty(`transition`),I5()+50)}))}t.style.opacity=`0`,e.style.transition=`transform ${F5}`,e.style.transform=`translate(${a.left/h}px, ${a.top/h}px)`,setTimeout(i,I5()+20)}}function te(){let e=G(!0);e?(ee(e,o.isConnected?o:null,new Map),t.current.end?.(n)):o.removeAttribute(`data-lifted`)}T5=i.current={cancel:te}};return{source:(e,t)=>t?{"data-draggable":`true`,onPointerDown:t=>l(t,e,t.currentTarget)}:{},start:l,dragging:n}}var w5,T5,E5,D5,O5,k5,A5,j5,M5,N5,P5,F5,I5,L5,Vie=s((()=>{w5=d(m(),1),Fie(),Pa(),T5=null,E5=!1,D5=0,O5=e=>{E5&&e.cancelable&&e.preventDefault()},k5=new WeakMap,A5=1,j5=`[data-drag-ignore], input, textarea, select, [contenteditable="true"]`,M5=[`id`,`data-drop-zone`,`data-drop-item`,`data-drop`,`data-lifted`,`data-draggable`,`data-row-key`,`data-card`],N5=()=>Number(getComputedStyle(Oa()).zoom)||1,P5=()=>typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches,F5=`var(--t-press, 140ms) var(--ease-out, ease-out)`,I5=()=>{let e=getComputedStyle(Oa()).getPropertyValue(`--t-press`).trim(),t=e.endsWith(`ms`)?parseFloat(e):e.endsWith(`s`)?parseFloat(e)*1e3:140;return Number.isFinite(t)?Math.min(t,150):140},L5=e=>`0 ${e}px`})),R5,Hie=s((()=>{Ya(),R5=Va({fill:`Fill in {column}.`,addLine:`Add line`,removeLine:`Remove line`,moveUp:`Move up`,moveDown:`Move down`,moveLine:`Move line {n}`,moveLineHint:`Drag, or press Alt and an arrow key, to move this line`,lineActions:`Line {n} actions`,lineActionsHeading:`Actions`,lineMoved:`Line moved to place {n} of {count}.`,noLinesYet:`No lines yet.`,subtotal:`Subtotal`})})),Uie=s((()=>{}));function z5(e,t){return Vs(e.id,t.name)??mr(t.name)}function Wie(e){try{return new Intl.NumberFormat(Ri(),{style:`currency`,currency:e}).formatToParts(0).find(e=>e.type===`currency`)?.value??e}catch{return e}}function Gie(e,t){if(b$(e.id,t.name))return`control`;if(t.references&&u5(e,t)&&Ys(t.references.table))return`reference`;if(t.allowed?.length||w8(t,null))return`control`;let n=ht(t.type);return n===`date`?`control`:q5(e,t.name)?.format===`money`?`money`:n===`number`?`number`:`text`}function Kie(e,t){return Object.entries(e.computed??{}).filter(([n,r])=>{if(t.includes(n))return!1;let i=cr(r.expr);return i.length>0&&i.every(t=>!t.includes(`.`)&&e.columns.some(e=>e.name===t))}).map(([e])=>e)}function B5(e,t){let n=q5(e,t);if(n||!e.computed?.[t])return n;let r=cr(e.computed[t].expr).filter(t=>q5(e,t)?.format===`money`);return r.length===1?q5(e,r[0]):null}function V5(e,t,n){if(t===null)return`—`;if(typeof t==`object`)return`day`in t?t.day:t.instant.toISOString();let r=e?.currencyColumn?{...e,currency:j3(e,n,e.currency??``)||void 0}:e,i=typeof t==`number`?vie(r,t):null;if(i&&`text`in i&&typeof i.text==`string`&&i.kind===`money`){let e=r?.currency||Hi(),n=Number(r?.minor?k3(t,e)??t:t),a=D3(e);return(Number.isFinite(n)?Gi(n,e,{minimumFractionDigits:a,maximumFractionDigits:a}):i.text).replace(/^-/,`−`)}return typeof t==`number`?Wi(t):typeof t==`boolean`?t?Fa(`mistri.form.yes`,R5(`common.yes`)):Fa(`mistri.form.no`,R5(`common.no`)):t}function qie(e,t,n,r,i={}){if(!e||!n.length)return{};try{return b8(e,t,n,r,i)}catch{return{}}}function Jie(e){let t=e.references?Ys(e.references.table):void 0,n=t?pt(t):[],r=t?Zs(t):void 0,i=r&&!r.startsWith(`$`)?r:/\{([^}]+)\}/.exec(String((t&&Qs(t))??``))?.[1];if(!t||n.length!==1||!i)return;let[a,o,s]=i.split(`.`);if(s!==void 0)return;let c=e=>typeof e?.subtitle==`string`?t.columns.find(t=>t.name===e.subtitle&&!t.references):void 0,l=e=>e?.avatar&&typeof e.avatar==`object`?e.avatar:void 0,u;if(o===void 0){let e=q5(t,a),r=c(e),i=l(e);u={owner:n[0],...r?{subtitle:r.name}:{},...i?{photo:i}:{}}}else{let e=t.columns.find(e=>e.name===a&&e.references),n=e?Ys(e.references.table):void 0;if(!e||!n||e.references.column!==pt(n)[0])return;let r=c(q5(t,a)),i=l(q5(n,o));u={owner:a,...r?{subtitle:r.name}:{},...i?{photo:i}:{}}}if(u.subtitle||u.photo)return{column:e.name,target:t,valueColumn:e.references.column,key:n[0],...u}}function H5({src:e}){return(0,W5.jsx)(`span`,{className:`lines-thumb`,children:e?(0,W5.jsx)(`img`,{src:e,alt:``,loading:`lazy`,decoding:`async`}):null})}function Yie({face:e,row:t,label:n,rows:r}){let i=g5(e.photo?[{name:`choice`,display:{avatar:e.photo},photoOwner:e.owner}]:[],r);return(0,W5.jsxs)(`span`,{className:`lines-choice`,children:[e.photo&&(0,W5.jsx)(H5,{src:i(`choice`,t[e.owner])}),(0,W5.jsxs)(`span`,{className:`lines-choice-text`,children:[(0,W5.jsx)(`span`,{className:`picker-option-label`,children:n}),e.subtitle&&(0,W5.jsx)(`span`,{className:`lines-ref-sub`,children:Y5(t[e.subtitle])})]})]})}function Xie(e,t){let n=Gs.activeConnection,r=e.map(e=>[...new Set(t.map(t=>t.values[e.column]).filter(Boolean))].sort()),i=TJ({queries:e.map((e,t)=>({queryKey:[`lines-faces`,n,e.target.id,e.valueColumn,e.owner,e.subtitle,r[t]],enabled:r[t].length>0,staleTime:6e4,placeholderData:e=>e,queryFn:async()=>(await Ns(`/api/query`,{...ao(n),table:e.target.id,columns:[...new Set([e.key,e.owner,e.valueColumn,...e.subtitle?[e.subtitle]:[]])],filter:{groups:[[{column:e.valueColumn,op:`in`,value:r[t]}]]},limit:r[t].length,offset:0})).rows??[]}))}),a=e.flatMap((e,t)=>e.photo?(i[t]?.data??[]).map(t=>({[e.column]:t[e.owner]})):[]),o=g5(e.flatMap(e=>e.photo?[{name:e.column,display:{avatar:e.photo},photoOwner:e.column}]:[]),a);return(t,n)=>{let r=e.findIndex(e=>e.column===t);if(r<0||!n)return{};let a=i[r]?.data?.find(t=>Y5(t[e[r].valueColumn])===n);return{photo:a?o(t,a[e[r].owner]):void 0,subtitle:a&&e[r].subtitle?Y5(a[e[r].subtitle]):``}}}function Zie(e,t,n,r){let i=Gs.activeConnection,a=[...new Set(Object.values(t).map(e=>e.split(`.`)[0]))].flatMap(r=>{let i=e.columns.find(e=>e.name===r)?.references,a=i?Ys(i.table):void 0;if(!i||!a)return[];let o=Object.entries(t).filter(([,e])=>e.split(`.`)[0]===r).map(([e,t])=>({column:e,read:t.split(`.`)[1]})),s=[...new Set(n.map(e=>e.values[r]).filter(Boolean))].sort();return[{via:r,target:a,valueColumn:i.column,reads:o,asked:s}]}),o=TJ({queries:a.map(e=>({queryKey:[`lines-copies`,i,e.target.id,e.valueColumn,e.reads.map(e=>e.read),e.asked],enabled:e.asked.length>0,staleTime:6e4,placeholderData:e=>e,queryFn:async()=>(await Ns(`/api/query`,{...ao(i),table:e.target.id,columns:[...new Set([e.valueColumn,...e.reads.map(e=>e.read)])],filter:{groups:[[{column:e.valueColumn,op:`in`,value:e.asked}]]},limit:e.asked.length,offset:0})).rows??[]}))}),s=a.map((e,t)=>o[t]?.data);(0,U5.useEffect)(()=>{let e=!1,t=n.map(t=>{let n={...t.values};return a.forEach((r,i)=>{let a=s[i]?.find(e=>Y5(e[r.valueColumn])===(t.values[r.via]??``));for(let{column:t,read:i}of r.reads){let r=a?Y5(a[i]):``;(n[t]??``)!==r&&(n[t]=r,e=!0)}}),{...t,values:n}});e&&r(t)})}function Qie(e,t,n){if(!/^-?\d+(\.\d*)?$/.test(e.trim()))return e;let[,r=``]=e.trim().split(`.`);return r.length>t?e:Gi(Number(e),n,{minimumFractionDigits:t,maximumFractionDigits:t})}function $ie({value:e,currency:t,minor:n,onChange:r,input:i}){let[a,o]=(0,U5.useState)(!1),s=D3(t),c=(e,n)=>(0,W5.jsxs)(`span`,{className:`lines-box lines-money`,children:[a&&(0,W5.jsx)(`span`,{className:`lines-affix`,"aria-hidden":`true`,children:Wie(t)}),(0,W5.jsx)(`input`,{type:`text`,inputMode:`decimal`,className:`lines-input is-figure`,autoComplete:`off`,...i,value:a?e:Qie(e,s,t),onFocus:()=>o(!0),onBlur:()=>o(!1),onChange:e=>n(e.target.value)})]});return n?(0,W5.jsx)(N8,{value:e,currency:t,onChange:r,children:c}):c(e,r)}function eae(){return(0,W5.jsx)(`svg`,{width:`8`,height:`14`,viewBox:`0 0 8 14`,"aria-hidden":`true`,focusable:`false`,children:[2,7,12].flatMap(e=>[1.5,6.5].map(t=>(0,W5.jsx)(`circle`,{cx:t,cy:e,r:`1.3`,fill:`currentColor`},`${t}-${e}`)))})}function tae({title:e,table:t,columns:n,rows:r,onChange:i,ordered:a=!1,max:o=64,problems:s={},disabled:c=!1,titleShown:l=!0,summary:u,description:d,copy:f,where:p,subtotal:m=!1}){let h=n.map(e=>t.columns.find(t=>t.name===e)).filter(e=>!!e),g=h.map(e=>Gie(t,e)),_=Object.keys(f??{}).filter(e=>t.columns.some(t=>t.name===e)),v=(0,U5.useMemo)(()=>Kie(t,[...n,..._]),[t,n,_.join()]);Zie(t,f??{},r,i);let y=r.map(e=>qie(Gs.schema,t,v,e.values)),b=m&&!u?v.filter(e=>B5(t,e)?.format===`money`):[],x=h.flatMap((e,t)=>g[t]===`reference`?Jie(e)??[]:[]),S=Xie(x,r),C=(0,U5.useRef)(null),w=(0,U5.useRef)(null),T=(0,U5.useRef)(null),[E,D]=(0,U5.useState)(``),[O,k]=(0,U5.useState)(null);(0,U5.useEffect)(()=>{C.current!==null&&(T.current?.querySelector(`tr[data-line="${C.current}"] input`)?.focus(),C.current=null),w.current&&=(T.current?.querySelector(`tr[data-line="${w.current.line}"] ${w.current.what}`)?.focus(),null)});let A=(e,t,n)=>i(r.map((r,i)=>i===e?{...r,values:{...r.values,[t]:n??``}}:r)),j=(e,t,n)=>{if(t<0||t>=r.length||t===e)return;let a=[...r],[o]=a.splice(e,1);a.splice(t,0,o),n&&(w.current={line:o.id,what:n}),D(R5(`lineMoved`,{n:t+1,count:r.length})),i(a)},M=e=>{let t=r.filter((t,n)=>n!==e),n=t[Math.min(e,t.length-1)];n&&(w.current={line:n.id,what:`.row-actions-trigger`}),i(t)},N=Bie({over:(e,t)=>k(P(e,t)),drop:(e,t)=>{let n=P(e,t),i=r.findIndex(t=>t.id===e);if(!n||i<0)return;let a=r.findIndex(e=>e.id===n.line)+ +(n.side===`after`);a>i&&--a,j(i,a,`.lines-grip`)},end:()=>k(null),items:`tr[data-line]`}),P=(e,t)=>{if(!t)return null;let n=t.item?Number(t.item.dataset.line):r[r.length-1]?.id;return n===void 0||n===e?null:{line:n,side:t.item&&t.upper?`before`:`after`}},F=(e,t)=>{let n=e.key===`ArrowUp`?-1:+(e.key===`ArrowDown`);!n||e.ctrlKey||e.metaKey||e.shiftKey||(e.preventDefault(),j(t,t+n,`.lines-grip`))},I=(e,n)=>{let r=q5(t,e.name);return j3(r??{},n.values,r?.currency||Hi())},L=e=>`is-${e}`,R=h.length+_.length+v.length+ +!!a+1,z=e=>Vs(t.id,e)??mr(e);return(0,W5.jsxs)(`fieldset`,{className:`form-lines`,disabled:c,children:[(0,W5.jsx)(`legend`,{className:l?void 0:`visually-hidden`,children:e}),d&&(0,W5.jsx)(`p`,{className:`form-lines-description`,children:d}),(0,W5.jsxs)(`div`,{className:`form-lines-body`,children:[(0,W5.jsxs)(`table`,{className:`form-lines-grid${a?` is-ordered`:``}`,children:[(0,W5.jsxs)(`colgroup`,{children:[a&&(0,W5.jsx)(`col`,{className:`lines-col-grip`}),h.map((e,t)=>(0,W5.jsx)(`col`,{className:`lines-col-${g[t]}`},e.name)),_.map(e=>(0,W5.jsx)(`col`,{className:`lines-col-figure`},e)),v.map(e=>(0,W5.jsx)(`col`,{className:`lines-col-figure`},e)),(0,W5.jsx)(`col`,{className:`lines-col-menu`})]}),(0,W5.jsx)(`thead`,{children:(0,W5.jsxs)(`tr`,{children:[a&&(0,W5.jsx)(`th`,{"aria-hidden":`true`}),h.map((e,n)=>(0,W5.jsx)(`th`,{scope:`col`,className:L(g[n]),children:z5(t,e)},e.name)),_.map(e=>(0,W5.jsx)(`th`,{scope:`col`,className:`is-figure`,children:z(e)},e)),v.map(e=>(0,W5.jsx)(`th`,{scope:`col`,className:`is-figure`,children:Vs(t.id,e)??mr(e)},e)),(0,W5.jsx)(`th`,{children:(0,W5.jsx)(`span`,{className:`visually-hidden`,children:R5(`lineActionsHeading`)})})]})}),(0,W5.jsxs)(`tbody`,{ref:T,"data-drop-zone":``,children:[r.map((e,n)=>{let i=n+1;return(0,W5.jsxs)(`tr`,{"data-line":e.id,...O?.line===e.id?{"data-drop":O.side}:{},...N.dragging===e.id?{"data-lifted":``}:{},children:[a&&(0,W5.jsx)(`td`,{className:`lines-handle`,children:(0,W5.jsx)(`button`,{type:`button`,className:`lines-grip`,"aria-label":R5(`moveLine`,{n:i}),"aria-keyshortcuts":`Alt+ArrowUp Alt+ArrowDown`,title:R5(`moveLineHint`),onPointerDown:t=>{let n=t.currentTarget.closest(`tr`);n&&N.start(t,e.id,n)},onKeyDown:e=>F(e,n),children:(0,W5.jsx)(eae,{})})}),h.map((r,a)=>{let o=g[a],c=s[`${n}.${r.name}`],l=c?`line-${e.id}-${r.name}-error`:void 0,u=`${z5(t,r)}, ${i}`,d=e.values[r.name]??``,f={"aria-label":u,...c?{"aria-invalid":!0,"aria-describedby":l}:{}},m;if(o===`reference`){let e=x.find(e=>e.column===r.name),t=Ys(r.references.table),i=e?S(r.name,d):{};m=(0,W5.jsxs)(`span`,{className:`lines-box lines-ref${e?.photo?` has-thumb`:``}${e?.subtitle?` has-sub`:``}`,children:[e?.photo&&(0,W5.jsx)(H5,{src:i.photo}),(0,W5.jsxs)(`span`,{className:`lines-ref-text`,children:[(0,W5.jsx)(z8,{table:t,valueColumn:r.references.column,value:d,onChange:e=>A(n,r.name,e),ariaLabel:u,invalid:f[`aria-invalid`]===!0,...f[`aria-describedby`]?{describedBy:f[`aria-describedby`]}:{},app:!0,hideKey:!!e,...p?.[r.name]?{where:p[r.name]}:{},editing:{onStateChange:()=>{}},...e?{face:{columns:[...new Set([e.key,e.owner,...e.subtitle?[e.subtitle]:[]])],draw:(t,n,r)=>(0,W5.jsx)(Yie,{face:e,row:t,label:n,rows:r})}}:{}}),e?.subtitle&&(0,W5.jsx)(`span`,{className:`lines-ref-sub`,children:i.subtitle})]})]})}else m=o===`money`?(0,W5.jsx)($ie,{value:d,currency:I(r,e),minor:!!J5(t,r.name),onChange:e=>A(n,r.name,e),input:f}):o===`number`||o===`text`?(0,W5.jsx)(`span`,{className:`lines-box`,children:(0,W5.jsx)(`input`,{type:`text`,className:`lines-input${o===`number`?` is-figure`:``}`,autoComplete:`off`,...o===`number`?{inputMode:`decimal`}:{},...f,value:d,onChange:e=>A(n,r.name,e.target.value)})}):(0,W5.jsx)(`span`,{className:`lines-box lines-control`,children:(0,W5.jsx)(wie,{table:t,column:r,value:d,onChange:e=>A(n,r.name,e),label:u,row:e.values,invalid:!!c,describedBy:l})});return(0,W5.jsxs)(`td`,{className:`${L(o)}${a===0?` lines-lead`:``}${c?` is-invalid`:``}`,"data-label":z5(t,r),children:[m,c&&(0,W5.jsx)(`span`,{id:l,className:`insert-missing`,children:c})]},r.name)}),_.map(n=>(0,W5.jsx)(`td`,{className:`is-figure lines-figure lines-copied`,"data-label":z(n),children:V5(q5(t,n),o4(t,n,e.values[n]),e.values)},n)),v.map(r=>(0,W5.jsx)(`td`,{className:`is-figure lines-figure`,"data-label":Vs(t.id,r)??mr(r),children:V5(B5(t,r),y[n][r]??null,e.values)},r)),(0,W5.jsx)(`td`,{className:`lines-menu`,children:(0,W5.jsxs)(QG,{className:`row-actions-menu`,triggerClassName:`ghost row-actions-trigger`,triggerLabel:R5(`lineActions`,{n:i}),triggerTitle:R5(`lineActions`,{n:i}),label:`⋯`,popupClassName:`page-actions-popup`,align:`end`,children:[a&&(0,W5.jsx)($G,{className:`page-actions-item`,disabled:n===0,onClick:()=>j(n,n-1,`.row-actions-trigger`),children:R5(`moveUp`)}),a&&(0,W5.jsx)($G,{className:`page-actions-item`,disabled:n===r.length-1,onClick:()=>j(n,n+1,`.row-actions-trigger`),children:R5(`moveDown`)}),(0,W5.jsx)($G,{className:`page-actions-item is-danger`,onClick:()=>M(n),children:R5(`removeLine`)})]})})]},e.id)}),!r.length&&(0,W5.jsx)(`tr`,{className:`lines-empty`,children:(0,W5.jsx)(`td`,{colSpan:R,children:R5(`noLinesYet`)})})]})]}),(0,W5.jsxs)(`div`,{className:`form-lines-foot`,children:[(0,W5.jsxs)(UG,{intent:`quiet`,size:`compact`,className:`lines-add`,disabled:r.length>=o,onClick:()=>{let e=K5();C.current=e.id,i([...r,e])},children:[`+ `,R5(`addLine`)]}),u,b.length>0&&(0,W5.jsx)(`dl`,{className:`form-live lines-summary`,"aria-live":`polite`,children:b.map(e=>{let n=y.map(t=>t[e]).filter(e=>typeof e==`number`),i=n.length?n.reduce((e,t)=>e+t,0):null;return(0,W5.jsxs)(`div`,{className:`lines-summary-row`,children:[(0,W5.jsx)(`dt`,{children:b.length===1?R5(`subtotal`):z(e)}),(0,W5.jsx)(`dd`,{children:V5(B5(t,e),i,r[0]?.values??{})})]},e)})})]}),(0,W5.jsx)(`div`,{className:`visually-hidden`,"aria-live":`polite`,children:E})]})]})}var U5,W5,G5,K5,q5,J5,Y5,nae=s((()=>{U5=d(m()),kJ(),tc(),uo(),xa(),Pre(),N3(),br(),St(),ur(),T8(),Tie(),d5(),D$(),I8(),W8(),eK(),GG(),kie(),Vie(),l5(),Ya(),Hie(),Uie(),W5=d(O()),G5=0,K5=()=>({id:++G5,values:{}}),q5=(e,t)=>Hs(e.id,t),J5=(e,t)=>{let n=q5(e,t);return n?.format===`money`&&n.minor?n:void 0},Y5=e=>e==null?``:String(e)})),rae=l({CommandLines:()=>sae,lineAt:()=>aae,lineCellOf:()=>iae});function iae(e,t,n){let r=Ys(e);return r?_8(r,t,n):{value:n}}function aae(e,t){let n=/^([A-Za-z_][A-Za-z0-9_]*)\[(\d+)\]\.([A-Za-z_][A-Za-z0-9_]*)$/.exec(t),r=n?e.find(e=>e.name===n[1]):void 0;if(!n||r?.type!==`lines`)return;let i=Ys(r.from);return{field:r,row:Number(n[2]),label:i&&Vs(i.id,n[3])||mr(n[3])}}function oae(e,t){let n=`${e}[`;return Object.fromEntries(Object.entries(t??{}).flatMap(([t,r])=>{if(!t.startsWith(n))return[];let i=/^\[(\d+)\]\.(.+)$/.exec(t.slice(e.length));return i?[[`${i[1]}.${i[2]}`,r]]:[]}))}function sae({field:e,path:t,rows:n,problems:r,disabled:i,onChange:a}){let o=Ys(e.from);return o?(0,X5.jsx)(tae,{title:e.label,...e.help?{description:e.help}:{},table:o,columns:e.show,rows:n,onChange:e=>a(e,t),ordered:!0,max:e.max,problems:oae(t,r),disabled:i===!0,...e.copy?{copy:e.copy}:{},...e.query?{where:e.query}:{},subtotal:!0}):null}var X5,cae=s((()=>{tc(),v8(),br(),nae(),X5=d(O())}));function lae(e){return T(Z5,e)}var Z5,uae=s((()=>{E(),Pa(),Z5=x(typeof document>`u`?null:Na(`meta[name="mistri-mount"]`)?.getAttribute(`content`)),(()=>{if(typeof window>`u`)return null;let e=new URLSearchParams(window.location.search).getAll(`via`);return e.length===1&&/^[A-Za-z0-9_-]{22,128}$/.test(e[0])?e[0]:null})()})),Q5,dae=s((()=>{Q5={prepare:`/api/commands/prepare`,execute:`/api/commands/execute`,status:`/api/commands/status`,availability:`/api/commands/availability`,check:`/api/commands/check`,draft:`/api/commands/draft`,files:`/api/commands/files`},Object.values(Q5)})),$5,fae=s((()=>{Ya(),$5=Va({stars:`{stars} of {outOf} stars`,pickColor:`Pick {label}`,jsonProblem:`Not valid JSON: {problem}`,formatJson:`Format`,scan:`Scan`,stopScanning:`Stop scanning`,cameraView:`Camera: hold the code in view`,cameraRefused:`The camera could not be opened. Type the code instead.`,signHere:`Sign here: {label}`,typedSignature:`{label}, typed`,typeYourName:`Type your full name`,keptSignature:`{label}: the kept signature`,signatureKept:`Signed`,undoStroke:`Undo`,clearSignature:`Clear`,typeInstead:`Type instead`,drawInstead:`Draw instead`,useSignature:`Use this signature`,keepingSignature:`Keeping…`,keepPrevious:`Keep the previous one`,signAgain:`Sign again`,removeSignature:`Remove`,signatureUnread:`The signature could not be kept. Try again.`})})),pae=s((()=>{}));async function mae(e){let t=await new Promise(t=>e.toBlob(t,`image/png`));if(!t)throw Error($5(`signatureUnread`));return t}async function hae(e){let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));return btoa(n)}function gae({value:e,onChange:t,id:n,describedBy:r,invalid:i,disabled:a,label:o,keeper:s}){let c=(0,e7.useRef)(null),[l,u]=(0,e7.useState)([]),[d,f]=(0,e7.useState)(null),[p,m]=(0,e7.useState)(e===null||e===``),[h,g]=(0,e7.useState)(`idle`),_=(0,e7.useRef)(null),v=(0,e7.useRef)(null),y=(0,e7.useRef)(!1);(0,e7.useEffect)(()=>{y.current&&v.current&&(y.current=!1,v.current.focus())});let b=d===null?l.length===0:!d.trim();(0,e7.useEffect)(()=>{let e=c.current,t=e?.getContext(`2d`);if(!e||!t)return;let n=window.devicePixelRatio||1;if(e.width=n7.wide*n,e.height=n7.high*n,t.setTransform(n,0,0,n,0,0),t.clearRect(0,0,n7.wide,n7.high),t.strokeStyle=t.fillStyle=`#111827`,t.lineWidth=2.4,t.lineCap=t.lineJoin=`round`,d!==null)t.font=`italic 40px Georgia, "Times New Roman", serif`,t.textBaseline=`middle`,t.fillText(d,24,n7.high/2,n7.wide-48);else for(let e of[...l,..._.current?[_.current]:[]])t.beginPath(),e.forEach(([e,n],r)=>r?t.lineTo(e,n):t.moveTo(e,n)),e.length===1&&t.lineTo(e[0][0]+.1,e[0][1]),t.stroke()});let x=e=>{let t=e.currentTarget.getBoundingClientRect();return[(e.clientX-t.left)/(t.width||1)*n7.wide,(e.clientY-t.top)/(t.height||1)*n7.high]},[,S]=(0,e7.useState)(0),C=async()=>{if(s&&c.current){g(`keeping`);try{t(await s.keep(await mae(c.current))),y.current=!0,m(!1),u([]),f(null),g(`idle`)}catch{g(`failed`)}}},w=e!==null&&e!==``&&typeof e!=`boolean`?s?.picture(e):void 0;return!p&&e!==null&&e!==``&&s?(0,t7.jsxs)(`span`,{className:`signature-input`,children:[w?(0,t7.jsx)(`img`,{className:`signature-input-kept`,src:w,alt:$5(`keptSignature`,{label:o})}):(0,t7.jsx)(`span`,{className:`signature-input-kept is-unseen`,children:$5(`signatureKept`)}),(0,t7.jsxs)(`span`,{className:`signature-input-tools`,children:[(0,t7.jsx)(UG,{ref:v,intent:`quiet`,disabled:a,onClick:()=>m(!0),children:Fa(`mistri.form.signAgain`,$5(`signAgain`))}),(0,t7.jsx)(UG,{intent:`quiet`,disabled:a,onClick:()=>t(null),children:$5(`removeSignature`)})]})]}):(0,t7.jsxs)(`span`,{className:`signature-input`,"aria-describedby":r,children:[d===null?(0,t7.jsx)(`canvas`,{id:n,ref:c,className:`signature-input-pad`,tabIndex:-1,role:`img`,"aria-label":$5(`signHere`,{label:o}),"aria-invalid":i||void 0,onPointerDown:e=>{a||(e.currentTarget.setPointerCapture?.(e.pointerId),_.current=[x(e)],S(e=>e+1))},onPointerMove:e=>{_.current&&(_.current.push(x(e)),S(e=>e+1))},onPointerUp:()=>{let e=_.current;_.current=null,e&&u(t=>[...t,e])},onPointerCancel:()=>{_.current=null,S(e=>e+1)}}):(0,t7.jsxs)(t7.Fragment,{children:[(0,t7.jsx)(`input`,{id:n,type:`text`,className:`signature-input-name`,value:d,autoComplete:`name`,placeholder:$5(`typeYourName`),"aria-label":$5(`typedSignature`,{label:o}),"aria-invalid":i||void 0,disabled:a,onChange:e=>f(e.target.value)}),(0,t7.jsx)(`canvas`,{ref:c,className:`signature-input-pad`,"aria-hidden":`true`})]}),(0,t7.jsxs)(`span`,{className:`signature-input-tools`,children:[d===null&&(0,t7.jsxs)(t7.Fragment,{children:[(0,t7.jsx)(UG,{intent:`quiet`,disabled:a||!l.length,onClick:()=>u(e=>e.slice(0,-1)),children:$5(`undoStroke`)}),(0,t7.jsx)(UG,{intent:`quiet`,disabled:a||!l.length,onClick:()=>u([]),children:$5(`clearSignature`)})]}),(0,t7.jsx)(UG,{intent:`quiet`,disabled:a,onClick:()=>f(d===null?``:null),children:$5(d===null?`typeInstead`:`drawInstead`)}),(0,t7.jsx)(UG,{className:`signature-input-keep`,disabled:a||b||!s||h===`keeping`,onClick:()=>void C(),children:$5(h===`keeping`?`keepingSignature`:`useSignature`)}),e!==null&&e!==``&&(0,t7.jsx)(UG,{intent:`quiet`,onClick:()=>m(!1),children:$5(`keepPrevious`)})]}),h===`failed`&&(0,t7.jsx)(`span`,{className:`signature-input-problem`,role:`alert`,children:$5(`signatureUnread`)})]})}var e7,t7,n7,_ae=s((()=>{e7=d(m()),GG(),tc(),h$(),zr(),Ya(),fae(),pae(),t7=d(O()),n7={wide:480,high:150}})),r7,vae=s((()=>{Ya(),r7=Va({chooseFiles:`Choose files`,chooseFile:`Choose a file`,orDropOrPaste:`or drop or paste them here`,orDropOrPasteOne:`or drop or paste it here`,sending:`Sending {name}, {percent}%`,cancel:`Cancel`,remove:`Remove`,removeFile:`Remove {name}`,preview:`Preview {name}`,takesAtMost:{one:`{label} takes at most {count} file.`,other:`{label} takes at most {count} files.`},notSent:`{name} was not sent: {reason}`,couldNotSend:`The server could not be reached.`,tooLarge:`it is too large`,noHolding:`Files cannot be sent from this form.`,aFile:`A file sent earlier`})})),yae=s((()=>{})),bae=l({HeldFilesInput:()=>a7,HeldInput:()=>xae,HeldSignatureInput:()=>o7});function i7(e,t,n,r){let i=new XMLHttpRequest,a=(async()=>{let a={field:t,file:{name:n.name||`file`,type:n.type,data:await hae(n)}};if(`command`in e&&Co().tenantRequired)try{let t=await Ns(Q5.files,{command:e.command,...a});if(r(1),typeof t.id!=`string`)throw new u7(r7(`couldNotSend`));return{id:t.id,name:typeof t.name==`string`?t.name:n.name,type:typeof t.type==`string`?t.type:n.type,size:typeof t.size==`number`?t.size:n.size,url:URL.createObjectURL(n)}}catch(e){throw e instanceof u7?e:new u7(e instanceof Error&&e.message?e.message:r7(`couldNotSend`))}let o,s,c={"content-type":`application/json`};if(`form`in e){if(o=`/api/forms/${encodeURIComponent(e.form)}/files${e.via?`?via=${encodeURIComponent(e.via)}`:``}`,s=a,e.guard){let t=await e.guard.take();t&&(c[`x-mistri-challenge`]=t)}}else{let t=oo(Q5.files,{command:e.command,...a,...ao(e.connection)},Gs.activeConnection);o=t.url,s=t.payload??{};let n=Co();n.mode===`authenticated`&&n.accountId&&(c[`x-mistri-account`]=n.accountId)}return await new Promise((e,t)=>{i.open(`POST`,lae(o)),i.withCredentials=!0;for(let[e,t]of Object.entries(c))i.setRequestHeader(e,t);i.upload.onprogress=e=>{e.lengthComputable&&e.total>0&&r(e.loaded/e.total)},i.onerror=()=>t(new u7(r7(`couldNotSend`))),i.onabort=()=>t(new DOMException(`aborted`,`AbortError`)),i.onload=()=>{let r={};try{r=JSON.parse(i.responseText)}catch{}if(i.status===200&&typeof r.id==`string`)return e({id:r.id,name:typeof r.name==`string`?r.name:n.name,type:typeof r.type==`string`?r.type:n.type,size:typeof r.size==`number`?r.size:n.size,url:URL.createObjectURL(n)});let a=typeof r.error==`string`?r.error:typeof r.message==`string`?r.message:void 0;t(new u7(a??(i.status===413?r7(`tooLarge`):r7(`couldNotSend`))))},i.send(JSON.stringify(s))})})();if(`form`in e&&e.guard){let{reset:t}=e.guard;a.then(t,t)}return{done:a,abort:()=>i.abort()}}function a7({id:e,describedBy:t,labelledBy:n,invalid:r,disabled:i,label:a,name:o,target:s,value:c,max:l,accept:u,onChange:d}){let[f,p]=(0,s7.useState)(!1),[m,h]=(0,s7.useState)([]),[g,_]=(0,s7.useState)(),[v,y]=(0,s7.useState)(),b=(0,s7.useRef)(null),x=(0,s7.useRef)(c);x.current=c;let S=e=>{x.current=e,d(e)},C=l-c.length-m.length,w=i||!s,T=async e=>{if(w||!e.length||!s)return;_(void 0);let t=[];e.length>C&&t.push(r7(`takesAtMost`,{label:a,count:l}));for(let n of e.slice(0,Math.max(0,C))){let e=++f7,r=i7(s,o,n,t=>h(n=>n.map(n=>n.key===e?{...n,fraction:t}:n)));h(t=>[...t,{key:e,name:n.name||`file`,fraction:0,abort:r.abort}]);try{let e=await r.done;N$(e.id,e),S([...x.current,e.id])}catch(e){e instanceof u7&&t.push(r7(`notSent`,{name:n.name||`file`,reason:e.message}))}finally{h(t=>t.filter(t=>t.key!==e))}}t.length&&_(t.join(` `))},E=e=>[...e.dataTransfer.types].includes(`Files`),D=l===1;return(0,c7.jsxs)(`div`,{className:`held-files${f?` is-over`:``}`,role:`group`,"aria-labelledby":n,"aria-describedby":t,onDragOver:e=>{!w&&E(e)&&(e.preventDefault(),p(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||p(!1)},onDrop:e=>{w||(e.preventDefault(),p(!1),T([...e.dataTransfer.files]))},onPaste:e=>{let t=[...e.clipboardData.files];!w&&t.length&&(e.preventDefault(),T(t))},children:[s?(0,c7.jsxs)(`div`,{className:`held-files-add`,children:[(0,c7.jsx)(UG,{id:e,intent:`secondary`,size:`compact`,disabled:w||C<=0,"aria-invalid":r||void 0,onClick:()=>b.current?.click(),children:`+ ${r7(D?`chooseFile`:`chooseFiles`)}`}),(0,c7.jsx)(`input`,{ref:b,type:`file`,multiple:!D,hidden:!0,tabIndex:-1,"aria-label":a,...u?.length?{accept:u.join(`,`)}:{},onChange:e=>{let t=[...e.target.files??[]];e.target.value=``,T(t)}}),(0,c7.jsx)(`span`,{className:`held-files-hint`,children:r7(D?`orDropOrPasteOne`:`orDropOrPaste`)})]}):(0,c7.jsx)(`p`,{className:`held-files-hint`,children:r7(`noHolding`)}),g&&(0,c7.jsx)(`p`,{className:`held-files-error`,role:`alert`,children:g}),(c.length>0||m.length>0)&&(0,c7.jsxs)(`ul`,{className:`held-files-list`,children:[c.map(e=>{let t=I$(e),n=t?.name??r7(`aFile`),r=t?.url?xY(n,t.type):void 0;return(0,c7.jsxs)(`li`,{className:`held-files-item`,children:[(0,c7.jsx)(`span`,{className:`held-files-badge`,"aria-hidden":`true`,children:d7(n)}),(0,c7.jsxs)(`span`,{className:`held-files-text`,children:[r&&t?.url?(0,c7.jsx)(`button`,{type:`button`,className:`held-files-name`,"aria-label":r7(`preview`,{name:n}),onClick:()=>y({name:n,kind:r,href:t.url}),children:n}):(0,c7.jsx)(`span`,{className:`held-files-name is-plain`,children:n}),t&&(0,c7.jsx)(`span`,{className:`held-files-meta`,children:Yi(t.size)})]}),(0,c7.jsx)(UG,{intent:`quiet`,size:`compact`,disabled:i,"aria-label":r7(`removeFile`,{name:n}),onClick:()=>{P$(e),S(x.current.filter(t=>t!==e))},children:r7(`remove`)})]},e)}),m.map(e=>{let t=Math.round(e.fraction*100);return(0,c7.jsxs)(`li`,{className:`held-files-item is-sending`,children:[(0,c7.jsx)(`span`,{className:`held-files-badge`,"aria-hidden":`true`,children:d7(e.name)}),(0,c7.jsxs)(`span`,{className:`held-files-text`,children:[(0,c7.jsx)(`span`,{className:`held-files-name is-plain`,children:e.name}),(0,c7.jsx)(Q$,{value:t,max:100,label:r7(`sending`,{name:e.name,percent:t})})]}),(0,c7.jsx)(UG,{intent:`quiet`,size:`compact`,onClick:e.abort,children:r7(`cancel`)})]},`sending-${e.key}`)})]}),v&&(0,c7.jsx)(l7,{file:v,onClose:()=>y(void 0)})]})}function o7({id:e,describedBy:t,invalid:n,disabled:r,label:i,name:a,target:o,value:s,onChange:c}){return o?(0,c7.jsx)(gae,{id:e,...t?{describedBy:t}:{},invalid:n,disabled:r,label:i,value:s??null,onChange:e=>{s&&e!==s&&P$(s),c(typeof e==`string`?e:null)},keeper:{keep:async e=>{try{let t=await i7(o,a,new File([e],`signature.png`,{type:`image/png`}),()=>{}).done;return N$(t.id,t),t.id}catch(e){throw e instanceof u7?e:Error(r7(`couldNotSend`))}},picture:e=>I$(String(e))?.url}}):(0,c7.jsx)(`p`,{className:`held-files-hint`,children:r7(`noHolding`)})}function xae({field:e,path:t,value:n,onChange:r,...i}){let a={...i,label:e.label,name:t??e.name};return e.type===`files`?(0,c7.jsx)(a7,{...a,value:Array.isArray(n)?n:[],max:e.max,...e.accept?{accept:e.accept}:{},onChange:e=>r(e.length?e:void 0)}):(0,c7.jsx)(o7,{...a,value:typeof n==`string`?n:void 0,onChange:e=>r(e??void 0)})}var s7,c7,l7,u7,d7,f7,Sae=s((()=>{s7=d(m()),xa(),uae(),tc(),uo(),wo(),wc(),EY(),GG(),a1(),dae(),L$(),_ae(),vae(),yae(),c7=d(O()),l7=vc(()=>Promise.resolve().then(()=>(LY(),kY)),`FilePreview`,{quiet:!0}),u7=class extends Error{},d7=e=>{let t=e.lastIndexOf(`.`);return(t>0?e.slice(t+1).slice(0,4).toUpperCase():``)||`FILE`},f7=0}));function Cae(e,t){if(_7(t))return e.required?`required`:void 0;switch(e.type){case`number`:case`money`:return typeof t==`number`&&Number.isFinite(t)?void 0:`number`;case`bool`:return typeof t==`boolean`?void 0:`bool`;case`date`:return typeof t==`string`&&p7.test(t)&&g7(t)?void 0:`date`;case`datetime`:return typeof t==`string`&&m7.test(t)&&g7(t)?void 0:`datetime`;case`choice`:return typeof t==`string`&&e.options.includes(t)?void 0:`choice`;case`choices`:return Array.isArray(t)&&t.every(t=>typeof t==`string`&&e.options.includes(t))&&new Set(t).size===t.length?void 0:`choice`;default:return typeof t==`string`&&t.length<=h7?void 0:`text`}}function wae(e,t,n){let r=e.flatMap(e=>{let n=Cae(e,t[e.key]);return n?[{key:e.key,reason:n}]:[]});if(n.extras){let n=new Set(e.map(e=>e.key));for(let e of Object.keys(t))n.has(e)||r.push({key:e,reason:`unknown`})}return r}function Tae(e,t){if(_7(t))return;if(e.type===`choices`){let e=(Array.isArray(t)?t.map(String):String(t).split(`,`)).map(e=>e.trim()).filter(Boolean);return e.length?[...new Set(e)]:void 0}if(e.type===`bool`)return typeof t==`boolean`?t:t===`true`||t===`1`?!0:t===`false`||t===`0`?!1:String(t);let n=String(t).trim();if(e.type===`number`||e.type===`money`){let e=Number(n.replace(/[,\s$]/g,``));return Number.isFinite(e)?e:n}return e.type===`textarea`?String(t):n}var p7,m7,h7,g7,_7,Eae=s((()=>{p7=/^\d{4}-\d{2}-\d{2}$/,m7=/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d{1,6})?)?(?:Z|[+-]\d{2}:?\d{2})?$/,h7=1e4,g7=e=>{let t=new Date(`${e.slice(0,10)}T00:00:00Z`);return!Number.isNaN(t.getTime())&&t.toISOString().slice(0,10)===e.slice(0,10)},_7=e=>e==null||typeof e==`string`&&!e.trim()||Array.isArray(e)&&!e.length,Object.freeze({required:`This field is required.`,number:`Enter a number.`,date:`Enter a date.`,datetime:`Enter a date and time.`,bool:`Choose yes or no.`,choice:`Choose from the list.`,text:`Enter text, at most 10,000 characters.`,unknown:`This is not one of the fields this record has.`})})),Dae=l({DefinedAnswers:()=>jae,answerProblems:()=>kae});function Oae(e,t){let n=e.label;switch(t){case`required`:return O$(`isRequired`,{label:n});case`number`:return O$(`mustBeANumber`,{label:n});case`date`:return O$(`mustBeADate`,{label:n});case`datetime`:return O$(`mustBeADateAndTime`,{label:n});case`bool`:return O$(`mustBeYes`,{label:n});case`choice`:return O$(`chooseLabel`,{label:n});case`text`:return O$(`hasCharactersAForm`,{label:n});case`unknown`:return O$(`theFormHasAnInput`)}}function kae(e,t,n){return n?e.flatMap(e=>{let r=e.type===`defined`?n[e.name]:void 0;if(!r)return[];let i=t[e.name];return wae(r,b7(i)?i:{},{extras:!1}).map(({key:t,reason:n})=>[`${e.name}.${t}`,Oae(r.find(e=>e.key===t),n)])}):[]}function Aae(e){let t={name:e.key,label:e.label,...e.required?{required:!0}:{}};switch(e.type){case`number`:return{...t,type:`number`};case`money`:return{...t,type:`number`,step:.01};case`date`:case`datetime`:return{...t,type:e.type};case`bool`:return{...t,type:`boolean`};case`choice`:return{...t,type:`choice`,options:e.options.map(e=>({value:e,label:e}))};case`textarea`:return{...t,type:`textarea`};default:return{...t,type:`text`}}}function jae({field:e,id:t,path:n,value:r,shared:i,onChange:a,Control:o}){let[s,c]=(0,v7.useState)({}),l=i.questions?.[e.name];if(!l?.length)return null;let u=b7(r)?r:{},d=e.help?`${t}-help`:void 0;return(0,y7.jsxs)(`fieldset`,{className:`command-group`,"aria-describedby":d,children:[(0,y7.jsx)(`legend`,{children:e.label}),(0,y7.jsxs)(`div`,{className:`command-group-body`,children:[e.help&&(0,y7.jsx)(`span`,{id:d,className:`command-help`,children:e.help}),(0,y7.jsx)(`div`,{className:`command-fields`,children:l.map(e=>{let r=`${n}.${e.key}`,l=`${t}-${e.key}`,d=i.problems?.[r],f=u[e.key],p=Object.hasOwn(s,e.key)?s[e.key]:f,m=t=>{c(n=>({...n,[e.key]:t}));let n=Tae(e,t),i={...u};n===void 0?delete i[e.key]:i[e.key]=n,a(i,r)},h=Aae(e),g=`${e.label}${e.required&&e.type!==`bool`?` (required)`:``}`;return(0,y7.jsx)(RJ,{label:g,id:l,hint:e.help,problem:d,group:h.type===`choice`||e.type===`choices`,check:e.type===`bool`,className:`command-field`,children:t=>e.type===`choices`?(0,y7.jsx)(`div`,{className:`command-choices`,role:`group`,id:l,"aria-labelledby":`${l}-label`,children:e.options.map(t=>{let n=Array.isArray(p)?p:[];return(0,y7.jsxs)(`label`,{className:`command-choice`,children:[(0,y7.jsx)(`input`,{type:`checkbox`,checked:n.includes(t),disabled:i.disabled,onChange:r=>m(e.options.filter(e=>e===t?r.target.checked:n.includes(e)))}),t]},t)})}):(0,y7.jsx)(o,{field:h,id:l,describedBy:t[`aria-describedby`],invalid:!!d,value:typeof p==`string`||typeof p==`number`||typeof p==`boolean`?p:void 0,disabled:i.disabled,onChange:m})},e.key)})})]})]})}var v7,y7,b7,Mae=s((()=>{v7=d(m()),Eae(),VJ(),k$(),y7=d(O()),b7=e=>!!e&&typeof e==`object`&&!Array.isArray(e)}));function x7(e,t){return t?.length?!0:e.some(e=>l9(e)!==void 0||e.type===`group`&&x7(e.fields))}function Nae(e){switch(e.type){case`money`:case`month`:case`choices`:return!0;case`number`:return e.as===`slider`;case`text`:return e.mask!==void 0||e.sensitive!==void 0;case`boolean`:return e.as===`buttons`||e.statement!==void 0;case`choice`:return e.as===`cards`||e.as===`buttons`||e.source!==void 0;default:return!1}}function S7(e){let t={};for(let n of e){let e=n.type===`group`?void 0:n.default;e!==void 0&&typeof e!=`object`?t[n.name]=e:typeof e==`object`&&`auto`in e&&e.auto!==`me`?t[n.name]=e.auto===`today`?new Intl.DateTimeFormat(`en-CA`,{timeZone:zi()}).format(Vi()):new Date(Math.floor(Vi().getTime()/6e4)*6e4).toISOString():n.type===`boolean`&&n.as!==`buttons`?t[n.name]=!1:n.type===`lines`?t[n.name]=Array.from({length:Math.max(n.min??0,1)},()=>Q7()):n.type===`group`&&(t[n.name]=n.repeat?Array.from({length:n.repeat.min??0},()=>S7(n.fields)):S7(n.fields))}return t}function C7(e,t){let n=S7(e);if(!c9(t))return n;for(let r of e){if(!Object.hasOwn(t,r.name))continue;let e=t[r.name];r.type!==`files`&&r.type!==`signature`&&(r.type===`defined`?c9(e)&&(n[r.name]={...e}):r.type===`lines`?Array.isArray(e)&&(n[r.name]=e.map(e=>Q7(Object.fromEntries(r.show.flatMap(t=>{let n=c9(e)?e[t]:void 0;return typeof n==`string`||typeof n==`number`||typeof n==`boolean`?[[t,String(n)]]:[]}))))):r.type===`group`?r.repeat?Array.isArray(e)&&(n[r.name]=e.map(e=>C7(r.fields,e))):n[r.name]=C7(r.fields,e):(typeof e==`string`||typeof e==`number`||typeof e==`boolean`)&&(n[r.name]=e))}return n}function w7(e,t){return(e.type===`number`||e.type===`money`)&&typeof t==`string`?t.trim()?Number(t):``:t}function T7(e,t,n){let r=new Set;if(!e.some(e=>l9(e)!==void 0))return r;let i=n??{fields:e,values:t},a={};for(let e of i.fields)a[e.name]=w7(e,i.values[e.name]);for(let n of e)a[n.name]=w7(n,t[n.name]);let o=[...i.fields,...e.filter(e=>!i.fields.includes(e))];for(let t of e){let e=l9(t);e===void 0||G7(e)||V7&&!V7.draftHolds(e,a,o)&&r.add(t.name)}return r}function E7(e,t,n){let r={},i=T7(e,t,n);for(let n of e){if(i.has(n.name))continue;let e=t[n.name];n.type===`lines`?r[n.name]=($7(e)?e:[]).map(e=>Object.fromEntries(n.show.flatMap(t=>e.values[t]?[[t,e.values[t]]]:[]))):n.type===`group`?r[n.name]=n.repeat?(Array.isArray(e)?e:[]).map(e=>E7(n.fields,c9(e)?e:{})):E7(n.fields,c9(e)?e:{}):(n.type===`number`||n.type===`money`)&&typeof e==`string`&&!(n.type===`money`&&n.minor)?r[n.name]=e.trim()?Number(e):``:e!==void 0&&(r[n.name]=e)}return r}function D7(e,t,n){let r=Y7(e,t);if(r){let e=r.label;return n===`required`?O$(`isRequired`,{label:e}):n===`choice`?O$(`chooseLabel`,{label:e}):n===`type`?O$(`isNotInAForm`,{label:e}):O$(`theFormHasAnInput`)}let i=bi(e,t);if(!i)return O$(`theFormHasAnInput`);let a=i.label,o=d9(i.type),s=e=>e&&i.type===`datetime`?new Date(e).toLocaleString(Ri(),{timeZone:zi(),dateStyle:`medium`,timeStyle:`short`}):e??``,c=i.type===`text`||i.type===`textarea`?i:void 0,l=c?.maxLength??(i.type===`richText`?i.maxLength:void 0),u=n=>{let r=t.includes(`.`)?t.slice(0,t.lastIndexOf(`.`)+1):``;return(n&&bi(e,`${r}${n}`)?.label)??n??``};switch(n){case`required`:return s9(i)?O$(`checkThisBoxTo`):O$(`isRequired`,{label:a});case`too_short`:return O$(`mustBeAtLeast`,{label:a,minLength:c?.minLength??(i.type===`richText`?i.minLength:void 0)??``});case`too_long`:return O$(`mustBeCharactersOrFewer`,{label:a,maxLength:l??``});case`format`:return c?.message??O$(`must`,{label:a,value:c?.format?u9[c.format]:c?.as===`color`?O$(`aColor`):O$(`inTheFormItTakes`)});case`pattern`:return c?.message??O$(`isNotInTheForm`,{label:a});case`not_below`:{let e=u(i.below);return O$(o?`mustBeBefore`:`mustBeLessThan`,{label:a,other:e})}case`not_above`:{let e=u(i.above);return O$(o?`mustBeAfter`:`mustBeMoreThan`,{label:a,other:e})}case`text`:return O$(`hasCharactersAForm`,{label:a});case`integer`:return O$(`mustBeASafe`,{label:a});case`precision`:return O$(`hasMoreDecimalsThanTheCurrency`,{label:a});case`below_min`:return o?O$(`mustBeOnOrAfter`,{label:a,min:s(i.min)}):O$(`labelMustBeAt`,{label:a,min:i.min??``});case`above_max`:return o?O$(`mustBeOnOrBefore`,{label:a,max:s(i.max)}):O$(`mustBeAtMost`,{label:a,max:i.max??``});case`choice`:return O$(`chooseLabel`,{label:a});case`too_few`:{if(i.type===`files`)return O$(`needsAtLeastFiles`,{label:a,count:i.min??1});let e=i.type===`group`?i.repeat?.min??0:i.type===`lines`?i.min??0:0;return O$(`needsAtLeastRows`,{label:a,count:e})}case`too_many`:return i.type===`files`?O$(`takesAtMostFiles`,{label:a,count:i.max}):O$(`takesAtMostRows`,{label:a,max:(i.type===`group`?i.repeat?.max:i.type===`lines`?i.max:0)??``});case`type`:return i.type===`number`?O$(`mustBeANumber`,{label:a}):i.type===`boolean`?O$(`mustBeYes`,{label:a}):o?O$(i.type===`datetime`?`mustBeADateAndTime`:i.type===`time`?`mustBeATime`:`mustBeADate`,{label:a}):i.type===`reference`?O$(`chooseLabel`,{label:a}):O$(`isNotInAForm`,{label:a});case`shape`:return O$(`isNotInAForm`,{label:a});case`exclusive`:return O$(`chooseAlone`,{label:a})}}function O7(e,t){let n=[],r=e;for(let i of t.split(`.`)){let a=/^([A-Za-z_][A-Za-z0-9_]*)(?:\[(\d+)\])?$/.exec(i),o=a&&r.find(e=>e.name===a[1]);if(!o)return;if(n.push(o.label),a[2]!==void 0&&n.push(O$(`rowMatch`,{match:Number(a[2])+1})),o.type===`lines`){let r=Y7(e,t);return r&&a[2]!==void 0&&n.push(r.label),r||!t.includes(`.`)?n.join(`, `):void 0}r=o.type===`group`?o.fields:[]}return n.join(`, `)}function k7(e,t,n){let r=[],i=T7(e,t,n.whole);for(let n of e){let a=l9(n);if(a===void 0||i.has(n.name)||G7(a)||n.type===`group`||n.type===`lines`)continue;let o=t[n.name],s=o==null||o===``||Array.isArray(o)&&!o.length;(s9(n)?n.accept===!0&&o!==!0:n.required&&s)&&r.push([n.name,D7(e,n.name,`required`)])}if(n.rules?.length&&V7){let i=n.whole??{fields:e,values:t},a={...E7(i.fields,i.values),...E7(e,t,n.whole)},o=new Set(e.map(e=>e.name));for(let t of V7.brokenRules(n.rules,a,[...i.fields,...e.filter(e=>!i.fields.includes(e))]))o.has(t.field)&&r.push([t.field,t.message])}return r}function A7(e,t,n,r={}){let i={};for(let n of yi(e,E7(e,t,r.whole),X7()))Object.hasOwn(i,n.path)||(i[n.path]=D7(e,n.path,n.reason));for(let[r,a]of i9(e,t,n))Object.hasOwn(i,r)||(i[r]=a);for(let[n,a]of k7(e,t,r))Object.hasOwn(i,n)||(i[n]=a);return i}function j7(e,t,n,r={}){let i;try{i=vi(e,E7(e,t,r.whole),X7())}catch(t){if(!(t instanceof Si))throw t;let n=D7(e,t.path,t.reason),r=t.path.includes(`.`)?O7(e,t.path.slice(0,t.path.lastIndexOf(`.`))):void 0;throw Error(r?`${r}: ${n}`:n)}let[a]=i9(e,t,n);if(a){let t=e.find(e=>e.name===a[0].slice(0,a[0].indexOf(`.`)));throw Error(t?`${t.label}: ${a[1]}`:a[1])}let[o]=k7(e,t,r);if(o)throw Error(o[1]);return i}function M7({field:e,id:t,describedBy:n,invalid:r,value:i,disabled:a,onChange:o,connection:s,visitor:c,record:l,valid:u,onLeave:d,answers:f}){let p={id:t,"aria-describedby":n,"aria-invalid":r||void 0,required:e.required,className:`field-control`,disabled:a,...d?{onBlur:d}:{}},m=(e,t=!1)=>u===void 0?e:(0,L7.jsxs)(`div`,{className:`field-box has-mark`,...t&&d?{onBlur:d}:{},children:[e,u?(0,L7.jsx)(`span`,{className:`field-mark`,"aria-hidden":`true`}):null]});if(Nae(e))return m((0,L7.jsx)(z7,{field:e,id:t,"aria-describedby":n,"aria-invalid":r||void 0,value:i,disabled:a,onChange:o,...s===void 0?c?{source:{visitor:c}}:{}:{source:s},...f&&(e.type===`choice`||e.type===`choices`)&&e.source?.match?{answers:f}:{}}),!0);if(e.type===`boolean`)return(0,L7.jsx)(`input`,{...p,required:e.accept===!0,className:`command-check`,type:`checkbox`,checked:i===!0,onChange:e=>o(e.target.checked)});if(e.type===`richText`)return(0,L7.jsx)(Tre,{id:t,label:e.label,describedBy:n,invalid:r,disabled:a,value:typeof i==`string`?i:``,onChange:o,...e.mentions&&s!==void 0?{mentions:Ere(e.mentions,s)}:{},...e.images&&s!==void 0&&l?(()=>{let t=Dre(e.images,l,s);return t?{pictures:t,onProblem:e=>Ws(e,`error`)}:{}})():{}});if(e.type===`textarea`)return(0,L7.jsx)(`textarea`,{...p,rows:3,maxLength:e.maxLength,placeholder:e.placeholder,value:String(i??``),onChange:e=>o(e.target.value)});if(e.type===`choice`){let s=e.options.findIndex(e=>e.value===i);return o9(e)?(0,L7.jsx)(A$,{id:t,options:e.options,value:i,describedBy:n,required:e.required,invalid:r,disabled:a,onChange:o}):(0,L7.jsx)(xQ,{id:t,ariaLabelledBy:`${t}-label`,ariaInvalid:r,ariaDescribedBy:n,disabled:a,value:s<0?``:String(s),valueClassName:s<0?`is-empty`:void 0,items:[...s<0?[{value:``,label:bQ(e.label)?O$(`choosePlaceholder`,{label:e.label.toLowerCase()}):O$(`chooseOne`)}]:[],...e.options.map((e,t)=>({value:String(t),label:e.label}))],onChange:t=>{t!==``&&o(e.options[Number(t)].value)}})}if(e.type===`date`)return(0,L7.jsx)(l$,{...p,"aria-label":`${e.label}${e.required?` (required)`:``}`,min:e.min,max:e.max,locale:Ri(),timezone:zi(),now:Vi(),value:String(i??``),onChange:o});if(e.type===`datetime`)return(0,L7.jsx)(R7,{...p,"aria-label":`${e.label}${e.required?` (required)`:``}`,min:e.min,max:e.max,value:typeof i==`string`?i:``,onChange:o});if(e.type===`time`)return(0,L7.jsx)(`input`,{...p,className:`field-control time-input`,type:`time`,min:e.min,max:e.max,value:typeof i==`string`?i:``,onChange:e=>o(e.target.value)});if(e.type===`number`){let t=e.integer||e.step!==void 0&&Number.isInteger(e.step);return m((0,L7.jsx)(`input`,{...p,type:`number`,min:e.min,max:e.max,step:e.step??(e.integer?1:`any`),inputMode:t?`numeric`:`decimal`,placeholder:e.placeholder,value:String(i??``),onChange:e=>o(e.target.value)}))}if(e.type!==`text`)return null;let h=e.format===`email`?`email`:e.format===`url`?`url`:e.format===`phone`?`tel`:`text`;return m((0,L7.jsx)(`input`,{...p,type:h,minLength:e.minLength,maxLength:e.maxLength,placeholder:e.placeholder,...e.case===`upper`?{autoCapitalize:`characters`}:{},value:String(i??``),onChange:e=>o(e.target.value)}))}function Pae(e){if(e.type===`number`&&e.as===`rating`)return`rating`;if(e.type===`text`&&(e.as===`scan`||e.as===`color`))return e.as}function Fae(e,t){if(t==null||t===``)return!1;let{when:n,...r}=e;return yi([r],E7([r],{[e.name]:t}),X7()).length===0}function Iae({fields:e,values:t,onChange:n,whole:r,...i}){let a=yc(W7,x7(r?.fields??e)),o=T7(e,t,r);return!a&&x7(r?.fields??e)?null:(0,L7.jsx)(L7.Fragment,{children:e.filter(e=>!o.has(e.name)).map(a=>{let o=(0,L7.jsx)(N7,{field:a,path:a.name,value:t[a.name],answers:r?.values??t,shared:i,onChange:(e,r)=>n({...t,[a.name]:e},r)},a.name);return a.type!==`number`&&a.type!==`money`||!a.live?o:(0,L7.jsxs)(I7.Fragment,{children:[o,(0,L7.jsx)(B7,{field:a,fields:r?.fields??e,values:r?.values??t,id:`${i.idPrefix}-live-${a.name}`})]},a.name)})})}function N7({field:e,path:t,value:n,onChange:r,shared:i,answers:a}){let o=`${i.idPrefix}-field-${t.replace(/[^A-Za-z0-9_-]/g,`-`)}`,s=i.problems?.[t],[c,l]=(0,I7.useState)(!1);if(e.type===`defined`)return(0,L7.jsx)(r9,{field:e,id:o,path:t,value:n,shared:i,onChange:r,Control:M7});if(e.type===`lines`)return(0,L7.jsxs)(`div`,{className:`command-lines`,children:[(0,L7.jsx)(J7,{field:e,path:t,rows:$7(n)?n:[],problems:i.problems,disabled:i.disabled,onChange:(e,t)=>r(e,t)}),i.problems&&(0,L7.jsx)(`span`,{className:`insert-missing`,"aria-live":`polite`,hidden:!s,children:s})]});if(e.type===`group`){let a=e.help?`${o}-help`:void 0,c=`${o}-error`,l=[a,s?c:void 0].filter(Boolean).join(` `)||void 0;return(0,L7.jsxs)(`fieldset`,{className:`command-group${e.repeat?` command-repeat`:``}`,"aria-describedby":l,children:[(0,L7.jsx)(`legend`,{children:e.label}),(0,L7.jsxs)(`div`,{className:`command-group-body`,children:[e.help&&(0,L7.jsx)(`span`,{id:a,className:`command-help`,children:e.help}),e.repeat?(0,L7.jsx)(Lae,{field:e,path:t,rows:Array.isArray(n)?n:[],shared:i,onChange:r}):(0,L7.jsx)(P7,{field:e,path:t,values:c9(n)?n:{},shared:i,onChange:r}),i.problems&&(0,L7.jsx)(`span`,{id:c,className:`insert-missing`,"aria-live":`polite`,hidden:!s,children:s})]})]})}let u=e.type===`choices`?Array.isArray(n)?n:void 0:c9(n)||Array.isArray(n)?void 0:n,d=s9(e)?e.accept===!0:e.required,f=d?(0,L7.jsxs)(L7.Fragment,{children:[e.label,(0,L7.jsxs)(`span`,{className:`visually-hidden`,children:[` `,Fa(`mistri.form.required`,O$(`requiredWord`))]})]}):e.label,p=e.type===`choice`&&o9(e),m=e.type===`choice`&&!p,h=e.type===`files`||e.type===`signature`,g=t.replace(/\[\d+\]/g,``),_=Pae(e),v=i.inputs&&Object.hasOwn(i.inputs,g)?i.inputs[g]:`input`in e&&typeof e.input==`string`?{id:e.input}:_?{id:w$(_)}:void 0,y=e.type===`boolean`&&e.statement!==void 0&&!v,b=s9(e)&&!v&&!y,x=e.type===`boolean`&&e.as===`buttons`&&!v,S=i.bound&&Object.hasOwn(i.bound,g)?i.bound[g]:void 0,C=v||`as`in e&&e.as!==void 0?void 0:f9(e);return(0,L7.jsx)(RJ,{label:f,required:d===!0,optional:s9(e)?void 0:Fa(`mistri.form.optional`,O$(`optionalWord`)),id:o,hint:e.help,problem:s,group:p||m||x||h,check:b,labelHidden:y,kind:C,className:`command-field`,children:d=>h?(0,L7.jsx)(t9,{field:e,path:xi(t),id:o,describedBy:d[`aria-describedby`],labelledBy:d[`aria-labelledby`],invalid:!!s,disabled:i.disabled===!0,target:i.held,value:n,onChange:e=>r(e,t)}):e.type===`reference`?(i.connection!==void 0||i.visitor)&&(0,L7.jsx)(e9,{field:S===void 0?e:{...e,query:S??``},id:o,describedBy:d[`aria-describedby`],invalid:!!s,connection:i.connection??{visitor:i.visitor},identityEpoch:i.identityEpoch,disabled:i.disabled===!0||S===null,value:u,isCurrent:i.isCurrent,onChange:e=>r(e,t)}):(()=>{let n=i.presentation===`intake`&&p9(e),f=(0,L7.jsx)(M7,{field:e,id:o,describedBy:d[`aria-describedby`],invalid:!!s,...n?{valid:c&&!s&&Fae(e,u),onLeave:()=>l(!0)}:{},value:u,disabled:i.disabled,onChange:e=>r(e,t),...i.connection===void 0?{}:{connection:i.connection},...i.visitor?{visitor:i.visitor}:{},...i.record?{record:i.record}:{},...a?{answers:a}:{}});return v?(0,L7.jsx)(x$,{component:v.id,fallback:f,value:Array.isArray(u)?null:u??null,onChange:e=>r(e,t),id:o,describedBy:d[`aria-describedby`],invalid:!!s,disabled:i.disabled===!0,required:e.required===!0,label:e.label,field:{name:e.name,...e.type===`number`&&e.outOf?{rule:{outOf:e.outOf}}:{}},context:`command`}):f})()})}function P7({field:e,path:t,values:n,shared:r,onChange:i}){let a=T7(e.fields,n);return(0,L7.jsx)(`div`,{className:`command-fields`,children:e.fields.filter(e=>!a.has(e.name)).map(e=>(0,L7.jsx)(N7,{field:e,path:`${t}.${e.name}`,value:n[e.name],shared:r,onChange:(t,r)=>i({...n,[e.name]:t},r)},e.name))})}function F7(e,t){if(Array.isArray(t))return t.flatMap(t=>F7(e,t));if(!t||typeof t!=`object`)return[];let n=t;return e.flatMap(e=>{let t=n[e.name];return e.type===`group`?F7(e.fields,t):e.type===`files`?Array.isArray(t)?t.filter(e=>typeof e==`string`):[]:e.type===`signature`&&typeof t==`string`?[t]:[]})}function Lae({field:e,path:t,rows:n,shared:r,onChange:i}){let a=(0,I7.useRef)([]),o=(0,I7.useRef)(0);for(;a.current.length<n.length;)a.current.push(o.current++);a.current.length>n.length&&(a.current.length=n.length);let s=e.repeat?.min??0,c=e.repeat?.max??0;return(0,L7.jsxs)(L7.Fragment,{children:[n.map((o,c)=>(0,L7.jsxs)(`div`,{className:`command-row`,role:`group`,"aria-label":O$(`groupRow`,{label:e.label,index:c+1}),children:[(0,L7.jsxs)(`div`,{className:`command-row-head`,children:[(0,L7.jsxs)(`span`,{className:`command-row-number`,children:[O$(`rowLabel`),` `,c+1]}),(0,L7.jsx)(UG,{intent:`secondary`,size:`compact`,disabled:r.disabled||n.length<=s,"aria-label":O$(`removeRow`,{index:c+1,label:e.label}),onClick:()=>{a.current.splice(c,1);for(let t of F7(e.fields,o))P$(t);i(n.filter((e,t)=>t!==c),t)},children:O$(`common.remove`)})]}),(0,L7.jsx)(P7,{field:e,path:`${t}[${c}]`,values:o,shared:r,onChange:(e,t)=>i(n.map((t,n)=>n===c?e:t),t)})]},a.current[c])),(0,L7.jsx)(`div`,{className:`command-repeat-actions`,children:(0,L7.jsx)(UG,{intent:`secondary`,disabled:r.disabled||n.length>=c,"aria-label":O$(`addRowTo`,{label:e.label}),onClick:()=>i([...n,S7(e.fields)],t),children:O$(`addRow`)})})]})}var I7,L7,R7,z7,B7,V7,H7,U7,W7,G7,K7,q7,J7,Y7,X7,Z7,Q7,$7,e9,t9,n9,r9,i9,a9,o9,s9,c9,l9,u9,d9,f9,p9;s((()=>{I7=d(m()),ji(),tc(),Ore(),CQ(),f$(),xa(),wc(),GG(),VJ(),D$(),Ya(),k$(),M$(),L$(),L7=d(O()),R7=vc(()=>Promise.resolve().then(()=>(Y$(),G$)),`DateTimeInput`,{quiet:!0}),z7=vc(()=>Promise.resolve().then(()=>(c6(),B3)),`IntakeControl`,{quiet:!0}),B7=vc(()=>Promise.resolve().then(()=>(F6(),D6)),`CommandLive`,{quiet:!0}),U7=()=>H7??=Promise.resolve().then(()=>(g8(),I6)).then(e=>{V7=e},e=>{throw H7=void 0,e}),W7={ready:()=>U7().catch(()=>{}),here:()=>V7!==void 0},G7=e=>V7?V7.readsRecord(e):/(?<![\w.])(?:record|tenant)\./.test(e),q7=()=>Promise.resolve().then(()=>(cae(),rae)).then(e=>(K7=e,e)),J7=vc(q7,`CommandLines`),Y7=(e,t)=>K7?.lineAt(e,t),X7=()=>({currency:Hi(),wire:!0,...K7?{cell:K7.lineCellOf}:{}}),Z7=0,Q7=(e={})=>({id:-++Z7,values:e}),$7=e=>Array.isArray(e)&&e.every(e=>!!e&&typeof e==`object`&&`values`in e&&`id`in e),e9=vc(()=>Promise.resolve().then(()=>(w3(),a3)),`CommandReferenceField`,{quiet:!0}),t9=vc(()=>Promise.resolve().then(()=>(Sae(),bae)),`HeldInput`,{quiet:!0}),r9=vc(()=>Promise.resolve().then(()=>(Mae(),Dae)).then(e=>(n9=e,e)),`DefinedAnswers`,{quiet:!0}),i9=(e,t,n)=>n&&n9?n9.answerProblems(e,t,n):[],a9=4,o9=e=>e.as===`radios`||e.as!==`select`&&e.options.length<=a9,s9=e=>e.type===`boolean`&&e.as!==`buttons`,c9=e=>!!e&&typeof e==`object`&&!Array.isArray(e),l9=e=>`when`in e?e.when:void 0,u9={email:O$(`anEmailAddress`),url:O$(`aWebAddressStarting`),phone:O$(`aPhoneNumber`)},d9=e=>e===`date`||e===`datetime`||e===`time`,f9=e=>e.type===`number`||e.type===`money`||e.type===`date`||e.type===`datetime`||e.type===`time`?e.type:void 0,p9=e=>(e.type===`money`||e.type===`number`)&&e.as!==`slider`&&e.as!==`rating`||e.type===`text`&&e.sensitive===void 0&&e.as!==`color`&&e.as!==`scan`}))();var m9={unauthenticated:`Sign in to continue.`,stale_account:`The signed-in account changed. Reload before continuing.`,invalid_input:`The command input is invalid.`,command_version_mismatch:`This command version is unavailable. Keep the original request for reconciliation.`,not_found:`The record was not found.`,ineligible_state:`This record is not eligible for this command.`,consumes_refused:`There is not enough left of what this would use.`,out_of_scope:`The row is outside this token's scope.`,reviewer_unavailable:`The selected reviewer is unavailable.`,forbidden:`This command is not available to this account.`,idempotency_conflict:`This request key was already used with different input.`,duplicate_record:`A record with this value already exists.`,stale_record:`The record has changed. Reload it before trying again.`,cancelled:`The command was cancelled.`,temporarily_unavailable:`The command could not be completed. Retry with the same request key.`,row_locked:`The record is locked by another transaction. Nothing was changed; retry in a moment.`,invalid_result:`The command did not produce a valid result.`};tc(),Pa();function Rae(e){let t=e=>{e.preventDefault(),e.returnValue=``};Ea(window,`beforeunload`,t),Ea(window,`pagehide`,e);let n=Rs(()=>!0);return()=>{Da(window,`beforeunload`,t),Da(window,`pagehide`,e),n()}}Fe();function zae({note:e}){return e?(0,j.jsxs)(`p`,{className:`intake-note`,children:[e.icon&&(0,j.jsx)(Pe,{name:e.icon,size:16}),(0,j.jsx)(`span`,{children:e.text})]}):null}Ya();var h9=Va({done:`Done`,sending:`Sending…`,checking:`Checking the result…`,queued:`Queued`,approval:`Awaiting approval`,refused:`Not done`,unknown:`Result not confirmed`,doneBody:`The change is saved.`,queuedBody:`It is in line and runs shortly. Nothing more is needed from you.`,approvalBody:`It goes ahead once someone who may approve it does.`,unknownBody:`The answer did not arrive, so it may or may not have gone through.`,unknownNext:`Check again before sending it a second time: a check reads what was kept and never sends twice.`,untrackedNext:`This action keeps no receipt to check by. Look at the record before you try again.`,nextField:`Change {field} and send again.`,nextInput:`Correct the answers and send again.`,nextStale:`Refresh and review what changed, then send again.`,nextIneligible:`It is no longer in a state this applies to. Refresh to see where it stands.`,nextForbidden:`Your role may not do this. Ask someone who may.`,nextNotFound:`It is no longer there. Refresh to see what is.`,sentIneligible:`Nothing was kept. Review your answers and send again, or come back later.`,sentNotFound:`Something your answers name is no longer there. Change it and send again.`,nextWait:`Wait a moment and send again.`,nextDuplicate:`One like it already exists. Find that one instead of making another.`,nextDefault:`Nothing was changed. Review and send again.`});ui();var Bae=(e,t)=>({label:e,derived:t!==void 0&&t.label===Gr(t.name)}),Vae=({label:e,derived:t})=>t&&/^[A-Z][a-z]+(?![A-Z])/.test(e)?e.charAt(0).toLowerCase()+e.slice(1):e;function Hae(e,t,n=!1){if(t)return h9(`nextField`,{field:Vae(typeof t==`string`?{label:t,derived:!1}:t)});if(n&&e===`ineligible_state`)return h9(`sentIneligible`);if(n&&e===`not_found`)return h9(`sentNotFound`);switch(e){case`invalid_input`:return h9(`nextInput`);case`stale_record`:case`idempotency_conflict`:case`command_version_mismatch`:return h9(`nextStale`);case`ineligible_state`:return h9(`nextIneligible`);case`forbidden`:return h9(`nextForbidden`);case`not_found`:return h9(`nextNotFound`);case`rate_limited`:case`row_locked`:case`temporarily_unavailable`:case`unavailable`:return h9(`nextWait`);case`duplicate_record`:return h9(`nextDuplicate`);default:return h9(`nextDefault`)}}var Uae=(e=!1)=>h9(e?`untrackedNext`:`unknownNext`);function Wae(e){return e.state===`pending`?Gae[e.waiting]():Kae[e.state]()}var Gae={sending:()=>h9(`sending`),checking:()=>h9(`checking`),queued:()=>h9(`queued`),approval:()=>h9(`approval`)},Kae={done:()=>h9(`done`),refused:()=>h9(`refused`),unknown:()=>h9(`unknown`)};Ya();var g9=Va({openRecord:`Open {label}`,checkAgain:`Check again`});GG();function qae({outcome:e,onOpen:t,onCheck:n,className:r,...i}){return(0,j.jsxs)(`div`,{...i,className:`command-outcome${r?` ${r}`:``}`,"data-state":e.state,...e.state===`pending`?{"data-waiting":e.waiting}:{},children:[(0,j.jsx)(`p`,{className:`command-outcome-title`,children:Wae(e)}),e.said&&(0,j.jsx)(`p`,{className:`command-outcome-body`,children:e.said}),e.state===`done`&&e.changed&&t&&(0,j.jsx)(`p`,{className:`command-outcome-next`,children:(0,j.jsx)(UG,{intent:`quiet`,size:`compact`,onClick:t,children:g9(`openRecord`,{label:e.changed.label})})}),(e.state===`refused`||e.state===`unknown`)&&(0,j.jsx)(`p`,{className:`command-outcome-next`,children:e.next}),e.state===`unknown`&&n&&(0,j.jsx)(`p`,{className:`command-outcome-check`,children:(0,j.jsx)(UG,{intent:`secondary`,onClick:n,children:g9(`checkAgain`)})})]})}wc(),G4();var Jae=vc(()=>Promise.resolve().then(()=>(w3(),a3)),`ReviewNamed`,{quiet:!0});function _9({field:e,value:t,from:n}){if(n&&(e.type===`reference`?t!==``&&t!=null:e.type===`group`&&e.fields.some(e=>e.type===`reference`)))return(0,j.jsx)(Jae,{field:e,value:t,from:n});if(e.type===`group`){let n=U4(e,t);if(n.length>1)return(0,j.jsx)(`ul`,{className:`review-lines`,children:n.map((e,t)=>(0,j.jsx)(`li`,{children:e},t))})}return(0,j.jsx)(j.Fragment,{children:V4(e,t)})}Ya();var v9=Va({theFormCouldNotBeSubmitted:`The form could not be submitted ({status}).`,tooManySubmissionsFromThisAddress:`Too many submissions from this address. Try again in {retryAfter} seconds.`,review:`Review`,reviewTitle:`Review your answers`,reviewLead:`Check each section. Change anything that is not right.`,keepThisReference:`Keep this reference.`,received:`Received`,yourReference:`Your reference`,fillInAnother:`Fill in another`,backToApp:`Back to {name}`,submit:`Submit`,change:`Change {label}`,changeStep:`Change`,checkThisBoxTo:`Check this box to continue.`,thisAnswerWasNot:`This answer was not accepted. Check it and try again.`,couldNotReach:`The form could not be sent. Check your connection and try again.`,refusedInvalidInput:`Some answers need another look.`,refusedVersion:`This form has changed since the page was opened. Reload the page to continue.`,refusedNotFound:`What this form was about is no longer here. Reload the page to continue.`,refusedIneligible:`This can’t be sent as it stands. Check your answers and try again.`,refusedForbidden:`This form can’t be sent from this page. Reload it and try again.`,refusedKeyReused:`This was already sent with different answers. Reload the page to start again.`,refusedDuplicate:`Something with these details already exists.`,refusedStale:`Something changed while you were filling this in. Reload the page and try again.`,refusedCancelled:`It was not sent.`,refusedUnavailable:`It could not be sent just now. Try again in a moment; it will not be sent twice.`,refusedLocked:`Someone else is changing this record right now. Nothing was sent; try again in a moment.`}),y9,Yae=s((()=>{Ya(),y9=Va({reviewThisStepBefore:`Review this step before continuing.`,thisStepCouldNotBeValidated:`This step could not be validated. Try again.`,thisFormCouldNotBeCompleted:`This form could not be completed. Try again.`,formSteps:`Form steps`,stepOf:`Step {step} of {count}`,progress:`Step {step} of {count}: {label}`,continue:`Continue`,stepDone:`, done`})})),Xae=s((()=>{})),Zae=l({}),Qae=s((()=>{T3(),Xae()})),$ae=l({MultiStepForm:()=>eoe,loadIntakeStyle:()=>b9});function b9(){return E9??=Promise.resolve().then(()=>(Qae(),Zae)).then(()=>{T9=!0}),E9}function x9(e,t){return Number.isSafeInteger(e)?Math.max(0,Math.min(e,t-1)):0}function eoe({steps:e,children:t,step:n,initialStep:r=0,onStepChange:i,validateStep:a,onComplete:o,nextLabel:s,previousLabel:c=Fa(`mistri.form.back`,y9(`common.back`)),completeLabel:l=y9(`common.save`),className:u=``,leading:d,said:f,style:p=`stepper`,note:m,isStepEmpty:h,presentation:g=`page`,headingLevel:_=1,summarize:v}){let y=(0,S9.useId)(),b=e.slice(0,w9),x=n!==void 0,[S,C]=(0,S9.useState)(()=>p!==`intake`||T9);(0,S9.useEffect)(()=>{if(S)return;let e=!0;return b9().then(()=>e&&C(!0)),()=>{e=!1}},[S]);let[w,T]=(0,S9.useState)(()=>x9(r,b.length)),E=x9(x?n:w,b.length),[D,O]=(0,S9.useState)(``),[k,A]=(0,S9.useState)(!1),j=(0,S9.useRef)(!0);(0,S9.useEffect)(()=>()=>{j.current=!1},[]);let M=(0,S9.useRef)(null),N=(0,S9.useRef)(null),P=(0,S9.useRef)(null),[F,I]=(0,S9.useState)(0);(0,S9.useLayoutEffect)(()=>{if(!F)return;let e=M.current?.querySelector(`[aria-invalid="true"], :is(input, select, textarea):invalid`);M.current?.querySelector(`[aria-invalid="true"]`)&&O(``),(e??P.current)?.focus({preventScroll:!0})},[F]);let L=(0,S9.useRef)(E);if((0,S9.useLayoutEffect)(()=>{if(L.current===E)return;L.current=E;let e=N.current?.getBoundingClientRect().top??0;(e<0||e>window.innerHeight)&&N.current?.scrollIntoView?.({block:`start`,inline:`nearest`,behavior:`instant`})},[E]),!b.length)return null;let R=b[E],z=`${y}-title`,B=`${y}-panel`,V=async e=>{if(k)return;let t=e===`next`?E+1:E-1;if(!(t<0||t>=b.length)){A(!0),O(``);try{if(e===`next`&&a&&!await a(R,e)){j.current&&(O(y9(`reviewThisStepBefore`)),I(e=>e+1));return}if(!j.current)return;x||T(t),i?.(t,b[t])}catch{j.current&&O(y9(`thisStepCouldNotBeValidated`))}finally{j.current&&A(!1)}}},H=async()=>{if(!k){A(!0),O(``);try{if(a&&!await a(R,`next`)){j.current&&(O(y9(`reviewThisStepBefore`)),I(e=>e+1));return}await o?.()}catch{j.current&&O(y9(`thisFormCouldNotBeCompleted`))}finally{j.current&&A(!1)}}},U=e=>{k||e>=E||(x||T(e),O(``),i?.(e,b[e]))},W=p===`intake`;if(!S)return(0,C9.jsx)(`section`,{ref:N,className:`multi-step-form ${u}`.trim(),"data-style":`intake`,"aria-busy":`true`});let G=E===b.length-1,ee=g===`dialog`,te=G?l:s??(W&&R.skip&&h?.(R)?R.skip:R.next??y9(`continue`)),ne=R.title??R.label,K=e=>{if(e.key!==`Enter`||e.defaultPrevented||e.nativeEvent.isComposing||e.shiftKey||e.altKey||e.ctrlKey||e.metaKey)return;let t=e.target;t instanceof HTMLInputElement&&!D9.has(t.type)&&t.getAttribute(`role`)!==`combobox`&&t.getAttribute(`aria-expanded`)!==`true`&&(e.preventDefault(),G?H():V(`next`))},re=b.length>1&&(0,C9.jsxs)(`div`,{className:`multi-step-progress`,children:[(0,C9.jsx)(Q$,{min:1,value:E+1,max:b.length,label:Fa(`mistri.form.stepNamed`,y9(`progress`,{step:E+1,count:b.length,label:R.label}),{step:E+1,count:b.length,label:R.label})}),(0,C9.jsx)(`span`,{className:`multi-step-count`,"aria-hidden":`true`,children:Fa(`mistri.form.step`,y9(`stepOf`,{step:E+1,count:b.length}),{step:E+1,count:b.length})})]}),q=(0,C9.jsx)(`div`,{id:B,ref:M,className:`multi-step-panel`,role:`group`,"aria-labelledby":z,onKeyDown:K,children:t(R,E)}),ie=(0,C9.jsx)(`p`,{ref:P,tabIndex:-1,className:`multi-step-problem`,role:`alert`,"aria-live":`polite`,hidden:!D,children:D}),ae=g===`page`?(0,C9.jsx)(`aside`,{className:`multi-step-aside`,children:(0,C9.jsx)(`nav`,{"aria-label":y9(`formSteps`),children:(0,C9.jsx)(`ol`,{className:`multi-step-list`,children:b.map((e,t)=>{let n=t<E?v?.(e,R):void 0,r=(0,C9.jsx)(`span`,{className:`multi-step-mark`,"aria-hidden":`true`,children:t<E&&(0,C9.jsx)(`svg`,{viewBox:`0 0 256 256`,width:`10`,height:`10`,focusable:`false`,children:(0,C9.jsx)(`path`,{d:O9,fill:`currentColor`})})});return(0,C9.jsxs)(`li`,{className:t<E?`is-done`:t===E?`is-current`:`is-ahead`,children:[t<E?(0,C9.jsxs)(`button`,{type:`button`,className:`multi-step-list-item`,disabled:k,onClick:()=>U(t),children:[r,(0,C9.jsx)(`span`,{className:`multi-step-list-label`,children:e.label}),(0,C9.jsx)(`span`,{className:`visually-hidden`,children:y9(`stepDone`)})]}):(0,C9.jsxs)(`span`,{className:`multi-step-list-item`,...t===E?{"aria-current":`step`}:{},children:[r,(0,C9.jsx)(`span`,{className:`multi-step-list-label`,children:e.label})]}),n&&(0,C9.jsx)(`p`,{className:`multi-step-list-said`,children:n})]},e.id)})})})}):null;return W&&!ee&&!d?(0,C9.jsxs)(`section`,{ref:N,className:`multi-step-form ${u}`.trim(),"data-style":`intake`,"aria-labelledby":z,children:[ae,m,(0,C9.jsxs)(`div`,{className:`intake-head`,children:[re,(0,C9.jsx)($$,{level:_,id:z,title:ne,...R.lead?{lead:R.lead}:{}})]}),q,ie,f,(0,C9.jsx)(e1,{className:`intake-actions`,...E>0?{back:{label:c,onClick:()=>void V(`previous`)}}:{},primary:{label:te,onClick:()=>void(G?H():V(`next`)),busy:k,busyLabel:y9(G?`common.saving`:`common.checking`)}})]}):(0,C9.jsxs)(`section`,{ref:N,className:`multi-step-form ${u}`.trim(),...W?{"data-style":`intake`}:{},"aria-labelledby":z,children:[ae,W?(0,C9.jsxs)(C9.Fragment,{children:[m,(0,C9.jsxs)(`div`,{className:`intake-head`,children:[re,(0,C9.jsx)($$,{level:2,id:z,title:ne,...R.lead?{lead:R.lead}:{}})]})]}):(0,C9.jsxs)(`div`,{className:`multi-step-heading`,children:[re,(0,C9.jsx)(`h2`,{id:z,children:ne}),R.lead&&(0,C9.jsx)(`p`,{className:`multi-step-lead`,children:R.lead})]}),q,ie,f,(0,C9.jsxs)(`div`,{className:`multi-step-actions form-actions`,children:[d,E>0&&(0,C9.jsx)(UG,{intent:`quiet`,className:`multi-step-back`,disabled:k,onClick:()=>void V(`previous`),children:c}),G?(0,C9.jsx)(UG,{intent:`primary`,busy:k,busyLabel:y9(`common.saving`),onClick:()=>void H(),children:te}):(0,C9.jsx)(UG,{intent:`primary`,busy:k,busyLabel:y9(`common.checking`),onClick:()=>void V(`next`),children:te})]})]})}var S9,C9,w9,T9,E9,D9,O9,toe=s((()=>{S9=d(m(),1),GG(),a1(),Yae(),Ya(),C9=d(O(),1),w9=16,T9=!1,D9=new Set([`checkbox`,`radio`,`button`,`submit`,`reset`,`file`,`image`]),O9=`M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z`})),noe=l({PublicGuard:()=>ioe});function roe(e){let t=M9.get(e);return t||(t=new Promise((t,n)=>{let r=document.createElement(`script`);r.src=e,r.async=!0,r.onload=()=>t(),r.onerror=()=>{M9.delete(e),n(Error(e))},document.head.append(r)}),M9.set(e,t)),t}function ioe({widget:e,handle:t}){let n=(0,k9.useRef)(null),r=(0,k9.useRef)(null),i=(0,k9.useRef)(void 0),a=(0,k9.useRef)([]),o=(0,k9.useRef)(void 0),s=e=>{let t=e===void 0?void 0:a.current.shift();t?t(e):i.current=e};return(0,k9.useEffect)(()=>(t.current={take(){let t=n.current?.value,r=t?{trap:t}:{};if(!e)return r;let o=e=>(i.current=void 0,e?{...r,challenge:e}:r);return i.current===void 0?new Promise(e=>{let t=t=>{clearTimeout(n),e(t)},n=setTimeout(()=>{a.current=a.current.filter(e=>e!==t),e(void 0)},j9);a.current.push(t)}).then(o):o(i.current)},reset(){i.current=void 0,e&&o.current!==void 0&&N9(e)?.reset?.(o.current)}},()=>{t.current=void 0}),[t,e]),(0,k9.useEffect)(()=>{if(!e)return;let t=!1;return roe(e.script).then(()=>{let n=N9(e);!t&&r.current&&n?.render&&(o.current=n.render(r.current,{sitekey:e.siteKey,...e.action?{action:e.action}:{},callback:e=>s(e),"expired-callback":()=>s(void 0),"error-callback":()=>s(void 0)}))}).catch(()=>s(void 0)),()=>{t=!0,o.current!==void 0&&N9(e)?.remove?.(o.current),o.current=void 0}},[e?.script,e?.api,e?.siteKey,e?.action]),(0,A9.jsxs)(A9.Fragment,{children:[(0,A9.jsx)(`div`,{className:`visually-hidden`,"aria-hidden":`true`,children:(0,A9.jsx)(`input`,{ref:n,name:`mx_hp_7f`,tabIndex:-1,autoComplete:`new-password`,"aria-hidden":`true`})}),e&&(0,A9.jsx)(`div`,{ref:r,className:`form-challenge`})]})}var k9,A9,j9,M9,N9,aoe=s((()=>{k9=d(m()),A9=d(O()),j9=1e4,M9=new Map,N9=e=>globalThis[e.api]})),ooe=c((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),soe=c(((e,t)=>{t.exports=ooe()})),coe=c((e=>{var t=soe(),n=m(),r=g();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function o(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function s(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(a(e)!==e)throw Error(i(188))}function l(e){var t=e.alternate;if(!t){if(t=a(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var o=n.return;if(o===null)break;var s=o.alternate;if(s===null){if(r=o.return,r!==null){n=r;continue}break}if(o.child===s.child){for(s=o.child;s;){if(s===n)return c(o),e;if(s===r)return c(o),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=o,r=s;else{for(var l=!1,u=o.child;u;){if(u===n){l=!0,n=o,r=s;break}if(u===r){l=!0,r=o,n=s;break}u=u.sibling}if(!l){for(u=s.child;u;){if(u===n){l=!0,n=s,r=o;break}if(u===r){l=!0,r=s,n=o;break}u=u.sibling}if(!l)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function u(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=u(e),t!==null)return t;e=e.sibling}return null}var d=Object.assign,f=Symbol.for(`react.element`),p=Symbol.for(`react.transitional.element`),h=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.memo_cache_sentinel`),k=Symbol.iterator;function A(e){return typeof e!=`object`||!e?null:(e=k&&e[k]||e[`@@iterator`],typeof e==`function`?e:null)}var j=Symbol.for(`react.client.reference`);function M(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===j?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case h:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return t=e.displayName||null,t===null?M(e.type)||`Memo`:t;case E:t=e._payload,e=e._init;try{return M(e(t))}catch{}}return null}var N=Array.isArray,P=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I={pending:!1,data:null,method:null,action:null},L=[],R=-1;function z(e){return{current:e}}function B(e){0>R||(e.current=L[R],L[R]=null,R--)}function V(e,t){R++,L[R]=e.current,e.current=t}var H=z(null),U=z(null),W=z(null),G=z(null);function ee(e,t){switch(V(W,t),V(U,e),V(H,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?zd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=zd(t),e=Bd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}B(H),V(H,e)}function te(){B(H),B(U),B(W)}function ne(e){e.memoizedState!==null&&V(G,e);var t=H.current,n=Bd(t,e.type);t!==n&&(V(U,e),V(H,n))}function K(e){U.current===e&&(B(H),B(U)),G.current===e&&(B(G),Xf._currentValue=I)}var re,q;function ie(e){if(re===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);re=t&&t[1]||``,q=-1<e.stack.indexOf(`
|
|
210
210
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
211
211
|
`+re+e+q}var ae=!1;function oe(e,t){if(!e||ae)return``;ae=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|