@soleone/factory 0.3.1 → 0.3.2

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.
@@ -54,27 +54,27 @@ ${e.slice(l,u)}`,l=Tg(e,u);else if(Mg(e,l,u)){var d=Tg(e,u);if(d<r&&(jg(e,d,wg(e
54
54
  `,ve),Se=xe<0?ye:xe);if(ve>=ye)break;var Ce=e.charCodeAt(ve)===Wp;jg(e,ve,Se);let r=null;var we=t.o?t.o.length:0;if(vg=e,yg=ve,bg=Se,!Ce&&kg>=4&&!t.inHTML)r=Ug(e,ve);else if(!Ce){let i=ve+Ag,a=e.charCodeAt(i);a===rp?r=Fg(e,ve,t,n):a===np?r=Wg(e,ve,t,n):a===Qf||a===$f?r=Vg(e,ve,t):a===ap||a===cp||a===lp?(r=Lg(e,ve),!r&&(r=Yg(e,ve,t,n))):a===Mp||a>=Gp&&a<=Kp?r=Yg(e,ve,t,n):a===up?(t.inList&&(be===-2&&(be=e.lastIndexOf(Th)),be>ve&&!n.ignoreHTMLBlocks&&!n.disableParsingRawHTML&&(__(e,i)!==0||h_(e,i))&&(e=e.slice(0,ve)+Eh(e.slice(ve)),ye=e.length,be=-1)),r=g_(e,ve,t,n)):a===Np?r=y_(e,ve,t,n):a===ep&&(r=b_(e,ve,t))}if(!r){for(var Te=!1,Ee=ve;Ee<Se;Ee++)if(e.charCodeAt(Ee)===Np){Te=!0;break}Te&&(r=y_(e,ve,t,n))}if(r||=S_(e,ve,t,n),r){r.node.type!==Q.refCollection&&_e.push(r.node);var De=t.o;if(n.optimizeForStreaming&&De&&De.length>we&&!Ng(e,r.end,ye))for(var Oe=we;Oe<De.length;Oe++)De[Oe].notAtEdge=!0;ve=r.end}else{var ke=e.indexOf(`
55
55
  `,ve);ve=ke<0?ye:ke+1}}return xg=i,Sg=a,Cg=o,t_=s,n_=c,r_=l,i_=u,d_=d,f_=f,t.p=r,_e}function mv(e,t,n,r){var i=ag(e,t);return i?{tagName:i.tag,tagLower:i.tag.toLowerCase(),attrs:i.a,whitespaceBeforeAttrs:i.i,isSelfClosing:i.n,hasSpaceBeforeSlash:i.v,isClosing:i.g,hasNewline:i.i.includes(`
56
56
  `)||i.a.includes(`
57
- `),endPos:i.end}:null}function hv(e,t,n){uv=0;var r=Gh;Gh=n,e=Fm(e),D_=e.length*16+E_,!t.refs&&(t.refs=Object.create(null)),(n.optimizeForStreaming||t.inline)&&(t.B=ug(e,t.refs,n));var i,a;t.o||(t.o=i=[],t.r=a=[]);let o=pv(e,t,n);if(i&&a){for(var s=i,c={inline:t.inline,inAnchor:t.inAnchor,inHTML:t.inHTML,htmlDepth:t.d,inList:t.inList,inBlockQuote:t.inBlockQuote,noSetext:t.m,depth:t.p,notAtEdge:t.f},l=0;l<s.length;l++){var u=s[l];t.inline=u.inline,t.inAnchor=u.inAnchor,t.inHTML=u.inHTML,t.d=u.htmlDepth,t.inList=u.inList,t.inBlockQuote=u.inBlockQuote,t.m=u.noSetext,t.p=u.depth,t.f=u.notAtEdge,t.l=u.breaks;var d=dv(u.text,0,u.text.length,t,n);t.l=!1;for(var f=0;f<d.length;f++)u.dest.push(d[f])}t.inline=c.inline,t.inAnchor=c.inAnchor,t.inHTML=c.inHTML,t.d=c.htmlDepth,t.inList=c.inList,t.inBlockQuote=c.inBlockQuote,t.m=c.noSetext,t.p=c.depth,t.f=c.notAtEdge;for(var p=a,m=0;m<p.length;m++)for(var h=p[m],g=0;g<h.src.length;g++){var _=h.src[g];if(h.unwrap&&_.type===Q.paragraph)for(var v=_.children,y=0;y<v.length;y++)h.dest.push(v[y]);else h.dest.push(_)}t.o=void 0,t.r=void 0,t_!==null&&a_(),ev(o,t,n.slugify)}return Gh=r,Vm(t.refs)?[{type:Q.refCollection,refs:t.refs},...o]:o}var gv;try{_v=v.createElement(`div`),gv=typeof _v==`object`&&_v&&`$$typeof`in _v&&typeof _v.$$typeof==`symbol`?_v.$$typeof:Symbol.for(`react.transitional.element`)}catch{gv=Symbol.for(`react.transitional.element`)}var _v;function vv(e,t,n){return{$$typeof:gv,type:e,key:n==null?null:String(n),ref:null,props:t,_owner:null,_store:{},_debugStack:null,_debugTask:null}}function yv(e,t){var n={key:e};if(t){var r=rm(t);for(var i in r)n[i]=r[i]}return n}var bv=typeof v.createContext>`u`?void 0:v.createContext(void 0);function xv(e,t,n,r,i,a,o,s,c){switch(e.type){case Q.blockQuote:{let i={key:n.key};return e.alert&&(i.className=`markdown-alert-${a(e.alert.toLowerCase(),ym)}`,e.children.unshift(Hm(e.alert))),r(`blockquote`,i,t(e.children,n))}case Q.breakLine:return r(`br`,{key:n.key});case Q.breakThematic:return r(`hr`,{key:n.key});case Q.frontmatter:return s.preserveFrontmatter?r(`pre`,{key:n.key},e.text):null;case Q.codeBlock:{let t=e.lang?sm(e.lang):``;var l=e.attrs?rm(lh(`code`,e.attrs,s.overrides)):{};return l.className=t?`language-${t} lang-${t}`:``,r(`pre`,{key:n.key},r(`code`,l,e.text))}case Q.codeInline:return r(`code`,{key:n.key},e.text);case Q.footnoteReference:return r(`a`,{key:n.key,href:i(e.target,`a`,`href`)||void 0},r(`sup`,null,e.text));case Q.gfmTask:return r(`input`,{checked:e.completed,key:n.key,readOnly:!0,type:`checkbox`});case Q.heading:return r(`h${e.level}`,{id:e.id,key:n.key},t(e.children,n));case Q.htmlBlock:{let a=e;if($m(s)&&mh(a.tag)){var u=Zm(a);return u.kind===`literal`?r(`span`,{key:n.key},u.literal):r(`span`,{key:n.key},...Qm(u.open,a.children?t(a.children,n):null,u.close))}let l=a.k,g=l!==void 0,_=g?l:a.b?a.e||``:(a.e||``)+(a.j||``);if(_&&a.c){let r=Fh(a.tag.toLowerCase()),l=a.children,u=l!=null&&l.length>0;if(r){let t=(g?a.text:a.e)||``,r=$m(s)?_h(t):t;if(/<[a-z][^>]{0,100}>/i.test(t)){var d=yv(n.key,e.attrs);return d.dangerouslySetInnerHTML={__html:r},c(e.tag,d)}return c(e.tag,yv(n.key,e.attrs),gh(e.tag,r))}let y=RegExp(`^<${a.tag}(\\s|>)`,`i`);if(u&&!y.test(_)&&$m(s)&&hh(_))return c(e.tag,yv(n.key,e.attrs),t(l,n));if(Ih(_)){let t=$m(s)?_h(_):_;var f=yv(n.key,e.attrs);return f.dangerouslySetInnerHTML={__html:t},c(e.tag,f)}let b=vh({overrides:s.overrides,slugify:s.slugify,sanitizer:i,tagfilter:!0}),x=zm(a.h||_);if(RegExp(`^<${a.tag}(\\s[^>]*)?>(\\s*</${a.tag}>)?$`,`i`).test(x))return a.children&&a.children.length>0?c(e.tag,yv(n.key,e.attrs),t(a.children,n)):c(e.tag,yv(n.key,e.attrs));let S=hv(x,{inline:!1,refs:o,inHTML:!1},b);if(Km(S),qm(S,x))return x;let C=a.tag.toLowerCase(),w=g;if(w&&u)return c(e.tag,yv(n.key,e.attrs),t(l,n));if(w)return t(S.flatMap(Gm),n);var p=Jm(S,C);if(p.found&&p.afterClose.length>0){var m=p.beforeClose.flatMap(Gm),h=p.afterClose.flatMap(Gm);return vv(v.Fragment,{children:[c(e.tag,yv(n.key,e.attrs),t(m,n)),t(h,n)]},n.key)}return c(e.tag,yv(n.key,e.attrs),t(S.flatMap(Gm),n))}return Sm(e.tag)?c(e.tag,yv(n.key,e.attrs)):c(e.tag,yv(n.key,e.attrs),e.children?t(e.children,n):``)}case Q.htmlSelfClosing:{let t=e;if($m(s)&&mh(t.tag)){var g=Zm(t);return r(`span`,{key:n.key},g.kind===`literal`?g.literal:g.open+(g.close||``))}return c(e.tag,yv(n.key,e.attrs))}case Q.image:{let t=e.target===null?null:i(e.target,`img`,`src`);return r(`img`,{key:n.key,alt:e.alt&&e.alt.length>0?e.alt:void 0,title:e.title||void 0,src:t||void 0})}case Q.link:{let a={key:n.key};if(e.target!=null){let t=eh(e.target,i,`a`,`href`);t!=null&&(a.href=t)}return e.title&&(a.title=e.title),r(`a`,a,t(e.children,n))}case Q.table:{let i=e;return r(`table`,{key:n.key},r(`thead`,{key:`thead`},r(`tr`,null,i.header.map(function(e,a){return r(`th`,{key:a,style:i.align[a]===null?{}:{textAlign:i.align[a]}},t(e,n))}))),i.cells.length>0&&r(`tbody`,{key:`tbody`},i.cells.map(function(e,a){return r(`tr`,{key:a},e.map(function(e,a){return r(`td`,{key:a,style:i.align[a]===null?{}:{textAlign:i.align[a]}},t(e,n))}))})))}case Q.text:return e.text;case Q.textFormatted:return r(e.tag,{key:n.key},t(e.children,n));case Q.orderedList:case Q.unorderedList:return r(e.type===Q.orderedList?`ol`:`ul`,{key:n.key,start:e.type===Q.orderedList?e.start:void 0},e.items.map(function(e,i){return r(`li`,{key:i},t(e,n))}));case Q.paragraph:return r(`p`,{key:n.key},t(e.children,n));case Q.ref:return null;default:return null}}var Sv=(e,t,n,r,i,a,o)=>{var s=e=>e.map(e=>`text`in e?e.text:``),c=(l,u={})=>{var d=Array.isArray(l)?l:[l],f=(u.renderDepth||0)+1;if(f>2500)return s(d);u.renderDepth=f;for(var p=u.key,m=[],h=!1,g=0;g<d.length;g++){u.key=g;var _=e?e(xv.bind(null,d[g],c,u,t,n,r,i,a,o),d[g],c,u):xv(d[g],c,u,t,n,r,i,a,o),v=typeof _==`string`;if(h&&typeof _==`string`){var y=m.at(-1);m[m.length-1]=(typeof y==`string`?y:``)+_}else if(_!=null){if(Array.isArray(_))for(var b=0;b<_.length;b++)m.push(_[b]);else m.push(_)}h=v}return u.key=p,u.renderDepth=f-1,m};return c},Cv=(e,t)=>{let n=oh(t,e,void 0);return n?typeof n==`function`||typeof n==`object`&&`render`in n?n:oh(t,`${e}.component`,e):e};function wv(e,t){let n={...t||{}};n.overrides=n.overrides||{};let r=n.slugify||ym,i=n.sanitizer||hm,a=n.createElement,o=Vm(n.overrides),s=e=>Tv(e,{...n,wrapper:null});function c(e){for(var t in e){var n=e[t];if(typeof n==`string`&&n.length>0&&n.charCodeAt(0)===up&&(yh.test(n)||bh.test(n)||mv(n,0))){var r=s(n.trim());e[t]=t===`innerHTML`&&Array.isArray(r)?r[0]:r}}}function l(e,t,...r){var i=t||{},s=e;if(o){var c=oh(n.overrides,`${e}.props`,{});s=Cv(e,n.overrides),i={...i,...c,className:dh(i.className,c.className)||void 0},typeof s==`string`&&Sm(s)&&(delete i.children,r.length=0)}if(!a){var l=i.key;return l!=null&&delete i.key,r.length===1?i.children=r[0]:r.length>1&&(i.children=r),vv(s,i,l)}return a(s,i,...r)}function u(e,t,...r){var i=t&&lh(e,t,n.overrides);if(i){if(typeof i.children==`string`){var a=i.dangerouslySetInnerHTML===void 0?am(i.children,r):void 0;delete i.children,a!==void 0&&(r=[a])}c(i)}return l(e,i,...r)}let d=vh(n,n.forceInline),f=e[0]&&e[0].type===Q.refCollection?e[0].refs:Object.create(null),p=Sv(n.renderRule,l,i,r,f,n,u),m=p(e,{inline:n.forceInline,refs:f}),h=th(f);if(h.length>0&&m.push(l(`footer`,{key:`footer`},h.map(function(e){let t=e.identifier.charCodeAt(0)===tp?e.identifier.slice(1):e.identifier,n=hv(e.footnote,{inline:!0,refs:f},d);return l(`div`,{id:r(t,ym),key:e.identifier},`${t}: `,p(n,{inline:!0,refs:f}))}))),n.wrapper===null)return m;let g=n.wrapper||(n.forceInline?`span`:`div`),_;if(m.length>1||n.forceWrapper)_=m;else return m.length===1?m[0]:null;var v=n.wrapperProps?{...n.wrapperProps}:{};return v.children=_,vv(g,v,`outer`)}function Tv(e=``,t={}){let n={...t||{}};n.overrides=n.overrides||{},n.slugify,n.sanitizer;function r(e){let t=n.forceInline||!(n.forceBlock||om.test(e)),r=vh(n,t);return wv(hv(t?e:Wm(e),{inline:t,refs:i},r),{...n,forceInline:t})}let i=Object.create(null);return r(e)}function Ev(e){let t=v.useRef(e),n=t.current;if(n!==e){var r=!0,i=0;for(var a in e)if(i++,!Object.is(n[a],e[a])){r=!1;break}if(r){var o=0;for(var s in n)o++;r=o===i}r||(t.current=e)}return t.current}var Dv=({children:e,options:t,...n})=>{if(typeof v.useContext>`u`){let r={...t,overrides:{...t?.overrides},wrapperProps:{...t?.wrapperProps,...n}};return Tv(e??``,r)}let r=bv?v.useContext(bv):void 0,i=Ev(n),a=v.useMemo(()=>({...r,...t,overrides:{...r?.overrides,...t?.overrides},wrapperProps:{...r?.wrapperProps,...t?.wrapperProps,...i}}),[r,t,i]),o=e??``;return v.useMemo(()=>Tv(o,a),[o,a])},Ov=[`communicator`,`builder`,`grunt`],kv=e=>e.id??[e.agent,e.model,e.effort].filter(Boolean).join(`/`),Av=e=>`${e.repo} ${e.id}`,jv=e=>e!==void 0&&e.step!==`merged`&&e.step!==`skipped`,Mv=e=>e.notes.findLast(e=>e.kind===`factory`&&e.url?.includes(`/pull/`))?.url??e.attempts.findLast(e=>e.url?.includes(`/pull/`))?.url,Nv=e=>e.state===`OPEN`&&!e.draft&&e.conflicts===!1&&(e.checks===`passing`||e.checks===`none`),Pv=e=>e.state===`OPEN`&&e.conflicts===!0&&!e.fork;function Fv(e){let t=new Map;for(let n of e.values())for(let e of n.after)t.set(e,[...t.get(e)??[],n]);let n=new Map,r=e=>{let i=n.get(e.id);if(i!==void 0)return i;n.set(e.id,0);let a=e.state!==`done`&&e.state!==`removed`,o=(t.get(e.id)??[]).map(r),s=+!!a+Math.max(0,...o);return n.set(e.id,s),s};for(let t of e.values())r(t);return n}function Iv(e){let t=new Map(e.map(e=>[e.id,e])),n=new Map,r=(e,i=new Set)=>{let a=n.get(e.id);if(a!==void 0)return a;if(i.has(e.id))return 0;i.add(e.id);let o=Math.max(-1,...e.after.flatMap(e=>t.get(e)?[r(t.get(e),i)]:[]))+1;return n.set(e.id,o),o};for(let t of e)r(t);return n}function Lv(e){let t=new Map(e.map(e=>[e.id,e])),n=Fv(t),r=new Map,i=e=>{let n=r.get(e.id);if(n!==void 0)return n;r.set(e.id,0);let a=+(e.state!==`done`&&e.state!==`removed`)+Math.max(0,...e.after.flatMap(e=>t.has(e)?[i(t.get(e))]:[]));return r.set(e.id,a),a},a=e=>i(e)+(n.get(e.id)??0)-1,o=e.filter(e=>e.state!==`done`&&e.state!==`removed`),s=Math.max(0,...o.map(a));return new Set(o.filter(e=>s>0&&a(e)===s).map(e=>e.id))}var Rv=v.createContext(void 0);function zv(e){let t=v.useContext(Rv);if(!e&&t===void 0)throw Error(J(27));return t}var Bv=v.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,s=zv(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return Hi(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:Nt,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),Vv=v.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,c=zv(),l=c.useState(`open`),{getButtonProps:u,buttonRef:d}=pf({disabled:a,native:o}),f={disabled:a};function p(e){l&&c.setOpen(!1,Jt(nn,e.nativeEvent))}return Hi(`button`,e,{state:f,ref:[t,d],props:[{onClick:p},s,u]})}),Hv=v.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=zv(),c=lc(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),Hi(`p`,e,{ref:t,props:[{id:c},o]})}),Uv=v.createContext(void 0);function Wv(){let e=v.useContext(Uv);if(e===void 0)throw Error(J(26));return e}var Gv=`ArrowUp`,Kv=`ArrowDown`,qv=`ArrowLeft`,Jv=`ArrowRight`,Yv=new Set([Gv,Kv,qv,Jv,`Home`,`End`]),Xv=[`Shift`,`Control`,`Alt`,`Meta`];function Zv(e){return Be(e)&&e.tagName===`INPUT`}function Qv(e){return!!(Zv(e)&&e.selectionStart!=null||Be(e)&&e.tagName===`TEXTAREA`)}function $v(e,t,n,r){if(!e||!t||!t.scrollTo)return;let i=e.scrollLeft,a=e.scrollTop,o=e.clientWidth<e.scrollWidth,s=e.clientHeight<e.scrollHeight;if(o&&r!==`vertical`){let r=ey(e,t,`left`),a=ty(e),o=ty(t);n===`ltr`&&(r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight?i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight:r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft&&(i=r-o.scrollMarginLeft-a.scrollPaddingLeft)),n===`rtl`&&(r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft?i=r-o.scrollMarginLeft-a.scrollPaddingLeft:r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight&&(i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight))}if(s&&r!==`horizontal`){let n=ey(e,t,`top`),r=ty(e),i=ty(t);n-i.scrollMarginTop<e.scrollTop+r.scrollPaddingTop?a=n-i.scrollMarginTop-r.scrollPaddingTop:n+t.offsetHeight+i.scrollMarginBottom>e.scrollTop+e.clientHeight-r.scrollPaddingBottom&&(a=n+t.offsetHeight+i.scrollMarginBottom-e.clientHeight+r.scrollPaddingBottom)}e.scrollTo({left:i,top:a,behavior:`auto`})}function ey(e,t,n){let r=n===`left`?`offsetLeft`:`offsetTop`,i=0;for(;t.offsetParent&&(i+=t[r],t.offsetParent!==e);)t=t.offsetParent;return i}function ty(e){let t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}var ny=`--nested-dialogs`,ry=`data-nested-dialog-open`,iy={...Mt,...yt,nestedDialogOpen(e){return e?{[ry]:``}:null}},ay=v.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,c=zv(),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`),C=d.useState(`floatingId`);Wv(),Ra({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let w=o===void 0?Va(c.context.popupRef):o,T=g>0,E=c.useStateSetter(`popupElement`),D=Hi(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:T},props:[f,{id:C,"aria-labelledby":y,"aria-describedby":l,role:x,...Ba,hidden:!m,onKeyDown(e){Yv.has(e.key)&&e.stopPropagation()},style:{[ny]:g}},s],ref:[t,c.context.popupRef,E],stateAttributesMapping:iy});return(0,S.jsx)(Ca,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:w,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:D})}),oy=v.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,S.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),sy=v.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=zv(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,S.jsx)(Uv.Provider,{value:n,children:(0,S.jsxs)(ia,{ref:t,...r,children:[a&&o===!0&&(0,S.jsx)(oy,{ref:i.context.internalBackdropRef,inert:Kc(!s)}),e.children]})}):null}),cy={},ly={},uy=``;function dy(e,t){return He(e)?e:t}function fy(e,t,n){return/hidden|clip/.test(e.getComputedStyle(dy(t,n)).overflowY)}function py(e){if(typeof document>`u`)return!1;let t=Un(e);return Ie(t).innerWidth-t.documentElement.clientWidth>0}function my(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=Un(e),n=t.documentElement,r=t.body,i=dy(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 hy(e){let t=Un(e),n=t.documentElement,r=t.body,i=dy(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 gy(e){let t=Un(e),n=t.documentElement,r=t.body,i=Ie(n),a=0,o=0,s=!1,c=Vn.create();if(we&&(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,cy={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},uy=n.style.scrollBehavior,ly={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=dy(n,r);s=my(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,cy),Object.assign(r.style,ly),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=uy)}function d(){u(),c.request(l)}l();let f=wn(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var _y=new class{lockCount=0;restore=null;timeoutLock=de.create();timeoutUnlock=de.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=Un(e),n=t.documentElement,r=t.body,i=Ie(n);if(fy(i,n,r)){let t=new i.MutationObserver(()=>{fy(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=ye||!py(e);this.restore=a?hy(e):gy(e)}};function vy(e=!0,t=null){q(()=>{if(e)return _y.acquire(t)},[e,t])}function yy({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`mounted`),a=e.useState(`disablePointerDismissal`),o=e.useState(`modal`),s=e.useState(`popupElement`),c=e.useState(`floatingRootContext`),[l,u]=v.useState(0),[d,f]=v.useState(0),p=l===0,m=Aa(c,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:o===`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=ct(t);if(p&&!a){if(o){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||ot(n,s)&&!n?.hasAttribute(`data-base-ui-portal`):!0}return!0}return!1},escapeKey:p});return vy(r&&o===!0,s),e.useContextCallback(`onNestedDialogOpen`,(t,n)=>{(e.select(`open`)||e.select(`mounted`))&&(u(t),f(n))}),q(()=>{!r&&!i&&(u(0),f(0))},[r,i]),q(()=>(t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(l+1,d+ +!!n),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,l,d,t]),Qa(e,{activeTriggerProps:m.reference,inactiveTriggerProps:m.trigger,popupProps:m.floating,nestedOpenDialogCount:l,nestedOpenDrawerCount:d}),null}var by={...Co,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},xy=class extends mo{constructor(e,t,n){let r=new eo,i=Sy(e,r,t,n);super(i,Cy(r),by)}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(Ka(this.state,e,t.trigger)))}};function Sy(e,t,n,r=!1){return{..._o(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 Cy(e){return{popupRef:v.createRef(),backdropRef:v.createRef(),internalBackdropRef:v.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function wy(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`,y=zv(!0),b={modal:h,disablePointerDismissal:g,nested:y!=null,role:_},x=Ha((e,t)=>new xy({open:i,openProp:r,activeTriggerId:f,triggerIdProp:d,...b},e,t),!0);x.useControlledProp(`openProp`,r),x.useControlledProp(`triggerIdProp`,d),x.useSyncedValues(b),x.useContextCallback(`onOpenChange`,a),x.useContextCallback(`onOpenChangeComplete`,o);let C=x.useState(`open`),w=x.useState(`mounted`),T=x.useState(`payload`);$a(x,C),Xa(x);let{forceUnmount:E}=Za(C,x);v.useImperativeHandle(l,()=>({unmount:E,close:()=>x.setOpen(!1,Jt(vn))}),[E,x]);let D=C||w||u!=null;return(0,S.jsxs)(Rv.Provider,{value:x,children:[u&&(0,S.jsx)(Ua,{handle:u,store:x}),D&&(0,S.jsx)(yy,{store:x,parentContext:y?.context,isDrawer:p}),typeof n==`function`?n({payload:T}):n]})}var Ty=W(function(e){return wy(`dialog`,e)}),Ey=v.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=zv(),c=lc(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),Hi(`h2`,e,{ref:t,props:[{id:c},o]})});function Dy(e){let t=v.useRef(``),n=v.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:v.useCallback(n=>{n.detail===0?e(n,`keyboard`):(`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``)},[e]),onPointerDown:n}}function Oy(e,t){let{onClick:n,onPointerDown:r}=Dy(Y((n,r)=>{(typeof e==`function`?e():e)||t(r||(ye?`touch`:``))}));return v.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function ky(e){let[t,n]=v.useState(null),r=Oy(e,n);return Bf(e,t=>{t&&!e&&n(null)}),v.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}var Ay=re(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,payload:c,handle:l,...u}=e,d=zv(!0),f=wo(l)??d;if(!f)throw Error(J(79));let p=lc(s),m=f.useState(`floatingRootContext`),h=f.useState(`isOpenedByTrigger`,p),g=f.useState(`triggerPopupId`,p),_=v.useRef(null),{registerTrigger:y,isMountedByThisTrigger:b}=Ya(p,_,f,{payload:c}),{getButtonProps:x,buttonRef:S}=pf({disabled:a,native:o}),C=wa(m),w=Oy(()=>f.select(`open`),e=>{f.set(`openMethod`,e)}),T={disabled:a,open:h},E=f.useState(`triggerProps`,b);return Hi(`button`,e,{state:T,ref:[S,t,y,_],props:[C.reference,E,w,{[Xi]:``,id:p,"aria-haspopup":`dialog`,"aria-expanded":h,"aria-controls":g},u,x],stateAttributesMapping:At})});function jy({...e}){return(0,S.jsx)(Ty,{"data-slot":`dialog`,...e})}function My({...e}){return(0,S.jsx)(Ay,{"data-slot":`dialog-trigger`,...e})}function Ny({...e}){return(0,S.jsx)(sy,{"data-slot":`dialog-portal`,...e})}function Py({className:e,...t}){return(0,S.jsx)(Bv,{"data-slot":`dialog-overlay`,className:X(`fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function Fy({className:e,children:t,showCloseButton:n=!0,...r}){return(0,S.jsxs)(Ny,{children:[(0,S.jsx)(Py,{}),(0,S.jsxs)(ay,{"data-slot":`dialog-content`,className:X(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[t,n&&(0,S.jsxs)(Vv,{"data-slot":`dialog-close`,render:(0,S.jsx)(vf,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`}),children:[(0,S.jsx)(Fd,{}),(0,S.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function Iy({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`dialog-header`,className:X(`flex flex-col gap-2`,e),...t})}function Ly({className:e,showCloseButton:t=!1,children:n,...r}){return(0,S.jsxs)(`div`,{"data-slot":`dialog-footer`,className:X(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,S.jsx)(Vv,{render:(0,S.jsx)(vf,{variant:`outline`}),children:`Close`})]})}function Ry({className:e,...t}){return(0,S.jsx)(Ey,{"data-slot":`dialog-title`,className:X(`font-heading text-base leading-none font-medium`,e),...t})}function zy({className:e,...t}){return(0,S.jsx)(Hv,{"data-slot":`dialog-description`,className:X(`text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function By({className:e,...t}){return(0,S.jsx)(sd,{"data-slot":`spinner`,role:`status`,"aria-label":`Loading`,className:X(`size-4 animate-spin`,e),...t})}var Vy=v.createContext(void 0);function Hy(e){let t=v.useContext(Vy);if(t===void 0&&!e)throw Error(J(47));return t}var Uy={...Co,disabled:e=>e.disabled,instantType:e=>e.instantType===`trigger-change`&&!Co.open(e)?void 0:e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,isPressOpenedByTrigger:(e,t)=>e.openChangeReason===`trigger-press`&&Co.isOpenedByTrigger(e,t),isTouchPressOpen:(e,t)=>t&&e.openMethod===`touch`&&e.openChangeReason===`trigger-press`,hasTriggerFocusGuards:(e,t)=>Co.isOpenedByTrigger(e,t)&&!e.focusManagerModal,modal:e=>e.modal,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},Wy=class extends mo{constructor(e,t,n){let r=new eo;super(Gy(e,r,t,n),Ky(r),Uy)}setOpen=(e,t)=>{let n=t.reason===Qt,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=qa(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=Ka(this.state,e,t.trigger,a());n.openChangeReason=t.reason,this.update(n)};n?(this.context.stickIfOpen=!0,this.context.stickIfOpenTimeout.start(500,()=>{this.context.stickIfOpen=!1}),R.flushSync(s)):s();let c;r?c=`click`:i?c=`dismiss`:t.reason===`focus-out`&&(c=`focus`),this.set(`instantType`,c)}};function Gy(e,t,n,r=!1){let i={..._o(t,n,r),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return i.open&&e?.mounted===void 0&&(i.mounted=!0),i}function Ky(e){return{popupRef:v.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:v.createRef(),beforeTriggerFocusGuardRef:v.createRef(),beforeContentFocusGuardRef:v.createRef(),stickIfOpenTimeout:new de,stickIfOpen:!0,triggerElements:e}}var qy=W(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=Yy(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),$a(u,d),Xa(u);let{forceUnmount:m}=Za(d,u,()=>{u.context.stickIfOpen=!0,u.set(`openChangeReason`,null)});u.useSyncedValues({modal:o}),v.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]),v.useImperativeHandle(e.actionsRef,()=>({unmount:m,close:()=>u.setOpen(!1,Jt(vn))}),[m,u]);let h=d||f||s!=null;return(0,S.jsxs)(Vy.Provider,{value:u,children:[s&&(0,S.jsx)(Ua,{handle:s,store:u}),h&&(0,S.jsx)(Xy,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})});function Jy(e){return Hy(!0)?(0,S.jsx)(qy,{props:e}):(0,S.jsx)(pa,{children:(0,S.jsx)(qy,{props:e})})}function Yy(e,t){let n=Ha((e,n)=>new Wy(t,e,n));return v.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function Xy({store:e,modal:t}){let n=Aa(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),r=n.reference,i=n.floating;return Qa(e,{activeTriggerProps:r,inactiveTriggerProps:r,popupProps:i}),null}function Zy(e,t){function n(n,r,i){let a=n.currentTarget;R.flushSync(()=>{e.setOpen(!1,Jt(cn,n.nativeEvent,a))}),Xr(a.isConnected?a:t.current,r,i)?.focus()}function r(t){n(t,-1,e.select(`positionerElement`))}function i(t){let r=e.select(`positionerElement`);r&&Zr(t,r)?e.context.beforeContentFocusGuardRef.current?.focus():n(t,1,r)}return{handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}var Qy=re(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=Hy(!0),h=wo(s)??m;if(!h)throw Error(J(74));let g=lc(f),_=h.useState(`isTriggerActive`,g),y=h.useState(`floatingRootContext`),b=h.useState(`isOpenedByTrigger`,g),x=h.useState(`triggerPopupId`,g),C=v.useRef(null),{registerTrigger:w,isMountedByThisTrigger:T}=Ya(g,C,h,{payload:c,disabled:a,openOnHover:l,closeDelay:d}),E=h.useState(`isPressOpenedByTrigger`,g),D=h.useState(`isTouchPressOpen`,l),O=h.useState(`hasTriggerFocusGuards`,g),k=Fo(y,{enabled:!a&&l&&!D,mouseOnly:!0,move:!1,handleClose:Zo(),restMs:u,delay:{close:d},triggerElementRef:C,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),A=wa(y,{stickIfOpen:Y(()=>h.context.stickIfOpen)}),j=Oy(()=>h.select(`open`),e=>{h.set(`openMethod`,e)}),M=h.useState(`triggerProps`,T),{getButtonProps:N,buttonRef:P}=pf({disabled:a,native:o}),F={open(e){return E?jt.open(e):At.open(e)}},{handlePreFocusGuardFocus:I,handleFocusTargetFocus:L}=Zy(h,C),R=Hi(`button`,e,{state:{disabled:a,open:b},ref:[P,t,w,C],props:[A.reference,k,M,j,{[Xi]:``,id:g,"aria-haspopup":`dialog`,"aria-expanded":b,"aria-controls":x},p,N],stateAttributesMapping:F}),z=(0,S.jsx)(v.Fragment,{children:R},g);return O?(0,S.jsxs)(v.Fragment,{children:[(0,S.jsx)(qn,{ref:h.context.beforeTriggerFocusGuardRef,onFocus:I}),z,(0,S.jsx)(qn,{ref:h.context.triggerFocusTargetRef,onFocus:L})]}):z}),$y=v.createContext(void 0);function eb(){let e=v.useContext($y);if(e===void 0)throw Error(J(45));return e}var tb=v.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return Hy().useState(`mounted`)||n?(0,S.jsx)($y.Provider,{value:n,children:(0,S.jsx)(ia,{ref:t,...r})}):null}),nb=v.createContext(void 0);function rb(){let e=v.useContext(nb);if(!e)throw Error(J(46));return e}function ib(e){let{store:t,domReference:n,positionerElement:r,open:i}=e,a=v.useRef(null),o=v.useRef(null),s=La(r);q(()=>{i||(o.current?.abort(),o.current=null,t.state.instantType===`trigger-change`&&t.set(`instantType`,void 0))},[i,t]),q(()=>{let e=n,r=a.current;if(e&&(a.current=e),!r||!e||e===r||!t.select(`open`))return;t.set(`instantType`,void 0);let i=new AbortController;return o.current=i,s(()=>{t.select(`open`)&&t.set(`instantType`,`trigger-change`)},i.signal),()=>{i.abort()}},[n,s,t])}var ab=20;function ob(e,t,n,r){let[i,a]=v.useState(!1);q(()=>{if(!e||!t||n==null){a(!1);return}let r=Un(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-ab)},[e,t,n]),vy(e&&(!t||i),r)}var sb=v.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=Qi,..._}=e,v=Hy(),y=eb(),b=da(),x=v.useState(`floatingRootContext`),C=v.useState(`mounted`),w=v.useState(`open`),T=v.useState(`openChangeReason`),E=v.useState(`activeTriggerElement`),D=v.useState(`modal`),O=v.useState(`openMethod`),k=v.useState(`positionerElement`),A=v.useState(`instantType`),j=v.useState(`transitionStatus`),M=Lc({anchor:a,floatingRootContext:x,positionMethod:o,mounted:C,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:y,nodeId:b,collisionAvoidance:g,adaptiveOrigin:v.useState(`adaptiveOrigin`)});ib({store:v,domReference:x.useState(`domReferenceElement`),positionerElement:k,open:w});let N=D===!0&&T!==`trigger-hover`;ob(w&&N,O===`touch`,k,E);let P=v.useStateSetter(`positionerElement`),F=Vc(e,{open:w,side:M.side,align:M.align,anchorHidden:M.anchorHidden,instant:A},{styles:M.positionerStyles,transitionStatus:j,props:_,refs:[t,P],hidden:!C,inert:!w});return(0,S.jsxs)(nb.Provider,{value:M,children:[C&&N&&(0,S.jsx)(oy,{inert:Kc(!w),cutout:E}),(0,S.jsx)(fa,{id:b,children:F})]})}),cb=v.createContext(void 0);function lb(e){let t=v.useContext(cb);if(t===void 0&&!e)throw Error(J(69));return t}var ub=v.createContext(void 0);function db(){let[e,t]=v.useState(0),n=Y(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:v.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}function fb(){let e=v.useContext(ub);q(()=>e?.register(),[e])}var pb=v.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=Hy(),l=rb(),u=lb(!0)!=null,{context:d,hasClosePart:f}=db(),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`),C=c.useState(`openChangeReason`),w=c.useState(`activeTriggerElement`),T=c.useState(`floatingRootContext`),E=T.useState(`floatingId`),D=c.useState(`disabled`),O=c.useState(`openOnHover`),k=c.useState(`closeDelay`);Ra({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}}),No(T,{enabled:O&&!D,closeDelay:k});let A=a===void 0?Va(c.context.popupRef):a,j=b!==!1&&f;c.useSyncedValue(`focusManagerModal`,j);let M=c.useStateSetter(`popupElement`),N=Hi(`div`,e,{state:{open:p,side:l.side,align:l.align,instant:h,transitionStatus:g},ref:[t,c.context.popupRef,M],props:[_,{id:E,role:`dialog`,...Ba,"aria-labelledby":v,"aria-describedby":y,onKeyDown(e){u&&Yv.has(e.key)&&e.stopPropagation()}},Bc(g),s],stateAttributesMapping:Nt});return(0,S.jsx)(Ca,{context:T,openInteractionType:m,modal:j,disabled:!x||C===`trigger-hover`,initialFocus:A,returnFocus:o,restoreFocus:`popup`,getInsideElements:()=>[c.context.beforeTriggerFocusGuardRef.current],previousFocusableElement:Be(w)?w:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,S.jsx)(ub.Provider,{value:d,children:N})})}),mb=v.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=Hy(),s=lc(a.id);return o.useSyncedValueWithCleanup(`titleElementId`,s),Hi(`h2`,e,{ref:t,props:[{id:s},a]})}),hb=v.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=Hy(),s=lc(a.id);return o.useSyncedValueWithCleanup(`descriptionElementId`,s),Hi(`p`,e,{ref:t,props:[{id:s},a]})}),gb=v.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,{buttonRef:c,getButtonProps:l}=pf({disabled:a,focusableWhenDisabled:!1,native:o}),u=Hy();return fb(),Hi(`button`,e,{ref:[t,c],props:[{onClick(e){u.setOpen(!1,Jt(nn,e.nativeEvent))}},s,l]})});function _b({...e}){return(0,S.jsx)(Jy,{"data-slot":`popover`,...e})}function vb({...e}){return(0,S.jsx)(Qy,{"data-slot":`popover-trigger`,...e})}function yb({...e}){return(0,S.jsx)(gb,{"data-slot":`popover-close`,...e})}function bb({className:e,align:t=`center`,alignOffset:n=0,side:r=`bottom`,sideOffset:i=4,...a}){return(0,S.jsx)(tb,{children:(0,S.jsx)(sb,{align:t,alignOffset:n,side:r,sideOffset:i,className:`isolate z-50`,children:(0,S.jsx)(pb,{"data-slot":`popover-content`,className:X(`z-50 flex w-72 origin-(--transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...a})})})}function xb({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`popover-header`,className:X(`flex flex-col gap-0.5 text-sm`,e),...t})}function Sb({className:e,...t}){return(0,S.jsx)(mb,{"data-slot":`popover-title`,className:X(`font-medium`,e),...t})}function Cb({className:e,...t}){return(0,S.jsx)(hb,{"data-slot":`popover-description`,className:X(`text-muted-foreground`,e),...t})}var wb={log:{label:`Log`,title:`Agent log`,name:`agent.log`,noun:`log`},prompt:{label:`Prompt`,title:`Prompt`,name:`prompt.md`,noun:`prompt`}};function Tb({log:e,agent:t,kind:n}){let r=wb[n],i=`/${e.replace(/agent\.log$/,r.name)}`;return(0,S.jsxs)(_b,{children:[(0,S.jsx)(vb,{render:(0,S.jsx)(vf,{variant:`link`,size:`xs`}),children:r.label}),(0,S.jsxs)(bb,{className:`w-xl max-w-[calc(100vw-2rem)]`,children:[(0,S.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,S.jsxs)(xb,{children:[(0,S.jsx)(Sb,{children:r.title}),(0,S.jsx)(Cb,{children:t})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsxs)(`a`,{className:`text-xs underline underline-offset-4`,href:i,target:`_blank`,rel:`noreferrer`,children:[`Open raw `,r.noun]}),(0,S.jsx)(yb,{render:(0,S.jsx)(vf,{variant:`ghost`,size:`icon-sm`,"aria-label":`Close`}),children:(0,S.jsx)(Fd,{})})]})]}),(0,S.jsx)(Eb,{url:i,noun:r.noun})]})]})}function Eb({url:e,noun:t}){let[n,r]=(0,v.useState)(),[i,a]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{let t=new AbortController;return(async()=>{try{let n=await fetch(e,{signal:t.signal});if(!n.ok)throw Error(`Request failed: ${n.status}`);let i=await n.text();t.signal.aborted||r(Db(i))}catch{t.signal.aborted||a(!0)}})(),()=>t.abort()},[e]),i?(0,S.jsxs)(`p`,{role:`status`,className:`text-destructive`,children:[`Could not load the `,t,`. Reopen it to try again.`]}):n===void 0?(0,S.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-muted-foreground`,children:[(0,S.jsx)(By,{}),` Loading `,t,`…`]}):n.trim()?(0,S.jsx)(`pre`,{tabIndex:0,className:`max-h-[min(28rem,50dvh)] overflow-auto rounded-md border bg-muted/50 p-3 font-mono text-xs leading-relaxed wrap-anywhere whitespace-pre-wrap focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none`,children:n}):(0,S.jsxs)(`p`,{className:`text-muted-foreground`,children:[`The `,t,` is empty.`]})}function Db(e){if(!e.trimStart().startsWith(`{`))return e;try{let t=JSON.parse(e);return t?.type===`result`&&typeof t.result==`string`&&t.result.trim()?t.result:JSON.stringify(t,null,2)}catch{return e}}function Ob({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=v.useRef(e!==void 0),[a,o]=v.useState(()=>t);return[i&&e!==void 0?e:a,v.useCallback(e=>{i||o(e)},[])]}var kb=v.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function Ab(){return v.useContext(kb)}function jb(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=Y(i),[,o]=v.useState(0),s=H(Nb).current,c=H(Mb).current,l=v.useRef(0),u=v.useRef(!0),d=v.useRef(null),f=v.useRef(null),p=Y(()=>{u.current||(u.current=!0,o(e=>e+1))}),m=Y((e,t)=>{c.set(e,t),p()}),h=Y(e=>{c.delete(e),p()}),g=Y(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(!Ib(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&Lb(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=Fb(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let y=Y(()=>{let[e,t]=Pb(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&&y()}),q(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let b=Y(e=>(s.add(e),()=>{s.delete(e)})),x=v.useMemo(()=>({register:m,unregister:h,subscribeMapChange:b,nextIndexRef:l}),[m,h,b,l]);return(0,S.jsx)(kb.Provider,{value:x,children:t})}function Mb(){return new Map}function Nb(){return new Set}function Pb(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)=>Lb(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 Fb(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function Ib(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 Lb(e,t){return e.nextElementSibling===t?-1:t.nextElementSibling===e?1:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}var Rb=v.createContext(void 0);function zb(){let e=v.useContext(Rb);if(e===void 0)throw Error(J(64));return e}var Bb=`data-activation-direction`,Vb={tabActivationDirection:e=>({[Bb]:e})},Hb=v.forwardRef(function(e,t){let{className:n,defaultValue:r=0,onValueChange:i,orientation:a=`horizontal`,render:o,value:s,style:c,...l}=e,u=e.defaultValue!==void 0,d=v.useRef([]),[f,p]=v.useState(()=>new Map),[m,h]=Ob({controlled:s,default:r,name:`Tabs`,state:`value`}),g=s!==void 0,[_,y]=v.useState(()=>new Map),b=v.useRef(void 0),x=v.useCallback(e=>Ub(_,e),[_]),[C,w]=v.useState(()=>({previousValue:m,tabActivationDirection:`none`})),{previousValue:T,tabActivationDirection:E}=C,D=E,O=!1;T!==m&&(D=Wb(T,m,a,_),O=T!=null&&m!=null&&x(m)==null);let k=O?T:m,A=T!==k||E!==D;q(()=>{A&&w({previousValue:k,tabActivationDirection:D})},[k,A,D]);let j=Y((e,t)=>{t.activationDirection=Wb(m,e,a,_),i?.(e,t),!t.isCanceled&&h(()=>e)}),M=Y((e,t)=>{i?.(e,Jt(t,void 0,void 0,{activationDirection:`none`}))}),N=Y((e,t)=>(p(n=>{let r=new Map(n);return r.set(e,t),r}),()=>{p(n=>{if(n.get(e)!==t)return n;let r=new Map(n);return r.delete(e),r})})),P=v.useCallback(e=>f.get(e),[f]),F=v.useCallback(e=>{for(let t of _.values())if(e===t.value)return t.id},[_]),I=v.useMemo(()=>({getTabElementBySelectedValue:x,getTabIdByPanelValue:F,getTabPanelIdByValue:P,onValueChange:j,orientation:a,registerMountedTabPanel:N,setTabMap:y,tabActivationDirection:D,value:m}),[x,F,P,j,a,N,y,D,m]),L=v.useMemo(()=>{for(let e of _.values())if(e.value===m)return e},[_,m]),R=v.useMemo(()=>{for(let e of _.values())if(!e.disabled)return e.value},[_]),z=v.useRef(!u),B=v.useRef(r),V=v.useRef(u),H=v.useRef(!1);q(()=>{if(g)return;function e(e,t){h(()=>e),w({previousValue:e,tabActivationDirection:`none`}),M(e,t),z.current=!1}if(_.size===0){H.current&&m!==null&&!b.current?.isConnected&&e(null,gn);return}H.current=!0,b.current=_.keys().next().value;let t=L?.disabled,n=L==null&&m!==null;if(!t&&m===B.current&&(V.current=!1),V.current&&t&&m===B.current)return;let r=z.current;if(t||n){let n=R??null;if(m===n){z.current=!1;return}let i=gn;r?i=_n:t&&(i=hn),e(n,i)}else r&&L!=null&&(M(m,_n),z.current=!1)},[R,g,M,L,h,_,m]);let U=Hi(`div`,e,{state:{orientation:a,tabActivationDirection:D},ref:t,props:l,stateAttributesMapping:Vb});return(0,S.jsx)(Rb.Provider,{value:I,children:(0,S.jsx)(jb,{elementsRef:d,children:U})})});function Ub(e,t){for(let[n,r]of e.entries())if(t===r.value)return n;return null}function Wb(e,t,n,r){if(e==null||t==null)return`none`;let[i,a,o]=n===`horizontal`?[`left`,`left`,`right`]:[`top`,`up`,`down`],s=Ub(r,e),c=Ub(r,t);if(s==null||c==null)return s!==c&&(typeof e==`number`||typeof e==`string`)&&typeof e==typeof t?t>e?o:a:`none`;let l=s.getBoundingClientRect()[i],u=c.getBoundingClientRect()[i];return u<l?a:u>l?o:`none`}var Gb=`data-composite-item-active`;function Kb(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=Ab(),u=v.useRef(-1),[d,f]=v.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=v.useRef(null),h=v.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}}function qb(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=uf(),{ref:i,index:a}=Kb(e),o=n===a,s=v.useRef(null),c=En(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 Jb=v.createContext(void 0);function Yb(){let e=v.useContext(Jb);if(e===void 0)throw Error(J(65));return e}var Xb=v.forwardRef(function(e,t){let{className:n,disabled:r=!1,render:i,value:a,id:o,nativeButton:s=!0,style:c,...l}=e,{value:u,getTabPanelIdByValue:d,onValueChange:f,orientation:p,tabActivationDirection:m}=zb(),{activateOnFocus:h,registerTabResizeObserverElement:g,tabsListElement:_}=Yb(),{highlightedIndex:y,onHighlightedIndexChange:b}=uf(),x=lc(o),{compositeProps:S,compositeRef:C,index:w}=qb({metadata:v.useMemo(()=>({disabled:r,id:x,value:a}),[r,x,a])}),T=a===u,E=v.useRef(!1),D=v.useRef(null),O=Y(e=>{D.current?.(),D.current=e?g(e):null});q(()=>{if(E.current){E.current=!1;return}if(!(T&&w>-1&&y!==w))return;let e=_;if(e!=null){let t=at(Un(e));if(t&&ot(e,t))return}r||b(w)},[T,w,y,b,r,_]);let{getButtonProps:k,buttonRef:A}=pf({disabled:r,native:s,focusableWhenDisabled:!0}),j=d(a),M=v.useRef(!1),N=v.useRef(!1);function P(e){f(a,Jt(Xt,e.nativeEvent,void 0,{activationDirection:`none`}))}function F(e){T||r||P(e)}function I(e){T||r||h&&(!M.current||N.current)&&P(e)}function L(e){if(T||r)return;M.current=!0,N.current=e.button===0;let t=Un(e.currentTarget);function n(){M.current=!1,N.current=!1,t.removeEventListener(`pointerup`,n),t.removeEventListener(`pointercancel`,n)}t.addEventListener(`pointerup`,n),t.addEventListener(`pointercancel`,n)}return Hi(`button`,e,{state:{disabled:r,active:T,orientation:p,tabActivationDirection:m},ref:[t,A,C,O],props:[S,{role:`tab`,"aria-controls":j,"aria-selected":T,id:x,onClick:F,onFocus:I,onPointerDown:L,[Gb]:T?``:void 0,onKeyDownCapture(){E.current=!0}},l,k],stateAttributesMapping:Vb})}),Zb=v.createContext(void 0),Qb={disableStyleElements:!1};function $b(){return v.useContext(Zb)??Qb}var ex=`data-index`,tx={...Vb,...yt},nx=v.forwardRef(function(e,t){let{className:n,value:r,render:i,keepMounted:a=!1,style:o,...s}=e,{value:c,getTabIdByPanelValue:l,orientation:u,tabActivationDirection:d,registerMountedTabPanel:f}=zb(),p=lc(),{ref:m,index:h}=Kb(),g=r===c,{mounted:_,transitionStatus:y,setMounted:b}=Na(g),x=!_,S=l(r),C={hidden:x,orientation:u,tabActivationDirection:d,transitionStatus:y},w=v.useRef(null),T=Hi(`div`,e,{state:C,ref:[t,m,w],props:[{"aria-labelledby":S,hidden:x,id:p,role:`tabpanel`,tabIndex:g?0:-1,inert:Kc(!g),[ex]:h},s],stateAttributesMapping:tx});return Ra({open:g,ref:w,onComplete(){g||b(!1)}}),q(()=>{if(!(p==null||x&&!a))return f(r,p)},[x,a,r,p,f]),a||_?T:null});function rx(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}function ix(e){let{loopFocus:t=!0,orientation:n=`both`,grid:r,onLoop:i,direction:a,highlightedIndex:o,onHighlightedIndexChange:s,rootRef:c,enableHomeAndEndKeys:l=!1,stopEventPropagation:u,disabledIndices:d,modifierKeys:f=G}=e,[p,m]=v.useState(0),h=r!=null,g=v.useRef(null),_=En(g,c),y=v.useRef([]),b=v.useRef(!1),x=v.useRef(null),S=o??p,C=Y((e,t=!1)=>{if(x.current=y.current[e]??null,(s??m)(e),t){let t=y.current[e];$v(g.current,t,a,n)}}),w=Y(e=>{if(e.size===0)return;if(b.current){let e=y.current,t=e.indexOf(x.current);if(t===-1){let t=e[S];!t||Or(e,S,d)?C(ax(e,d)):x.current=t}else t!==S&&C(t);return}b.current=!0;let t=Array.from(e.keys()),r=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,i=r?e.get(r)?.index??-1:-1;if(i!==-1)C(i);else if(Or(t,S,d)){let e=Er(t,{disabledIndices:d});Sr(t,e)||C(e)}$v(g.current,r,a,n)});q(()=>{if(d==null||o!=null||!b.current)return;let e=y.current;if(Or(e,S,d)){let t=Er(e,{disabledIndices:d});Sr(e,t)||C(t)}},[d,o,S,y,C]);let T=Y((e,t,n)=>i?i(e,t,n,y):n),E=Y(e=>{let o=e.key===`Home`||e.key===`End`;if(!Yv.has(e.key)||!l&&o||ox(e,f)||!g.current)return;let s=a===`rtl`,c=s?qv:Jv,p=s?Jv:qv,m=n===`vertical`?Kv:c,_=n===`vertical`?Gv:p,v=ct(e.nativeEvent);if(v!=null&&Qv(v)&&!rx(v)){let t=v.selectionStart,n=v.selectionEnd,r=v.value;if(t==null||e.shiftKey||t!==n||e.key!==_&&t<r.length||e.key!==m&&t>0)return}let b=S,x=Cr(y,d),w=wr(y,d);r!=null&&(b=r({disabledIndices:d,elementsRef:y,event:e,highlightedIndex:S,loopFocus:t,maxIndex:w,minIndex:x,onLoop:T,orientation:n,rtl:s}));let E=n!==`vertical`&&e.key===c||n!==`horizontal`&&e.key===`ArrowDown`,D=n!==`vertical`&&e.key===p||n!==`horizontal`&&e.key===`ArrowUp`;l&&(e.key===`Home`?b=x:e.key===`End`&&(b=w)),b===S&&(E||D)&&(t&&b===w&&E?(b=x,i&&(b=i(e,S,b,y))):t&&b===x&&D?(b=w,i&&(b=i(e,S,b,y))):b=Er(y.current,{startingIndex:b,decrement:D,disabledIndices:d})),b!==S&&!Sr(y.current,b)&&(u&&e.stopPropagation(),(h||o||E||D)&&e.preventDefault(),C(b,!0),queueMicrotask(()=>{y.current[b]?.focus()}))});return{props:{ref:_,onFocus(e){let t=g.current,n=ct(e.nativeEvent);t&&n!=null&&Qv(n)&&n.setSelectionRange(0,n.value.length)},onKeyDown:E},highlightedIndex:S,onHighlightedIndexChange:C,elementsRef:y,onMapChange:w,relayKeyboardEvent:E}}function ax(e,t){let n=-1;for(let r=0;r<e.length;r+=1){let i=e[r];if(i&&!Or(e,r,t)){if(i.hasAttribute(`data-composite-item-active`))return r;n===-1&&(n=r)}}return Math.max(n,0)}function ox(e,t){for(let n of Xv)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function sx(e){let{render:t,className:n,style:r,refs:i=G,props:a=G,state:o=K,stateAttributesMapping:s,highlightedIndex:c,onHighlightedIndexChange:l,orientation:u,grid:d,loopFocus:f,onLoop:p,enableHomeAndEndKeys:m,onMapChange:h,stopEventPropagation:g=!0,rootRef:_,disabledIndices:y,modifierKeys:b,highlightItemOnHover:x=!1,tag:C=`div`,...w}=e,{props:T,highlightedIndex:E,onHighlightedIndexChange:D,elementsRef:O,onMapChange:k,relayKeyboardEvent:A}=ix({grid:d,loopFocus:f,onLoop:p,orientation:u,highlightedIndex:c,onHighlightedIndexChange:l,rootRef:_,stopEventPropagation:g,enableHomeAndEndKeys:m,direction:Cc(),disabledIndices:y,modifierKeys:b}),j=Hi(C,e,{state:o,ref:i,props:[T,...a,w],stateAttributesMapping:s}),M=v.useMemo(()=>({highlightedIndex:E,onHighlightedIndexChange:D,highlightItemOnHover:x,relayKeyboardEvent:A}),[E,D,x,A]);return(0,S.jsx)(lf.Provider,{value:M,children:(0,S.jsx)(jb,{elementsRef:O,onMapChange:e=>{h?.(e),k(e)},children:j})})}var cx=v.forwardRef(function(e,t){let{activateOnFocus:n=!1,className:r,loopFocus:i=!0,render:a,style:o,...s}=e,{orientation:c,setTabMap:l,tabActivationDirection:u}=zb(),[d,f]=v.useState(0),[p,m]=v.useState(null),h=v.useRef(new Set),g=v.useRef(new Set),_=v.useRef(null);q(()=>{if(typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>{h.current.forEach(e=>{e()})});return _.current=e,p&&e.observe(p),g.current.forEach(t=>{e.observe(t)}),()=>{e.disconnect(),_.current=null}},[p]);let y=Y(e=>(h.current.add(e),()=>{h.current.delete(e)})),b=Y(e=>(g.current.add(e),_.current?.observe(e),()=>{g.current.delete(e),_.current?.unobserve(e)})),x={orientation:c,tabActivationDirection:u},C={"aria-orientation":c===`vertical`?`vertical`:void 0,role:`tablist`},w=v.useMemo(()=>({activateOnFocus:n,registerIndicatorUpdateListener:y,registerTabResizeObserverElement:b,tabsListElement:p}),[n,y,b,p]);return(0,S.jsx)(Jb.Provider,{value:w,children:(0,S.jsx)(sx,{render:a,className:r,style:o,state:x,refs:[t,m],props:[C,s],stateAttributesMapping:Vb,highlightedIndex:d,enableHomeAndEndKeys:!0,loopFocus:i,orientation:c,onHighlightedIndexChange:f,onMapChange:l,disabledIndices:G})})});function lx({className:e,orientation:t=`horizontal`,...n}){return(0,S.jsx)(Hb,{"data-slot":`tabs`,"data-orientation":t,className:X(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var ux=Bd(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function dx({className:e,variant:t=`default`,...n}){return(0,S.jsx)(cx,{"data-slot":`tabs-list`,"data-variant":t,className:X(ux({variant:t}),e),...n})}function fx({className:e,...t}){return(0,S.jsx)(Xb,{"data-slot":`tabs-trigger`,className:X(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function px({className:e,...t}){return(0,S.jsx)(nx,{"data-slot":`tabs-content`,className:X(`flex-1 text-sm outline-none`,e),...t})}var mx=`max-h-[60dvh] overflow-auto rounded-md border bg-muted/50 p-3 font-mono text-xs leading-relaxed`,hx={wrapper:null,overrides:{h1:{props:{className:`mt-3 text-base font-semibold first:mt-0`}},h2:{props:{className:`mt-3 font-semibold first:mt-0`}},h3:{props:{className:`mt-2 font-medium first:mt-0`}},ul:{props:{className:`list-disc pl-5`}},ol:{props:{className:`list-decimal pl-5`}},a:{props:{className:`underline underline-offset-4`,target:`_blank`,rel:`noreferrer`}},code:{props:{className:`rounded bg-muted px-1 font-mono text-xs`}},pre:{props:{className:`overflow-auto rounded-md bg-muted p-2`}},blockquote:{props:{className:`border-l-2 pl-3 text-muted-foreground`}},table:{props:{className:`border-collapse text-xs`}},th:{props:{className:`border px-2 py-1 text-left font-medium`}},td:{props:{className:`border px-2 py-1`}}}};function gx({jobId:e,url:t,pr:n}){return(0,S.jsxs)(jy,{children:[(0,S.jsx)(My,{render:(0,S.jsx)(vf,{variant:`link`,size:`xs`}),children:`Review`}),(0,S.jsxs)(Fy,{className:`sm:max-w-4xl`,children:[(0,S.jsxs)(Iy,{className:`mr-8`,children:[(0,S.jsx)(Ry,{children:n.title}),(0,S.jsx)(zy,{children:(0,S.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1`,children:[t.replace(`https://github.com/`,``),` `,(0,S.jsx)(Vu,{className:`size-3`})]})})]}),(0,S.jsx)(_x,{jobId:e,pr:n})]})]})}function _x({jobId:e,pr:t}){let[n,r]=(0,v.useState)(),[i,a]=(0,v.useState)();return(0,v.useEffect)(()=>{let t=!0;return rf.prDetails(e).then(e=>t&&r(e),e=>t&&a(e.message)),()=>{t=!1}},[e]),i?(0,S.jsxs)(`p`,{role:`status`,className:`text-destructive`,children:[`Could not load the PR: `,i]}):n?(0,S.jsxs)(lx,{defaultValue:`description`,className:`min-w-0`,children:[(0,S.jsxs)(dx,{children:[(0,S.jsx)(fx,{value:`description`,children:`Description`}),(0,S.jsxs)(fx,{value:`diff`,children:[`Diff`,(0,S.jsxs)(`span`,{className:`text-success`,children:[`+`,t.additions]}),(0,S.jsxs)(`span`,{className:`text-destructive`,children:[`−`,t.deletions]})]})]}),(0,S.jsx)(px,{value:`description`,children:(0,S.jsx)(`div`,{tabIndex:0,className:`${mx} flex flex-col gap-2 font-sans text-sm wrap-anywhere`,children:n.body.trim()?(0,S.jsx)(Dv,{options:hx,children:n.body}):`This PR has no description.`})}),(0,S.jsx)(px,{value:`diff`,children:(0,S.jsx)(`pre`,{tabIndex:0,className:mx,children:n.diff.split(`
58
- `).map((e,t)=>(0,S.jsx)(`span`,{className:`block ${vx(e)}`,children:e||` `},t))})})]}):(0,S.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-muted-foreground`,children:[(0,S.jsx)(By,{}),` Asking GitHub…`]})}function vx(e){return e.startsWith(`diff --git`)?`mt-3 font-semibold text-foreground first:mt-0`:/^(\+\+\+|---|index |@@)/.test(e)?`text-muted-foreground`:e.startsWith(`+`)?`bg-success/10 text-success`:e.startsWith(`-`)?`bg-destructive/10 text-destructive`:``}function yx(e,t){let n=new URLSearchParams(location.search);t?n.set(e,t):n.delete(e),history.replaceState(null,``,n.size?`?${n}`:location.pathname)}function bx(e,t){let[n,r]=(0,v.useState)(()=>new URLSearchParams(location.search).get(e)??t);return[n,n=>{yx(e,n===t?``:n),r(n)}]}function xx(e){if(!e)return null;for(let t of e.elements){let e=t.tagName;if(e===`BUTTON`||e===`INPUT`){let e=t;if(e.type===`submit`)return e}}return null}var Sx=`data-checked`,Cx=`data-unchecked`;function wx(e){return{checked(t){return e.indeterminate?{}:t?{[Sx]:``}:{[Cx]:``}},...wf}}var Tx=v.createContext(void 0);function Ex(){return v.useContext(Tx)}var Dx=v.createContext(void 0);function Ox(){let e=v.useContext(Dx);if(e===void 0)throw Error(J(14));return e}var kx=`data-parent`,Ax=v.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i=!1,"aria-labelledby":a,disabled:o=!1,form:s,id:c,indeterminate:l=!1,inputRef:u,name:d,onCheckedChange:f,parent:p=!1,readOnly:m=!1,render:h,required:g=!1,uncheckedValue:_,value:y,nativeButton:b=!1,style:x,...C}=e,{clearErrors:w}=kf(),{disabled:T,name:E,setDirty:D,setFilled:O,setTouched:k,state:A,validationMode:j,validityData:M,validation:N}=Df(),P=Lf(),{labelId:F,registerControlId:I,getDescriptionProps:L}=jf(),R=Ex(),z=R?.allValues===void 0?void 0:R.parent,B=z!==void 0,V=T||P.disabled||R?.disabled||o,H=E??d,U=y??H,ee=lc(),te=R?.registerControlId!==I,ne=Ff({id:c||void 0,enabled:te}),W=b?ne:ee,re={};B&&(p?re=z.getParentProps():U!==void 0&&(re=z.getChildProps(U)));let{checked:ie=n,indeterminate:ae=l,onCheckedChange:G,...oe}=re,J=R?.value,se=v.useRef(null),ce=Rf(V,se),{getButtonProps:le,buttonRef:ue}=pf({disabled:V,native:b}),de=R?.validation??N,[fe,pe]=Ob({controlled:U!==void 0&&J!==void 0&&!p?J.includes(U):ie,default:i,name:`Checkbox`,state:`checked`}),me=B?!!ie:fe,he=B&&ae||l;zf(se,ee,fe,void 0,!R&&!V,d);let ge=z?.registerChildId,_e=v.useRef(null),ve=de.registerInput,ye=R?U:void 0,be=v.useCallback(e=>ve(e,{controlRef:se,value:ye}),[ve,ye]),xe=En(u,_e,p?void 0:be),Se=Mf(a,F,_e,!b,ne,C[`aria-label`]);q(()=>{_e.current&&(_e.current.indeterminate=he),R||O(fe)},[fe,he,R,O]),Bf(fe,()=>{R||(w(H),D(fe!==M.initialValue),de.change(fe))});let Ce=ki({checked:fe,disabled:V,form:s,name:p?void 0:H,id:b?void 0:ne,required:g,ref:xe,style:H?Kn:Gn,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(m){e.preventDefault();return}let t=e.currentTarget.checked,n=Jt(Xt,e.nativeEvent);if(f?.(t,n),!n.isCanceled&&(G?.(t,n),!n.isCanceled&&(pe(t),U!==void 0&&R!==void 0&&!p&&!B))){let e=t?[...R.value,U]:R.value.filter(e=>e!==U);R.setValue(e,n)}},onClick(e){e.stopPropagation()},onFocus(){se.current?.focus()}},y===void 0?K:{value:(R?fe&&y:y)||``},L,e=>de.getValidationProps(V,e));v.useEffect(()=>{if(!z||U===void 0)return;let e=z.disabledStatesRef.current;return e.set(U,V),()=>{e.delete(U)}},[z,V,U]);let we=v.useMemo(()=>({...A,checked:me,disabled:V,readOnly:m,required:g,indeterminate:he}),[A,me,V,m,g,he]),Te=wx(we),Ee=Hi(`span`,e,{state:we,ref:[ue,se,t],props:[{id:W,role:`checkbox`,"aria-checked":he?`mixed`:me,"aria-readonly":m||void 0,"aria-required":g||void 0,"aria-labelledby":Se,[kx]:p?``:void 0,onFocus(){ce(!0)},onBlur(){let e=_e.current;e&&(k(!0),ce(!1),j===`onBlur`&&de.commit(R?J:e.checked))},onKeyDown(e){if(e.key!==`Enter`||(e.preventBaseUIHandler(),e.defaultPrevented))return;let t=_e.current?.form??null,n=e.currentTarget,r=e.nativeEvent,i=e.preventDefault,a=r.preventDefault,o=!1;e.preventDefault=()=>{o=!0,i.call(e)},r.preventDefault=()=>{o=!0,a.call(r)},a.call(r),Ie(n).queueMicrotask(()=>{e.preventDefault=i,r.preventDefault=a,o||xx(t)?.click()})},onClick(e){if(m||V)return;e.preventDefault();let t=_e.current;t&&ff(t,e)}},C,oe,le,L,e=>de.getValidationProps(V,e)],stateAttributesMapping:Te}),De=Ee.props.id;return q(()=>{if(ge&&!p&&U!==void 0&&De!==void 0)return ge(U,De)},[ge,p,U,De]),(0,S.jsxs)(Dx.Provider,{value:we,children:[Ee,!fe&&!R&&H&&!p&&_!==void 0&&(0,S.jsx)(`input`,{type:`hidden`,form:s,name:H,value:_,disabled:V}),(0,S.jsx)(`input`,{...Ce,suppressHydrationWarning:!0})]})}),jx=v.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=Ox(),c=s.checked||s.indeterminate,{mounted:l,transitionStatus:u,setMounted:d}=Na(c),f=v.useRef(null),p={...s,transitionStatus:u};Ra({batch:!0,enabled:!c,open:c,ref:f,onComplete(){c||d(!1)}});let m={...wx(s),...yt},h=a||l,g=Hi(`span`,e,{ref:[t,f],state:p,stateAttributesMapping:m,props:o});return h?g:null});function Mx({className:e,...t}){return(0,S.jsx)(Ax,{"data-slot":`checkbox`,className:X(`peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary`,e),...t,children:(0,S.jsx)(jx,{"data-slot":`checkbox-indicator`,className:`grid place-content-center text-current transition-none [&>svg]:size-3.5`,children:(0,S.jsx)(Cu,{})})})}function Nx({className:e,...t}){return(0,S.jsx)(Mx,{className:X(`data-checked:border-foreground data-checked:bg-foreground data-checked:text-background dark:data-checked:bg-foreground`,e),...t})}var Px=v.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return Hi(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})});function Fx({className:e,...t}){return(0,S.jsx)(`div`,{role:`list`,"data-slot":`item-group`,className:X(`group/item-group flex w-full flex-col gap-4 has-data-[size=sm]:gap-2.5 has-data-[size=xs]:gap-2`,e),...t})}var Ix=Bd(`group/item flex w-full flex-wrap items-center rounded-lg border text-sm transition-colors duration-100 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 [a]:transition-colors [a]:hover:bg-muted`,{variants:{variant:{default:`border-transparent`,outline:`border-border`,muted:`border-transparent bg-muted/50`},size:{default:`gap-2.5 px-3 py-2.5`,sm:`gap-2.5 px-3 py-2.5`,xs:`gap-2 px-2.5 py-2 in-data-[slot=dropdown-menu-content]:p-0`}},defaultVariants:{variant:`default`,size:`default`}});function Lx({className:e,variant:t=`default`,size:n=`default`,render:r,...i}){return of({defaultTagName:`div`,props:ki({className:X(Ix({variant:t,size:n,className:e}))},i),render:r,state:{slot:`item`,variant:t,size:n}})}var Rx=Bd(`flex shrink-0 items-center justify-center gap-2 group-has-data-[slot=item-description]/item:translate-y-0.5 group-has-data-[slot=item-description]/item:self-start [&_svg]:pointer-events-none`,{variants:{variant:{default:`bg-transparent`,icon:`[&_svg:not([class*='size-'])]:size-4`,image:`size-10 overflow-hidden rounded-sm group-data-[size=sm]/item:size-8 group-data-[size=xs]/item:size-6 [&_img]:size-full [&_img]:object-cover`}},defaultVariants:{variant:`default`}});function zx({className:e,variant:t=`default`,...n}){return(0,S.jsx)(`div`,{"data-slot":`item-media`,"data-variant":t,className:X(Rx({variant:t,className:e})),...n})}function Bx({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`item-content`,className:X(`flex flex-1 flex-col gap-1 group-data-[size=xs]/item:gap-0 [&+[data-slot=item-content]]:flex-none`,e),...t})}function Vx({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`item-title`,className:X(`line-clamp-1 flex w-fit items-center gap-2 text-sm leading-snug font-medium underline-offset-4`,e),...t})}function Hx({className:e,...t}){return(0,S.jsx)(`p`,{"data-slot":`item-description`,className:X(`line-clamp-2 text-left text-sm leading-normal font-normal text-muted-foreground group-data-[size=xs]/item:text-xs [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}function Ux({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`item-actions`,className:X(`flex items-center gap-2`,e),...t})}function Wx({leading:e,title:t,meta:n,below:r,progress:i,children:a}){return(0,S.jsxs)(Lx,{variant:`outline`,size:`sm`,className:`relative overflow-hidden`,children:[i!==void 0&&(0,S.jsx)(`span`,{"aria-hidden":!0,className:`absolute bottom-0 left-0 h-0.5 w-(--progress) bg-primary transition-all duration-700`,style:{"--progress":`${Math.min(i,1)*100}%`}}),e&&(0,S.jsx)(zx,{children:e}),(0,S.jsxs)(Bx,{children:[(0,S.jsx)(Vx,{children:t}),(0,S.jsx)(Hx,{children:n}),r]}),a&&(0,S.jsx)(Ux,{children:a})]})}function Gx({title:e,children:t}){return(0,S.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,S.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground`,children:e}),t]})}var Kx=Object.keys({claude:/usage limit|You've hit your [\w' ]*limit|You've reached your [\w ]*limit|rate_limit_error/i,pi:/usage limit|usage_limit_reached|usage_not_included|rate_limit_exceeded/i}),qx={claude:[`low`,`medium`,`high`,`xhigh`,`max`],pi:[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`]};function Jx(e){let{open:t,defaultOpen:n=!1,onOpenChange:r,disabled:i}=e,[a,o]=Ob({controlled:t,default:n,name:`Collapsible`,state:`open`}),{mounted:s,setMounted:c,transitionStatus:l}=Na(a,!0,!0),u=lc(),[d,f]=v.useState(),p=d===null?void 0:d??u,m=Y(e=>{let t=!a,n=Jt(Zt,e.nativeEvent);r(t,n),!n.isCanceled&&o(t)});return v.useMemo(()=>({defaultPanelId:u,disabled:i,handleTrigger:m,mounted:s,open:a,panelId:p,setMounted:c,setOpen:o,setPanelIdState:f,transitionStatus:l}),[u,i,m,s,a,p,c,o,f,l])}var Yx=v.createContext(void 0);function Xx(){let e=v.useContext(Yx);if(e===void 0)throw Error(J(15));return e}var Zx=`data-open`,Qx=`data-closed`,$x=ht,eS=`data-panel-open`,tS={[Zx]:``},nS={[Qx]:``},rS={open(e){return e?{[eS]:``}:null}},iS={open(e){return e?tS:nS}},aS={height:void 0,width:void 0};function oS(e){let{externalRef:t,hiddenUntilFound:n,id:r,keepMounted:i,mounted:a,onOpenChange:o,open:s,setMounted:c,setOpen:l,transitionStatus:u}=e,d=v.useRef(null),f=v.useRef(null),[p,m]=v.useState(aS),h=v.useRef(aS),g=v.useRef(!1),_=v.useRef(s),y=v.useRef(!1),[b,x]=v.useState(!1),S=v.useRef(null),C=En(t,d),w=Mn(s),T=La(d),E=!s&&!a,D=b?`idle`:u,O=s&&(_.current||y.current),k=!s&&a&&f.current===`css-animation`&&p.height===void 0&&p.width===void 0?h.current:p,A=n&&E&&f.current!==`css-animation`,j=Y((e,t=!0)=>{t&&(h.current=e),m(e)}),M=Y(()=>{S.current?.(),S.current=null}),N=Y(e=>{M(),S.current=()=>{S.current=null,e()}}),P=Y(()=>{s&&a&&f.current===`css-animation`&&(y.current=!0)});q(()=>{b&&u!==`starting`&&x(!1)},[b,u]),v.useEffect(()=>()=>{P(),M()},[P,M]),q(()=>{s||(_.current=!1,y.current=!1);let e=d.current;if(!e)return;!s&&S.current&&M();let t=cS(e,O);if(f.current=t,s&&u===`idle`&&_.current&&t===`css-animation`){h.current=sS(e);return}if(s&&u===`starting`){let n=g.current;if(g.current=!1,t===`none`){j(sS(e)),x(!0);return}if(t===`css-transition`){let t=dS(e);if(j(sS(e)),!n)return t;let r=uS(e,`transition-duration`,`0s`);return N(r),x(!0),t}j(sS(e));let r=uS(e,`animation-name`,`none`);if(!n){r();return}let i=uS(e,`animation-duration`,`0s`);r(),N(i),x(!0);return}if(!s&&a&&(u===`idle`||u===`starting`)){if(t===`none`){j(aS,!1),c(!1);return}j(sS(e));return}if(u!==`ending`)return;if(t===`none`){c(!1);return}let n=sS(e);n.height>0||n.width>0?(j(n),t===`css-animation`&&uS(e,`animation-name`,`none`)()):c(!1)},[a,s,M,j,c,N,O,u]),Ra({enabled:s&&a&&D===`idle`,open:!0,ref:d,onComplete(){s&&j(aS,!1)}}),v.useEffect(()=>{if(s||!a||D!==`ending`)return;if(!d.current){c(!1),j(aS,!1);return}let e=new AbortController,t=-1;function n(){w.current||(c(!1),j(aS,!1))}return t=Vn.request(()=>{T(n,e.signal)}),()=>{Vn.cancel(t),e.abort()}},[w,a,s,D,T,j,c]),q(()=>{let e=d.current;e&&n&&E&&e.setAttribute(`hidden`,`until-found`)},[E,n]),v.useEffect(function(){let e=d.current;if(!e)return;let t=de.create(),n=-1,r=(r,i)=>{t.start(0,()=>{w.current||(n=Vn.request(()=>{w.current||(r&&(g.current=!1),i&&e.setAttribute($x,``),e.setAttribute(`hidden`,`until-found`))}))})},i=wn(e,`beforematch`,t=>{let n=Jt(Xt,t);if(o(!0,n),n.isCanceled){r(!1,!1);return}g.current=!0;let i=e.hasAttribute($x);e.removeAttribute($x),l(!0),r(!0,i)});return()=>{t.clear(),Vn.cancel(n),i()}},[w,o,l]);let F=i||n||a||s;return{height:k.height,props:{...A?{[$x]:``}:void 0,hidden:E,id:r},ref:C,shouldPreventOpenAnimation:O,shouldRender:F,transitionStatus:D,width:k.width}}function sS(e){return{height:e.scrollHeight,width:e.scrollWidth}}function cS(e,t){let n=Ie(e).getComputedStyle(e),r=(n.animationName.split(`,`).map(e=>e.trim()).some(e=>e!==``&&e!==`none`)||t)&&lS(n.animationDuration),i=lS(n.transitionDuration);return r&&i||i?`css-transition`:r?`css-animation`:`none`}function lS(e){return e.split(`,`).map(e=>e.trim()).some(e=>e!==``&&Number.parseFloat(e)>0)}function uS(e,t,n){let r=e.style.getPropertyValue(t),i=e.style.getPropertyPriority(t);return e.style.setProperty(t,n),()=>{r===``?e.style.removeProperty(t):e.style.setProperty(t,r,i)}}function dS(e){let t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(t=>{e.style.setProperty(t,`initial`,`important`)});function n(){Object.entries(t).forEach(([t,n])=>{n===``?e.style.removeProperty(t):e.style.setProperty(t,n)})}let r=Vn.request(n);return()=>{Vn.cancel(r),n()}}function fS(e){let t=v.useRef(!0);t.current&&(t.current=!1,e())}function pS(e,t,n,r,i,a,o,s,c,l=2){let u=Dr(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 Sr(n.current,u)?void 0:u}function mS(e){return e==null?Xt:e.type.startsWith(`key`)?dn:e.type.startsWith(`mouse`)||e.type.startsWith(`pointer`)?fn:Xt}var hS=v.createContext(void 0),gS=v.createContext(void 0),_S=v.createContext(void 0),vS=v.createContext(!1),yS=v.createContext(``);function bS(){let e=v.useContext(hS);if(!e)throw Error(J(22));return e}function xS(){let e=v.useContext(gS);if(!e)throw Error(J(23));return e}function SS(){let e=v.useContext(_S);if(!e)throw Error(J(24));return e}function CS(){return v.useContext(yS)}function wS(){return v.useContext(vS)}function TS(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 ES=(e,t)=>Object.is(e,t);function DS(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function OS(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!TS(e,t,(e,t)=>DS(e,t,n)):e!==t}function kS(e,t,n){return e?e.some(e=>e!==void 0&&DS(t,e,n)):!1}function AS(e,t,n){return e?e.findIndex(e=>e!==void 0&&DS(e,t,n)):-1}function jS(e,t){if(t!==ES)return n=>kS(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 MS(e,t,n,r){let i=r&&Array.isArray(t)?e.findIndex(jS(t,n)):AS(e,t,n);return i===-1?null:i}function NS(e,t,n,r,i,a){return kS(r,t,i)?a!=null&&e>a&&kS(r,n[a],i)?a:e:e===a?MS(n,r,i,!0):a}function PS(e,t,n){return e.filter(e=>!DS(t,e,n))}function FS(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function IS(e){return typeof e==`object`&&!!e&&Array.isArray(e.items)}function LS(e){return IS(e?.[0])}function RS(e){return LS(e)?e.flatMap(e=>e.items):e}function zS(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(LS(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 BS(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 FS(e)}function VS(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?FS(e.value):FS(e)}function HS(e,t,n){function r(){return BS(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return(Object.hasOwn(t,e)?t[e]:void 0)??r();if(Array.isArray(t)){let n=RS(t);if(typeof e!=`object`||!e){let t=n.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=n.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function US(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,S.jsx)(v.Fragment,{children:HS(r,t,n)},i)),e),[])}var WS={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?zS(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=>DS(t,e,n)):DS(t,r,n)},transitionStatus:e=>e.transitionStatus,popupProps:e=>e.popupProps,listProps:e=>e.listProps,inputProps:e=>e.inputProps,triggerProps:e=>e.triggerProps,itemRoot:e=>e.itemRoot,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 GS(e){return e==null?void 0:`${e}-popup`}function KS(e,t){return(n,r)=>n!=null&&e.contains(n,r,t)}function qS(e){return Array.isArray(e)?e.map(e=>qS(e)).join(`,`):e==null?``:String(e)}var JS=new Map;function YS(e={}){let{locale:t,...n}=e,r={usage:`search`,sensitivity:`base`,ignorePunctuation:!0,...n},i=`${qS(t)}|${JSON.stringify(r)}`,a=JS.get(i);if(a)return a;let o=new Intl.Collator(t,r),s={contains(e,t,n){if(!t)return!0;let r=BS(e,n);for(let e=0;e<=r.length-t.length;e+=1)if(o.compare(r.slice(e,e+t.length),t)===0)return!0;return!1},startsWith(e,t,n){if(!t)return!0;let r=BS(e,n);return o.compare(r.slice(0,t.length),t)===0},endsWith(e,t,n){if(!t)return!0;let r=BS(e,n),i=t.length;return r.length>=i&&o.compare(r.slice(r.length-i),t)===0}};return JS.set(i,s),s}var XS=YS;function ZS(e,t=!1){let{overflowY:n}=$e(e);return n!==`auto`&&n!==`scroll`?!1:t?e.clientHeight>0:e.scrollHeight>e.clientHeight}var QS=Symbol(`none`),$S={value:QS,index:-1};function eC(e,t,n){let r=e.get(t);if(r!==void 0||n===ES)return r;for(let[r,i]of e)if(DS(r,t,n))return i}function tC(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:y=!1,items:b,filteredItems:x,filter:C,filterQuery:w,openOnInputClick:T=!0,autoHighlight:E=!1,keepHighlight:D=!1,highlightItemOnHover:O=!0,loopFocus:k=!0,itemToStringLabel:A,itemToStringValue:j,isItemEqualToValue:M=ES,virtualized:N=!1,inline:P=!1,fillInputOnItemPress:F=!0,modal:I=!1,limit:L=-1,autoComplete:R=`list`,formAutoComplete:z,locale:B,submitOnItemClick:V=!1}=e,{clearErrors:U}=kf(),{setDirty:ee,validityData:te,setFilled:ne,name:W,disabled:re,setTouched:ie,setFocused:oe,validationMode:se,validation:ce}=Df(),le=Cc(),ue=Ff({id:t}),de=XS({locale:B}),fe=Array.isArray(b)?null:b;if(fe&&typeof fe.label!=`function`)throw Error(J(100));let pe=fe?fe.data:b,me=fe?.value,he=me?void 0:pe,ge=v.useMemo(()=>{if(!x||!me)return;let e=RS(x),t=e.map(me),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 eC(n,r,i)}}},[x,me]),_e=v.useMemo(()=>fe?e=>fe.label(e,M,e=>{let t=ge?.findItem(e,M);return t==null?BS(e,A):fe.itemLabel(t)}):A,[fe,A,ge,M]),ve=v.useMemo(()=>fe?Object.assign(e=>fe.itemLabel(e),{selected:e=>BS(e,_e)}):A,[fe,_e,A]);function ye(e){return BS(e,_e)}let[be,xe]=v.useState(!1),[Se,Ce]=v.useState(null),we=v.useRef(Se),Te=v.useRef([]),Ee=v.useRef([]),De=v.useRef(null),Oe=v.useRef(null),ke=v.useRef(null),Ae=v.useRef(null),je=v.useRef(null),Me=v.useRef(!1),Ne=v.useRef(null),Pe=v.useRef(null),Fe=v.useRef(null),Ie=v.useRef($S),Le=v.useRef(null),Re=v.useRef([]),ze=v.useRef(null),Ve=re||m,He=W??f,Ue=u===`multiple`,We=u===`single`,Ge=s!==void 0||o!==void 0,Ke=pe!==void 0,qe=x!==void 0,Je;Je=E===`always`?`always`:E?`input-change`:!1;let[Ye,Xe]=Ob({controlled:i,default:Ue?r??G:r,name:`Combobox`,state:`selectedValue`}),Ze=v.useMemo(()=>C===null?()=>!0:C===void 0?KS(de,ve):C,[C,de,ve]),Qe=H(()=>Ge?o??``:We?ye(Ye):``).current,[$e,et]=Ob({controlled:s,default:Qe,name:`Combobox`,state:`inputValue`}),[tt,nt]=Ob({controlled:c,default:l,name:`Combobox`,state:`open`}),it=LS(pe),lt=!tt&&Se!==null?Se:String($e).trim(),ut=We?ye(Ye):``,dt=We&&!be&&lt!==``&&ut.length===lt.length&&de.contains(ut,lt),ft=dt?``:w??lt,pt=Ke&&qe&&dt&&(!fe||fe.hasValue(Ye,M)),mt=v.useMemo(()=>pe?RS(pe):G,[pe]),ht=v.useMemo(()=>{if(x&&!pt)return x;if(!pe)return G;if(it){let e=pe,t=[],n=0;for(let r of e){if(L>-1&&n>=L)break;let e=L>-1?L-n:1/0,i=ft===``?r.items.slice(0,e):[];if(ft!==``)for(let t of r.items){if(i.length>=e)break;Ze(t,ft,ve)&&i.push(t)}if(i.length>0){let e={...r,items:i};t.push(e),n+=i.length}}return t}if(ft===``)return L>-1?mt.slice(0,L):mt;let e=[];for(let t of mt){if(L>-1&&e.length>=L)break;Ze(t,ft,ve)&&e.push(t)}return e},[x,pt,pe,it,ft,L,Ze,ve,mt]),gt=v.useMemo(()=>{if(ge&&ht===x)return ge.values;let e=RS(ht);return me?e.map(e=>me(e)):e},[ht,x,ge,me]),_t=H(()=>{let e=null;return P&&tt&&Ke&&u!==`none`&&(e=MS(gt,Ye,M,Ue)),new mo({id:ue,labelId:void 0,selectedValue:Ye,open:tt,items:he,selectionMode:u,name:He,form:p,disabled:Ve,readOnly:h,required:g,grid:y,virtualized:N,openOnInputClick:T,itemToStringLabel:_e,isItemEqualToValue:M,modal:I,autoHighlight:Je,submitOnItemClick:V,hasInputValue:Ge,mounted:!1,forceMounted:!1,transitionStatus:`idle`,inline:P,activeIndex:null,selectedIndex:e,popupProps:{},listProps:{},inputProps:{},triggerProps:{},itemRoot:{props:K,id:ue,selectionMode:u,disabled:Ve,readOnly:h,isItemEqualToValue:M},positionerElement:null,listElement:null,popupId:void 0,triggerElement:null,inputElement:null,inputGroupElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,inputOwnsFormValue:u===`none`},{onOpenChangeComplete:ae,setOpen:ae,setInputValue:ae,setSelectedValue:ae,setIndices:ae,handleSelection:ae,forceMount:ae,requestSubmit:ae,listRef:Te,labelsRef:Ee,popupRef:De,emptyRef:je,inputRef:Oe,startDismissRef:ke,endDismissRef:Ae,chipsContainerRef:Ne,clearRef:Pe,valuesRef:Re,pointerDownItemRef:ze,selectionEventRef:Fe},WS)}).current,vt=u===`none`?$e:Ye,yt=v.useMemo(()=>u===`none`?vt:Array.isArray(Ye)?Ye.map(e=>VS(e,j)):VS(Ye,j),[vt,j,u,Ye]),bt=Y(d),xt=Y(n),St=_t.useState(`activeIndex`),Ct=_t.useState(`selectedIndex`),wt=_t.useState(`positionerElement`),Tt=_t.useState(`listElement`),Et=_t.useState(`triggerElement`),Dt=_t.useState(`inputElement`),Ot=_t.useState(`inputGroupElement`),kt=_t.useState(`inline`),At=_t.useState(`inputInsidePopup`),jt=_t.useState(`inputOwnsFormValue`),Mt=We&&!At&&$e===ut,Nt=Mn(Et),{openMethod:Pt,triggerProps:Ft}=ky(tt),It=Y(()=>yt);zf(At?Nt:Oe,ue,vt,It,!Ve,f);let Lt=Y(()=>{pe?Ee.current=gt.map(ye):_t.set(`forceMounted`,!0)}),Rt=Y((e,t,n,r)=>{if(t===-1){if(Ie.current===$S)return;Ie.current=$S}else Ie.current={value:e,index:t};bt(e,Yt(n,r,{index:t}))}),zt=Y(e=>{let t={};e.activeIndex!==void 0&&(t.activeIndex=e.activeIndex),e.selectedIndex!==void 0&&(t.selectedIndex=e.selectedIndex),_t.update(t);let n=e.activeIndex;if(n===void 0)return;let r=e.type||`none`;n===null?Rt(void 0,-1,r,e.event):Rt(Re.current[n],n,r,e.event)}),Bt=Y((t,n)=>{if(e.onInputValueChange?.(t,n),!n.isCanceled){if(Me.current=n.reason===on,n.reason===`input-change`){tt&&Se!==null&&Ce(null);let e=n.event,r=e.inputType;if(e.type===`compositionend`||r!=null&&r!==``&&r!==`insertReplacementText`){let e=t.trim()!==``;e&&xe(!0),Le.current={hasQuery:e};let n=_t.state.listElement;if(!_t.state.virtualized&&n){let e=De.current;for(let t of rt(n.firstElementChild??n)){if(!Be(t)||(e?!ot(e,t):t.getAttribute(`role`)===`dialog`))break;if(ZS(t)){t.scrollTop=0;break}}}e&&Je&&_t.state.activeIndex==null&&(tt||kt)&&_t.set(`activeIndex`,0)}}else n.reason===`input-clear`&&t===``&&_t.state.inputInsidePopup&&(Le.current={hasQuery:!1,selection:!0});et(t)}}),Vt=Y(e=>{let t=!e&&At&&!kt&&$e!==``&&(String($e).trim()===Se||$e===ut);!e&&(t||$e===``||Mt)&&xe(!1),Ce(null),t&&Bt(``,Jt(on))}),[Ht,Ut]=v.useState(!1),Wt=Y((t,n)=>{if(tt===t)return;n.reason===`escape-key`&&Ke&&gt.length===0&&!je.current&&n.allowPropagation();let r=n,i=qa(r);if(e.onOpenChange?.(t,r),Le.current?.hasQuery&&n.reason===`input-change`===n.isCanceled&&(Le.current=null),!n.isCanceled&&(t&&Se!==null&&Vt(n.reason===an),!t&&be&&(We?(kt||Ce(lt),lt===``&&xe(!1)):Ue&&(kt||Ce(lt),At&&zt({activeIndex:null}),(!At||kt)&&Bt(``,Jt(on,n.event,void 0,{isItemPress:n.reason===tn})))),t||Ut(i()),nt(t),!t&&At&&(n.reason===`focus-out`||n.reason===`outside-press`)&&(ie(!0),oe(!1),se===`onBlur`))){let e=u===`none`?$e:Ye;ce.commit(e)}}),Gt=Y((e,t)=>{a?.(e,t),!t.isCanceled&&(Xe(e),(u===`none`&&De.current&&F||We&&!_t.state.inputInsidePopup)&&Bt(ye(e),Jt(t.reason,t.event)))}),Kt=Y((e,t)=>{let n=ct(e),r=Fe.current??e;Fe.current=null;let i=Jt(tn,r),a=st(n,`a`)?.getAttribute(`href`);if(a)a.startsWith(`#`)&&Wt(!1,i);else if(Ue){let e=Array.isArray(Ye)?Ye:[],n=kS(e,t,M),r=n?PS(e,t,M):[...e,t];if(Gt(r,i),i.isCanceled||!(Oe.current&&Oe.current.value.trim()!==``))return;if(_t.state.inputInsidePopup){Bt(``,Jt(on,i.event,void 0,{isItemPress:!0}));let e=Le.current;e&&!n&&(e.toggledValue=t)}else Wt(!1,i)}else{if(Gt(t,i),i.isCanceled)return;Wt(!1,i)}}),qt=Y(()=>{let e=ce.inputRef.current?.form??_t.state.inputElement?.form;e&&typeof e.requestSubmit==`function`&&e.requestSubmit()}),Zt=Y(()=>{if(xt?.(!1),xe(!1),Ce(null),zt(u===`none`?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),Ue&&Oe.current&&Oe.current.value!==``&&!Me.current&&Bt(``,Jt(on)),We){if(_t.state.inputInsidePopup)Oe.current&&Oe.current.value!==``&&Bt(``,Jt(on));else{let e=ye(Ye);Oe.current&&Oe.current.value!==e&&Bt(e,Jt(e===``?on:Xt))}}}),Qt=v.useMemo(()=>kt&&wt?{current:st(wt,`[role="dialog"]`)}:De,[kt,wt]),{mounted:$t,transitionStatus:en,forceUnmount:nn}=za({open:tt,ref:Qt,preventUnmountOnClose:Ht,setPreventUnmountOnClose:Ut,onUnmount:Zt});v.useImperativeHandle(e.actionsRef,()=>({unmount:nn,close:()=>Wt(!1,Jt(vn))}),[nn,Wt]),q(function(){let e=we.current!==null&&Se===null;if(we.current=Se,tt&&(!e||!Ke)||(tt||(ze.current=null),u===`none`))return;let t=Ke?gt:Re.current;zt({selectedIndex:MS(t,Ye,M,Ue)})},[tt,Se,Ye,u,Ue,Ke,gt,M,zt]),q(()=>{pe&&(Re.current=gt,Te.current.length=gt.length)},[pe,gt]),q(()=>{!tt&&Le.current?.hasQuery&&(Le.current=null)},[tt]),q(()=>{if(!tt&&kt&&Qt.current){Le.current=null;return}let e=Ke||qe?gt:Re.current,t=Le.current;if(t){let n=tt||kt||_t.state.positionerElement?.hidden===!1;if(t.hasQuery){let t=Oe.current;!Je||String($e).trim()===``||kt&&Je!==`always`&&(!t||at(t.ownerDocument)!==t)?Le.current=null:n&&(e[0]!==void 0||!Ke&&!qe)&&(_t.set(`activeIndex`,0),Le.current=null)}else if(String($e).trim()===``&&(Le.current=null,n)){let e=t.selection;Je===`always`&&!e&&_t.state.selectionMode===`none`&&_t.set(`activeIndex`,0),queueMicrotask(()=>{if(!_t.state.open&&(!_t.state.inline||Qt.current)||Oe.current&&Oe.current.value.trim()!==``)return;let n=_t.state.selectedValue,r=_t.state.selectionMode===`multiple`;if(r&&Array.isArray(n)?n.length>0:_t.state.selectionMode!==`none`&&n!=null){let e=Ke||qe?gt:Re.current,i=AS(e,t.toggledValue,_t.state.isItemEqualToValue);_t.set(`activeIndex`,i===-1?MS(e,n,_t.state.isItemEqualToValue,r):i)}else e?_t.set(`activeIndex`,null):Je===`always`&&_t.set(`activeIndex`,0)})}}if(!tt&&!kt)return;let n=_t.state.activeIndex;if(n==null){if(Je===`always`&&e.length>0){_t.set(`activeIndex`,0);return}Rt(void 0,-1,Xt);return}if(n>=e.length){Rt(void 0,-1,Xt),_t.set(`activeIndex`,null);return}let r=e[n],i=Ie.current.value,a=i!==QS&&DS(r,i,_t.state.isItemEqualToValue);(Ie.current.index!==n||!a)&&Rt(r,n,Xt)},[St,Je,Rt,qe,Ke,gt,kt,tt,Qt,_t,$e]),q(()=>{ne(u===`none`?String($e)!==``:Ue?Array.isArray(Ye)&&Ye.length>0:Ye!=null)},[ne,u,$e,Ye,Ue]),v.useEffect(()=>{Ke&&Je&&gt.length===0&&zt({activeIndex:null})},[Ke,Je,gt.length,zt]);function rn(){tt&&lt!==``&&lt!==String(Qe)&&!Mt&&xe(!0)}function cn(){tt&&Se!==null&&Vt(!1)}let ln=!1;function un(){!ln&&$e!==ut&&(ln=!0,Bt(ut,Jt(Xt)))}function dn(){u!==`none`&&(U(He),ee(OS(Ye,te.initialValue,M)),ce.change(Ye),We&&!Ge&&!At&&un())}function fn(){We&&!Ge&&!At&&!be&&un()}function pn(){u===`none`&&(U(He),ee($e!==te.initialValue),ce.change($e))}Bf(lt,rn),Bf(tt,cn),Bf(Ye,dn),Bf(ut,fn),Bf(pe,fn),Bf($e,pn);let mn=To({open:kt?!0:tt,onOpenChange:Wt,elements:{reference:At?Et:Dt,floating:wt}}),hn=y?`grid`:`listbox`,gn=tt||kt,_n=gn?`true`:`false`,yn=v.useMemo(()=>{let e=Dt?.tagName===`INPUT`,t=Dt==null||e,n=t||gn,r=t?{autoComplete:`off`,spellCheck:`false`,autoCorrect:`off`,autoCapitalize:`none`}:{};return n&&(r.role=`combobox`,r[`aria-expanded`]=_n,r[`aria-haspopup`]=hn,r[`aria-controls`]=gn?Tt?.id:void 0,r[`aria-autocomplete`]=h?`none`:R),{reference:r,floating:{role:`presentation`}}},[Dt,gn,_n,hn,Tt?.id,R,h]),bn=wa(mn,{enabled:!Ve&&T,event:`mousedown-only`,toggle:!1,touchOpenDelay:At?0:100,reason:sn}),xn=Aa(mn,{enabled:!Ve&&!kt,outsidePressEvent:{mouse:`sloppy`,touch:`intentional`},bubbles:kt?!0:void 0,outsidePress(e){let t=ct(e);return!ot(Et,t)&&!ot(Pe.current,t)&&!ot(Ne.current,t)&&!ot(Ot,t)}}),Sn=Ho(mn,{enabled:!Ve,id:ue,listRef:Te,activeIndex:St,selectedIndex:Ct,virtual:!0,loopFocus:k,allowEscape:k&&!Je,focusItemOnOpen:be||u===`none`&&!Je?!1:`auto`,focusItemOnHover:O,resetOnPointerLeave:!D,orientation:y?`horizontal`:void 0,rtl:le===`rtl`,disabledIndices:G,grid:y?pS:void 0,onNavigate(e,t){(t||tt||kt&&e===null)&&en!==`ending`&&zt({activeIndex:e,type:mS(t),event:t?.nativeEvent})}}),Cn=v.useMemo(()=>ki(Sn.reference,{onKeyDown(e){y&&_t.state.activeIndex==null&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&e.preventBaseUIHandler()}},xn.reference,bn.reference,yn.reference),[Sn.reference,xn.reference,bn.reference,yn.reference,y,_t]),wn=v.useMemo(()=>ki(Ba,xn.floating),[xn.floating]),Tn=v.useMemo(()=>ki(Sn.floating,yn.floating),[Sn.floating,yn.floating]),Dn=v.useMemo(()=>{let e=Sn.item;return{props:e?{...e,onFocus:void 0}:K,id:ue,selectionMode:u,disabled:Ve,readOnly:h,isItemEqualToValue:M}},[Sn.item,ue,u,Ve,h,M]);_t.useContextCallback(`setOpen`,Wt),_t.useContextCallback(`setInputValue`,Bt),_t.useContextCallback(`setSelectedValue`,Gt),_t.useContextCallback(`setIndices`,zt),_t.useContextCallback(`handleSelection`,Kt),_t.useContextCallback(`forceMount`,Lt),_t.useContextCallback(`requestSubmit`,qt),_t.useContextCallback(`onOpenChangeComplete`,n),fS(()=>{_t.update({inline:P,popupProps:wn,listProps:Tn,inputProps:Cn,triggerProps:Ft,itemRoot:Dn})});let On={id:ue,selectedValue:Ye,open:tt,mounted:$t,transitionStatus:en,items:he,inline:P,popupProps:wn,listProps:Tn,inputProps:Cn,triggerProps:Ft,itemRoot:Dn,openMethod:Pt,selectionMode:u,name:He,form:p,disabled:Ve,readOnly:h,required:g,grid:y,virtualized:N,openOnInputClick:T,itemToStringLabel:_e,modal:I,autoHighlight:Je,isItemEqualToValue:M,submitOnItemClick:V,hasInputValue:Ge};q(()=>{_t.update({...On,inputOwnsFormValue:u===`none`&&(P||!_t.state.inputInsidePopup)})},[_t,...Object.values(On)]);let kn=En(_,ce.inputRef),An=v.useMemo(()=>({query:lt,hasItems:Ke,filteredItems:ht,flatFilteredValues:gt}),[lt,Ke,ht,gt]),jn=v.useMemo(()=>Array.isArray(vt)?``:VS(vt,j),[vt,j]),Nn=Ue&&Array.isArray(Ye)&&Ye.length>0,Pn=Ue||u===`none`&&jt?void 0:He,Fn=v.useMemo(()=>!Ue||!Array.isArray(Ye)||!He?null:Ye.map(e=>{let t=VS(e,j);return(0,S.jsx)(`input`,{type:`hidden`,form:p,name:He,value:t,disabled:Ve},t)}),[Ue,Ye,p,He,j,Ve]),In=(0,S.jsxs)(v.Fragment,{children:[e.children,(0,S.jsx)(`input`,{...ce.getValidationProps(Ve,{onFocus(){At?Et?.focus():(Oe.current||Et)?.focus()},onChange(e){if(e.nativeEvent.defaultPrevented||Ve||h)return;let t=e.currentTarget.value,n=t.toLowerCase(),r=Jt(Xt,e.nativeEvent),i=()=>Re.current.findIndex(e=>VS(e,j).toLowerCase()===n||ye(e).toLowerCase()===n);function a(){if(Ue)return;if(u===`none`){Bt(t,r);return}let e=i();e===-1&&(e=Re.current.findIndex((e,t)=>{let r=Ee.current[t];return r!=null&&r.toLowerCase()===n}));let a=e===-1?void 0:Re.current[e];a!=null&&Gt?.(a,r)}We&&(Lt(),pe&&i()===-1&&_t.set(`forceMounted`,!0)),queueMicrotask(a)}}),id:ue&&Pn==null?`${ue}-hidden-input`:void 0,form:p,name:Pn,autoComplete:z,disabled:Ve,required:g&&!Nn,readOnly:h,value:jn,ref:kn,style:Pn?Kn:Gn,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Fn]});return(0,S.jsx)(hS.Provider,{value:_t,children:(0,S.jsx)(gS.Provider,{value:mn,children:(0,S.jsx)(vS.Provider,{value:Ke,children:(0,S.jsx)(_S.Provider,{value:An,children:(0,S.jsx)(yS.Provider,{value:$e,children:In})})})})})}var nC=`data-popup-side`,rC=`data-list-empty`,iC={...jt,...wf,popupSide:e=>e?{[nC]:e}:null,listEmpty:e=>e?{[rC]:``}:null},aC=5;function oC(e,t){let n=sC(t);return e.clientX>=n.left-aC&&e.clientX<=n.right+aC&&e.clientY>=n.top-aC&&e.clientY<=n.bottom+aC}function sC(e){let t=e.getBoundingClientRect(),n=Ie(e);if(De)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}}function cC(e,t){return e??t}function lC(e){let t=e.useState(`mounted`),n=e.useState(`popupSide`),r=e.useState(`positionerElement`);return t&&r?n:null}function uC(){return SS().filteredItems.length===0}function dC(e){return e===`rtl`?[`ArrowRight`,`ArrowLeft`]:[`ArrowLeft`,`ArrowRight`]}function fC(e,t,n){let r=e.context.listRef.current[t];r&&(e.context.selectionEventRef.current=n,r.click(),e.context.selectionEventRef.current=null)}var pC=v.forwardRef(function(e,t){let{render:n,className:r,nativeButton:i=!0,disabled:a=!1,id:o,style:s,...c}=e,{state:l,disabled:u,setTouched:d,validationMode:f,validation:p}=Df(),{labelId:m}=jf(),h=bS(),g=h.useState(`selectionMode`),_=h.useState(`disabled`),y=h.useState(`readOnly`),b=h.useState(`required`),x=h.useState(`positionerElement`),S=h.useState(`listElement`),C=h.useState(`popupId`),w=h.useState(`triggerProps`),T=h.useState(`inputInsidePopup`),E=h.useState(`id`),D=h.useState(`labelId`),O=h.useState(`open`),k=h.useState(`selectedValue`),A=h.useState(`activeIndex`),j=h.useState(`selectedIndex`),M=h.useState(`hasSelectedValue`),N=xS(),P=CS(),F=fe(),I=u||_||a,L=uC(),R=lC(h),z=v.useRef(null),B=Rf(I,z);Ff({id:T?o:void 0});let V=T?o??E:o,H=cC(m,D),U;O&&T?U=C??GS(E):O&&(U=S?.id);let ee=v.useRef(``);function te(e){ee.current=e.pointerType}let{reference:ne}=Uo(N,{enabled:!O&&!y&&!_&&g===`single`,listRef:h.context.labelsRef,activeIndex:A,selectedIndex:j,onMatch(e){let t=h.context.valuesRef.current[e];t!==void 0&&h.context.setSelectedValue(t,Jt(Xt))}}),{reference:W}=wa(N,{enabled:!_,event:`mousedown`}),{buttonRef:re,getButtonProps:ie}=pf({native:i,disabled:I}),ae={...l,readOnly:y,open:O,disabled:I,popupSide:R,listEmpty:L,placeholder:g!==`none`&&!M};return Hi(`button`,e,{ref:[t,re,z,Y(e=>{h.set(`triggerElement`,e)})],state:ae,props:[w,W,ne,{id:V,tabIndex:T?0:-1,role:T?`combobox`:void 0,"aria-expanded":O,"aria-haspopup":T?`dialog`:`listbox`,"aria-controls":U,"aria-required":T&&b||void 0,"aria-readonly":T&&y||void 0,"aria-labelledby":H,onPointerDown:te,onPointerEnter:te,onFocus(){B(!0),!I&&F.start(0,h.context.forceMount)},onBlur(e){if(!ot(x,e.relatedTarget)&&(d(!0),B(!1),f===`onBlur`)){let e=g===`none`?P:k;p.commit(e)}},onMouseDown(e){if(I||(T||N.set(`domReferenceElement`,e.currentTarget),h.context.forceMount(),ee.current!==`touch`&&(h.context.inputRef.current?.focus(),T||e.preventDefault()),O))return;let t=Un(e.currentTarget);function n(e){let t=h.state.triggerElement;if(!t)return;let n=ct(e),r=h.state.positionerElement,i=h.state.listElement;ot(t,n)||ot(r,n)||ot(i,n)||oC(e,t)||h.context.setOpen(!1,Jt(pn,e))}T&&t.addEventListener(`mouseup`,n,{once:!0})},onKeyDown(e){(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(Oe(e),h.context.setOpen(!0,Jt(un,e.nativeEvent)),h.context.inputRef.current?.focus())}},p.getValidationProps(I,c),ie],stateAttributesMapping:iC})}),mC=v.createContext(void 0);function hC(){return v.useContext(mC)}var gC=v.createContext(void 0);function _C(e){let t=v.useContext(gC);if(t===void 0&&!e)throw Error(J(21));return t}var vC=v.forwardRef(function(e,t){let n=bS(),{buttonRef:r,getButtonProps:i}=pf({native:!1}),a=En(t,r);function o(e){n.context.setOpen(!1,Jt(nn,e.nativeEvent,e.currentTarget))}let s=i({onClick:o});return(0,S.jsx)(`span`,{ref:a,...s,"aria-label":`Dismiss`,tabIndex:void 0,style:Kn})}),yC=v.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,id:a,style:o,...s}=e,{state:c,disabled:l,setTouched:u,validationMode:d,validation:f}=Df(),{labelId:p}=jf(),m=hC(),h=!!_C(!0),g=bS(),_=CS(),y=Cc(),b=g.useState(`required`),x=g.useState(`disabled`),C=g.useState(`readOnly`),w=g.useState(`name`),T=g.useState(`form`),E=g.useState(`selectionMode`),D=g.useState(`autoHighlight`),O=g.useState(`inputProps`),k=g.useState(`triggerProps`),A=g.useState(`open`),j=g.useState(`mounted`),M=g.useState(`selectedValue`),N=g.useState(`id`),P=g.useState(`inline`),F=g.useState(`modal`),I=!!D,L=lC(g),R=l||x||i,z=uC(),B=Rf(R,g.context.inputRef),V=h||P,H=!V||F,U=lc(a??(V?void 0:N)),ee=h?Sf:c,[te,ne]=v.useState(null),W=v.useRef(!1),re=v.useRef(null);q(()=>{A||(re.current=null)},[A]);let ie=E===`none`&&!h,ae=Y(e=>{let t=h||g.state.inline;t&&!g.state.hasInputValue&&g.context.setInputValue(``,Jt(Xt)),g.update({inputElement:e,inputInsidePopup:t,inputOwnsFormValue:ie})}),G=h?s:f.getValidationProps(R,s);function K(e){g.context.setIndices({activeIndex:null,selectedIndex:null,type:mS(e),event:e})}let oe={...ee,open:A,disabled:R,readOnly:C,popupSide:L,listEmpty:z};function J(e){if(!m)return;let t,n=m.chipsRef.current.length,[r]=dC(y);return e.key===r&&(e.currentTarget.selectionStart??0)===0&&M.length>0&&(e.preventDefault(),t=n>0?n-1:void 0),t}let se=Hi(`input`,e,{state:oe,ref:[t,g.context.inputRef,ae],props:[O,k,{value:te??_,"aria-readonly":C||void 0,"aria-required":b||void 0,"aria-labelledby":p,disabled:R,readOnly:C,required:E===`none`?b:void 0,form:T,...ie&&w&&{name:w},id:U,onFocus(){if(B(!0),!P)return;let e=re.current;re.current=null,e!=null&&Object.hasOwn(g.context.valuesRef.current,e)&&g.context.setIndices({activeIndex:e})},onBlur(){u(!0),B(!1);let e=g.state.activeIndex;if(P&&e!==null&&D!==`always`&&(re.current=e,g.context.setIndices({activeIndex:null})),d===`onBlur`){let e=E===`none`?_:M;f.commit(e)}},onCompositionStart(e){xe||(W.current=!0,ne(e.currentTarget.value))},onCompositionEnd(e){W.current=!1;let t=e.currentTarget.value;ne(null),g.context.setInputValue(t,Jt(an,e.nativeEvent))},onChange(e){let t=e.nativeEvent,n=t.inputType,r=!n||n===`insertReplacementText`,i=W.current||!r;function a(e){!C&&!R&&e&&i&&(g.context.setOpen(!0,Jt(an,t)),I||K(t))}if(W.current){let n=e.currentTarget.value;ne(n),n===``&&!g.state.openOnInputClick&&!g.state.inputInsidePopup&&g.context.setOpen(!1,Jt(on,t));let r=n.trim(),i=I&&r!==``;a(r),A&&g.state.activeIndex!==null&&!i&&K(t);return}let o=Jt(an,t);if(g.context.setInputValue(e.currentTarget.value,o),o.isCanceled)return;let s=e.currentTarget.value===``,c=Jt(on,t);s&&!g.state.inputInsidePopup&&(E===`single`&&g.context.setSelectedValue(null,c),g.state.openOnInputClick||g.context.setOpen(!1,c)),a(e.currentTarget.value.trim()),A&&g.state.activeIndex!==null&&!I&&K(t)},onKeyDown(e){if(e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)return;if(R||C){C&&e.key===`Enter`&&A&&g.state.activeIndex!==null&&Oe(e);return}let t=e.currentTarget,n=t.scrollWidth-t.clientWidth,r=y===`rtl`;if(e.key===`Home`){Oe(e);let n=Te&&r?t.value.length:0;t.setSelectionRange(n,n),t.scrollLeft=0;return}if(e.key===`End`){Oe(e);let i=Te&&r?0:t.value.length;t.setSelectionRange(i,i),t.scrollLeft=r?-n:n;return}if(!j&&e.key===`Escape`){let t=E===`multiple`&&Array.isArray(M)?M.length===0:M===null,n=Jt(ln,e.nativeEvent),r=E===`multiple`?[]:null;g.context.setInputValue(``,n),g.context.setSelectedValue(r,n),!t&&!g.state.inline&&!n.isPropagationAllowed&&e.stopPropagation();return}if(m&&e.key===`Backspace`&&t.value===``&&Array.isArray(M)&&M.length>0){let t=m.chipsRef.current.length,n=t>0?t-1:M.length-1,r=M.filter((e,t)=>t!==n);K(e.nativeEvent),g.context.setSelectedValue(r,Jt(Xt,e.nativeEvent));return}let i=J(e);if(i!==void 0&&m?.chipsRef.current[i]?.focus(),e.which!==229&&e.key===`Enter`&&A){let t=g.state.activeIndex,n=e.nativeEvent;if(t===null){if(P)return;g.context.setOpen(!1,Jt(Xt,n));return}Oe(e),fC(g,t,n)}}},G],stateAttributesMapping:iC}),ce=h?(0,S.jsx)(Ef.Provider,{value:Tf,children:se}):se;return(0,S.jsxs)(v.Fragment,{children:[A&&H&&(0,S.jsx)(vC,{ref:g.context.startDismissRef}),ce]})}),bC={...yt,...At},xC=v.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,keepMounted:o=!1,style:s,...c}=e,{disabled:l}=Df(),u=bS(),d=u.useState(`selectionMode`),f=u.useState(`disabled`),p=u.useState(`readOnly`),m=u.useState(`open`),h=u.useState(`selectedValue`),g=u.useState(`hasSelectionChips`),_=CS(),v=!1;v=d===`none`?_!==``:d===`single`?h!=null:g;let y=l||f||i,{buttonRef:b,getButtonProps:x}=pf({native:a,disabled:y}),{mounted:S,transitionStatus:C,setMounted:w}=Na(v),T={disabled:y,visible:v,open:m,transitionStatus:C};Ra({open:v,ref:u.context.clearRef,onComplete(){v||w(!1)}});let E=Hi(`button`,e,{state:T,ref:[t,b,u.context.clearRef],props:[{tabIndex:-1,children:`x`,onMouseDown(e){e.preventDefault()},onClick(e){if(y||p)return;let t=mS(e);u.context.setInputValue(``,Jt(rn,e.nativeEvent)),d===`none`?u.context.setIndices({activeIndex:null,type:t,event:e.nativeEvent}):(u.context.setSelectedValue(Array.isArray(h)?[]:null,Jt(rn,e.nativeEvent)),u.context.setIndices({activeIndex:null,selectedIndex:null,type:t,event:e.nativeEvent})),u.context.inputRef.current?.focus()}},c,x],stateAttributesMapping:bC});return o||S?E:null}),SC=v.createContext(null);function CC(){return v.useContext(SC)}function wC(e){let{children:t,items:n}=e,r=v.useMemo(()=>({items:n}),[n]);return(0,S.jsx)(SC.Provider,{value:r,children:t})}function TC(e){let{children:t}=e,{filteredItems:n}=SS(),r=CC(),i=r?r.items:n;return(0,S.jsx)(v.Fragment,{children:i.map(t)})}var EC=v.forwardRef(function(e,t){var n;let{render:r,className:i,style:a,children:o,...s}=e,c=bS(),l=xS(),u=!!_C(!0),{filteredItems:d,hasItems:f}=SS(),p=c.useState(`selectionMode`),m=c.useState(`grid`),h=c.useState(`readOnly`),g=c.useState(`listProps`),_=c.useState(`virtualized`),y=c.useState(`forceMounted`),b=p===`multiple`,x=d.length===0,C=Y(e=>{c.set(`positionerElement`,e)}),w=Y(e=>{c.set(`listElement`,e)}),T=v.useMemo(()=>typeof o==`function`?n||=(0,S.jsx)(TC,{children:o}):o,[o]),E={empty:x},D=l.useState(`floatingId`),O=Hi(`div`,e,{state:E,ref:[t,w,u?null:C],props:[g,{children:T,tabIndex:-1,id:D,role:m?`grid`:`listbox`,"aria-multiselectable":b?`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;Oe(e),fC(c,t,e.nativeEvent)}}},s]});if(_)return O;let k=f&&!y?void 0:c.context.labelsRef;return(0,S.jsx)(jb,{elementsRef:c.context.listRef,labelsRef:k,children:O})}),DC=`⁠`;function OC(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 kC(e=!0){let t=fe(),n=v.useRef(null);return v.useEffect(()=>{if(!e||ye)return;let r=n.current;if(r==null)return;let i=OC(r);if(i==null)return;let a=i.data,o=`${a}${DC}`;return i.nodeValue=o,t.start(200,()=>{i.nodeValue===o&&(i.nodeValue=a)}),()=>{t.clear(),i.nodeValue===o&&(i.nodeValue=a)}},[e,n,t]),n}var AC=v.createContext(void 0);function jC(){let e=v.useContext(AC);if(e===void 0)throw Error(J(20));return e}var MC=v.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=bS(),a=i.useState(`mounted`),o=i.useState(`forceMounted`);return a||n||o?(0,S.jsx)(AC.Provider,{value:n,children:(0,S.jsx)(ia,{ref:t,...r})}):null}),NC=v.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=Zi,style:g,..._}=e,v=bS(),y=xS(),b=jC(),x=v.useState(`modal`),C=v.useState(`open`),w=v.useState(`mounted`),T=v.useState(`openMethod`),E=v.useState(`positionerElement`),D=v.useState(`triggerElement`),O=v.useState(`inputElement`),k=v.useState(`inputGroupElement`),A=v.useState(`inputInsidePopup`),j=v.useState(`transitionStatus`),M=uC(),N=Lc({anchor:i??(A?D:k??O),floatingRootContext:y,positionMethod:a,mounted:w,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m,keepMounted:b,collisionAvoidance:h,lazyFlip:!0});ob(C&&x,T===`touch`,E,D);let P={open:C,side:N.side,align:N.align,anchorHidden:N.anchorHidden,empty:M};q(()=>{v.set(`popupSide`,N.side)},[v,N.side]);let F=Y(e=>{v.set(`positionerElement`,e)}),I=Vc(e,P,{styles:N.positionerStyles,transitionStatus:j,props:_,refs:[t,F],hidden:!w,inert:!C});return(0,S.jsxs)(gC.Provider,{value:N,children:[w&&x&&(0,S.jsx)(oy,{inert:Kc(!C),cutout:k??O??D}),I]})}),PC={...Mt,...yt},FC=v.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=bS(),l=_C(),u=xS(),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`),y=c.useState(`modal`),b=c.useState(`id`),x=uC(),C=s.id??(g?GS(b):void 0);q(()=>(c.set(`popupId`,c.context.popupRef.current?.id||C),()=>{c.set(`popupId`,void 0)}),[c,C]),Ra({open:f,ref:c.context.popupRef,onComplete(){f&&c.context.onOpenChangeComplete(!0)}});let w=Hi(`div`,e,{state:{open:f,side:l.side,align:l.align,anchorHidden:l.anchorHidden,transitionStatus:h,empty:x},ref:[t,c.context.popupRef],props:[m,{id:C,role:g?`dialog`:`presentation`,onFocus(e){let t=ct(e.nativeEvent);p!==`touch`&&(ot(c.state.listElement,t)||t===e.currentTarget)&&c.context.inputRef.current?.focus()}},Bc(h),s],stateAttributesMapping:PC}),T=a===void 0?g?e=>e===`touch`?c.context.popupRef.current:_:!1:a,E;E=o??(g?void 0:!1);let D=!g||y;return(0,S.jsx)(Ca,{context:u,disabled:!d,modal:D,openInteractionType:p,initialFocus:T,returnFocus:E,getInsideElements:()=>[c.context.startDismissRef.current,c.context.endDismissRef.current],children:(0,S.jsxs)(v.Fragment,{children:[w,D&&(0,S.jsx)(vC,{ref:c.context.endDismissRef})]})})}),IC=v.createContext(void 0);function LC(){let e=v.useContext(IC);if(e===void 0)throw Error(J(18));return e}var RC=v.forwardRef(function(e,t){let{render:n,className:r,style:i,items:a,...o}=e,s=bS().useState(`grid`),[c,l]=v.useState(),u=v.useMemo(()=>({labelId:c,setLabelId:l,items:a}),[c,l,a]),d=Hi(`div`,e,{ref:t,props:[{role:s?`rowgroup`:`group`,"aria-labelledby":c},o]}),f=(0,S.jsx)(IC.Provider,{value:u,children:d});return a?(0,S.jsx)(wC,{items:a,children:f}):f}),zC=v.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{setLabelId:s}=LC(),c=lc(a);return q(()=>(s(c),()=>{s(e=>e===c?void 0:e)}),[c,s]),Hi(`div`,e,{ref:t,props:[{id:c,"aria-hidden":!0},o]})}),BC=v.createContext(void 0);function VC(){let e=v.useContext(BC);if(!e)throw Error(J(19));return e}var HC=v.createContext(!1);function UC(){return v.useContext(HC)}function WC(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=v.useRef(null),m=Kb({guess:!0,index:l,textRef:p}),h=bS(),g=UC(),_=wS(),{props:y,id:b,selectionMode:x,disabled:C,readOnly:w,isItemEqualToValue:T}=h.useState(`itemRoot`),E=C||u,D=x!==`none`,O=l??i??m.index,k=O!==-1,A=h.useState(`isActive`,O),j=h.useState(`isSelected`,c),M=v.useRef(null),N=b!=null&&k?`${b}-${O}`:void 0,P=j&&D;q(()=>{if(!k||!r&&l==null)return;let e=h.context.listRef.current;return e[O]=M.current,()=>{delete e[O]}},[k,r,O,l,h]),q(()=>{if(!k||_)return;let e=h.context.valuesRef.current;return e[O]=c,()=>{delete e[O]}},[k,_,O,c,h]),q(()=>{if(!k||_)return;let e=h.state.selectedValue,t=h.state.selectedIndex;h.state.selectionMode===`multiple`&&Array.isArray(e)?t=NS(O,c,h.context.valuesRef.current,e,T,t):DS(c,e,T)&&(t=O),h.set(`selectedIndex`,t)},[k,_,h,O,c,T]);let{getButtonProps:F,buttonRef:I}=pf({disabled:E,focusableWhenDisabled:!0,native:d,composite:!0}),L={disabled:E,selected:P,highlighted:A};function z(e){function t(){h.context.handleSelection(e,c)}h.state.submitOnItemClick?(R.flushSync(t),h.context.requestSubmit()):t()}let B={id:N,role:g?`gridcell`:`option`,"aria-selected":D?P:void 0,tabIndex:void 0,onPointerDownCapture(e){e.isPrimary&&(h.context.pointerDownItemRef.current=e.currentTarget),e.preventDefault()},onMouseDown(e){e.preventDefault()},onClick(e){E||w||z(e.nativeEvent)},onMouseUp(e){let t=h.context.pointerDownItemRef.current===e.currentTarget;h.context.pointerDownItemRef.current=null,!(E||w||e.button!==0||t||!A)&&z(e.nativeEvent)}},V=Hi(`div`,t,{ref:[I,n,m.ref,M],state:L,props:[y,B,f,F]}),H=v.useMemo(()=>({selected:P,textRef:p}),[P,p]);return(0,S.jsx)(BC.Provider,{value:H,children:V})}function GC(e){let{componentProps:t,forwardedRef:n}=e,r=bS().useState(`isItemEqualToValue`),{flatFilteredValues:i}=SS(),a=AS(i,t.value??null,r);return(0,S.jsx)(WC,{componentProps:t,forwardedRef:n,virtualized:!0,indexFromFilter:a})}var KC=v.memo(v.forwardRef(function(e,t){let n=bS().useState(`virtualized`);return n&&e.index==null?(0,S.jsx)(GC,{componentProps:e,forwardedRef:t}):(0,S.jsx)(WC,{componentProps:e,forwardedRef:t,virtualized:n,indexFromFilter:void 0})})),qC=v.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,{filteredItems:s}=SS(),c=bS(),l=kC(),u=s.length===0?a:null;return Hi(`div`,e,{ref:[t,c.context.emptyRef,l],props:[{children:u,role:`status`,"aria-live":`polite`,"aria-atomic":!0},o]})}),JC=v.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return Hi(`div`,e,{state:{orientation:i},ref:t,props:[{role:`presentation`},o]})}),YC={...iS,...yt},XC=v.forwardRef(function(e,t){let{render:n,className:r,defaultOpen:i=!1,disabled:a=!1,onOpenChange:o,open:s,style:c,...l}=e,u=Y(o),d=Jx({open:s,defaultOpen:i,onOpenChange:u,disabled:a}),f=v.useMemo(()=>({open:d.open,disabled:d.disabled,transitionStatus:d.transitionStatus}),[d.open,d.disabled,d.transitionStatus]),p=v.useMemo(()=>({...d,onOpenChange:u,state:f}),[d,u,f]),m=Hi(`div`,e,{state:f,ref:t,props:l,stateAttributesMapping:YC});return(0,S.jsx)(Yx.Provider,{value:p,children:m})}),ZC={...rS,...yt},QC=v.forwardRef(function(e,t){let{panelId:n,open:r,handleTrigger:i,state:a,disabled:o}=Xx(),{className:s,disabled:c=o,render:l,nativeButton:u=!0,style:d,...f}=e,{getButtonProps:p,buttonRef:m}=pf({disabled:c,native:u});return Hi(`button`,e,{state:a,ref:[t,m],props:[{"aria-controls":r?n:void 0,"aria-expanded":r,onClick:i},f,p],stateAttributesMapping:ZC})}),$C=`--collapsible-panel-height`,ew=`--collapsible-panel-width`,tw=v.forwardRef(function(e,t){let{className:n,hiddenUntilFound:r,keepMounted:i,render:a,id:o,style:s,...c}=e,{defaultPanelId:l,mounted:u,onOpenChange:d,open:f,setMounted:p,setPanelIdState:m,setOpen:h,state:g,transitionStatus:_}=Xx(),v=r??!1,y=i??!1,b=o||void 0,x=b??l;q(()=>(m(e=>b??(e===null?void 0:e)),()=>{m(e=>e===b?null:e)}),[b,m]);let{height:S,props:C,ref:w,shouldPreventOpenAnimation:T,shouldRender:E,transitionStatus:D,width:O}=oS({externalRef:t,hiddenUntilFound:v,id:x,keepMounted:y,mounted:u,onOpenChange:d,open:f,setMounted:p,setOpen:h,transitionStatus:_}),k={...g,transitionStatus:D},A=Di(s,k),j=Hi(`div`,{...e,style:void 0},{state:k,ref:w,props:[C,{style:{[$C]:S===void 0?`auto`:`${S}px`,[ew]:O===void 0?`auto`:`${O}px`}},c,A?{style:A}:void 0,T?{style:{animationName:`none`}}:void 0],stateAttributesMapping:YC});return E?j:null});function nw(e){let{multiple:t=!1,defaultValue:n,value:r,onValueChange:i,autoComplete:a,...o}=e;return(0,S.jsx)(tC,{...o,selectionMode:t?`multiple`:`single`,selectedValue:r,defaultSelectedValue:n,onSelectedValueChange:i,formAutoComplete:a})}var rw=v.memo(v.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a,selected:o,...s}=e,c=v.useRef(null),{transitionStatus:l,setMounted:u}=Na(o),d=Hi(`span`,e,{ref:[t,c],state:{selected:o,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},s],stateAttributesMapping:yt});return Ra({batch:!0,enabled:!o,open:o,ref:c,onComplete(){o||u(!1)}}),d})),iw=v.forwardRef(function(e,t){let{selected:n}=VC();return e.keepMounted||n?(0,S.jsx)(rw,{...e,selected:n,ref:t}):null}),aw=v.createContext(void 0);function ow(e=!0){let t=v.useContext(aw);if(t===void 0&&!e)throw Error(J(25));return t}var sw=v.createContext(void 0);function cw(e){let t=v.useContext(sw);if(t===void 0&&!e)throw Error(J(33));return t}var lw=v.createContext(void 0);function uw(e){let t=v.useContext(lw);if(t===void 0&&!e)throw Error(J(36));return t}var dw=v.createContext(null);function fw(e=`root`){let t=v.useContext(dw),n=v.useContext(lw);return t===null||n===void 0?null:(e===`submenu-trigger`?n.virtualFocus||n.parentVirtualFocus:n.virtualFocus)?t:null}var pw={visible:!0,ref:null};function mw(){return pw}function hw(e,t,n=`root`){let r=fw(n),i=((n===`submenu-trigger`?r?.useSubmenuTrigger:r?.useItem)??mw)({label:e.label,children:e.children,render:e.render}),a=En(t,i.ref);return{visible:i.visible,ref:a,props:i.props}}function gw(e){e.preventDefault()}function _w(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,l=uw(),u=ow(!0),d=c.type===`submenu-trigger`,f=d?l.parentVirtualFocus:l.virtualFocus,p=(d&&l.parent.type===`menu`?l.parent.store:l.store).useState(`webkitAriaSelected`,n),{events:m}=a.useState(`floatingTreeRoot`),h=a.useState(`open`),g=u!==void 0,_=!f&&h&&n?0:-1;return v.useMemo(()=>({id:r,role:`menuitem`,tabIndex:_,"aria-selected":p,onMouseDown:f?gw:void 0,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&m.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&m.emit(`close`,{domEvent:e.nativeEvent,reason:tn})},onMouseUp(e){if(u){let t=u.initialCursorPointRef.current;if(u.initialCursorPointRef.current=null,g&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||g&&!Se&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!g||e.button===2)&&c.type===`regular-item`&&ff(s.current,e,{detail:1,pointerType:`mouse`})}}),[t,_,r,m,i,a.context.allowMouseUpTriggerRef,o,s,u,g,c.type,p,f])}var vw={type:`regular-item`};function yw(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=v.useRef(null),{getButtonProps:d,buttonRef:f}=pf({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=_w({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=v.useCallback(e=>ki(p,{onMouseEnter(e){c.type===`submenu-trigger`&&c.setActive(e.nativeEvent)}},e,d),[p,d,c]),h=En(u,f);return v.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var bw=v.createContext(void 0);function xw(){let e=v.useContext(bw);if(e===void 0)throw Error(J(31));return e}var Sw=v.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=v.useState(void 0),c=Hi(`div`,e,{ref:t,props:{role:`group`,"aria-labelledby":o,...a}});return(0,S.jsx)(bw.Provider,{value:s,children:c})}),Cw=v.forwardRef(function(e,t){let n=fw()?.Group??Sw;return(0,S.jsx)(n,{...e,ref:t})}),ww=v.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=lc(a),c=xw();return q(()=>(c(s),()=>{c(e=>e===s?void 0:e)}),[c,s]),Hi(`div`,e,{ref:t,props:{id:s,"aria-hidden":!0,...o}})}),Tw=v.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,{store:d}=uw(),f=Kb({guess:!0,label:a}),p=lc(i),m=d.useState(`disabled`),h=d.useState(`isActive`,f.index),g=d.useState(`floatingNodeId`),_=d.useState(`itemProps`),v=s||m,{getItemProps:y,itemRef:b}=yw({closeOnClick:c,disabled:v,highlighted:h,id:p,store:d,nativeButton:o,nodeId:g,itemMetadata:vw});return Hi(`div`,e,{state:{disabled:v,highlighted:h},props:[_,u,y],ref:[b,t,f.ref]})}),Ew=v.forwardRef(function(e,t){let n=hw(e,t);return n.visible?(0,S.jsx)(Tw,{...e,ref:n.ref}):null}),Dw=v.createContext(void 0);function Ow(){return v.useContext(Dw)}function kw(e,t){let n=Ki(e.render);if(v.isValidElement(n)){let e=n.props;if(Object.hasOwn(e,`id`))return e.id??``}return e.id??t}function Aw(e,t,n){let r=kw(e,t),i=r===t?void 0:r;return[r,v.useCallback(e=>n?.(e?i:void 0),[i,n])]}function jw(e,t,n){let r=Ki(e.render),i=v.isValidElement(r)?r.props:void 0,a=e[`aria-label`]??i?.[`aria-label`],o=e[`aria-labelledby`]??i?.[`aria-labelledby`];return o==null&&!a&&(o=t?t.id||void 0:n||void 0),o}var Mw=v.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,id:o,initialFocus:s,...c}=e,{store:l,defaultFloatingId:u,setRenderedFloatingId:d,virtualFocus:f,orientation:p}=uw(),m=Ow(),{side:h,align:g}=cw(),_=lb(!0)!=null,y=l.useState(`open`),b=l.useState(`transitionStatus`),x=l.useState(`popupProps`),C=l.useState(`mounted`),w=l.useState(`instantType`),T=l.useState(`activeTriggerElement`),E=l.useState(`parent`),D=l.useState(`lastOpenChangeReason`),O=l.useState(`rootId`),k=l.useState(`floatingRootContext`),A=l.useState(`floatingTreeRoot`),j=l.useState(`closeDelay`),M=l.useState(`hoverEnabled`),N=l.useState(`disabled`),P=l.useState(`openMethod`),F=l.useState(`activeTriggerId`),I=l.useState(`listElement`),[L,R]=Aw(e,u,d),z=jw(e,T,F),B=E.type===`menu`?m:void 0,V=E.type===`context-menu`,H=s??E.type!==`menu`;s===void 0&&I&&E.type!==`menu`&&(H=()=>l.state.activeIndex===null&&I),Ra({open:y,ref:l.context.popupRef,onComplete(){y&&l.context.onOpenChangeComplete?.(!0)}}),v.useEffect(()=>{function e(e){l.setOpen(!1,Jt(e.reason,e.domEvent))}return A.events.on(`close`,e),()=>{A.events.off(`close`,e)}},[A.events,l]),No(k,{enabled:M&&!N&&!V&&E.type!==`menubar`,closeDelay:j});let U=l.useStateSetter(`popupElement`),{parentVirtualFocusRef:ee,handleFocus:te}=(v.useContext(dw)?.useParentHandoff??Pw)(l,E,y,f),ne=Hi(`div`,e,{state:{transitionStatus:b,side:h,align:g,open:y,nested:E.type===`menu`,instant:w},ref:[t,l.context.popupRef,U,R],stateAttributesMapping:Nt,props:[x,{id:L,...I?{role:`presentation`}:{role:`menu`,"aria-orientation":p===`horizontal`?`horizontal`:void 0,"aria-labelledby":z},onKeyDown(e){B?.onPopupKeyDown?.(e),_&&Yv.has(e.key)&&e.stopPropagation()},onFocus:te},Bc(b),c,{"data-rootownerid":O}]}),W=E.type===void 0||V;(T||E.type===`menubar`&&D!==`outside-press`)&&(W=!0);let re=B?.getReturnElement??ee;return(0,S.jsx)(Ca,{context:k,openInteractionType:P,modal:V,disabled:!C,returnFocus:a??re??W,explicitReturnFocus:a===void 0&&re?!1:void 0,initialFocus:H,restoreFocus:!0,getInsideElements:E.type===void 0?()=>[l.context.beforeTriggerFocusGuardRef.current]:void 0,externalTree:E.type===`menubar`?void 0:A,previousFocusableElement:T,nextFocusableElement:E.type===void 0?l.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:l.context.beforeContentFocusGuardRef,children:ne})}),Nw={parentVirtualFocusRef:void 0,handleFocus:void 0};function Pw(){return Nw}var Fw=v.forwardRef(function(e,t){let n=fw()?.Popup??Mw;return(0,S.jsx)(n,{...e,ref:t})}),Iw=v.createContext(void 0);function Lw(){let e=v.useContext(Iw);if(e===void 0)throw Error(J(32));return e}var Rw=v.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i,parent:a}=uw();if(!(i.useState(`mounted`)||n))return null;let o=a.type===`menu`||a.type===`menubar`?`group`:void 0;return(0,S.jsx)(Iw.Provider,{value:n,children:(0,S.jsx)(ia,{ref:t,...r,portalOwnerRole:o})})}),zw=v.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=Zi,style:g,..._}=e,{store:y,virtualFocus:b,syncHighlightedItem:x}=uw(),C=Lw(),w=ow(!0),T=y.useState(`parent`),E=y.useState(`floatingRootContext`),D=y.useState(`floatingTreeRoot`),O=y.useState(`mounted`),k=y.useState(`open`),A=y.useState(`modal`),j=y.useState(`openMethod`),M=y.useState(`activeTriggerElement`),N=y.useState(`transitionStatus`),P=y.useState(`positionerElement`),F=y.useState(`instantType`),I=y.useState(`adaptiveOrigin`),L=y.useState(`lastOpenChangeReason`),R=y.useState(`floatingNodeId`),z=y.useState(`floatingParentNodeId`),B=E.useState(`domReferenceElement`),V=n,H=c,U=l,ee=s,te=h;T.type===`context-menu`&&(V=n??T.context?.anchor,ee??=`start`,!o&&ee!==`center`&&(U=e.alignOffset??2,H=e.sideOffset??-5));let ne=o,W=ee;T.type===`menu`?(ne??=`inline-end`,W??=`start`,te=e.collisionAvoidance??Qi):T.type===`menubar`&&(ne??=T.context.orientation===`vertical`?`inline-end`:`bottom`,W??=`start`);let re=T.type===`context-menu`,ie=Lc({anchor:V,floatingRootContext:E,positionMethod:w?`fixed`:r,mounted:O,side:ne,sideOffset:H,align:W,alignOffset:U,arrowPadding:re?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:R,keepMounted:C,disableAnchorTracking:m,collisionAvoidance:te,shift:re?{crossAxis:!(`side`in te&&te.side===`flip`),rootBoundary:`layoutViewport`}:void 0,externalTree:D,adaptiveOrigin:I,lazyFlip:b?`placement`:!1});v.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===R&&y.set(`hoverEnabled`,!1),e.nodeId!==R&&e.parentNodeId===y.select(`floatingParentNodeId`)&&y.setOpen(!1,Jt(mn)))}return D.events.on(`menuopenchange`,e),()=>{D.events.off(`menuopenchange`,e)}},[y,D.events,R]),v.useEffect(()=>{if(y.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==y.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;y.setOpen(!1,Jt(t))}return D.events.on(`menuopenchange`,e),()=>{D.events.off(`menuopenchange`,e)}},[D.events,y]);let ae=fe();v.useEffect(()=>{k||ae.clear()},[k,ae]),v.useEffect(()=>{function e(e){if(k&&e.nodeId===y.select(`floatingParentNodeId`)){if(e.target&&M&&M!==e.target){let e=y.select(`closeDelay`);e>0?ae.isStarted()||ae.start(e,()=>{y.setOpen(!1,Jt(mn))}):y.setOpen(!1,Jt(mn))}else ae.clear()}}return D.events.on(`itemhover`,e),()=>{D.events.off(`itemhover`,e)}},[D.events,k,M,y,ae]),v.useEffect(()=>{let e={open:k,nodeId:R,parentNodeId:z,reason:y.select(`lastOpenChangeReason`)};D.events.emit(`menuopenchange`,e)},[D.events,k,y,R,z]),ib({store:y,domReference:B,positionerElement:P,open:k});let G={open:k,side:ie.side,align:ie.align,anchorHidden:ie.anchorHidden,nested:T.type===`menu`,instant:F},K=T.type===`menubar`&&T.context.modal;ob(k&&(K||A&&L!==`trigger-hover`),j===`touch`,P,M);let q=Vc(e,G,{styles:ie.positionerStyles,transitionStatus:N,props:_,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!O,inert:!k}),oe=O&&T.type!==`menu`&&(T.type!==`menubar`&&A&&L!==`trigger-hover`||T.type===`menubar`&&T.context.modal),J=null;return T.type===`menubar`?J=T.context.contentElement:T.type===void 0&&(J=M),(0,S.jsxs)(sw.Provider,{value:ie,children:[oe&&(0,S.jsx)(oy,{ref:T.type===`context-menu`||T.type===`nested-context-menu`?T.context.internalBackdropRef:null,inert:Kc(!k),cutout:J}),(0,S.jsx)(fa,{id:R,children:(0,S.jsx)(jb,{elementsRef:y.context.itemDomElements,labelsRef:y.context.itemLabels,onMapChange:x,children:q})})]})}),Bw=v.createContext(null);function Vw(e){let t=v.useContext(Bw);if(t===null&&!e)throw Error(J(5));return t}var Hw={...Co,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,keyboardOpen:e=>e.keyboardOpen,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,listElement:e=>e.listElement,triggerControlsId:(e,t)=>{let n=Co.triggerPopupId(e,t);return n?e.listElement?.id||n:void 0},filterTriggerProps:e=>e.filterTriggerProps,inputProps:e=>e.inputProps,webkitAriaSelected:(e,t)=>we&&e.inputFocused&&t?!0:void 0,highlightedItemId:e=>e.highlightedItem?.id||void 0,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType===`trigger-change`&&!Co.open(e)?void 0: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`)}},Uw=class extends mo{constructor(e,t,n=!1){let r=new eo,i=Gw(r,t,n,e);super(i,Ww(r),Hw),this.observe(`parent`,e=>{e.type===`menu`?this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef:e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef)})}subscribeToParentMenu(){let e=this.state.parent;if(e.type!==`menu`)return;let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);return 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())})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}setActiveIndex(e,t,n){if(this.state.activeIndex!==e){let r=(e===null?void 0:this.context.itemDomElements.current[e])===this.context.reportedItem;this.context.highlightReason=r?`none`:t,this.context.highlightEvent=r?void 0:n}this.set(`activeIndex`,e)}highlightItem(e,t,n){let r=this.context.itemDomElements.current.indexOf(e);r>-1&&this.setActiveIndex(r,t,n)}};function Ww(e){return{positionerRef:v.createRef(),popupRef:v.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},highlightReason:`none`,highlightEvent:void 0,reportedItem:void 0,allowMouseUpTriggerRef:{current:!1},virtualFocusRef:void 0,triggerFocusTargetRef:v.createRef(),beforeTriggerFocusGuardRef:v.createRef(),beforeContentFocusGuardRef:v.createRef(),onOpenChangeComplete:void 0,triggerElements:e}}function Gw(e,t,n=!1,r){return{..._o(e,t,n),disabled:!1,modal:!0,openMethod:null,keyboardOpen:!1,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,listElement:null,filterTriggerProps:K,inputProps:K,inputFocused:!1,highlightedItem:void 0,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new oa,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:K,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...r}}var Kw=v.createContext(null);function qw(e,t){return(e===`trigger-press`||e===`item-press`)&&t?.detail===0}function Jw(e,t){return e===`list-navigation`||qw(e,t)}var Yw=W(function(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,onItemHighlighted:a,defaultOpen:o=!1,disabled:s=!1,modal:c,loopFocus:l=!0,orientation:u=`vertical`,actionsRef:d,closeParentOnEsc:f=!1,handle:p,triggerId:m,defaultTriggerId:h=null,highlightItemOnHover:g=!0,isSubmenu:_=!1,virtualFocus:y=!1,virtualFocusRef:b,allowEscape:x=!0,resetOnPointerLeave:C=!0}=e,w=ow(!0),T=uw(!0),E=Vw(!0),D=T?.store,O=T?.virtualFocus??!1,k=v.useMemo(()=>_&&D?{type:`menu`,store:D}:E?{type:`menubar`,context:E}:w&&!D?{type:`context-menu`,context:w}:{type:void 0},[w,D,E,_]),A=lc(),j=lc(),[M,N]=v.useState(void 0),P=(M??j)||void 0,F=la(),I=k.type===`menu`?k.store:void 0,L=(n??o)&&I?.state.transitionStatus===`starting`,R=H(()=>L?I?.state.instantType:void 0).current,z=H(()=>{let e=new Uw({open:o,openProp:n,activeTriggerId:h,triggerIdProp:m,parent:k,disabled:s,highlightItemOnHover:g,modal:k.type===void 0?c:void 0,rootId:A,instantType:R},P,F!=null);return e.context.virtualFocusRef=b,e}).current;z.useControlledProp(`openProp`,n),z.useControlledProp(`triggerIdProp`,m),z.useContextCallback(`onOpenChangeComplete`,i);let B=z.useState(`floatingTreeRoot`),V=da(B),U=z.useState(`open`),ee=z.useState(`activeTriggerElement`),te=z.useState(`positionerElement`),ne=z.useState(`hoverEnabled`),W=z.useState(`disabled`),re=z.useState(`lastOpenChangeReason`),ie=z.useState(`parent`),ae=z.useState(`activeIndex`),oe=z.useState(`keyboardOpen`),J=z.useState(`payload`),se=z.useState(`floatingParentNodeId`),ce=v.useRef(null),le=v.useRef(ie.type!==`context-menu`),ue=fe(),de=v.useRef(!0),pe=fe(),me=se!=null,{openMethod:he,triggerProps:ge}=ky(U);z.useSyncedValues({disabled:s,highlightItemOnHover:g,modal:ie.type===void 0?c:void 0,openMethod:he,rootId:A}),Xa(z);let{forceUnmount:_e,transitionStatus:ve}=Za(U,z,()=>{z.set(`allowMouseEnter`,!1)},L),ye=La(z.context.popupRef);v.useEffect(()=>{if(R===void 0)return;let e=()=>{z.state.instantType===R&&z.set(`instantType`,void 0)};if(!U){e();return}if(ve!==void 0)return;if(z.context.popupRef.current==null){e();return}let t=new AbortController;return ye(e,t.signal),()=>{t.abort()}},[R,U,ve,ye,z]),q(()=>{w&&!T?z.update({parent:{type:`context-menu`,context:w},floatingNodeId:V,floatingParentNodeId:F}):(T||!z.select(`activeTriggerElement`))&&z.update({floatingNodeId:V,floatingParentNodeId:F})},[w,T,V,F,ee,z]),v.useEffect(()=>{U||(ce.current=null),ie.type===`context-menu`&&(U?ue.start(500,()=>{le.current=!0}):(ue.clear(),le.current=!1))},[ue,U,ie.type]),q(()=>{!U&&!ne&&z.set(`hoverEnabled`,!0)},[U,ne,z]);let be=Y((e,t)=>{let n=t.reason;if(!e&&!z.select(`open`)||U===e&&t.trigger===ee&&re===n)return;let i=qa(t);if(!e&&t.trigger==null&&(t.trigger=ee??void 0),r?.(e,t),t.isCanceled)return;z.state.floatingRootContext.dispatchOpenChange(e,t);let a=t.event;if(e===!1&&n!==`item-press`&&a?.type===`click`&&a.pointerType===`touch`&&!de.current)return;e&&n===`trigger-focus`?(de.current=!1,pe.start(300,()=>{de.current=!0})):(de.current=!0,pe.clear());let o=!e&&(n===`escape-key`||n==null);ce.current=t.event;let s=Ka(z.state,e,t.trigger,i());s.openChangeReason=n,s.keyboardOpen=e&&Jw(n,a),s.instantType=ie.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?`group`:qw(n,a)?`click`:o?`dismiss`:void 0,z.update(s)}),xe=Ma({popupStore:z,floatingRootContext:z.state.floatingRootContext,floatingId:P,nested:F!=null,onOpenChange:be}),Se=xe.context.events;q(()=>{let e=({open:e,eventDetails:t})=>be(e,t);return Se.on(`setOpen`,e),()=>{Se?.off(`setOpen`,e)}},[Se,be]),q(()=>z.subscribeToParentMenu(),[z]);let Ce=v.useCallback(()=>{z.setOpen(!1,Jt(vn))},[z]);v.useImperativeHandle(d,()=>({unmount:_e,close:Ce}),[_e,Ce]);let we;ie.type===`context-menu`&&(we=ie.context),v.useImperativeHandle(we?.positionerRef,()=>te,[te]),v.useImperativeHandle(we?.actionsRef,()=>({setOpen:be}),[be]);let Te=Aa(xe,{enabled:!W,bubbles:{escapeKey:f&&ie.type===`menu`},outsidePress(){return ie.type!==`context-menu`||ce.current?.type===`contextmenu`||le.current},externalTree:me?B:void 0}),Ee=Cc(),De=Ho(xe,{enabled:!W,listRef:z.context.itemDomElements,activeIndex:ae,virtual:y,nested:ie.type===`menubar`||!y&&ie.type!==void 0,parentOrientation:ie.type===`menubar`?ie.context.orientation:void 0,loopFocus:l,focusItemOnOpen:y?oe:void 0,allowEscape:y&&l&&x,orientation:u,triggerOrientation:y?`vertical`:u,rtl:Ee===`rtl`,disabledIndices:G,onNavigate(e,t){z.setActiveIndex(e,mS(t),t?.nativeEvent)},openOnArrowKeyDown:ie.type!==`context-menu`&&!(y&&_),externalTree:!y&&me?B:void 0,nestedReturnFocusRef:I?.context.virtualFocusRef,focusItemOnHover:g,resetOnPointerLeave:C}),Oe=v.useCallback(e=>{z.context.typingRef.current=e},[z]),ke=Uo(xe,{enabled:!W&&!y,listRef:z.context.itemLabels,elementsRef:z.context.itemDomElements,activeIndex:ae,resetMs:500,onMatch:(e,t)=>{U&&e!==ae&&z.setActiveIndex(e,dn,t.nativeEvent)},onTyping:Oe}),Ae=Y(a),je=v.useRef(-1),Me=Y(()=>{let e=z.state.activeIndex,t=e===null?void 0:z.context.itemDomElements.current[e]??void 0;if(t?.isConnected===!1)return;let n=t===void 0?-1:e;if(je.current===n&&z.context.reportedItem===t)return;je.current=n,z.context.reportedItem=t,y&&z.set(`highlightedItem`,t);let{highlightReason:r,highlightEvent:i}=z.context;z.context.highlightReason=Xt,z.context.highlightEvent=void 0,a&&Ae(t,Yt(r,i,{label:t===void 0?void 0:z.context.itemLabels.current[n]??void 0}))});q(()=>{Me()},[ae,Me]);let Ne=v.useMemo(()=>{if(!y)return De.reference;if(!De.trigger)return K;let{onFocus:e,...t}=De.trigger;return t},[y,De.reference,De.trigger]);z.useSyncedValue(`inputProps`,y?De.reference??K:K);let Pe=v.useMemo(()=>{let e=ki(ke.reference,Ne,Te.reference,{onMouseMove(){z.set(`allowMouseEnter`,!0)}},ge);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=U,e},[z,ke.reference,Ne,Te.reference,ge,U]),Fe=v.useMemo(()=>{let e=ki(De.trigger,Te.trigger,ge);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[De.trigger,Te.trigger,ge]);H(()=>(z.update({inactiveTriggerProps:Fe}),null)),Qa(z,{floatingRootContext:xe,activeTriggerProps:Pe,inactiveTriggerProps:Fe,popupProps:v.useMemo(()=>ki(Ba,{onMouseMove(){z.set(`allowMouseEnter`,!0),ie.type===`menu`&&z.set(`hoverEnabled`,!1)},onClick(){z.select(`hoverEnabled`)&&z.set(`hoverEnabled`,!1)},onKeyDown(e){let t=z.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},ke.floating,De.floating,Te.floating),[ie.type,z,ke.floating,De.floating,Te.floating]),itemProps:De.item??K});let Ie=v.useMemo(()=>({store:z,parent:k,orientation:u,loopFocus:l,allowEscape:x,defaultFloatingId:j,setRenderedFloatingId:N,virtualFocus:y,parentVirtualFocus:O,syncHighlightedItem:Me}),[z,k,u,l,x,j,y,O,Me]),Le=typeof t==`function`?t({payload:J}):t,Re=(0,S.jsxs)(lw.Provider,{value:Ie,children:[p&&(0,S.jsx)(Ua,{handle:p,store:z}),Le]});return(ie.type===void 0||ie.type===`context-menu`)&&(Re=(0,S.jsx)(pa,{externalTree:B,children:Re})),Re});function Xw(e){let t=v.useContext(Kw);if(t===null)return(0,S.jsx)(Yw,{...e});let n=t.Root;return(0,S.jsx)(Kw.Provider,{value:null,children:(0,S.jsx)(n,{...t.options,...e})})}function Zw(e){let{render:t,className:n,style:r,state:i=K,props:a=G,refs:o=G,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=qb({metadata:s});return Hi(l,e,{state:i,ref:[f,...o],props:[d,...a,u],stateAttributesMapping:c})}function Qw(e){if(Be(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`);if(!Qe(e))return Qw(tt(e))}function $w(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=v.useRef(!1);return v.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,Un(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:K,[t,n,r])}var eT=re(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=uw(!0),h=wo(d)??m?.store;if(!h)throw Error(J(85));let g=lc(s),_=h.useState(`isTriggerActive`,g),y=h.useState(`floatingRootContext`),b=h.useState(`isOpenedByTrigger`,g),x=h.useState(`triggerControlsId`,g),C=v.useRef(null),w=nT(),T=uf(!0),E=ua(),D=v.useMemo(()=>E??new oa,[E]),{registerTrigger:O,isMountedByThisTrigger:k}=Ya(g,C,h,{payload:f,closeDelay:u,parent:w,floatingTreeRoot:D,floatingNodeId:da(D),floatingParentNodeId:la(),keyboardEventRelay:T?.relayKeyboardEvent}),A=w.type===`menubar`,j=h.useState(`disabled`),M=a||j||A&&w.context.disabled,{getButtonProps:N,buttonRef:P}=pf({disabled:M,native:o});v.useEffect(()=>{!b&&w.type===void 0&&(h.context.allowMouseUpTriggerRef.current=!1)},[h,b,w.type]);let F=v.useRef(null),I=fe(),L=Y(e=>{if(!F.current)return;I.clear(),h.context.allowMouseUpTriggerRef.current=!1;let t=e.target;ot(F.current,t)||ot(h.select(`positionerElement`),t)||t===F.current||(t==null||Qw(t)!==h.select(`rootId`))&&(oC(e,F.current)||D.events.emit(`close`,{domEvent:e,reason:pn}))});v.useEffect(()=>{let e=Un(F.current);if(b&&h.select(`lastOpenChangeReason`)===`trigger-hover`)return e.addEventListener(`mouseup`,L,{once:!0}),()=>{e.removeEventListener(`mouseup`,L)}},[b,L,h]);let R=A&&w.context.hasSubmenuOpen,z=Fo(y,{enabled:(c??R)&&!M&&(!A||R&&!k),handleClose:Zo({blockPointerEvents:!A}),mouseOnly:!0,move:!1,restMs:w.type===void 0?l:void 0,delay:{close:u},triggerElementRef:C,externalTree:D,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),B=tT(b,h.select(`lastOpenChangeReason`)),V=wa(y,{enabled:!M,event:b&&A?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:w.type===void 0&&B}),H=Do(y,{enabled:!M&&R}),U=$w({open:b,enabled:A,mouseDownAction:`open`}),ee=v.useMemo(()=>ki(H.reference,V.reference),[H.reference,V.reference]),te=h.useState(`triggerProps`,k),ne=h.useState(`filterTriggerProps`),{handlePreFocusGuardFocus:W,handleFocusTargetFocus:re}=Zy(h,C),ie={disabled:M,open:b},ae=[F,t,P,O,C],G=[ee,z??K,te,{"aria-haspopup":`menu`,"aria-controls":x,id:g,onMouseDown:e=>{h.select(`open`)||(I.start(200,()=>{h.context.allowMouseUpTriggerRef.current=!0}),Un(e.currentTarget).addEventListener(`mouseup`,L,{once:!0}))}},ne,A?{role:`menuitem`}:{},U,p,N],q=Hi(`button`,e,{enabled:!A,stateAttributesMapping:jt,state:ie,ref:ae,props:G});return A?(0,S.jsx)(Zw,{tag:`button`,render:n,className:r,style:i,state:ie,refs:ae,props:G,stateAttributesMapping:jt}):b?(0,S.jsxs)(v.Fragment,{children:[(0,S.jsx)(qn,{ref:h.context.beforeTriggerFocusGuardRef,onFocus:W},`${g}-pre-focus-guard`),(0,S.jsx)(v.Fragment,{children:q},g),(0,S.jsx)(qn,{ref:h.context.triggerFocusTargetRef,onFocus:re},`${g}-post-focus-guard`)]}):(0,S.jsx)(v.Fragment,{children:q},g)});function tT(e,t){let n=fe(),[r,i]=v.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 nT(){let e=Vw(!0);return v.useMemo(()=>e?{type:`menubar`,context:e}:{type:void 0},[e])}function rT(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}var iT=`base-ui-disable-scrollbar`,aT={className:iT,getElement(e){return(0,S.jsx)(`style`,{nonce:e,href:iT,precedence:`base-ui:low`,children:`.${iT}{scrollbar-width:none}.${iT}::-webkit-scrollbar{display:none}`})}};function oT(e,t){return Math.max(0,e-t)}function sT(e,t){if(t<=0)return 0;let n=rT(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 cT=v.createContext(void 0),lT=v.createContext(void 0);function uT(){let e=v.useContext(cT);if(e===void 0)throw Error(J(60));return e}function dT(){let e=v.useContext(lT);if(e===void 0)throw Error(J(61));return e}var fT={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,multiple:e=>e.multiple,disabled:e=>e.disabled,readOnly:e=>e.readOnly,required:e=>e.required,highlightItemOnHover:e=>e.highlightItemOnHover,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:VS(t,r)!==``},hasNullItemLabel:(e,t)=>t?zS(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=>DS(t,e,n)):DS(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,itemRoot:e=>e.itemRoot,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 pT(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:y,multiple:b=!1,itemToStringLabel:x,itemToStringValue:C,isItemEqualToValue:w=ES,highlightItemOnHover:T=!0,children:E}=e,{clearErrors:D}=kf(),{setDirty:O,setTouched:k,setFocused:A,validityData:j,setFilled:M,name:N,disabled:P,validation:F,validationMode:I}=Df(),L=Ff({id:t}),R=P||d,z=N??c,[B,V]=Ob({controlled:n,default:b?r??G:r,name:`Select`,state:`value`}),[U,ee]=Ob({controlled:a,default:o,name:`Select`,state:`open`}),te=v.useRef([]),ne=v.useRef([]),W=v.useRef(null),re=v.useRef(null),ie=v.useRef(0),oe=v.useRef(null),J=v.useRef([]),se=v.useRef(!1),ce=v.useRef(null),le=v.useRef(null),ue=v.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),de=v.useRef(!1),fe=v.useRef(B),{openMethod:pe,triggerProps:me}=ky(U),he=H(()=>new mo({id:L,labelId:void 0,modal:m,multiple:b,disabled:R,readOnly:f,required:p,highlightItemOnHover:T,itemToStringLabel:x,itemToStringValue:C,isItemEqualToValue:w,value:B,open:U,mounted:U,transitionStatus:void 0,items:y,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:K,triggerProps:K,itemRoot:{props:K,multiple:b,disabled:R,readOnly:f,isItemEqualToValue:w},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:ae,setOpen:ae,handleScrollArrowVisibility:ae,onOpenChangeComplete:ae,listRef:te,popupRef:W,scrollHandlerRef:re,scrollArrowsMountedCountRef:ie,valueRef:oe,valuesRef:J,labelsRef:ne,typingRef:se,selectionRef:ue,firstItemTextRef:ce,selectedItemTextRef:le,alignItemWithTriggerActiveRef:de,initialValueRef:fe},fT)).current,[ge,_e]=v.useState(!1),{mounted:ve,transitionStatus:ye,forceUnmount:be}=za({open:U,ref:W,preventUnmountOnClose:ge,setPreventUnmountOnClose:_e,onUnmount(){he.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),_?.(!1)}}),xe=he.useState(`activeIndex`),Se=he.useState(`selectedIndex`),Ce=he.useState(`triggerElement`),we=he.useState(`positionerElement`),Te=qc(pe),Ee=pe??Te,De=v.useMemo(()=>b?``:VS(B,C),[b,B,C]),Oe=v.useMemo(()=>b&&Array.isArray(B)?B.map(e=>VS(e,C)):VS(B,C),[b,B,C]);zf(Mn(Ce),L,B,Y(()=>Oe),!R,c);let ke=b?Array.isArray(B)&&B.length>0:B!=null&&De!==``;q(()=>{M(ke)},[ke,M]),q(function(){let e=MS(J.current,B,w,b);e===null&&(le.current=null),!U&&he.set(`selectedIndex`,e)},[b,U,B,w,he]),Bf(B,()=>{D(z),O(OS(B,j.initialValue,w)),F.change(B)});let Ae=Y((e,t)=>{let n=t,r=qa(n);s?.(e,n),!t.isCanceled&&(e||_e(r()),ee(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(k(!0),A(!1),I===`onBlur`&&F.commit(B)))});v.useImperativeHandle(h,()=>({unmount:be,close:()=>{he.state.open&&Ae(!1,Jt(vn))}}),[be,Ae,he]);let je=Y((e,t)=>{i?.(e,t),!t.isCanceled&&V(e)}),Me=Y(e=>{let t=oT(e.scrollHeight,e.clientHeight),n=sT(e.scrollTop,t),r=n>0,i=n<t;he.set(`scrollUpArrowVisible`,r),he.set(`scrollDownArrowVisible`,i)}),Ne=To({open:U,onOpenChange:Ae,elements:{reference:Ce,floating:we}}),Pe=wa(Ne,{enabled:!R,event:`mousedown`}),Fe=Aa(Ne),Ie=Ho(Ne,{enabled:!R,listRef:te,activeIndex:xe,selectedIndex:Se,disabledIndices:G,onNavigate(e){(e!==null||U)&&he.set(`activeIndex`,e)},focusItemOnHover:T}),Le=Uo(Ne,{enabled:!R&&(U||!f&&!b),listRef:ne,activeIndex:xe,selectedIndex:Se,disabledIndices:e=>rx(te.current[e]),onMatch(e){U?he.set(`activeIndex`,e):je(J.current[e],Jt(Xt))},onTyping(e){se.current=e}}),Re=v.useMemo(()=>ki(Le.reference,Ie.reference,Fe.reference,Pe.reference,me),[Pe.reference,Le.reference,Ie.reference,Fe.reference,me]),ze=v.useMemo(()=>ki(Ba,Le.floating,Ie.floating,Fe.floating),[Le.floating,Ie.floating,Fe.floating]),Be=Ie.item??K,Ve=v.useMemo(()=>({props:Be,multiple:b,disabled:R,readOnly:f,isItemEqualToValue:w}),[Be,b,R,f,w]);he.useContextCallback(`setValue`,je),he.useContextCallback(`setOpen`,Ae),he.useContextCallback(`handleScrollArrowVisibility`,Me),he.useContextCallback(`onOpenChangeComplete`,_),fS(()=>{he.update({popupProps:ze,triggerProps:Re,itemRoot:Ve})}),he.useSyncedValues({id:L,modal:m,multiple:b,disabled:R,readOnly:f,required:p,highlightItemOnHover:T,value:B,open:U,mounted:ve,transitionStatus:ye,popupProps:ze,triggerProps:Re,itemRoot:Ve,items:y,itemToStringLabel:x,itemToStringValue:C,isItemEqualToValue:w,openMethod:Ee});let He=En(g,F.inputRef),Ue=b?void 0:z,We=v.useMemo(()=>!b||!Array.isArray(B)||!z?null:B.map(e=>{let t=VS(e,C);return(0,S.jsx)(`input`,{type:`hidden`,form:l,name:z,value:t,disabled:R},t)}),[b,B,l,z,C,R]);return(0,S.jsxs)(cT.Provider,{value:he,children:[(0,S.jsx)(lT.Provider,{value:Ne,children:E}),(0,S.jsx)(`input`,{...F.getValidationProps(R,{onFocus(){he.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented||R||f)return;let t=e.currentTarget.value,n=Jt(Xt,e.nativeEvent);function r(){if(b)return;let e=t.toLowerCase(),r=J.current.findIndex(t=>VS(t,C).toLowerCase()===e||BS(t,x).toLowerCase()===e);r===-1&&(r=J.current.findIndex((t,n)=>{let r=ne.current[n];return r!=null&&r.toLowerCase()===e}));let i=J.current[r];i!=null&&je(i,n)}he.set(`forceMount`,!0),queueMicrotask(r)}}),id:L&&Ue==null?`${L}-hidden-input`:void 0,form:l,name:Ue,autoComplete:u,value:De,disabled:R,required:p&&!(b&&ke),readOnly:f,ref:He,style:z?Kn:Gn,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),We]})}var mT=`data-popup-side`,hT=400,gT={...jt,...wf,popupSide:e=>e?{[mT]:e}:null,value:()=>null},_T=v.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{setTouched:l,validationMode:u,validation:d,state:f,disabled:p}=Df(),{labelId:m}=jf(),h=uT(),g=h.useState(`readOnly`),_=h.useState(`required`),y=h.useState(`disabled`),b=p||y||a,x=h.useState(`open`),S=h.useState(`mounted`),C=h.useState(`value`),w=h.useState(`triggerProps`),T=h.useState(`positionerElement`),E=h.useState(`listElement`),D=h.useState(`popupSide`),O=h.useState(`id`),k=h.useState(`labelId`),A=h.useState(`hasSelectedValue`),j=S&&T?D:null,M=i??O,N=cC(m,k);Ff({id:i});let P=Mn(T),F=v.useRef(null),I=Rf(b,F),{getButtonProps:L,buttonRef:R}=pf({disabled:b,native:o}),z=h.useStateSetter(`triggerElement`),B=fe(),V=fe(),H=fe();v.useEffect(()=>{if(x)return H.start(hT,()=>{h.context.selectionRef.current.allowUnselectedMouseUp=!0,h.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{H.clear()};h.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},V.clear()},[x,h,V,H]);let U=ki(w,{id:M,role:`combobox`,"aria-expanded":x,"aria-haspopup":`listbox`,"aria-controls":x?E?.id??Ht(T)?.id:void 0,"aria-labelledby":N,"aria-readonly":g||void 0,"aria-required":_||void 0,tabIndex:b?-1:0,onFocus(e){I(!0),x&&h.context.alignItemWithTriggerActiveRef.current&&h.context.setOpen(!1,Jt(Xt,e.nativeEvent)),B.start(0,()=>{h.set(`forceMount`,!0)})},onBlur(e){ot(T,e.relatedTarget)||(l(!0),I(!1),u===`onBlur`&&d.commit(C))},onMouseDown(e){if(x)return;let t=Un(e.currentTarget);function n(e){if(!F.current)return;let t=e.target;ot(F.current,t)||ot(P.current,t)||oC(e,F.current)||h.context.setOpen(!1,Jt(pn,e))}V.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},c,L),ee=d.getValidationProps(b,U);ee.role=`combobox`;let te={...f,open:x,disabled:b,value:C,readOnly:g,popupSide:j,placeholder:!A};return Hi(`button`,e,{ref:[t,F,R,z],state:te,stateAttributesMapping:gT,props:ee})}),vT={value:()=>null},yT=v.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,c=uT(),l=c.useState(`value`),u=c.useState(`items`),d=c.useState(`itemToStringLabel`),f=c.useState(`hasSelectedValue`),p=!f&&a!=null&&i==null,m=c.useState(`hasNullItemLabel`,p),h={value:l,placeholder:!f},g=null;return g=typeof i==`function`?i(l):i??(p&&!m?a:Array.isArray(l)?US(l,u,d):HS(l,u,d)),Hi(`span`,e,{state:h,ref:[t,c.context.valueRef],props:[{children:g},s],stateAttributesMapping:vT})}),bT=v.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e;return Hi(`span`,e,{state:{open:uT().useState(`open`)},ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:At})}),xT=v.forwardRef(function(e,t){let n=uT(),r=n.useState(`mounted`),i=n.useState(`forceMount`);return r||i?(0,S.jsx)(ia,{ref:t,...e}):null}),ST=v.createContext(void 0);function CT(){let e=v.useContext(ST);if(!e)throw Error(J(59));return e}function wT(e,t){e&&Object.assign(e.style,t)}var TT={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},ET={position:`fixed`},DT=v.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=Zi,style:_,...y}=e,b=uT(),x=dT(),C=b.useState(`open`),w=b.useState(`mounted`),T=b.useState(`modal`),E=b.useState(`value`),D=b.useState(`openMethod`),O=b.useState(`positionerElement`),k=b.useState(`triggerElement`),A=b.useState(`isItemEqualToValue`),j=b.useState(`transitionStatus`),M=v.useRef(null),N=v.useRef(null),[P,F]=v.useState(h),I=w&&P&&D!==`touch`;!w&&P!==h&&F(h),v.useImperativeHandle(b.context.alignItemWithTriggerActiveRef,()=>I),ob((I||T)&&C,D===`touch`,O,k);let L=Lc({anchor:n,floatingRootContext:x,positionMethod:a,mounted:w,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??I,collisionAvoidance:g,keepMounted:!0}),R=I?`none`:L.side,z=I?ET:L.positionerStyles,B={open:C,side:R,align:L.align,anchorHidden:L.anchorHidden};q(()=>{b.set(`popupSide`,L.side)},[b,L.side]);let V=Vc(e,B,{styles:z,transitionStatus:j,props:y,refs:[t,b.useStateSetter(`positionerElement`)],hidden:!w,inert:!C}),H=v.useRef(0),U=Y(e=>{if(b.context.valuesRef.current.length===0)return;let t=H.current;H.current=e.size;let n=Jt(Xt);if(t!==0&&!b.state.multiple&&E!==null&&AS(b.context.valuesRef.current,E,A)===-1){let e=b.context.initialValueRef.current,t=e!=null&&AS(b.context.valuesRef.current,e,A)!==-1?e:null;b.context.setValue(t,n),t===null&&(b.set(`selectedIndex`,null),b.context.selectedItemTextRef.current=null)}if(t!==0&&b.state.multiple&&Array.isArray(E)){let e=E.filter(e=>AS(b.context.valuesRef.current,e,A)!==-1);e.length!==E.length&&(b.context.setValue(e,n),e.length===0&&(b.set(`selectedIndex`,null),b.context.selectedItemTextRef.current=null))}if(C&&I){b.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};wT(O,e),wT(b.context.popupRef.current,e)}}),ee=v.useMemo(()=>({...L,side:R,alignItemWithTriggerActive:I,setControlledAlignItemWithTrigger:F,scrollUpArrowRef:M,scrollDownArrowRef:N}),[L,R,I,F]);return(0,S.jsx)(jb,{elementsRef:b.context.listRef,labelsRef:b.context.labelsRef,onMapChange:U,children:(0,S.jsxs)(ST.Provider,{value:ee,children:[w&&T&&(0,S.jsx)(oy,{inert:Kc(!C),cutout:k}),V]})})}),OT=`--transform-origin`,kT={...Mt,...yt},AT=v.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,s=uT(),c=s.useState(`multiple`),l=s.useState(`readOnly`),u=s.useState(`highlightItemOnHover`),d=dT(),{side:f,align:p,alignItemWithTriggerActive:m,isPositioned:h,setControlledAlignItemWithTrigger:g}=CT(),_=lb(!0)!=null,y=Cc(),{nonce:b,disableStyleElements:x}=$b(),C=s.useState(`id`),w=s.useState(`open`),T=s.useState(`openMethod`),E=s.useState(`mounted`),D=s.useState(`popupProps`),O=s.useState(`transitionStatus`),k=s.useState(`triggerElement`),A=s.useState(`positionerElement`),j=s.useState(`listElement`),M=v.useRef(!1),N=v.useRef(!1),P=v.useRef({}),F=Hn(),I=Y(e=>{if(!A||!s.context.popupRef.current||!N.current)return;let t=A.style.top===`0px`,n=A.style.bottom===`0px`;if(M.current||!m||!t&&!n){s.context.handleScrollArrowVisibility(e);return}let r=NT(A),i=PT(A.getBoundingClientRect().height,`y`,r),a=Un(A),o=Ie(A),c=o.getComputedStyle(A),l=parseFloat(c.marginTop),u=parseFloat(c.marginBottom),d=jT(o.getComputedStyle(s.context.popupRef.current)),f=Math.min(a.documentElement.clientHeight-l-u,d),p=e.scrollTop,h=MT(e),g=null,_=e=>{A.style.height=`${e}px`},v=t?h-p:p,y=Math.min(i+v,f);if(v<=1){let n=rT(v,0,f-i);n>0&&_(i+n),e.scrollTop=t?h:0,f-(i+n)<=1&&(M.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=rT(g,0,MT(e));Math.abs(e.scrollTop-t)>1&&(e.scrollTop=t)}b>=f-1&&(M.current=!0),s.context.handleScrollArrowVisibility(e)});v.useImperativeHandle(s.context.scrollHandlerRef,()=>I,[I]),Ra({open:w,ref:s.context.popupRef,onComplete(){w&&s.context.onOpenChangeComplete(!0)}});let L={open:w,transitionStatus:O,side:f,align:p};q(()=>{A&&s.context.popupRef.current&&!Object.keys(P.current).length&&(P.current={top:A.style.top||`0`,left:A.style.left||`0`,right:A.style.right,height:A.style.height,bottom:A.style.bottom,minHeight:A.style.minHeight,maxHeight:A.style.maxHeight,marginTop:A.style.marginTop,marginBottom:A.style.marginBottom})},[s,A]),q(()=>{w||m||(N.current=!1,M.current=!1,wT(A,P.current))},[w,m,A]),q(()=>{let e=s.context.popupRef.current;if(!w||!k||!A||!e||m&&!h||s.state.transitionStatus===`ending`)return;if(N.current=!0,e.style.removeProperty(OT),!m){F.request(()=>s.context.handleScrollArrowVisibility(j||e));return}let t=LT(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=Ie(A),i=r.getComputedStyle(A),a=r.getComputedStyle(e),o=Un(k),c=NT(k),l=FT(k.getBoundingClientRect(),c),d=FT(A.getBoundingClientRect(),c),f=l.height,p=j||e,m=p.scrollHeight,h=parseFloat(a.borderBottomWidth),_=parseFloat(i.marginTop)||10,v=parseFloat(i.marginBottom)||10,b=parseFloat(i.minHeight)||100,x=jT(a),S=o.documentElement.clientHeight-_-v,C=o.documentElement.clientWidth,w=S-l.bottom+f,T,E=y===`rtl`?l.right-d.width:l.left,D=0;if(t&&n){let e=FT(n.getBoundingClientRect(),c);T=FT(t.getBoundingClientRect(),c),E=d.left+(y===`rtl`?e.right-T.right:e.left-T.left);let r=e.top-l.top+e.height/2;D=T.top-d.top+T.height/2-r}let O=w+D+v+h,N=Math.min(S,O),F=S-_-v,I=O-N,L=C-5;A.style.left=`${rT(E,5,L-d.width)}px`,A.style.height=`${N}px`,A.style.maxHeight=`none`,A.style.marginTop=`${_}px`,A.style.marginBottom=`${v}px`,e.style.height=`100%`;let R=MT(p),z=I>=R-1;z&&(N=Math.min(S,d.height)-(I-R));let B=l.top<20||l.bottom>S-20||Math.ceil(N)+1<Math.min(m,b),V=(r.visualViewport?.scale??1)!==1&&we;if(B||V){wT(A,P.current),g(!1);return}let H=Math.max(b,N);if(z){let e=Math.max(0,S-O);A.style.top=d.height>=F?`0`:`${e}px`,A.style.height=`${N}px`,p.scrollTop=MT(p)}else A.style.bottom=`0`,p.scrollTop=I;if(T){let t=d.top,n=d.height,r=T.top+T.height/2,i=rT(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(OT,`50% ${i}%`)}(H===S||N>=x)&&(M.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,w,A,k,m,g,F,j,u,y,h]),v.useEffect(()=>{if(!m||!A||!w)return;let e=Ie(A);function t(e){s.context.setOpen(!1,Jt(yn,e))}return wn(e,`resize`,t)},[s,m,A,w]);let R={...j?{role:`presentation`}:{role:`listbox`,"aria-multiselectable":c||void 0,"aria-readonly":l||void 0,id:`${C}-list`},onKeyDown(e){_&&Yv.has(e.key)&&e.stopPropagation()},onScroll(e){j||I(e.currentTarget)},...m&&{style:j?{height:`100%`}:TT},className:!j&&m?aT.className:void 0},z=Hi(`div`,e,{ref:[t,s.context.popupRef],state:L,stateAttributesMapping:kT,props:[D,R,Bc(O),o]});return(0,S.jsxs)(v.Fragment,{children:[!x&&aT.getElement(b),(0,S.jsx)(Ca,{context:d,modal:!1,disabled:!E,openInteractionType:T,returnFocus:a,restoreFocus:!0,children:z})]})});function jT(e){let t=e.maxHeight;return t.endsWith(`px`)&&parseFloat(t)||1/0}function MT(e){return oT(e.scrollHeight,e.clientHeight)}function NT(e){return Ps.getScale(e)}function PT(e,t,n){return e/n[t]}function FT(e,t){return br({x:PT(e.x,`x`,t),y:PT(e.y,`y`,t),width:PT(e.width,`x`,t),height:PT(e.height,`y`,t)})}var IT=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function LT(e){let{style:t}=e,n={};for(let[e,r]of IT)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of IT){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var RT=v.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=uT(),s=o.useState(`multiple`),c=o.useState(`readOnly`),{alignItemWithTriggerActive:l}=CT(),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:TT},className:u&&d!==`touch`?aT.className:void 0};return Hi(`div`,e,{ref:[t,o.useStateSetter(`listElement`)],props:[f,a]})}),zT=v.createContext(void 0);function BT(){let e=v.useContext(zT);if(!e)throw Error(J(57));return e}var VT=v.memo(v.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=v.useRef(null),d=Kb({guess:!0,label:o,textRef:u}),f=uT(),{props:p,multiple:m,disabled:h,readOnly:g,isItemEqualToValue:_}=f.useState(`itemRoot`),y=h||s,b=f.useState(`isActive`,d.index),x=f.useState(`open`),C=f.useState(`isSelected`,a),w=f.useState(`isSelectedByFocus`,d.index),T=d.index,E=v.useRef(null);q(()=>{let e=f.context.valuesRef.current;return e[T]=a,()=>{delete e[T]}},[T,a,f]),q(()=>{let e=f.state.value,t=f.state.selectedIndex,n=t,r;m&&Array.isArray(e)?(n=NS(T,a,f.context.valuesRef.current,e,_,t),r=n===T,T===t&&!r&&(f.context.selectedItemTextRef.current=null)):(r=e!==void 0&&DS(a,e,_),r&&(n=T)),f.set(`selectedIndex`,n),r&&u.current&&(f.context.selectedItemTextRef.current=u.current)},[T,m,_,f,a]);let D=v.useRef(`mouse`),O=v.useRef(!1),{getButtonProps:k,buttonRef:A}=pf({disabled:y,focusableWhenDisabled:!0,native:c,composite:!0}),j={disabled:y,selected:C,highlighted:b};function M(e){if(h||g)return;let t=f.state.value;if(m){let n=Array.isArray(t)?t:[],r=C?PS(n,a,_):[...n,a];f.context.setValue(r,Jt(tn,e))}else f.context.setValue(a,Jt(tn,e)),f.context.setOpen(!1,Jt(tn,e))}function N(){f.context.selectionRef.current.dragY=0}let P={role:`option`,"aria-selected":C,tabIndex:x&&b?0:-1,onKeyDown(e){f.set(`activeIndex`,T),e.key===` `&&f.context.typingRef.current&&e.preventDefault()},onClick(e){let t=D.current!==`touch`,n=e.nativeEvent.pointerType,r=t&&Ae(e.nativeEvent)&&(n!==void 0||b),i=t&&!r&&!O.current;O.current=!1,!(y||i)&&M(e.nativeEvent)},onPointerEnter(e){D.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){D.current=e.pointerType,O.current=!0,N()},onMouseUp(){if(N(),y||D.current===`touch`||O.current)return;let e=!f.context.selectionRef.current.allowSelectedMouseUp&&C,t=!f.context.selectionRef.current.allowUnselectedMouseUp&&!C;e||t||(O.current=!0,E.current?.click(),O.current=!1)}},F=Hi(`div`,e,{ref:[A,t,d.ref,E],state:j,props:[p,P,l,k]}),I=v.useMemo(()=>({selected:C,index:T,textRef:u,selectedByFocus:w}),[C,T,u,w]);return(0,S.jsx)(zT.Provider,{value:I,children:F})})),HT=v.forwardRef(function(e,t){let{selected:n}=BT();return e.keepMounted||n?(0,S.jsx)(rw,{...e,selected:n,ref:t}):null}),UT=v.memo(v.forwardRef(function(e,t){let{index:n,textRef:r,selectedByFocus:i}=BT(),a=uT(),{render:o,className:s,style:c,...l}=e;return Hi(`div`,e,{ref:[v.useCallback(e=>{e&&(n===0&&(a.context.firstItemTextRef.current=e),i&&(a.context.selectedItemTextRef.current=e))},[a,n,i]),t,r],props:l})})),WT=v.forwardRef(function(e,t){let{render:n,className:r,style:i,direction:a,keepMounted:o,...s}=e,c=a===`up`,l=uT(),{side:u,scrollDownArrowRef:d,scrollUpArrowRef:f}=CT(),p=c?`scrollUpArrowVisible`:`scrollDownArrowVisible`,m=l.useState(p),h=l.useState(`openMethod`),g=m&&h!==`touch`,_=fe(),v=c?f:d,{mounted:y,transitionStatus:b,setMounted:x}=Na(g);q(()=>(l.context.scrollArrowsMountedCountRef.current+=1,l.set(`hasScrollArrows`,!0),()=>{l.context.scrollArrowsMountedCountRef.current=Math.max(0,l.context.scrollArrowsMountedCountRef.current-1),l.context.scrollArrowsMountedCountRef.current===0&&l.set(`hasScrollArrows`,!1)}),[l]),Ra({open:g,ref:v,onComplete(){g||x(!1)}});let S=Hi(`div`,e,{ref:[t,v],state:{direction:a,visible:g,side:u,transitionStatus:b},props:[{"aria-hidden":!0,children:c?`▲`:`▼`,style:{position:`absolute`},onMouseMove(e){if(e.movementX===0&&e.movementY===0||_.isStarted())return;l.set(`activeIndex`,null);function t(){let e=l.state.listElement??l.context.popupRef.current;if(!e)return;l.set(`activeIndex`,null),l.context.handleScrollArrowVisibility(e);let n=oT(e.scrollHeight,e.clientHeight),r=sT(e.scrollTop,n),i=r===(c?0:n),a=l.context.listRef.current;if(r!==e.scrollTop&&(e.scrollTop=r),i)_.clear();else{if(a.length>0){let t=v.current?.offsetHeight||0;e.scrollTop=GT(a,c,r,e.clientHeight,t,n)}_.start(40,t)}}_.start(40,t)},onMouseLeave(){_.clear()}},s],stateAttributesMapping:yt});return y||o?S:null});function GT(e,t,n,r,i,a){if(t){let t=0,r=n+i-1;for(let n=0;n<e.length;n+=1){let i=e[n];if(i&&i.offsetTop>=r){t=n;break}}let o=Math.max(0,t-1),s=e[o];return o<t&&s?sT(s.offsetTop-i,a):0}let o=e.length-1,s=n+r-i+1;for(let t=0;t<e.length;t+=1){let n=e[t];if(n&&n.offsetTop+n.offsetHeight>s){o=Math.max(0,t-1);break}}let c=Math.min(e.length-1,o+1),l=e[c];return c>o&&l?sT(l.offsetTop+l.offsetHeight-r+i,a):a}var KT=v.forwardRef(function(e,t){return(0,S.jsx)(WT,{...e,ref:t,direction:`down`})}),qT=v.forwardRef(function(e,t){return(0,S.jsx)(WT,{...e,ref:t,direction:`up`})}),JT=v.createContext(void 0),YT=v.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=v.useState(),c=v.useMemo(()=>({labelId:o,setLabelId:s}),[o,s]),l=Hi(`div`,e,{ref:t,props:[{role:`group`,"aria-labelledby":o},a]});return(0,S.jsx)(JT.Provider,{value:c,children:l})}),XT=JC,ZT=v.createContext(void 0);function QT(){return v.useContext(ZT)}var $T=v.forwardRef(function(e,t){let{className:n,defaultPressed:r=!1,disabled:i=!1,form:a,onPressedChange:o,pressed:s,render:c,type:l,value:u,nativeButton:d=!0,style:f,...p}=e,m=lc(u||void 0),h=QT(),g=h?.value??[],_=(i||h?.disabled)??!1,[y,b]=Ob({controlled:h?m!==void 0&&g.indexOf(m)>-1:s,default:r,name:`Toggle`,state:`pressed`}),{getButtonProps:x,buttonRef:C}=pf({disabled:_,native:d}),w={disabled:_,pressed:y},T=[C,t],E=[{"aria-pressed":y,onClick(e){let t=!y,n=Jt(Xt,e.nativeEvent);o?.(t,n),!n.isCanceled&&(m&&h?.setGroupValue?.(m,t,n),!n.isCanceled&&b(t))}},p,x],D=Hi(`button`,e,{enabled:!h,state:w,ref:T,props:E}),O=v.useMemo(()=>({disabled:_,focusableWhenDisabled:!1}),[_]);return h?(0,S.jsx)(Zw,{tag:`button`,render:c,className:n,style:f,metadata:O,state:w,refs:T,props:E}):D}),eE=v.createContext(void 0);function tE(){return v.useContext(eE)}var nE=v.forwardRef(function(e,t){let{defaultValue:n,disabled:r=!1,loopFocus:i=!0,onValueChange:a,orientation:o=`horizontal`,multiple:s=!1,value:c,className:l,render:u,style:d,...f}=e,p=lb(!0),m=tE(),h=n??G,g=c!==void 0||n!==void 0,_=(p?.disabled??!1)||(m?.disabled??!1)||r,[y,b]=Ob({controlled:c,default:h,name:`ToggleGroup`,state:`value`}),x=Y((e,t,n)=>{let r;s?(r=y.slice(),t?r.push(e):r.splice(y.indexOf(e),1)):r=t?[e]:[],a?.(r,n),!n.isCanceled&&b(r)}),C={disabled:_,multiple:s,orientation:o},w=v.useMemo(()=>({disabled:_,setGroupValue:x,value:y,isValueInitialized:g}),[_,x,y,g]),T={role:`group`},E=Hi(`div`,e,{enabled:!!p,state:C,ref:t,props:[T,f]});return(0,S.jsx)(ZT.Provider,{value:w,children:p?E:(0,S.jsx)(sx,{render:u,className:l,style:d,state:C,refs:[t],props:[T,f],loopFocus:i,enableHomeAndEndKeys:!0,orientation:o})})});function rE({className:e,...t}){return(0,S.jsx)(`textarea`,{"data-slot":`textarea`,className:X(`flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...t})}function iE({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`input-group`,role:`group`,className:X(`group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5`,e),...t})}var aE=Bd(`flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4`,{variants:{align:{"inline-start":`order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]`,"inline-end":`order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]`,"block-start":`order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2`,"block-end":`order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2`}},defaultVariants:{align:`inline-start`}});function oE({className:e,align:t=`inline-start`,...n}){return(0,S.jsx)(`div`,{role:`group`,"data-slot":`input-group-addon`,"data-align":t,className:X(aE({align:t}),e),onClick:e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...n})}var sE=Bd(`flex items-center gap-2 text-sm shadow-none`,{variants:{size:{xs:`h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5`,sm:``,"icon-xs":`size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0`,"icon-sm":`size-8 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});function cE({className:e,type:t=`button`,variant:n=`ghost`,size:r=`xs`,...i}){return(0,S.jsx)(vf,{type:t,"data-size":r,variant:n,className:X(sE({size:r}),e),...i})}function lE({className:e,...t}){return(0,S.jsx)(Uf,{"data-slot":`input-group-control`,className:X(`flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent`,e),...t})}function uE({className:e,...t}){return(0,S.jsx)(rE,{"data-slot":`input-group-control`,className:X(`flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent`,e),...t})}var dE=nw;function fE({className:e,children:t,...n}){return(0,S.jsxs)(pC,{"data-slot":`combobox-trigger`,className:X(`[&_svg:not([class*='size-'])]:size-4`,e),...n,children:[t,(0,S.jsx)(Tu,{className:`pointer-events-none size-4 text-muted-foreground`})]})}function pE({className:e,...t}){return(0,S.jsx)(xC,{"data-slot":`combobox-clear`,render:(0,S.jsx)(cE,{variant:`ghost`,size:`icon-xs`}),className:X(e),...t,children:(0,S.jsx)(Fd,{className:`pointer-events-none`})})}function mE({className:e,children:t,disabled:n=!1,showTrigger:r=!0,showClear:i=!1,...a}){return(0,S.jsxs)(iE,{className:X(`w-auto`,e),children:[(0,S.jsx)(yC,{render:(0,S.jsx)(lE,{disabled:n}),...a}),(0,S.jsxs)(oE,{align:`inline-end`,children:[r&&(0,S.jsx)(cE,{size:`icon-xs`,variant:`ghost`,render:(0,S.jsx)(fE,{}),"data-slot":`input-group-button`,className:`group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent`,disabled:n}),i&&(0,S.jsx)(pE,{disabled:n})]}),t]})}function hE({className:e,side:t=`bottom`,sideOffset:n=6,align:r=`start`,alignOffset:i=0,anchor:a,...o}){return(0,S.jsx)(MC,{children:(0,S.jsx)(NC,{side:t,sideOffset:n,align:r,alignOffset:i,anchor:a,className:`isolate z-50`,children:(0,S.jsx)(FC,{"data-slot":`combobox-content`,"data-chips":!!a,className:X(`group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[chips=true]:min-w-(--anchor-width) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:border-input/30 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:shadow-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...o})})})}function gE({className:e,...t}){return(0,S.jsx)(EC,{"data-slot":`combobox-list`,className:X(`no-scrollbar max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0`,e),...t})}function _E({className:e,children:t,...n}){return(0,S.jsxs)(KC,{"data-slot":`combobox-item`,className:X(`relative flex w-full cursor-default items-center gap-2 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...n,children:[t,(0,S.jsx)(iw,{render:(0,S.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`}),children:(0,S.jsx)(Cu,{className:`pointer-events-none`})})]})}function vE({className:e,...t}){return(0,S.jsx)(RC,{"data-slot":`combobox-group`,className:X(e),...t})}function yE({className:e,...t}){return(0,S.jsx)(zC,{"data-slot":`combobox-label`,className:X(`px-2 py-1.5 text-xs text-muted-foreground`,e),...t})}function bE({...e}){return(0,S.jsx)(TC,{"data-slot":`combobox-collection`,...e})}function xE({className:e,...t}){return(0,S.jsx)(qC,{"data-slot":`combobox-empty`,className:X(`hidden w-full justify-center py-2 text-center text-sm text-muted-foreground group-data-empty/combobox-content:flex`,e),...t})}function SE({className:e,...t}){return(0,S.jsx)(`label`,{"data-slot":`label`,className:X(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function CE({className:e,...t}){return(0,S.jsx)(`fieldset`,{"data-slot":`field-set`,className:X(`flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3`,e),...t})}function wE({className:e,variant:t=`legend`,...n}){return(0,S.jsx)(`legend`,{"data-slot":`field-legend`,"data-variant":t,className:X(`mb-1.5 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base`,e),...n})}function TE({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`field-group`,className:X(`group/field-group @container/field-group flex w-full flex-col gap-5 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,e),...t})}var EE=Bd(`group/field flex w-full gap-2 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function DE({className:e,orientation:t=`vertical`,...n}){return(0,S.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":t,className:X(EE({orientation:t}),e),...n})}function OE({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`field-content`,className:X(`group/field-content flex flex-1 flex-col gap-0.5 leading-snug`,e),...t})}function kE({className:e,...t}){return(0,S.jsx)(SE,{"data-slot":`field-label`,className:X(`group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-muted/50 has-[>[data-slot=field]]:has-[:focus-visible]:border-ring has-[>[data-slot=field]]:has-[:focus-visible]:ring-3 has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/50 *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,e),...t})}function AE({className:e,...t}){return(0,S.jsx)(`p`,{"data-slot":`field-description`,className:X(`text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5`,`last:mt-0 nth-last-2:-mt-1`,`[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}var jE=pT;function ME({className:e,...t}){return(0,S.jsx)(YT,{"data-slot":`select-group`,className:X(`scroll-my-1 p-1`,e),...t})}function NE({className:e,...t}){return(0,S.jsx)(yT,{"data-slot":`select-value`,className:X(`flex flex-1 text-left`,e),...t})}function PE({className:e,size:t=`default`,children:n,...r}){return(0,S.jsxs)(_T,{"data-slot":`select-trigger`,"data-size":t,className:X(`flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,S.jsx)(bT,{render:(0,S.jsx)(Tu,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function FE({className:e,children:t,side:n=`bottom`,sideOffset:r=4,align:i=`center`,alignOffset:a=0,alignItemWithTrigger:o=!0,...s}){return(0,S.jsx)(xT,{children:(0,S.jsx)(DT,{side:n,sideOffset:r,align:i,alignOffset:a,alignItemWithTrigger:o,className:`isolate z-50`,children:(0,S.jsxs)(AT,{"data-slot":`select-content`,"data-align-trigger":o,className:X(`relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...s,children:[(0,S.jsx)(RE,{}),(0,S.jsx)(RT,{children:t}),(0,S.jsx)(zE,{})]})})})}function IE({className:e,children:t,...n}){return(0,S.jsxs)(VT,{"data-slot":`select-item`,className:X(`relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,S.jsx)(UT,{className:`flex flex-1 shrink-0 gap-2 whitespace-nowrap`,children:t}),(0,S.jsx)(HT,{render:(0,S.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`}),children:(0,S.jsx)(Cu,{className:`pointer-events-none`})})]})}function LE({className:e,...t}){return(0,S.jsx)(XT,{"data-slot":`select-separator`,className:X(`pointer-events-none -mx-1 my-1 h-px bg-border`,e),...t})}function RE({className:e,...t}){return(0,S.jsx)(qT,{"data-slot":`select-scroll-up-button`,className:X(`top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,S.jsx)(ku,{})})}function zE({className:e,...t}){return(0,S.jsx)(KT,{"data-slot":`select-scroll-down-button`,className:X(`bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,S.jsx)(Tu,{})})}var BE=`default`,VE=[{value:`1`,label:`Stop that agent`},{value:`2`,label:`Wait for 1 reset, then stop`},{value:`3`,label:`Wait for 2 resets, then stop`},{value:`4`,label:`Wait for 3 resets, then stop`},{value:`5`,label:`Wait for 4 resets, then stop`},{value:`none`,label:`Wait and always continue`}];function HE({value:e,onChange:t}){let n=(n,r)=>{let i={...e.agents};r?i[n]=r:delete i[n],t({...e,agents:i})};return(0,S.jsxs)(TE,{children:[(0,S.jsxs)(CE,{children:[(0,S.jsx)(wE,{variant:`label`,children:`Agents`}),Kx.map(t=>{let r=e.agents[t];return(0,S.jsxs)(DE,{orientation:`horizontal`,children:[(0,S.jsx)(Nx,{id:`agent-${t}`,checked:r!==void 0,onCheckedChange:e=>n(t,e?{}:void 0)}),(0,S.jsx)(kE,{htmlFor:`agent-${t}`,className:`w-14 flex-none!`,children:t}),(0,S.jsx)(GE,{agent:t,value:r,onChange:e=>n(t,e)})]},t)})]}),(0,S.jsxs)(DE,{children:[(0,S.jsxs)(OE,{children:[(0,S.jsx)(kE,{children:`When an agent hits its usage limit`}),(0,S.jsx)(AE,{children:`Waiting pauses that agent until its plan resets, then it goes on. Once every agent has stopped, the factory turns off.`})]}),(0,S.jsxs)(jE,{items:VE,value:e.limit===null?`none`:String(e.limit),onValueChange:n=>t({...e,limit:n===`none`?null:Number(n)}),children:[(0,S.jsx)(PE,{className:`w-56`,children:(0,S.jsx)(NE,{})}),(0,S.jsx)(FE,{children:VE.map(e=>(0,S.jsx)(IE,{value:e.value,children:e.label},e.value))})]})]}),(0,S.jsxs)(DE,{orientation:`horizontal`,children:[(0,S.jsxs)(OE,{children:[(0,S.jsx)(kE,{htmlFor:`until`,children:`Start nothing new after`}),(0,S.jsx)(AE,{children:`Leave empty to keep going.`})]}),(0,S.jsx)(Uf,{id:`until`,type:`time`,className:`w-28`,value:e.until??``,onChange:n=>t({...e,until:n.target.value||void 0})})]})]})}var UE;function WE(){let[e,t]=(0,v.useState)({});return(0,v.useEffect)(()=>{UE??=rf.models(),UE.then(t,()=>UE=void 0)},[]),e}function GE({agent:e,value:t,onChange:n}){let r=WE()[e]??[],i=t=>r.find(e=>e.value===t)?.efforts??qx[e],a=[{value:BE,label:`Default effort`}].concat(i(t?.model).map(e=>({value:e,label:e}))),o=e=>e===BE?void 0:e??void 0;return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(KE,{label:`${e} model`,offered:r,disabled:!t,value:t?.model??BE,onChange:e=>{let r=o(e),a=t?.effort&&i(r).includes(t.effort)?t.effort:void 0;n({...t,model:r,effort:a})}}),(0,S.jsx)(qE,{label:`${e} effort`,items:a,disabled:!t,value:t?.effort??BE,onChange:e=>n({...t,effort:o(e)})})]})}function KE({label:e,offered:t,disabled:n,value:r,onChange:i}){let[a,o]=(0,v.useState)(null),s=[{value:BE,label:`Default model`,efforts:[],scoped:!0}];r!==BE&&!t.some(e=>e.value===r)&&s.push({value:r,label:r,efforts:[],scoped:!0});let c=[{value:``,items:s},{value:`Scoped`,items:t.filter(e=>e.scoped)},{value:`All models`,items:t.filter(e=>!e.scoped)}].filter(e=>e.items.length>0),l=c.flatMap(e=>e.items).find(e=>e.value===r);return(0,S.jsxs)(dE,{items:c,disabled:n,value:l,inputValue:a??l?.label??``,onInputValueChange:(e,{reason:t})=>{t===`input-change`&&o(e)},onOpenChange:e=>{e||o(null)},onValueChange:e=>e&&i(e.value),isItemEqualToValue:(e,t)=>e.value===t.value,autoHighlight:!0,filter:(e,t)=>t.toLowerCase().split(/\s+/).every(t=>`${e.label} ${e.value}`.toLowerCase().includes(t)),children:[(0,S.jsx)(mE,{"aria-label":e,className:`w-full min-w-0 flex-1`,disabled:n,onFocus:e=>e.target.select(),onBlur:()=>o(null)}),(0,S.jsxs)(hE,{className:`min-w-72`,children:[(0,S.jsx)(xE,{children:`No model matches`}),(0,S.jsx)(gE,{children:e=>(0,S.jsxs)(vE,{items:e.items,children:[e.value&&(0,S.jsx)(yE,{children:e.value}),(0,S.jsx)(bE,{children:e=>(0,S.jsx)(_E,{value:e,children:(0,S.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,S.jsx)(`span`,{className:`truncate`,children:e.label}),e.value!==BE&&e.value!==e.label&&(0,S.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:e.value})]})},e.value)})]},e.value)})]})]})}function qE({label:e,className:t,items:n,disabled:r,value:i,onChange:a}){return(0,S.jsxs)(jE,{items:n,disabled:r,value:i,onValueChange:a,children:[(0,S.jsx)(PE,{"aria-label":e,className:t,children:(0,S.jsx)(NE,{})}),(0,S.jsx)(FE,{children:n.map(e=>(0,S.jsx)(IE,{value:e.value,children:e.label},e.value))})]})}var JE={blocked:{label:`Waiting for you`,shows:e=>e.state===`blocked`},review:{label:`Needs review`,shows:(e,t)=>{let n=Mv(e);return n!==void 0&&(t[n]?.state??`OPEN`)===`OPEN`}},failed:{label:`Failed`,shows:e=>e.state===`failed`},nothing:{label:`Nothing to do`,shows:e=>{let t=e.attempts.at(-1);return e.state===`done`&&!t.url&&!t.branch}},all:{label:`All`,shows:()=>!0}},YE={passing:{label:`checks passing`,Icon:ju,className:`text-success`},failing:{label:`checks failing`,Icon:Lu,className:`text-destructive`},pending:{label:`checks running`,Icon:Nu,className:void 0},none:{label:`no checks`,Icon:zu,className:void 0}};function XE(e){return e.state===`done`||e.state===`failed`||e.state===`blocked`}var ZE=`factory.results.seen`;function QE(){let[e]=(0,v.useState)(()=>{try{return localStorage.getItem(ZE)??``}catch{return``}});return(0,v.useEffect)(()=>{let e=()=>{try{localStorage.setItem(ZE,new Date().toISOString())}catch{}};return e(),e},[]),e}function $E(e,t,n){let r=Mv(e),i=r?t[r]:void 0;return i?.state===`OPEN`&&!i.draft&&i.checks!==`failing`&&!(i.conflicts&&i.fork)&&!jv(n[e.id])}function eD({snapshot:e,act:t,onAsk:n}){let[r,i]=bx(`filter`,`all`),[a,o]=(0,v.useState)(()=>new Set),[s,c]=(0,v.useState)(!1),l=QE(),{prs:u,train:d}=e,f=e.jobs.filter(e=>e.state!==`removed`),p=new Set(f.filter(e=>e.item.play===`review`).map(e=>Av(e.item))),m=Object.keys(e.settings.agents),h=f.filter(e=>e.attempts.length>0).sort((e,t)=>t.attempts.at(-1).start.localeCompare(e.attempts.at(-1).start));if(h.length===0)return(0,S.jsx)(Vd,{children:(0,S.jsxs)(Hd,{children:[(0,S.jsx)(Ud,{children:`Nothing done yet`}),(0,S.jsx)(Wd,{children:`What the agents did shows up here, with their PRs to review and merge.`})]})});let g=h.filter(e=>(JE[r]??JE.all).shows(e,u)),_=g.filter(XE),y=_.filter(e=>a.has(e.id)),b=y.length===_.length,x=y.filter(e=>$E(e,u,d)),C=(e,t)=>{o(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})};return(0,S.jsxs)(`div`,{className:`flex flex-col gap-4 pt-2`,children:[(0,S.jsxs)(`div`,{className:`flex min-h-8 flex-wrap items-center gap-3 border border-transparent px-3`,children:[_.length>0&&(0,S.jsx)(Nx,{"aria-label":b?`Clear selection`:`Select all`,checked:y.length>0&&b,disabled:s,onCheckedChange:e=>o(new Set(e?_.map(e=>e.id):[]))}),y.length===0?(0,S.jsx)(qE,{label:`Filter`,className:`w-56`,items:Object.entries(JE).map(([e,{label:t,shows:n}])=>({value:e,label:`${t} (${h.filter(e=>n(e,u)).length})`})),value:r,onChange:e=>e&&i(e)}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`span`,{className:`text-sm font-medium`,children:[y.length,` of `,_.length,` selected`]}),(0,S.jsxs)(`div`,{role:`group`,"aria-label":`Batch actions`,className:`flex items-center gap-2 sm:ml-auto`,children:[(0,S.jsx)(vf,{variant:`outline`,size:`sm`,disabled:s,onClick:async()=>{if(!y.some(e=>e.attempts.some(e=>e.branch))||window.confirm(`Dismiss selected results and delete their unpushed branches?`)){c(!0);try{await t(async()=>{let e=(await Promise.allSettled(y.map(e=>rf.remove(e.id)))).find(e=>e.status===`rejected`);if(e)throw e.reason})}finally{c(!1)}}},children:s?`Dismissing…`:`Dismiss`}),x.length>0&&(0,S.jsxs)(Xl,{children:[(0,S.jsx)(Gl,{render:(0,S.jsx)(`span`,{}),children:(0,S.jsxs)(vf,{variant:`outline`,size:`sm`,disabled:s,onClick:()=>{let e=x.length===1?`1 PR`:`${x.length} PRs`;window.confirm(`Merge ${e} one after another? Conflicting ones get rebased; ones that still conflict are skipped.`)&&(t(()=>rf.mergeTrain(x.map(e=>e.id))),o(new Set))},children:[`Merge `,x.length<y.length&&`(${x.length})`]})}),(0,S.jsx)(Kl,{children:`Merges one after another per repo, smallest first`})]})]})]})]}),(0,S.jsx)(Fx,{children:g.map(r=>(0,S.jsx)(tD,{job:r,snapshot:e,act:t,car:d[r.id],onAsk:n,asked:e.settings.chat.agent,unread:l!==``&&r.attempts.at(-1).end>l,reviewer:r.item.play!==`review`&&!p.has(Av(r.item))?m.find(e=>e!==r.agent):void 0,disabled:s&&a.has(r.id),selection:XE(r)&&(0,S.jsx)(Nx,{"aria-label":`Select ${Xd(r.item)}`,checked:a.has(r.id),disabled:s,onCheckedChange:e=>C(r.id,e)})},r.id))})]})}function tD({job:e,snapshot:t,act:n,car:r,onAsk:i,asked:a,unread:o,reviewer:s,disabled:c,selection:l}){let[u,d]=(0,v.useState)(),f=e.attempts.at(-1),p=Mv(e),m=p?t.prs[p]:void 0,h=dD(e,t.prs),g=m?.state===`OPEN`,_=c||u!==void 0||jv(r),y=m&&(Pv(m)?`rebase`:Nv(m)?`merge`:void 0),b=r?.step===`skipped`?`The merge train skipped ${p}, "${Xd(e.item)}": ${r.reason}. Why, and what should I do about it?`:e.state===`failed`?`Job ${e.id}, "${Xd(e.item)}" (workwork ${e.item.id} in ${e.item.repo}), failed${f.error?`: ${f.error}`:``}. Its log is ${f.log}. Why did it fail, and should I retry it, pin another agent, or drop it?`:void 0;async function x(t){d(t);try{await n(()=>rf[t](e.id))}finally{d(void 0)}}let C={merge:`Merging…`,rebase:`Rebasing…`,close:`Closing…`},w=y&&(0,S.jsx)(vf,{variant:`outline`,size:`sm`,disabled:_,onClick:()=>x(y),children:u?C[u]:y===`rebase`?`Rebase`:`Merge`}),T=e.state===`failed`&&(0,S.jsx)(vf,{variant:`outline`,size:`sm`,disabled:_,onClick:()=>n(()=>rf.retry(e.id)),children:`Retry`}),E=()=>n(()=>rf.remove(e.id)),D=e.state===`blocked`?e.notes.findLast(e=>e.kind===`ask`):void 0;return(0,S.jsxs)(Wx,{leading:(0,S.jsxs)(S.Fragment,{children:[l,(0,S.jsx)(lD,{state:h})]}),title:(0,S.jsxs)(S.Fragment,{children:[o&&(0,S.jsx)(`span`,{role:`img`,"aria-label":`new`,className:`mr-1 inline-block size-2 rounded-full bg-primary align-middle`}),(0,S.jsx)(pD,{item:e.item,job:e,snapshot:t,act:n,actions:(0,S.jsxs)(S.Fragment,{children:[XE(e)&&(0,S.jsx)(vf,{variant:`ghost`,size:`sm`,className:`sm:mr-auto`,disabled:_,onClick:E,children:`Dismiss`}),g&&(0,S.jsx)(vf,{variant:`outline`,size:`sm`,disabled:_,onClick:()=>x(`close`),children:u===`close`?C.close:`Close PR`}),g&&s&&(0,S.jsxs)(vf,{variant:`outline`,size:`sm`,disabled:_,onClick:()=>n(()=>rf.review(e.id,s)),children:[`Review with `,tf(s)]}),b&&(0,S.jsxs)(vf,{variant:`outline`,size:`sm`,onClick:()=>i(b),children:[`Ask `,tf(a)]}),T,w]})})]}),meta:(0,S.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,S.jsx)(uD,{state:h,label:h===`failed`&&f.outcome!==`failed`?f.outcome:void 0}),(0,S.jsx)(nD,{job:e,last:f,pr:m,url:p,car:r})]}),below:D&&(0,S.jsx)(Kf,{job:e,question:D,act:n}),children:[w,T,XE(e)&&(0,S.jsxs)(Xl,{children:[(0,S.jsx)(Gl,{render:(0,S.jsx)(vf,{variant:`ghost`,size:`icon-sm`,"aria-label":`Dismiss ${Xd(e.item)}`,disabled:_,onClick:E}),children:(0,S.jsx)(Fd,{"aria-hidden":`true`})}),(0,S.jsx)(Kl,{children:e.attempts.some(e=>e.branch)?`Dismiss: hide from results and delete its unpushed branch`:`Dismiss: hide from results, its PR stays as it is`})]})]})}function nD({job:e,last:t,pr:n,url:r,car:i}){let a=e.notes.findLast(e=>e.kind===`result`),o=n?.state===`OPEN`&&YE[n.checks],s=r?[n?.state===`OPEN`&&(n.level??e.item.level),n&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`span`,{className:`text-success`,children:[`+`,n.additions]}),` `,(0,S.jsxs)(`span`,{className:`text-destructive`,children:[`−`,n.deletions]})]}),o&&(0,S.jsx)(`span`,{className:o.className,children:o.label},`checks`),n?.state===`OPEN`&&n.conflicts&&(0,S.jsx)(`span`,{className:`text-destructive`,children:`conflicts`},`conflicts`),n?.draft&&`draft`,i&&(0,S.jsx)(iD,{car:i},`train`),`#${r.split(`/`).at(-1)}`]:e.state===`failed`?[t.error&&(0,S.jsx)(`span`,{className:`text-destructive`,children:t.error.split(`
59
- `)[0]},`error`),e.attempts.length>1&&`${e.attempts.length} attempts`]:[e.state===`done`&&(a?.text??`nothing to change`)];return(0,S.jsx)(`span`,{className:`min-w-0 truncate`,children:[...s,tf(t.agent),qd(t.end)].filter(Boolean).map((e,t)=>(0,S.jsxs)(`span`,{children:[t>0&&` · `,e]},t))})}var rD={queued:`on the merge train`,waiting:`merge train: waiting for checks`,rebasing:`merge train: rebasing`,merging:`merge train: merging`,merged:void 0};function iD({car:e}){return e?.step===`skipped`?(0,S.jsxs)(`span`,{className:`text-destructive`,children:[`merge train skipped it: `,e.reason.replaceAll(`
60
- `,` `)]}):e&&rD[e.step]?(0,S.jsx)(`span`,{children:rD[e.step]}):null}function aD({jobId:e,url:t,pr:n}){let r=n?.state===`OPEN`&&YE[n.checks];return(0,S.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-3`,children:[(0,S.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1`,children:[(0,S.jsx)(Zu,{className:`size-3.5`,"aria-hidden":`true`}),t.replace(`https://github.com/`,``)]}),n?(0,S.jsxs)(S.Fragment,{children:[r&&(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-1 ${r.className??``}`,children:[(0,S.jsx)(r.Icon,{className:`size-3.5`,"aria-hidden":`true`}),r.label]}),n.draft&&(0,S.jsx)(`span`,{children:`draft`}),n.state===`OPEN`&&n.conflicts===null&&(0,S.jsx)(`span`,{children:`checking mergeability…`}),n.state===`OPEN`&&n.conflicts&&(0,S.jsx)(`span`,{className:`text-destructive`,children:n.fork?`conflicts · resolve in fork`:`conflicts`}),(0,S.jsxs)(`span`,{children:[(0,S.jsxs)(`span`,{className:`text-success`,children:[`+`,n.additions]}),` `,(0,S.jsxs)(`span`,{className:`text-destructive`,children:[`−`,n.deletions]}),` in `,n.files.length,` `,n.files.length===1?`file`:`files`]}),(0,S.jsx)(gx,{jobId:e,url:t,pr:n})]}):(0,S.jsx)(`span`,{children:`asking GitHub…`})]})}var oD={auto:`a check defines correct, so a digest is enough`,skim:`same behavior and a small diff, to skim and accept`,decide:`changes behavior or needs your product judgment`},sD={candidate:{Icon:Nu,icon:`text-muted-foreground`,pill:`bg-muted text-muted-foreground`},queued:{Icon:zu,icon:`text-muted-foreground`,pill:`bg-muted text-muted-foreground`},running:{Icon:sd,icon:`animate-spin text-primary`,pill:`bg-primary/15 text-primary`},blocked:{Icon:Fu,icon:`text-warning`,pill:`bg-warning text-background`},review:{Icon:Zu,icon:`text-primary`,pill:`bg-primary/15 text-primary`},done:{Icon:ju,icon:`text-success`,pill:`bg-success/15 text-success`},merged:{Icon:qu,icon:`text-success`,pill:`bg-success/15 text-success`},failed:{Icon:Lu,icon:`text-destructive`,pill:`bg-destructive/15 text-destructive`},closed:{Icon:Yu,icon:`text-muted-foreground`,pill:`bg-muted text-muted-foreground`},removed:{Icon:Lu,icon:`text-muted-foreground`,pill:`bg-muted text-muted-foreground`}},cD={blocked:`waiting for you`,review:`needs review`};function lD({state:e}){let{Icon:t,icon:n}=sD[e];return(0,S.jsx)(t,{role:`img`,"aria-label":e,className:`size-4 shrink-0 ${n}`})}function uD({state:e,label:t}){return(0,S.jsx)(`span`,{className:`inline-flex h-5 items-center rounded-full px-2 text-xs font-medium whitespace-nowrap ${sD[e].pill}`,children:t??cD[e]??e})}function dD(e,t){if(!e)return`candidate`;let n=Mv(e);if(!n||e.state!==`done`)return e.state;let r=t[n]?.state;return r===`MERGED`?`merged`:r===`CLOSED`?`closed`:`review`}function fD({item:e,bare:t}){return(0,S.jsxs)(S.Fragment,{children:[!t&&(0,S.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[Yd(e.repo),`: `]}),e.title||e.id]})}function pD({item:e,job:t,play:n,snapshot:r,act:i,actions:a,bare:o}){let s=dD(t,r.prs);return(0,S.jsxs)(jy,{children:[(0,S.jsx)(My,{render:(0,S.jsx)(`button`,{type:`button`,className:`cursor-pointer truncate text-left underline-offset-4 hover:underline`}),children:(0,S.jsx)(fD,{item:e,bare:o})}),(0,S.jsxs)(Fy,{className:t?`sm:max-w-5xl`:`sm:max-w-3xl`,children:[(0,S.jsx)(Iy,{className:`mr-8`,children:(0,S.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,S.jsx)(`span`,{className:`mt-0.5`,children:(0,S.jsx)(lD,{state:s})}),(0,S.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,S.jsx)(Ry,{children:(0,S.jsx)(fD,{item:e})}),(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-muted-foreground`,children:[(0,S.jsx)(uD,{state:s}),(0,S.jsxs)(zy,{children:[e.label,` · `,e.play,` · `,e.level]})]})]})]})}),t?(0,S.jsxs)(`div`,{className:`-mx-4 -mb-4 grid border-t md:max-h-[65dvh] md:grid-cols-[3fr_2fr]`,children:[(0,S.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 overflow-auto p-4`,children:[(0,S.jsx)(yD,{children:`The task`}),(0,S.jsx)(mD,{item:e,jobId:t.id}),(0,S.jsx)(bD,{item:e,play:n})]}),(0,S.jsx)(`div`,{className:`flex min-w-0 flex-col gap-3 overflow-auto bg-muted/30 p-4 md:border-l`,children:(0,S.jsx)(hD,{job:t,snapshot:r,act:i})})]}):(0,S.jsxs)(`div`,{className:`flex max-h-[65dvh] flex-col gap-3 overflow-auto`,children:[(0,S.jsx)(mD,{item:e}),(0,S.jsx)(bD,{item:e,play:n})]}),a&&(0,S.jsx)(Ly,{children:a})]})]})}function mD({item:e,jobId:t}){let[n,r]=(0,v.useState)(),[i,a]=(0,v.useState)();return(0,v.useEffect)(()=>{let n=!0;return(t?rf.jobPrompt(t):rf.prompt(e)).then(e=>n&&r(e),e=>n&&a(e.message)),()=>{n=!1}},[e,t]),i?(0,S.jsxs)(`p`,{role:`status`,className:`text-destructive`,children:[`Could not load the task: `,i]}):n===void 0?(0,S.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-muted-foreground`,children:[(0,S.jsx)(By,{}),` Asking workwork…`]}):(0,S.jsx)(`div`,{className:`flex flex-col gap-2 text-sm wrap-anywhere`,children:(0,S.jsx)(Dv,{options:hx,children:n.split(`
61
- ## Standard`)[0].replace(/^# workwork[^]*?(?=^## )/m,``)})})}function hD({job:e,snapshot:t,act:n}){let{status:r,prs:i,train:a}=t,o=e.attempts.at(-1),s=new Set(t.jobs.filter(e=>e.state!==`removed`&&e.item.play===`followup`).map(e=>e.item.title)),c=r?.workers.find(t=>t.job===e.id),l=e.notes.findLast(t=>t.kind===`step`&&t.attempt===e.attempts.length+1),u=e.state===`blocked`?e.notes.findLast(e=>e.kind===`ask`):void 0,d=Mv(e),f=CD(e).sort((e,t)=>t.at.localeCompare(e.at)),p=new Map;for(let e of f){let t=TD(e.at);p.set(t,[...p.get(t)??[],e])}return(0,S.jsxs)(S.Fragment,{children:[c&&r&&(0,S.jsxs)(vD,{className:`border-primary/40`,children:[(0,S.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,children:[(0,S.jsx)(lD,{state:`running`}),c.id,` working, `,Jd(c.since),` min`]}),l&&(0,S.jsxs)(`span`,{children:[l.text,l.of?` (${l.done??0}/${l.of})`:``]}),(0,S.jsx)(`span`,{className:`text-muted-foreground`,children:[c.activity,c.context&&`${Math.round(c.context/1e3)}k context`].filter(Boolean).join(` · `)})]}),(0,S.jsx)(gD,{job:e,act:n}),u&&(0,S.jsx)(Kf,{job:e,question:u,act:n}),o?.error&&(0,S.jsx)(vD,{className:`border-destructive/40 text-destructive`,children:o.error.split(`
62
- `)[0]}),d&&(0,S.jsxs)(vD,{className:i[d]?.state===`MERGED`?`border-success/40`:``,children:[(0,S.jsx)(aD,{jobId:e.id,url:d,pr:i[d]}),(0,S.jsx)(iD,{car:a[e.id]})]}),(0,S.jsx)(Gf,{job:e,act:n,queued:s}),(0,S.jsx)(yD,{children:`Log`}),(0,S.jsx)(`div`,{className:`flex flex-col gap-3 text-sm`,children:[...p].map(([e,t])=>(0,S.jsxs)(`section`,{className:`flex flex-col gap-1.5`,children:[(0,S.jsx)(`h4`,{className:`text-xs text-muted-foreground`,children:e}),(0,S.jsx)(`ol`,{className:`flex flex-col`,children:t.map(e=>(0,S.jsxs)(`li`,{className:`group grid grid-cols-[4.5rem_0.75rem_1fr] gap-x-2`,children:[(0,S.jsx)(`time`,{dateTime:e.at,className:`text-right whitespace-nowrap text-muted-foreground tabular-nums`,children:Kd(e.at)}),(0,S.jsx)(`span`,{"aria-hidden":!0,className:`relative flex justify-center before:absolute before:inset-y-0 before:w-px before:bg-border group-first:before:top-2 group-last:before:bottom-auto group-last:before:h-2 ${e.tone??`text-muted-foreground`}`,children:(0,S.jsx)(`span`,{className:`relative mt-1.5 size-2 rounded-full border-2 border-current bg-popover`})}),(0,S.jsxs)(`span`,{className:`pb-3 wrap-anywhere ${e.tone??``}`,children:[e.text,` `,e.ended&&(0,S.jsx)(Tb,{log:e.ended.log,agent:e.ended.agent,kind:`log`})]})]},`${e.at} ${e.text}`))})]},e))})]})}function gD({job:e,act:t}){let n=e.notes.flatMap((t,n)=>t.kind===`assume`&&!e.notes.some(e=>e.kind===`answer`&&e.re===n)?[t]:[]),r=[e.tier&&`tier ${e.tier}${e.escalations?`, moved up ${e.escalations}×`:``}`,e.gates.length>0&&`gates ${e.gates.map(e=>`\`${e}\``).join(`, `)}`,e.touches&&`touches ${e.touches.length?e.touches.join(`, `):`anything`}`,e.needs.length>0&&`needs ${e.needs.join(`, `)}`].filter(Boolean);return r.length===0&&e.unverified.length===0&&n.length===0?null:(0,S.jsxs)(`div`,{className:`flex flex-col gap-2 text-sm`,children:[r.length>0&&(0,S.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r.join(` · `)}),e.unverified.map(n=>(0,S.jsx)(vD,{className:`border-warning/40`,children:(0,S.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsxs)(`span`,{className:`flex-1`,children:[`Not verified: `,n]}),(0,S.jsx)(vf,{size:`sm`,variant:`outline`,onClick:()=>t(()=>rf.verify(e.id,n)),children:`Checked`})]})},n)),n.map(n=>(0,S.jsxs)(vD,{className:`border-warning/40`,children:[(0,S.jsxs)(`span`,{children:[`Assumed `,(0,S.jsx)(`strong`,{children:n.assumed}),`, asked: `,n.text]}),(0,S.jsxs)(`span`,{className:`flex gap-2`,children:[(0,S.jsx)(vf,{size:`sm`,onClick:()=>t(()=>rf.answer(e.id,`fine`)),children:`Fine`}),(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`or answer below to queue a change`})]}),(0,S.jsx)(_D,{job:e,act:t})]},n.at))]})}function _D({job:e,act:t}){let[n,r]=(0,v.useState)(``);return(0,S.jsxs)(`form`,{className:`flex gap-2`,onSubmit:r=>{r.preventDefault(),t(()=>rf.answer(e.id,n))},children:[(0,S.jsx)(Uf,{value:n,onChange:e=>r(e.target.value),placeholder:`Your answer`}),(0,S.jsx)(vf,{type:`submit`,size:`sm`,variant:`outline`,disabled:!n.trim(),children:`Answer`})]})}function vD({className:e,children:t}){return(0,S.jsx)(`div`,{className:`flex flex-col gap-2 rounded-md border bg-popover p-2 text-sm ${e}`,children:t})}function yD({children:e}){return(0,S.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:e})}function bD({item:e,play:t}){return(0,S.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[t&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`span`,{className:`font-medium text-foreground`,children:e.play}),`: `,t,` `]}),oD[e.level]&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`span`,{className:`font-medium text-foreground`,children:e.level}),`: `,oD[e.level],`.`]})]})}var xD=200;function SD(e){if(!e.turns)return``;let t=(e,t)=>`${e} ${t}${e===1?``:`s`}`;return[t(e.turns,`turn`),e.followups?t(e.followups,`follow-up`):``,e.peak?`peak ${Math.round(e.peak/1e3)}k`:``,e.compactions?t(e.compactions,`compaction`):``].filter(Boolean).join(`, `)}function CD(e){return[{at:e.added,job:e,text:`queued${e.agent?` for ${e.agent}`:``}`},...e.attempts.flatMap(t=>[{at:t.start,job:e,text:`${t.agent} started`},{at:t.end,job:e,text:[`${t.preset??t.agent} ${t.outcome}`,t.url?.replace(`https://github.com/`,``),SD(t)].filter(Boolean).join(` · `),tone:t.outcome===`done`?void 0:`text-destructive`,ended:t}]),...e.notes.map(t=>({at:t.at,job:e,text:`${Wf[t.kind]}: ${t.text}`,tone:t.kind===`ask`?`text-foreground font-medium`:void 0}))]}function wD(e){return e.filter(e=>e.state!==`removed`).flatMap(CD).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,xD)}var TD=e=>new Date(e).toLocaleDateString([],{weekday:`long`,day:`numeric`,month:`short`});function ED({snapshot:e,act:t}){let n=wD(e.jobs);if(n.length===0)return(0,S.jsx)(Vd,{children:(0,S.jsxs)(Hd,{children:[(0,S.jsx)(Ud,{children:`Nothing happened yet`}),(0,S.jsx)(Wd,{children:`Jobs queued, started and finished show up here, with what their agents said.`})]})});let r=new Map;for(let e of n){let t=TD(e.at);r.set(t,[...r.get(t)??[],e])}return(0,S.jsx)(`div`,{className:`flex flex-col gap-6 pt-2`,children:[...r].map(([n,r])=>(0,S.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,S.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground`,children:n}),(0,S.jsx)(`ol`,{className:`flex flex-col gap-1.5 text-sm`,children:r.map(n=>(0,S.jsxs)(`li`,{className:`grid grid-cols-[4.5rem_1fr] gap-x-3 sm:grid-cols-[4.5rem_16rem_1fr]`,children:[(0,S.jsx)(`time`,{dateTime:n.at,className:`whitespace-nowrap text-muted-foreground tabular-nums`,children:Kd(n.at)}),(0,S.jsx)(pD,{item:n.job.item,job:n.job,snapshot:e,act:t}),(0,S.jsx)(`span`,{className:`col-start-2 wrap-anywhere sm:col-start-3 ${n.tone??`text-muted-foreground`}`,children:n.text})]},`${n.at} ${n.job.id} ${n.text}`))})]},n))})}function DD(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var OD=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,kD=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,AD={};function jD(e,t){return((t||AD).jsx?kD:OD).test(e)}var MD=/[ \t\n\f\r]/g;function ND(e){return typeof e==`object`?e.type===`text`&&PD(e.value):PD(e)}function PD(e){return e.replace(MD,``)===``}var FD=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};FD.prototype.normal={},FD.prototype.property={},FD.prototype.space=void 0;function ID(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new FD(n,r,t)}function LD(e){return e.toLowerCase()}var RD=class{constructor(e,t){this.attribute=t,this.property=e}};RD.prototype.attribute=``,RD.prototype.booleanish=!1,RD.prototype.boolean=!1,RD.prototype.commaOrSpaceSeparated=!1,RD.prototype.commaSeparated=!1,RD.prototype.defined=!1,RD.prototype.mustUseProperty=!1,RD.prototype.number=!1,RD.prototype.overloadedBoolean=!1,RD.prototype.property=``,RD.prototype.spaceSeparated=!1,RD.prototype.space=void 0;var zD=s({boolean:()=>VD,booleanish:()=>HD,commaOrSpaceSeparated:()=>KD,commaSeparated:()=>GD,number:()=>$,overloadedBoolean:()=>UD,spaceSeparated:()=>WD}),BD=0,VD=qD(),HD=qD(),UD=qD(),$=qD(),WD=qD(),GD=qD(),KD=qD();function qD(){return 2**++BD}var JD=Object.keys(zD),YD=class extends RD{constructor(e,t,n,r){let i=-1;if(super(e,t),XD(this,`space`,r),typeof n==`number`)for(;++i<JD.length;){let e=JD[i];XD(this,JD[i],(n&zD[e])===zD[e])}}};YD.prototype.defined=!0;function XD(e,t,n){n&&(e[t]=n)}function ZD(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new YD(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[LD(r)]=r,n[LD(a.attribute)]=r}return new FD(t,n,e.space)}var QD=ZD({properties:{ariaActiveDescendant:null,ariaAtomic:HD,ariaAutoComplete:null,ariaBusy:HD,ariaChecked:HD,ariaColCount:$,ariaColIndex:$,ariaColSpan:$,ariaControls:WD,ariaCurrent:null,ariaDescribedBy:WD,ariaDetails:null,ariaDisabled:HD,ariaDropEffect:WD,ariaErrorMessage:null,ariaExpanded:HD,ariaFlowTo:WD,ariaGrabbed:HD,ariaHasPopup:null,ariaHidden:HD,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:WD,ariaLevel:$,ariaLive:null,ariaModal:HD,ariaMultiLine:HD,ariaMultiSelectable:HD,ariaOrientation:null,ariaOwns:WD,ariaPlaceholder:null,ariaPosInSet:$,ariaPressed:HD,ariaReadOnly:HD,ariaRelevant:null,ariaRequired:HD,ariaRoleDescription:WD,ariaRowCount:$,ariaRowIndex:$,ariaRowSpan:$,ariaSelected:HD,ariaSetSize:$,ariaSort:null,ariaValueMax:$,ariaValueMin:$,ariaValueNow:$,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function $D(e,t){return t in e?e[t]:t}function eO(e,t){return $D(e,t.toLowerCase())}var tO=ZD({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:GD,acceptCharset:WD,accessKey:WD,action:null,allow:null,allowFullScreen:VD,allowPaymentRequest:VD,allowUserMedia:VD,alpha:VD,alt:null,as:null,async:VD,autoCapitalize:null,autoComplete:WD,autoFocus:VD,autoPlay:VD,blocking:WD,capture:null,charSet:null,checked:VD,cite:null,className:WD,closedBy:null,colorSpace:null,cols:$,colSpan:$,command:null,commandFor:null,content:null,contentEditable:HD,controls:VD,controlsList:WD,coords:$|GD,crossOrigin:null,data:null,dateTime:null,decoding:null,default:VD,defer:VD,dir:null,dirName:null,disabled:VD,download:UD,draggable:HD,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:VD,formTarget:null,headers:WD,height:$,hidden:UD,high:$,href:null,hrefLang:null,htmlFor:WD,httpEquiv:WD,id:null,imageSizes:null,imageSrcSet:null,inert:VD,inputMode:null,integrity:null,is:null,isMap:VD,itemId:null,itemProp:WD,itemRef:WD,itemScope:VD,itemType:WD,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:VD,low:$,manifest:null,max:null,maxLength:$,media:null,method:null,min:null,minLength:$,multiple:VD,muted:VD,name:null,nonce:null,noModule:VD,noValidate:VD,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:VD,optimum:$,pattern:null,ping:WD,placeholder:null,playsInline:VD,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:VD,referrerPolicy:null,rel:WD,required:VD,reversed:VD,rows:$,rowSpan:$,sandbox:WD,scope:null,scoped:VD,seamless:VD,selected:VD,shadowRootClonable:VD,shadowRootCustomElementRegistry:VD,shadowRootDelegatesFocus:VD,shadowRootMode:null,shadowRootSerializable:VD,shape:null,size:$,sizes:null,slot:null,span:$,spellCheck:HD,src:null,srcDoc:null,srcLang:null,srcSet:null,start:$,step:null,style:null,tabIndex:$,target:null,title:null,translate:null,type:null,typeMustMatch:VD,useMap:null,value:HD,width:$,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:WD,axis:null,background:null,bgColor:null,border:$,borderColor:null,bottomMargin:$,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:VD,declare:VD,event:null,face:null,frame:null,frameBorder:null,hSpace:$,leftMargin:$,link:null,longDesc:null,lowSrc:null,marginHeight:$,marginWidth:$,noResize:VD,noHref:VD,noShade:VD,noWrap:VD,object:null,profile:null,prompt:null,rev:null,rightMargin:$,rules:null,scheme:null,scrolling:HD,standby:null,summary:null,text:null,topMargin:$,valueType:null,version:null,vAlign:null,vLink:null,vSpace:$,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:VD,disablePictureInPicture:VD,disableRemotePlayback:VD,exportParts:GD,part:WD,prefix:null,property:null,results:$,security:null,unselectable:null},space:`html`,transform:eO}),nO=ZD({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:KD,accentHeight:$,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:$,amplitude:$,arabicForm:null,ascent:$,attributeName:null,attributeType:null,azimuth:$,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:$,by:null,calcMode:null,capHeight:$,className:WD,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:$,diffuseConstant:$,direction:null,display:null,dur:null,divisor:$,dominantBaseline:null,download:VD,dx:null,dy:null,edgeMode:null,editable:null,elevation:$,enableBackground:null,end:null,event:null,exponent:$,externalResourcesRequired:null,fill:null,fillOpacity:$,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:GD,g2:GD,glyphName:GD,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:$,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:$,horizOriginX:$,horizOriginY:$,id:null,ideographic:$,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:$,k:$,k1:$,k2:$,k3:$,k4:$,kernelMatrix:KD,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:$,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:$,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:$,overlineThickness:$,paintOrder:null,panose1:null,path:null,pathLength:$,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:WD,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:$,pointsAtY:$,pointsAtZ:$,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:KD,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:KD,rev:KD,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:KD,requiredFeatures:KD,requiredFonts:KD,requiredFormats:KD,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:$,specularExponent:$,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:$,strikethroughThickness:$,string:null,stroke:null,strokeDashArray:KD,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:$,strokeOpacity:$,strokeWidth:null,style:null,surfaceScale:$,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:KD,tabIndex:$,tableValues:null,target:null,targetX:$,targetY:$,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:KD,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:$,underlineThickness:$,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:$,values:null,vAlphabetic:$,vMathematical:$,vectorEffect:null,vHanging:$,vIdeographic:$,version:null,vertAdvY:$,vertOriginX:$,vertOriginY:$,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:$,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:$D}),rO=ZD({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),iO=ZD({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:eO}),aO=ZD({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),oO={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},sO=/[A-Z]/g,cO=/-[a-z]/g,lO=/^data[-\w.:]+$/i;function uO(e,t){let n=LD(t),r=t,i=RD;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&lO.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(cO,fO);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!cO.test(e)){let n=e.replace(sO,dO);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=YD}return new i(r,t)}function dO(e){return`-`+e.toLowerCase()}function fO(e){return e.charAt(1).toUpperCase()}var pO=ID([QD,tO,rO,iO,aO],`html`),mO=ID([QD,nO,rO,iO,aO],`svg`);function hO(e){return e.join(` `).trim()}var gO=/\/\*(?:[^*]|\*(?!\/))*\*\//g,_O=/\n/g,vO=/^\s*/,yO=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,bO=/^:\s*/,xO=/^((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|url\((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|[^)]*)\)|[^};])+)/,SO=/^[;\s]*/,CO=`
63
- `,wO=`/`,TO=`*`,EO=``,DO=`comment`,OO=`declaration`;function kO(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var n=1,r=1;function i(e){var t=e.match(_O);t&&(n+=t.length);var i=e.lastIndexOf(CO);r=~i?e.length-i:r+e.length}function a(){var e={line:n,column:r};return function(t){return t.position=new o(e),l(),t}}function o(e){this.start=e,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function s(i){var a=Error(t.source+`:`+n+`:`+r+`: `+i);if(a.reason=i,a.filename=t.source,a.line=n,a.column=r,a.source=e,!t.silent)throw a}function c(t){var n=t.exec(e);if(n){var r=n[0];return i(r),e=e.slice(r.length),n}}function l(){c(vO)}function u(e){for(var t;t=d();)e.push(t);return e}function d(){var t=a();if(wO==e.charAt(0)&&TO==e.charAt(1)){for(var n=2;EO!=e.charAt(n)&&(TO!=e.charAt(n)||wO!=e.charAt(n+1));)++n;if(n+=2,EO===e.charAt(n-1))return s(`End of comment missing`);var o=e.slice(2,n-2);return r+=2,i(o),e=e.slice(n),r+=2,t({type:DO,comment:o})}}function f(){var e=a(),t=c(yO);if(t){if(d(),!c(bO))return s(`property missing ':'`);var n=c(xO),r=e({type:OO,property:t[0].replace(gO,EO).trim(),value:n?n[0].replace(gO,EO).trim():EO});return c(SO),r}}function p(){var e=[];u(e);for(var t;t=f();)e.push(t),u(e);return e}return l(),p()}function AO(e,t){let n=null;if(!e||typeof e!=`string`)return n;let r=kO(e),i=typeof t==`function`;return r.forEach(e=>{if(e.type!==`declaration`)return;let{property:r,value:a}=e;i?t(r,a,e):a&&(n??={},n[r]=a)}),n}var jO=NO(`end`),MO=NO(`start`);function NO(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function PO(e){let t=MO(e),n=jO(e);if(t&&n)return{start:t,end:n}}function FO(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?LO(e.position):`start`in e||`end`in e?LO(e):`line`in e||`column`in e?IO(e):``}function IO(e){return RO(e&&e.line)+`:`+RO(e&&e.column)}function LO(e){return IO(e&&e.start)+`-`+IO(e&&e.end)}function RO(e){return e&&typeof e==`number`?e:1}var zO=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=FO(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};Object.defineProperties(zO.prototype,{file:{configurable:!0,enumerable:!0,value:``,writable:!0},name:{configurable:!0,enumerable:!0,value:``,writable:!0},reason:{configurable:!0,enumerable:!0,value:``,writable:!0},message:{configurable:!0,enumerable:!0,value:``,writable:!0},stack:{configurable:!0,enumerable:!0,value:``,writable:!0},column:{configurable:!0,enumerable:!0,writable:!0},line:{configurable:!0,enumerable:!0,writable:!0},ancestors:{configurable:!0,enumerable:!0,writable:!0},cause:{configurable:!0,enumerable:!0,writable:!0},fatal:{configurable:!0,enumerable:!0,writable:!0},place:{configurable:!0,enumerable:!0,writable:!0},ruleId:{configurable:!0,enumerable:!0,writable:!0},source:{configurable:!0,enumerable:!0,writable:!0}});var BO={}.hasOwnProperty,VO=new Map,HO=/[A-Z]/g,UO=/-([a-z])/g,WO=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),GO=new Set([`td`,`th`]),KO=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function qO(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=ik(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=rk(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?mO:pO,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=JO(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function JO(e,t,n){if(t.type===`element`)return YO(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return XO(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return QO(e,t,n);if(t.type===`mdxjsEsm`)return ZO(e,t);if(t.type===`root`)return $O(e,t,n);if(t.type===`text`)return ek(e,t)}function YO(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=mO,e.schema=i),e.ancestors.push(t);let a=uk(e,t.tagName,!1),o=ak(e,t),s=sk(e,t);return WO.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!ND(e)})),tk(e,o,a,t),nk(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function XO(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}dk(e,t.position)}function ZO(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);dk(e,t.position)}function QO(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=mO,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:uk(e,t.name,!0),o=ok(e,t),s=sk(e,t);return tk(e,o,a,t),nk(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function $O(e,t,n){let r={};return nk(r,sk(e,t)),e.create(t,e.Fragment,r,n)}function ek(e,t){return t.value}function tk(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function nk(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function rk(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function ik(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=MO(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function ak(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&BO.call(t.properties,i)){let a=ck(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&GO.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function ok(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`){if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else dk(e,t.position)}else{let{name:i}=r,a;if(r.value&&typeof r.value==`object`){if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else dk(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function sk(e,t){let n=[],r=-1,i=e.passKeys?new Map:VO;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=JO(e,a,o);s!==void 0&&n.push(s)}return n}function ck(e,t,n){if(n==null||typeof n==`number`&&Number.isNaN(n))return;let r=uO(e.schema,t);return Array.isArray(n)&&(n=r.commaSeparated?DD(n):hO(n)),r.property===`style`?[`style`,typeof n==`object`?e.stylePropertyNameCase===`dom`?n:fk(n):lk(e,String(n))]:[e.elementAttributeNameCase===`react`&&r.space?oO[r.property]||r.property:r.attribute,n]}function lk(e,t){let n={};try{AO(t,function(t,r){if(t&&r){let i=t;i.slice(0,2)!==`--`&&(i=i.toLowerCase(),e.stylePropertyNameCase===`dom`&&(i.slice(0,4)===`-ms-`&&(i=i.slice(1)),i=i.replace(UO,hk))),n[i]=r}})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new zO("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=KO+`#cannot-parse-style-attribute`,r}return n}function uk(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=jD(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=jD(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return BO.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);dk(e)}function dk(e,t){let n=new zO("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=KO+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function fk(e){let t={},n;for(n in e)BO.call(e,n)&&(t[pk(n)]=e[n]);return t}function pk(e){if(e.slice(0,2)===`--`)return e;let t=e.replace(HO,mk);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function mk(e){return`-`+e.toLowerCase()}function hk(e,t){return t.toUpperCase()}var gk={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},_k={};function vk(e,t){let n=t||_k;return yk(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function yk(e,t,n){if(xk(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return bk(e.children,t,n)}return Array.isArray(e)?bk(e,t,n):``}function bk(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=yk(e[i],t,n);return r.join(``)}function xk(e){return!!(e&&typeof e==`object`)}var Sk=document.createElement(`i`);function Ck(e){let t=`&`+e+`;`;Sk.innerHTML=t;let n=Sk.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`?!1:n!==t&&n}function wk(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function Tk(e,t){return e.length>0?(wk(e,e.length,0,t),e):t}var Ek={}.hasOwnProperty;function Dk(e){let t={},n=-1;for(;++n<e.length;)Ok(t,e[n]);return t}function Ok(e,t){let n;for(n in t){let r=(Ek.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){Ek.call(r,a)||(r[a]=[]);let e=i[a];kk(r[a],Array.isArray(e)?e:e?[e]:[])}}}function kk(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);wk(e,0,0,r)}function Ak(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function jk(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var Mk=Wk(/[A-Za-z]/),Nk=Wk(/[\dA-Za-z]/),Pk=Wk(/[#-'*+\--9=?A-Z^-~]/);function Fk(e){return e!==null&&(e<32||e===127)}var Ik=Wk(/\d/),Lk=Wk(/[\dA-Fa-f]/),Rk=Wk(/[!-/:-@[-`{-~]/);function zk(e){return e!==null&&e<-2}function Bk(e){return e!==null&&(e<0||e===32)}function Vk(e){return e===-2||e===-1||e===32}var Hk=Wk(/\p{P}|\p{S}/u),Uk=Wk(/\s/);function Wk(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Gk(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&Nk(e.charCodeAt(n+1))&&Nk(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function Kk(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Vk(r)?(e.enter(n),s(r)):t(r)}function s(r){return Vk(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}function qk(e,t,n,r,i,a){let o=0;return s;function s(t){return a>0&&Vk(t)?(e.enter(r),c(t)):l(t)}function c(t){return Vk(t)&&o<a?(e.consume(t),o++,c):(e.exit(r),l(t))}function l(e){return o>=i?t(e):n(e)}}var Jk={tokenize:Yk};function Yk(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null)e.consume(n);else return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Kk(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null)e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);else return zk(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Xk=class{constructor(){this.index=new Map,this.map=[]}add(e,t,n){Zk(this,e,t,n,!1)}addBefore(e,t,n){Zk(this,e,t,n,!0)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0,this.index.clear()}};function Zk(e,t,n,r,i){if(n===0&&r.length===0)return;let a=e.index.get(t);if(a){a[1]+=n,i?(r.push(...a[2]),a[2]=r):a[2].push(...r);return}let o=[t,n,r];e.map.push(o),e.index.set(t,o)}var Qk={tokenize:eA},$k={tokenize:tA};function eA(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;let c=new Xk;return c.add(a+1,0,t.events.slice(n)),c.add(n,s-n,[]),c.consume(t.events),l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!(!i.currentConstruct||i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check($k,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt($k,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null)i&&v(),_(0),e.consume(n);else return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null)g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);else return zk(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;let l=new Xk;l.add(a+1,0,t.events.slice(n)),l.add(n,e-n,[]),l.consume(t.events)}}function _(r){let i=n.length;for(;i-->r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function tA(e,t,n){return Kk(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function nA(e){if(e===null||Bk(e)||Uk(e))return 1;if(Hk(e))return 2}function rA(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var iA={name:`attention`,resolveAll:aA,tokenize:oA};function aA(e,t){let n=-1,r;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){let i=n;for(;i--;)if(e[i][0]===`exit`&&e[i][1].type===`attentionSequence`&&e[i][1]._open&&t.sliceSerialize(e[i][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[i][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;let a=e[i][1].end.offset-e[i][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1,o={...e[i][1].end},s={...e[n][1].start};sA(o,-a),sA(s,a);let c={type:a>1?`strongSequence`:`emphasisSequence`,start:o,end:{...e[i][1].end}},l={type:a>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:s},u={type:a>1?`strongText`:`emphasisText`,start:{...e[i][1].end},end:{...e[n][1].start}},d={type:a>1?`strong`:`emphasis`,start:{...c.start},end:{...l.end}};e[i][1].end={...c.start},e[n][1].start={...l.end},r=[],e[i][1].end.offset-e[i][1].start.offset&&(r=Tk(r,[[`enter`,e[i][1],t],[`exit`,e[i][1],t]])),r=Tk(r,[[`enter`,d,t],[`enter`,c,t],[`exit`,c,t],[`enter`,u,t]]),r=Tk(r,rA(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),r=Tk(r,[[`exit`,u,t],[`enter`,l,t],[`exit`,l,t],[`exit`,d,t]]);let f=0;e[n][1].end.offset-e[n][1].start.offset&&(f=2,r=Tk(r,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])),wk(e,i-1,n-i+3,r),n=i+r.length-f-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function oA(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=nA(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=nA(o),u=!l||l===2&&i||n.includes(o)&&o!==42&&o!==95,d=!i||i===2&&l||n.includes(r)&&r!==42&&r!==95;return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function sA(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var cA={name:`autolink`,tokenize:lA};function lA(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return Mk(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||Nk(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||Nk(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||Fk(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):Pk(t)?(e.consume(t),l):n(t)}function u(e){return Nk(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||Nk(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var uA={partial:!0,tokenize:dA};function dA(e,t,n){return r;function r(t){return Vk(t)?Kk(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||zk(e)?t(e):n(e)}}var fA={continuation:{tokenize:mA},exit:hA,name:`blockQuote`,tokenize:pA};function pA(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return Vk(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function mA(e,t,n){let r=this;return i;function i(t){return Vk(t)?Kk(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(fA,t,n)(r)}}function hA(e){e.exit(`blockQuote`)}var gA={name:`characterEscape`,tokenize:_A};function _A(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return Rk(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var vA={name:`characterReference`,tokenize:yA};function yA(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=Nk,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=Lk,u):(e.enter(`characterReferenceValue`),a=7,o=Ik,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===Nk&&!Ck(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var bA={partial:!0,tokenize:xA};function xA(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var SA={concrete:!0,name:`codeFenced`,tokenize:CA};function CA(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),Vk(t)?Kk(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||zk(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(bA,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||zk(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):Vk(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),Kk(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||zk(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||zk(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&Vk(t)?Kk(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||zk(t)?e.check(bA,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||zk(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Vk(t)?Kk(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Vk(t)?Kk(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||zk(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}var wA={name:`codeIndented`,tokenize:EA},TA={partial:!0,tokenize:DA};function EA(e,t,n){return r;function r(t){return e.enter(`codeIndented`),qk(e,i,n,`linePrefix`,4,4)(t)}function i(t){return t===null?o(t):zk(t)?e.attempt(TA,i,o)(t):(e.enter(`codeFlowValue`),a(t))}function a(t){return t===null||zk(t)?(e.exit(`codeFlowValue`),i(t)):(e.consume(t),a)}function o(n){return e.exit(`codeIndented`),t(n)}}function DA(e,t,n){let r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):zk(o)?(e.enter(`lineEnding`),e.consume(o),e.exit(`lineEnding`),i):qk(e,t,a,`linePrefix`,4,4)(o)}function a(e){return zk(e)?i(e):n(e)}}var OA={name:`codeText`,previous:AA,resolve:kA,tokenize:jA};function kA(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function AA(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function jA(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):zk(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||zk(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var MA=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&NA(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),NA(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),NA(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0)){if(e<this.left.length){let t=this.left.splice(e,1/0);NA(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);NA(this.left,t.reverse())}}}};function NA(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function PA(e){let t={},n=-1,r,i,a,o,s,c,l,u=new MA(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,FA(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(o[1].type!==`linePrefix`&&o[1].type!==`listItemIndent`)break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return wk(e,0,1/0,u.slice(0)),!l}function FA(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var IA={resolve:RA,tokenize:zA},LA={partial:!0,tokenize:BA};function RA(e){return PA(e),e}function zA(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):zk(t)?e.check(LA,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function BA(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Kk(e,a,`linePrefix`)}function a(i){if(i===null||zk(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function VA(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||Fk(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||zk(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||Bk(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||Fk(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function HA(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):zk(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||zk(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Vk(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function UA(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):zk(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Kk(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||zk(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function WA(e,t){let n;return r;function r(i){return zk(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Vk(i)?Kk(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var GA={name:`definition`,tokenize:qA},KA={partial:!0,tokenize:JA};function qA(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return HA.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=jk(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return Bk(t)?WA(e,l)(t):l(t)}function l(t){return VA(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(KA,d,d)(t)}function d(t){return Vk(t)?Kk(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||zk(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function JA(e,t,n){return r;function r(t){return Bk(t)?WA(e,i)(t):n(t)}function i(t){return UA(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Vk(t)?Kk(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||zk(e)?t(e):n(e)}}var YA={name:`hardBreakEscape`,tokenize:XA};function XA(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return zk(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var ZA={name:`headingAtx`,resolve:QA,tokenize:$A};function QA(e,t){let n=e.length-2,r=3;if(e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r){let i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`};wk(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])}return e}function $A(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||Bk(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||zk(n)?(e.exit(`atxHeading`),t(n)):Vk(n)?Kk(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||Bk(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var ej=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),tj=[`pre`,`script`,`style`,`textarea`],nj={concrete:!0,name:`htmlFlow`,resolveTo:ij,tokenize:aj},rj={partial:!0,tokenize:oj};function ij(e){let t=e.length;for(;t--&&(e[t][0]!==`enter`||e[t][1].type!==`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function aj(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:I):Mk(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):Mk(a)?(e.consume(a),i=4,r.interrupt?t:I):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:I):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return Mk(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||Bk(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&tj.includes(l)?(i=1,r.interrupt?t(s):O(s)):ej.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||Nk(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return Vk(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||Mk(t)?(e.consume(t),b):Vk(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||Nk(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Vk(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Vk(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||zk(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||Bk(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Vk(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||zk(t)?O(t):Vk(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),N):t===62&&i===4?(e.consume(t),L):t===63&&i===3?(e.consume(t),I):t===93&&i===5?(e.consume(t),F):zk(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(rj,R,k)(t)):t===null||zk(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(bA,A,R)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||zk(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),I):O(t)}function N(t){return t===47?(e.consume(t),o=``,P):O(t)}function P(t){if(t===62){let n=o.toLowerCase();return tj.includes(n)?(e.consume(t),L):O(t)}return Mk(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),P):O(t)}function F(t){return t===93?(e.consume(t),I):O(t)}function I(t){return t===62?(e.consume(t),L):t===45&&i===2?(e.consume(t),I):O(t)}function L(t){return t===null||zk(t)?(e.exit(`htmlFlowData`),R(t)):(e.consume(t),L)}function R(n){return e.exit(`htmlFlow`),t(n)}}function oj(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(uA,t,n)}}var sj={name:`htmlText`,tokenize:cj};function cj(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):Mk(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):Mk(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):zk(t)?(o=d,N(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):zk(t)?(o=h,N(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):zk(t)?(o=v,N(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):zk(t)?(o=y,N(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return Mk(t)?(e.consume(t),S):n(t)}function S(t){return t===45||Nk(t)?(e.consume(t),S):C(t)}function C(t){return zk(t)?(o=C,N(t)):Vk(t)?(e.consume(t),C):M(t)}function w(t){return t===45||Nk(t)?(e.consume(t),w):t===47||t===62||Bk(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||Mk(t)?(e.consume(t),E):zk(t)?(o=T,N(t)):Vk(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||Nk(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):zk(t)?(o=D,N(t)):Vk(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):zk(t)?(o=O,N(t)):Vk(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):zk(t)?(o=k,N(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||Bk(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||Bk(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function N(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),P}function P(t){return Vk(t)?Kk(e,F,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):F(t)}function F(t){return e.enter(`htmlTextData`),o(t)}}var lj={name:`labelEnd`,resolveAll:pj,resolveTo:mj,tokenize:hj},uj={tokenize:gj},dj={tokenize:_j},fj={tokenize:vj};function pj(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&wk(e,0,e.length,n),e}function mj(e,t){let n=e.length,r=0,i,a,o;for(;n--;){let t=e[n][1];if(i){if(t.type===`link`||t.type===`labelLink`&&t._inactive)break;e[n][0]===`enter`&&t.type===`labelLink`&&(t._inactive=!0)}else if(a){if(e[n][0]===`enter`&&(t.type===`labelImage`||t.type===`labelLink`)&&!t._balanced&&(i=n,t.type!==`labelLink`)){r=2;break}}else t.type===`labelEnd`&&(a=n)}let s={type:e[i][1].type===`labelLink`?`link`:`image`,start:{...e[i][1].start},end:{...e[e.length-1][1].end}},c={type:`label`,start:{...e[i][1].start},end:{...e[a][1].end}},l={type:`labelText`,start:{...e[i+r+2][1].end},end:{...e[a-2][1].start}};return o=[[`enter`,s,t],[`enter`,c,t]],o=Tk(o,e.slice(i+1,i+r+3)),o=Tk(o,[[`enter`,l,t]]),o=Tk(o,rA(t.parser.constructs.insideSpan.null,e.slice(i+r+4,a-3),t)),o=Tk(o,[[`exit`,l,t],e[a-2],e[a-1],[`exit`,c,t]]),o=Tk(o,e.slice(a+1)),o=Tk(o,[[`exit`,s,t]]),wk(e,i,e.length,o),e}function hj(e,t,n){let r=this,i=r._labelStarts,a,o;if(i){for(;i.length>0&&i[i.length-1]._balanced;)i.pop();a=i[i.length-1]}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(jk(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(uj,u,o?u:d)(t):t===91?e.attempt(dj,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(fj,u,d)(t)}function u(e){return i.pop(),t(e)}function d(e){return a._balanced=!0,n(e)}}function gj(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return Bk(t)?WA(e,a)(t):a(t)}function a(t){return t===41?u(t):VA(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return Bk(t)?WA(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?UA(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return Bk(t)?WA(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function _j(e,t,n){let r=this;return i;function i(t){return HA.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(jk(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function vj(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var yj={name:`labelStartImage`,resolveAll:lj.resolveAll,tokenize:bj};function bj(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),o}function o(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelImage`),s):n(t)}function s(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var xj={name:`labelStartLink`,resolveAll:lj.resolveAll,tokenize:Sj};function Sj(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelLink`),o}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var Cj={name:`lineEnding`,tokenize:wj};function wj(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Kk(e,t,`linePrefix`)}}var Tj={name:`thematicBreak`,tokenize:Ej};function Ej(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||zk(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Vk(t)?Kk(e,s,`whitespace`)(t):s(t))}}var Dj={continuation:{tokenize:jj},exit:Nj,name:`list`,tokenize:Aj},Oj={partial:!0,tokenize:Pj},kj={partial:!0,tokenize:Mj};function Aj(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:Ik(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(Tj,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return Ik(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(uA,r.interrupt?n:u,e.attempt(Oj,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Vk(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function jj(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(uA,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Kk(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Vk(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(kj,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,Kk(e,e.attempt(Dj,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function Mj(e,t,n){let r=this;return Kk(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function Nj(e){e.exit(this.containerState.type)}function Pj(e,t,n){let r=this;return Kk(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Vk(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var Fj={name:`setextUnderline`,resolveTo:Ij,tokenize:Lj};function Ij(e,t){let n=new Xk,r=e.length,i,a,o;for(;r--;)if(e[r][0]===`enter`){if(e[r][1].type===`content`){i=r;break}e[r][1].type===`paragraph`&&(a=r)}else e[r][1].type===`content`&&n.add(r,1,[]),!o&&e[r][1].type===`definition`&&(o=r);let s={type:`setextHeading`,start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type=`setextHeadingText`,o?(n.add(a,0,[[`enter`,s,t]]),n.add(o+1,0,[[`exit`,e[i][1],t]]),e[i][1].end={...e[o][1].end}):e[i][1]=s,n.add(e.length,0,[[`exit`,s,t]]),n.consume(e),e}function Lj(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Vk(t)?Kk(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||zk(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var Rj={tokenize:zj};function zj(e){let t=this,n=e.attempt(uA,r,e.attempt(this.parser.constructs.flowInitial,i,Kk(e,e.attempt(this.parser.constructs.flow,i,e.attempt(IA,i)),`linePrefix`)));return n;function r(r){if(r===null)e.consume(r);else return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null)e.consume(r);else return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var Bj={resolveAll:Wj()},Vj=Uj(`string`),Hj=Uj(`text`);function Uj(e){return{resolveAll:Wj(e===`text`?Gj:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null)t.consume(e);else return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function Wj(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function Gj(e,t){let n=new Xk,r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type===`lineEnding`)&&e[r-1][1].type===`data`){let i=e[r-1][1],a=t.sliceStream(i),o=a.length,s=-1,c=0,l;for(;o--;){let e=a[o];if(typeof e==`string`){for(s=e.length;e.charCodeAt(s-1)===32;)c++,s--;if(s)break;s=-1}else if(e===-2)l=!0,c++;else if(e!==-1){o++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(c=0),c){let a={type:r===e.length||l||c<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:o?s:i.start._bufferIndex+s,_index:i.start._index+o,line:i.end.line,column:i.end.column-c,offset:i.end.offset-c},end:{...i.end}};i.end={...a.start},i.start.offset===i.end.offset?Object.assign(i,a):n.add(r,0,[[`enter`,a,t],[`exit`,a,t]])}r++}return n.consume(e),e}var Kj=s({attentionMarkers:()=>eM,contentInitial:()=>Jj,disable:()=>tM,document:()=>qj,flow:()=>Xj,flowInitial:()=>Yj,insideSpan:()=>$j,string:()=>Zj,text:()=>Qj}),qj={42:Dj,43:Dj,45:Dj,48:Dj,49:Dj,50:Dj,51:Dj,52:Dj,53:Dj,54:Dj,55:Dj,56:Dj,57:Dj,62:fA},Jj={91:GA},Yj={[-2]:wA,[-1]:wA,32:wA},Xj={35:ZA,42:Tj,45:[Fj,Tj],60:nj,61:Fj,95:Tj,96:SA,126:SA},Zj={38:vA,92:gA},Qj={[-5]:Cj,[-4]:Cj,[-3]:Cj,33:yj,38:vA,42:iA,60:[cA,sj],91:xj,92:[YA,gA],93:lj,95:iA,96:OA},$j={null:[iA,Bj]},eM={null:[42,95]},tM={null:[]};function nM(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=Tk(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=rA(a,l.events,l),l.events):[]}function f(e,t){return iM(p(e),t)}function p(e){return rM(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){for(;r._index<o.length;){let e=o[r._index];if(typeof e==`string`){let t=r._index;for(r._bufferIndex<0&&(r._bufferIndex=0);r._index===t&&r._bufferIndex<e.length;)_(e.charCodeAt(r._bufferIndex))}else _(e)}}function _(e){u=u(e)}function v(e){zk(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&wk(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function rM(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function iM(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
57
+ `),endPos:i.end}:null}function hv(e,t,n){uv=0;var r=Gh;Gh=n,e=Fm(e),D_=e.length*16+E_,!t.refs&&(t.refs=Object.create(null)),(n.optimizeForStreaming||t.inline)&&(t.B=ug(e,t.refs,n));var i,a;t.o||(t.o=i=[],t.r=a=[]);let o=pv(e,t,n);if(i&&a){for(var s=i,c={inline:t.inline,inAnchor:t.inAnchor,inHTML:t.inHTML,htmlDepth:t.d,inList:t.inList,inBlockQuote:t.inBlockQuote,noSetext:t.m,depth:t.p,notAtEdge:t.f},l=0;l<s.length;l++){var u=s[l];t.inline=u.inline,t.inAnchor=u.inAnchor,t.inHTML=u.inHTML,t.d=u.htmlDepth,t.inList=u.inList,t.inBlockQuote=u.inBlockQuote,t.m=u.noSetext,t.p=u.depth,t.f=u.notAtEdge,t.l=u.breaks;var d=dv(u.text,0,u.text.length,t,n);t.l=!1;for(var f=0;f<d.length;f++)u.dest.push(d[f])}t.inline=c.inline,t.inAnchor=c.inAnchor,t.inHTML=c.inHTML,t.d=c.htmlDepth,t.inList=c.inList,t.inBlockQuote=c.inBlockQuote,t.m=c.noSetext,t.p=c.depth,t.f=c.notAtEdge;for(var p=a,m=0;m<p.length;m++)for(var h=p[m],g=0;g<h.src.length;g++){var _=h.src[g];if(h.unwrap&&_.type===Q.paragraph)for(var v=_.children,y=0;y<v.length;y++)h.dest.push(v[y]);else h.dest.push(_)}t.o=void 0,t.r=void 0,t_!==null&&a_(),ev(o,t,n.slugify)}return Gh=r,Vm(t.refs)?[{type:Q.refCollection,refs:t.refs},...o]:o}var gv;try{_v=v.createElement(`div`),gv=typeof _v==`object`&&_v&&`$$typeof`in _v&&typeof _v.$$typeof==`symbol`?_v.$$typeof:Symbol.for(`react.transitional.element`)}catch{gv=Symbol.for(`react.transitional.element`)}var _v;function vv(e,t,n){return{$$typeof:gv,type:e,key:n==null?null:String(n),ref:null,props:t,_owner:null,_store:{},_debugStack:null,_debugTask:null}}function yv(e,t){var n={key:e};if(t){var r=rm(t);for(var i in r)n[i]=r[i]}return n}var bv=typeof v.createContext>`u`?void 0:v.createContext(void 0);function xv(e,t,n,r,i,a,o,s,c){switch(e.type){case Q.blockQuote:{let i={key:n.key};return e.alert&&(i.className=`markdown-alert-${a(e.alert.toLowerCase(),ym)}`,e.children.unshift(Hm(e.alert))),r(`blockquote`,i,t(e.children,n))}case Q.breakLine:return r(`br`,{key:n.key});case Q.breakThematic:return r(`hr`,{key:n.key});case Q.frontmatter:return s.preserveFrontmatter?r(`pre`,{key:n.key},e.text):null;case Q.codeBlock:{let t=e.lang?sm(e.lang):``;var l=e.attrs?rm(lh(`code`,e.attrs,s.overrides)):{};return l.className=t?`language-${t} lang-${t}`:``,r(`pre`,{key:n.key},r(`code`,l,e.text))}case Q.codeInline:return r(`code`,{key:n.key},e.text);case Q.footnoteReference:return r(`a`,{key:n.key,href:i(e.target,`a`,`href`)||void 0},r(`sup`,null,e.text));case Q.gfmTask:return r(`input`,{checked:e.completed,key:n.key,readOnly:!0,type:`checkbox`});case Q.heading:return r(`h${e.level}`,{id:e.id,key:n.key},t(e.children,n));case Q.htmlBlock:{let a=e;if($m(s)&&mh(a.tag)){var u=Zm(a);return u.kind===`literal`?r(`span`,{key:n.key},u.literal):r(`span`,{key:n.key},...Qm(u.open,a.children?t(a.children,n):null,u.close))}let l=a.k,g=l!==void 0,_=g?l:a.b?a.e||``:(a.e||``)+(a.j||``);if(_&&a.c){let r=Fh(a.tag.toLowerCase()),l=a.children,u=l!=null&&l.length>0;if(r){let t=(g?a.text:a.e)||``,r=$m(s)?_h(t):t;if(/<[a-z][^>]{0,100}>/i.test(t)){var d=yv(n.key,e.attrs);return d.dangerouslySetInnerHTML={__html:r},c(e.tag,d)}return c(e.tag,yv(n.key,e.attrs),gh(e.tag,r))}let y=RegExp(`^<${a.tag}(\\s|>)`,`i`);if(u&&!y.test(_)&&$m(s)&&hh(_))return c(e.tag,yv(n.key,e.attrs),t(l,n));if(Ih(_)){let t=$m(s)?_h(_):_;var f=yv(n.key,e.attrs);return f.dangerouslySetInnerHTML={__html:t},c(e.tag,f)}let b=vh({overrides:s.overrides,slugify:s.slugify,sanitizer:i,tagfilter:!0}),x=zm(a.h||_);if(RegExp(`^<${a.tag}(\\s[^>]*)?>(\\s*</${a.tag}>)?$`,`i`).test(x))return a.children&&a.children.length>0?c(e.tag,yv(n.key,e.attrs),t(a.children,n)):c(e.tag,yv(n.key,e.attrs));let S=hv(x,{inline:!1,refs:o,inHTML:!1},b);if(Km(S),qm(S,x))return x;let C=a.tag.toLowerCase(),w=g;if(w&&u)return c(e.tag,yv(n.key,e.attrs),t(l,n));if(w)return t(S.flatMap(Gm),n);var p=Jm(S,C);if(p.found&&p.afterClose.length>0){var m=p.beforeClose.flatMap(Gm),h=p.afterClose.flatMap(Gm);return vv(v.Fragment,{children:[c(e.tag,yv(n.key,e.attrs),t(m,n)),t(h,n)]},n.key)}return c(e.tag,yv(n.key,e.attrs),t(S.flatMap(Gm),n))}return Sm(e.tag)?c(e.tag,yv(n.key,e.attrs)):c(e.tag,yv(n.key,e.attrs),e.children?t(e.children,n):``)}case Q.htmlSelfClosing:{let t=e;if($m(s)&&mh(t.tag)){var g=Zm(t);return r(`span`,{key:n.key},g.kind===`literal`?g.literal:g.open+(g.close||``))}return c(e.tag,yv(n.key,e.attrs))}case Q.image:{let t=e.target===null?null:i(e.target,`img`,`src`);return r(`img`,{key:n.key,alt:e.alt&&e.alt.length>0?e.alt:void 0,title:e.title||void 0,src:t||void 0})}case Q.link:{let a={key:n.key};if(e.target!=null){let t=eh(e.target,i,`a`,`href`);t!=null&&(a.href=t)}return e.title&&(a.title=e.title),r(`a`,a,t(e.children,n))}case Q.table:{let i=e;return r(`table`,{key:n.key},r(`thead`,{key:`thead`},r(`tr`,null,i.header.map(function(e,a){return r(`th`,{key:a,style:i.align[a]===null?{}:{textAlign:i.align[a]}},t(e,n))}))),i.cells.length>0&&r(`tbody`,{key:`tbody`},i.cells.map(function(e,a){return r(`tr`,{key:a},e.map(function(e,a){return r(`td`,{key:a,style:i.align[a]===null?{}:{textAlign:i.align[a]}},t(e,n))}))})))}case Q.text:return e.text;case Q.textFormatted:return r(e.tag,{key:n.key},t(e.children,n));case Q.orderedList:case Q.unorderedList:return r(e.type===Q.orderedList?`ol`:`ul`,{key:n.key,start:e.type===Q.orderedList?e.start:void 0},e.items.map(function(e,i){return r(`li`,{key:i},t(e,n))}));case Q.paragraph:return r(`p`,{key:n.key},t(e.children,n));case Q.ref:return null;default:return null}}var Sv=(e,t,n,r,i,a,o)=>{var s=e=>e.map(e=>`text`in e?e.text:``),c=(l,u={})=>{var d=Array.isArray(l)?l:[l],f=(u.renderDepth||0)+1;if(f>2500)return s(d);u.renderDepth=f;for(var p=u.key,m=[],h=!1,g=0;g<d.length;g++){u.key=g;var _=e?e(xv.bind(null,d[g],c,u,t,n,r,i,a,o),d[g],c,u):xv(d[g],c,u,t,n,r,i,a,o),v=typeof _==`string`;if(h&&typeof _==`string`){var y=m.at(-1);m[m.length-1]=(typeof y==`string`?y:``)+_}else if(_!=null){if(Array.isArray(_))for(var b=0;b<_.length;b++)m.push(_[b]);else m.push(_)}h=v}return u.key=p,u.renderDepth=f-1,m};return c},Cv=(e,t)=>{let n=oh(t,e,void 0);return n?typeof n==`function`||typeof n==`object`&&`render`in n?n:oh(t,`${e}.component`,e):e};function wv(e,t){let n={...t||{}};n.overrides=n.overrides||{};let r=n.slugify||ym,i=n.sanitizer||hm,a=n.createElement,o=Vm(n.overrides),s=e=>Tv(e,{...n,wrapper:null});function c(e){for(var t in e){var n=e[t];if(typeof n==`string`&&n.length>0&&n.charCodeAt(0)===up&&(yh.test(n)||bh.test(n)||mv(n,0))){var r=s(n.trim());e[t]=t===`innerHTML`&&Array.isArray(r)?r[0]:r}}}function l(e,t,...r){var i=t||{},s=e;if(o){var c=oh(n.overrides,`${e}.props`,{});s=Cv(e,n.overrides),i={...i,...c,className:dh(i.className,c.className)||void 0},typeof s==`string`&&Sm(s)&&(delete i.children,r.length=0)}if(!a){var l=i.key;return l!=null&&delete i.key,r.length===1?i.children=r[0]:r.length>1&&(i.children=r),vv(s,i,l)}return a(s,i,...r)}function u(e,t,...r){var i=t&&lh(e,t,n.overrides);if(i){if(typeof i.children==`string`){var a=i.dangerouslySetInnerHTML===void 0?am(i.children,r):void 0;delete i.children,a!==void 0&&(r=[a])}c(i)}return l(e,i,...r)}let d=vh(n,n.forceInline),f=e[0]&&e[0].type===Q.refCollection?e[0].refs:Object.create(null),p=Sv(n.renderRule,l,i,r,f,n,u),m=p(e,{inline:n.forceInline,refs:f}),h=th(f);if(h.length>0&&m.push(l(`footer`,{key:`footer`},h.map(function(e){let t=e.identifier.charCodeAt(0)===tp?e.identifier.slice(1):e.identifier,n=hv(e.footnote,{inline:!0,refs:f},d);return l(`div`,{id:r(t,ym),key:e.identifier},`${t}: `,p(n,{inline:!0,refs:f}))}))),n.wrapper===null)return m;let g=n.wrapper||(n.forceInline?`span`:`div`),_;if(m.length>1||n.forceWrapper)_=m;else return m.length===1?m[0]:null;var v=n.wrapperProps?{...n.wrapperProps}:{};return v.children=_,vv(g,v,`outer`)}function Tv(e=``,t={}){let n={...t||{}};n.overrides=n.overrides||{},n.slugify,n.sanitizer;function r(e){let t=n.forceInline||!(n.forceBlock||om.test(e)),r=vh(n,t);return wv(hv(t?e:Wm(e),{inline:t,refs:i},r),{...n,forceInline:t})}let i=Object.create(null);return r(e)}function Ev(e){let t=v.useRef(e),n=t.current;if(n!==e){var r=!0,i=0;for(var a in e)if(i++,!Object.is(n[a],e[a])){r=!1;break}if(r){var o=0;for(var s in n)o++;r=o===i}r||(t.current=e)}return t.current}var Dv=({children:e,options:t,...n})=>{if(typeof v.useContext>`u`){let r={...t,overrides:{...t?.overrides},wrapperProps:{...t?.wrapperProps,...n}};return Tv(e??``,r)}let r=bv?v.useContext(bv):void 0,i=Ev(n),a=v.useMemo(()=>({...r,...t,overrides:{...r?.overrides,...t?.overrides},wrapperProps:{...r?.wrapperProps,...t?.wrapperProps,...i}}),[r,t,i]),o=e??``;return v.useMemo(()=>Tv(o,a),[o,a])},Ov=[`communicator`,`builder`,`grunt`],kv=[`decompose`,`replan`],Av=e=>e.id??[e.agent,e.model,e.effort].filter(Boolean).join(`/`),jv=e=>`${e.repo} ${e.id}`,Mv=e=>e!==void 0&&e.step!==`merged`&&e.step!==`skipped`,Nv=e=>e.notes.findLast(e=>e.kind===`factory`&&e.url?.includes(`/pull/`))?.url??e.attempts.findLast(e=>e.url?.includes(`/pull/`))?.url,Pv=e=>e.state===`OPEN`&&!e.draft&&e.conflicts===!1&&(e.checks===`passing`||e.checks===`none`),Fv=e=>e.state===`OPEN`&&e.conflicts===!0&&!e.fork;function Iv(e){let t=new Map;for(let n of e.values())for(let e of n.after)t.set(e,[...t.get(e)??[],n]);let n=new Map,r=e=>{let i=n.get(e.id);if(i!==void 0)return i;n.set(e.id,0);let a=e.state!==`done`&&e.state!==`removed`,o=(t.get(e.id)??[]).map(r),s=+!!a+Math.max(0,...o);return n.set(e.id,s),s};for(let t of e.values())r(t);return n}function Lv(e){let t=new Map(e.map(e=>[e.id,e])),n=new Map,r=(e,i=new Set)=>{let a=n.get(e.id);if(a!==void 0)return a;if(i.has(e.id))return 0;i.add(e.id);let o=Math.max(-1,...e.after.flatMap(e=>t.get(e)?[r(t.get(e),i)]:[]))+1;return n.set(e.id,o),o};for(let t of e)r(t);return n}function Rv(e){let t=new Map(e.map(e=>[e.id,e])),n=Iv(t),r=new Map,i=e=>{let n=r.get(e.id);if(n!==void 0)return n;r.set(e.id,0);let a=+(e.state!==`done`&&e.state!==`removed`)+Math.max(0,...e.after.flatMap(e=>t.has(e)?[i(t.get(e))]:[]));return r.set(e.id,a),a},a=e=>i(e)+(n.get(e.id)??0)-1,o=e.filter(e=>e.state!==`done`&&e.state!==`removed`),s=Math.max(0,...o.map(a));return new Set(o.filter(e=>s>0&&a(e)===s).map(e=>e.id))}var zv=v.createContext(void 0);function Bv(e){let t=v.useContext(zv);if(!e&&t===void 0)throw Error(J(27));return t}var Vv=v.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,s=Bv(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return Hi(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:Nt,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),Hv=v.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,c=Bv(),l=c.useState(`open`),{getButtonProps:u,buttonRef:d}=pf({disabled:a,native:o}),f={disabled:a};function p(e){l&&c.setOpen(!1,Jt(nn,e.nativeEvent))}return Hi(`button`,e,{state:f,ref:[t,d],props:[{onClick:p},s,u]})}),Uv=v.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=Bv(),c=lc(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),Hi(`p`,e,{ref:t,props:[{id:c},o]})}),Wv=v.createContext(void 0);function Gv(){let e=v.useContext(Wv);if(e===void 0)throw Error(J(26));return e}var Kv=`ArrowUp`,qv=`ArrowDown`,Jv=`ArrowLeft`,Yv=`ArrowRight`,Xv=new Set([Kv,qv,Jv,Yv,`Home`,`End`]),Zv=[`Shift`,`Control`,`Alt`,`Meta`];function Qv(e){return Be(e)&&e.tagName===`INPUT`}function $v(e){return!!(Qv(e)&&e.selectionStart!=null||Be(e)&&e.tagName===`TEXTAREA`)}function ey(e,t,n,r){if(!e||!t||!t.scrollTo)return;let i=e.scrollLeft,a=e.scrollTop,o=e.clientWidth<e.scrollWidth,s=e.clientHeight<e.scrollHeight;if(o&&r!==`vertical`){let r=ty(e,t,`left`),a=ny(e),o=ny(t);n===`ltr`&&(r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight?i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight:r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft&&(i=r-o.scrollMarginLeft-a.scrollPaddingLeft)),n===`rtl`&&(r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft?i=r-o.scrollMarginLeft-a.scrollPaddingLeft:r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight&&(i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight))}if(s&&r!==`horizontal`){let n=ty(e,t,`top`),r=ny(e),i=ny(t);n-i.scrollMarginTop<e.scrollTop+r.scrollPaddingTop?a=n-i.scrollMarginTop-r.scrollPaddingTop:n+t.offsetHeight+i.scrollMarginBottom>e.scrollTop+e.clientHeight-r.scrollPaddingBottom&&(a=n+t.offsetHeight+i.scrollMarginBottom-e.clientHeight+r.scrollPaddingBottom)}e.scrollTo({left:i,top:a,behavior:`auto`})}function ty(e,t,n){let r=n===`left`?`offsetLeft`:`offsetTop`,i=0;for(;t.offsetParent&&(i+=t[r],t.offsetParent!==e);)t=t.offsetParent;return i}function ny(e){let t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}var ry=`--nested-dialogs`,iy=`data-nested-dialog-open`,ay={...Mt,...yt,nestedDialogOpen(e){return e?{[iy]:``}:null}},oy=v.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,c=Bv(),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`),C=d.useState(`floatingId`);Gv(),Ra({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let w=o===void 0?Va(c.context.popupRef):o,T=g>0,E=c.useStateSetter(`popupElement`),D=Hi(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:T},props:[f,{id:C,"aria-labelledby":y,"aria-describedby":l,role:x,...Ba,hidden:!m,onKeyDown(e){Xv.has(e.key)&&e.stopPropagation()},style:{[ry]:g}},s],ref:[t,c.context.popupRef,E],stateAttributesMapping:ay});return(0,S.jsx)(Ca,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:w,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:D})}),sy=v.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,S.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),cy=v.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=Bv(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,S.jsx)(Wv.Provider,{value:n,children:(0,S.jsxs)(ia,{ref:t,...r,children:[a&&o===!0&&(0,S.jsx)(sy,{ref:i.context.internalBackdropRef,inert:Kc(!s)}),e.children]})}):null}),ly={},uy={},dy=``;function fy(e,t){return He(e)?e:t}function py(e,t,n){return/hidden|clip/.test(e.getComputedStyle(fy(t,n)).overflowY)}function my(e){if(typeof document>`u`)return!1;let t=Un(e);return Ie(t).innerWidth-t.documentElement.clientWidth>0}function hy(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=Un(e),n=t.documentElement,r=t.body,i=fy(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 gy(e){let t=Un(e),n=t.documentElement,r=t.body,i=fy(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 _y(e){let t=Un(e),n=t.documentElement,r=t.body,i=Ie(n),a=0,o=0,s=!1,c=Vn.create();if(we&&(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,ly={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},dy=n.style.scrollBehavior,uy={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=fy(n,r);s=hy(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,ly),Object.assign(r.style,uy),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=dy)}function d(){u(),c.request(l)}l();let f=wn(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var vy=new class{lockCount=0;restore=null;timeoutLock=de.create();timeoutUnlock=de.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=Un(e),n=t.documentElement,r=t.body,i=Ie(n);if(py(i,n,r)){let t=new i.MutationObserver(()=>{py(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=ye||!my(e);this.restore=a?gy(e):_y(e)}};function yy(e=!0,t=null){q(()=>{if(e)return vy.acquire(t)},[e,t])}function by({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`mounted`),a=e.useState(`disablePointerDismissal`),o=e.useState(`modal`),s=e.useState(`popupElement`),c=e.useState(`floatingRootContext`),[l,u]=v.useState(0),[d,f]=v.useState(0),p=l===0,m=Aa(c,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:o===`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=ct(t);if(p&&!a){if(o){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||ot(n,s)&&!n?.hasAttribute(`data-base-ui-portal`):!0}return!0}return!1},escapeKey:p});return yy(r&&o===!0,s),e.useContextCallback(`onNestedDialogOpen`,(t,n)=>{(e.select(`open`)||e.select(`mounted`))&&(u(t),f(n))}),q(()=>{!r&&!i&&(u(0),f(0))},[r,i]),q(()=>(t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(l+1,d+ +!!n),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,l,d,t]),Qa(e,{activeTriggerProps:m.reference,inactiveTriggerProps:m.trigger,popupProps:m.floating,nestedOpenDialogCount:l,nestedOpenDrawerCount:d}),null}var xy={...Co,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},Sy=class extends mo{constructor(e,t,n){let r=new eo,i=Cy(e,r,t,n);super(i,wy(r),xy)}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(Ka(this.state,e,t.trigger)))}};function Cy(e,t,n,r=!1){return{..._o(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 wy(e){return{popupRef:v.createRef(),backdropRef:v.createRef(),internalBackdropRef:v.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function Ty(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`,y=Bv(!0),b={modal:h,disablePointerDismissal:g,nested:y!=null,role:_},x=Ha((e,t)=>new Sy({open:i,openProp:r,activeTriggerId:f,triggerIdProp:d,...b},e,t),!0);x.useControlledProp(`openProp`,r),x.useControlledProp(`triggerIdProp`,d),x.useSyncedValues(b),x.useContextCallback(`onOpenChange`,a),x.useContextCallback(`onOpenChangeComplete`,o);let C=x.useState(`open`),w=x.useState(`mounted`),T=x.useState(`payload`);$a(x,C),Xa(x);let{forceUnmount:E}=Za(C,x);v.useImperativeHandle(l,()=>({unmount:E,close:()=>x.setOpen(!1,Jt(vn))}),[E,x]);let D=C||w||u!=null;return(0,S.jsxs)(zv.Provider,{value:x,children:[u&&(0,S.jsx)(Ua,{handle:u,store:x}),D&&(0,S.jsx)(by,{store:x,parentContext:y?.context,isDrawer:p}),typeof n==`function`?n({payload:T}):n]})}var Ey=W(function(e){return Ty(`dialog`,e)}),Dy=v.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=Bv(),c=lc(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),Hi(`h2`,e,{ref:t,props:[{id:c},o]})});function Oy(e){let t=v.useRef(``),n=v.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:v.useCallback(n=>{n.detail===0?e(n,`keyboard`):(`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``)},[e]),onPointerDown:n}}function ky(e,t){let{onClick:n,onPointerDown:r}=Oy(Y((n,r)=>{(typeof e==`function`?e():e)||t(r||(ye?`touch`:``))}));return v.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function Ay(e){let[t,n]=v.useState(null),r=ky(e,n);return Bf(e,t=>{t&&!e&&n(null)}),v.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}var jy=re(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,payload:c,handle:l,...u}=e,d=Bv(!0),f=wo(l)??d;if(!f)throw Error(J(79));let p=lc(s),m=f.useState(`floatingRootContext`),h=f.useState(`isOpenedByTrigger`,p),g=f.useState(`triggerPopupId`,p),_=v.useRef(null),{registerTrigger:y,isMountedByThisTrigger:b}=Ya(p,_,f,{payload:c}),{getButtonProps:x,buttonRef:S}=pf({disabled:a,native:o}),C=wa(m),w=ky(()=>f.select(`open`),e=>{f.set(`openMethod`,e)}),T={disabled:a,open:h},E=f.useState(`triggerProps`,b);return Hi(`button`,e,{state:T,ref:[S,t,y,_],props:[C.reference,E,w,{[Xi]:``,id:p,"aria-haspopup":`dialog`,"aria-expanded":h,"aria-controls":g},u,x],stateAttributesMapping:At})});function My({...e}){return(0,S.jsx)(Ey,{"data-slot":`dialog`,...e})}function Ny({...e}){return(0,S.jsx)(jy,{"data-slot":`dialog-trigger`,...e})}function Py({...e}){return(0,S.jsx)(cy,{"data-slot":`dialog-portal`,...e})}function Fy({className:e,...t}){return(0,S.jsx)(Vv,{"data-slot":`dialog-overlay`,className:X(`fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function Iy({className:e,children:t,showCloseButton:n=!0,...r}){return(0,S.jsxs)(Py,{children:[(0,S.jsx)(Fy,{}),(0,S.jsxs)(oy,{"data-slot":`dialog-content`,className:X(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[t,n&&(0,S.jsxs)(Hv,{"data-slot":`dialog-close`,render:(0,S.jsx)(vf,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`}),children:[(0,S.jsx)(Fd,{}),(0,S.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function Ly({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`dialog-header`,className:X(`flex flex-col gap-2`,e),...t})}function Ry({className:e,showCloseButton:t=!1,children:n,...r}){return(0,S.jsxs)(`div`,{"data-slot":`dialog-footer`,className:X(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,S.jsx)(Hv,{render:(0,S.jsx)(vf,{variant:`outline`}),children:`Close`})]})}function zy({className:e,...t}){return(0,S.jsx)(Dy,{"data-slot":`dialog-title`,className:X(`font-heading text-base leading-none font-medium`,e),...t})}function By({className:e,...t}){return(0,S.jsx)(Uv,{"data-slot":`dialog-description`,className:X(`text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function Vy({className:e,...t}){return(0,S.jsx)(sd,{"data-slot":`spinner`,role:`status`,"aria-label":`Loading`,className:X(`size-4 animate-spin`,e),...t})}var Hy=v.createContext(void 0);function Uy(e){let t=v.useContext(Hy);if(t===void 0&&!e)throw Error(J(47));return t}var Wy={...Co,disabled:e=>e.disabled,instantType:e=>e.instantType===`trigger-change`&&!Co.open(e)?void 0:e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,isPressOpenedByTrigger:(e,t)=>e.openChangeReason===`trigger-press`&&Co.isOpenedByTrigger(e,t),isTouchPressOpen:(e,t)=>t&&e.openMethod===`touch`&&e.openChangeReason===`trigger-press`,hasTriggerFocusGuards:(e,t)=>Co.isOpenedByTrigger(e,t)&&!e.focusManagerModal,modal:e=>e.modal,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},Gy=class extends mo{constructor(e,t,n){let r=new eo;super(Ky(e,r,t,n),qy(r),Wy)}setOpen=(e,t)=>{let n=t.reason===Qt,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=qa(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=Ka(this.state,e,t.trigger,a());n.openChangeReason=t.reason,this.update(n)};n?(this.context.stickIfOpen=!0,this.context.stickIfOpenTimeout.start(500,()=>{this.context.stickIfOpen=!1}),R.flushSync(s)):s();let c;r?c=`click`:i?c=`dismiss`:t.reason===`focus-out`&&(c=`focus`),this.set(`instantType`,c)}};function Ky(e,t,n,r=!1){let i={..._o(t,n,r),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return i.open&&e?.mounted===void 0&&(i.mounted=!0),i}function qy(e){return{popupRef:v.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:v.createRef(),beforeTriggerFocusGuardRef:v.createRef(),beforeContentFocusGuardRef:v.createRef(),stickIfOpenTimeout:new de,stickIfOpen:!0,triggerElements:e}}var Jy=W(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=Xy(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),$a(u,d),Xa(u);let{forceUnmount:m}=Za(d,u,()=>{u.context.stickIfOpen=!0,u.set(`openChangeReason`,null)});u.useSyncedValues({modal:o}),v.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]),v.useImperativeHandle(e.actionsRef,()=>({unmount:m,close:()=>u.setOpen(!1,Jt(vn))}),[m,u]);let h=d||f||s!=null;return(0,S.jsxs)(Hy.Provider,{value:u,children:[s&&(0,S.jsx)(Ua,{handle:s,store:u}),h&&(0,S.jsx)(Zy,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})});function Yy(e){return Uy(!0)?(0,S.jsx)(Jy,{props:e}):(0,S.jsx)(pa,{children:(0,S.jsx)(Jy,{props:e})})}function Xy(e,t){let n=Ha((e,n)=>new Gy(t,e,n));return v.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function Zy({store:e,modal:t}){let n=Aa(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),r=n.reference,i=n.floating;return Qa(e,{activeTriggerProps:r,inactiveTriggerProps:r,popupProps:i}),null}function Qy(e,t){function n(n,r,i){let a=n.currentTarget;R.flushSync(()=>{e.setOpen(!1,Jt(cn,n.nativeEvent,a))}),Xr(a.isConnected?a:t.current,r,i)?.focus()}function r(t){n(t,-1,e.select(`positionerElement`))}function i(t){let r=e.select(`positionerElement`);r&&Zr(t,r)?e.context.beforeContentFocusGuardRef.current?.focus():n(t,1,r)}return{handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}var $y=re(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=Uy(!0),h=wo(s)??m;if(!h)throw Error(J(74));let g=lc(f),_=h.useState(`isTriggerActive`,g),y=h.useState(`floatingRootContext`),b=h.useState(`isOpenedByTrigger`,g),x=h.useState(`triggerPopupId`,g),C=v.useRef(null),{registerTrigger:w,isMountedByThisTrigger:T}=Ya(g,C,h,{payload:c,disabled:a,openOnHover:l,closeDelay:d}),E=h.useState(`isPressOpenedByTrigger`,g),D=h.useState(`isTouchPressOpen`,l),O=h.useState(`hasTriggerFocusGuards`,g),k=Fo(y,{enabled:!a&&l&&!D,mouseOnly:!0,move:!1,handleClose:Zo(),restMs:u,delay:{close:d},triggerElementRef:C,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),A=wa(y,{stickIfOpen:Y(()=>h.context.stickIfOpen)}),j=ky(()=>h.select(`open`),e=>{h.set(`openMethod`,e)}),M=h.useState(`triggerProps`,T),{getButtonProps:N,buttonRef:P}=pf({disabled:a,native:o}),F={open(e){return E?jt.open(e):At.open(e)}},{handlePreFocusGuardFocus:I,handleFocusTargetFocus:L}=Qy(h,C),R=Hi(`button`,e,{state:{disabled:a,open:b},ref:[P,t,w,C],props:[A.reference,k,M,j,{[Xi]:``,id:g,"aria-haspopup":`dialog`,"aria-expanded":b,"aria-controls":x},p,N],stateAttributesMapping:F}),z=(0,S.jsx)(v.Fragment,{children:R},g);return O?(0,S.jsxs)(v.Fragment,{children:[(0,S.jsx)(qn,{ref:h.context.beforeTriggerFocusGuardRef,onFocus:I}),z,(0,S.jsx)(qn,{ref:h.context.triggerFocusTargetRef,onFocus:L})]}):z}),eb=v.createContext(void 0);function tb(){let e=v.useContext(eb);if(e===void 0)throw Error(J(45));return e}var nb=v.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return Uy().useState(`mounted`)||n?(0,S.jsx)(eb.Provider,{value:n,children:(0,S.jsx)(ia,{ref:t,...r})}):null}),rb=v.createContext(void 0);function ib(){let e=v.useContext(rb);if(!e)throw Error(J(46));return e}function ab(e){let{store:t,domReference:n,positionerElement:r,open:i}=e,a=v.useRef(null),o=v.useRef(null),s=La(r);q(()=>{i||(o.current?.abort(),o.current=null,t.state.instantType===`trigger-change`&&t.set(`instantType`,void 0))},[i,t]),q(()=>{let e=n,r=a.current;if(e&&(a.current=e),!r||!e||e===r||!t.select(`open`))return;t.set(`instantType`,void 0);let i=new AbortController;return o.current=i,s(()=>{t.select(`open`)&&t.set(`instantType`,`trigger-change`)},i.signal),()=>{i.abort()}},[n,s,t])}var ob=20;function sb(e,t,n,r){let[i,a]=v.useState(!1);q(()=>{if(!e||!t||n==null){a(!1);return}let r=Un(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-ob)},[e,t,n]),yy(e&&(!t||i),r)}var cb=v.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=Qi,..._}=e,v=Uy(),y=tb(),b=da(),x=v.useState(`floatingRootContext`),C=v.useState(`mounted`),w=v.useState(`open`),T=v.useState(`openChangeReason`),E=v.useState(`activeTriggerElement`),D=v.useState(`modal`),O=v.useState(`openMethod`),k=v.useState(`positionerElement`),A=v.useState(`instantType`),j=v.useState(`transitionStatus`),M=Lc({anchor:a,floatingRootContext:x,positionMethod:o,mounted:C,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:y,nodeId:b,collisionAvoidance:g,adaptiveOrigin:v.useState(`adaptiveOrigin`)});ab({store:v,domReference:x.useState(`domReferenceElement`),positionerElement:k,open:w});let N=D===!0&&T!==`trigger-hover`;sb(w&&N,O===`touch`,k,E);let P=v.useStateSetter(`positionerElement`),F=Vc(e,{open:w,side:M.side,align:M.align,anchorHidden:M.anchorHidden,instant:A},{styles:M.positionerStyles,transitionStatus:j,props:_,refs:[t,P],hidden:!C,inert:!w});return(0,S.jsxs)(rb.Provider,{value:M,children:[C&&N&&(0,S.jsx)(sy,{inert:Kc(!w),cutout:E}),(0,S.jsx)(fa,{id:b,children:F})]})}),lb=v.createContext(void 0);function ub(e){let t=v.useContext(lb);if(t===void 0&&!e)throw Error(J(69));return t}var db=v.createContext(void 0);function fb(){let[e,t]=v.useState(0),n=Y(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:v.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}function pb(){let e=v.useContext(db);q(()=>e?.register(),[e])}var mb=v.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=Uy(),l=ib(),u=ub(!0)!=null,{context:d,hasClosePart:f}=fb(),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`),C=c.useState(`openChangeReason`),w=c.useState(`activeTriggerElement`),T=c.useState(`floatingRootContext`),E=T.useState(`floatingId`),D=c.useState(`disabled`),O=c.useState(`openOnHover`),k=c.useState(`closeDelay`);Ra({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}}),No(T,{enabled:O&&!D,closeDelay:k});let A=a===void 0?Va(c.context.popupRef):a,j=b!==!1&&f;c.useSyncedValue(`focusManagerModal`,j);let M=c.useStateSetter(`popupElement`),N=Hi(`div`,e,{state:{open:p,side:l.side,align:l.align,instant:h,transitionStatus:g},ref:[t,c.context.popupRef,M],props:[_,{id:E,role:`dialog`,...Ba,"aria-labelledby":v,"aria-describedby":y,onKeyDown(e){u&&Xv.has(e.key)&&e.stopPropagation()}},Bc(g),s],stateAttributesMapping:Nt});return(0,S.jsx)(Ca,{context:T,openInteractionType:m,modal:j,disabled:!x||C===`trigger-hover`,initialFocus:A,returnFocus:o,restoreFocus:`popup`,getInsideElements:()=>[c.context.beforeTriggerFocusGuardRef.current],previousFocusableElement:Be(w)?w:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,S.jsx)(db.Provider,{value:d,children:N})})}),hb=v.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=Uy(),s=lc(a.id);return o.useSyncedValueWithCleanup(`titleElementId`,s),Hi(`h2`,e,{ref:t,props:[{id:s},a]})}),gb=v.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=Uy(),s=lc(a.id);return o.useSyncedValueWithCleanup(`descriptionElementId`,s),Hi(`p`,e,{ref:t,props:[{id:s},a]})}),_b=v.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,{buttonRef:c,getButtonProps:l}=pf({disabled:a,focusableWhenDisabled:!1,native:o}),u=Uy();return pb(),Hi(`button`,e,{ref:[t,c],props:[{onClick(e){u.setOpen(!1,Jt(nn,e.nativeEvent))}},s,l]})});function vb({...e}){return(0,S.jsx)(Yy,{"data-slot":`popover`,...e})}function yb({...e}){return(0,S.jsx)($y,{"data-slot":`popover-trigger`,...e})}function bb({...e}){return(0,S.jsx)(_b,{"data-slot":`popover-close`,...e})}function xb({className:e,align:t=`center`,alignOffset:n=0,side:r=`bottom`,sideOffset:i=4,...a}){return(0,S.jsx)(nb,{children:(0,S.jsx)(cb,{align:t,alignOffset:n,side:r,sideOffset:i,className:`isolate z-50`,children:(0,S.jsx)(mb,{"data-slot":`popover-content`,className:X(`z-50 flex w-72 origin-(--transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...a})})})}function Sb({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`popover-header`,className:X(`flex flex-col gap-0.5 text-sm`,e),...t})}function Cb({className:e,...t}){return(0,S.jsx)(hb,{"data-slot":`popover-title`,className:X(`font-medium`,e),...t})}function wb({className:e,...t}){return(0,S.jsx)(gb,{"data-slot":`popover-description`,className:X(`text-muted-foreground`,e),...t})}var Tb={log:{label:`Log`,title:`Agent log`,name:`agent.log`,noun:`log`},prompt:{label:`Prompt`,title:`Prompt`,name:`prompt.md`,noun:`prompt`}};function Eb({log:e,agent:t,kind:n}){let r=Tb[n],i=`/${e.replace(/agent\.log$/,r.name)}`;return(0,S.jsxs)(vb,{children:[(0,S.jsx)(yb,{render:(0,S.jsx)(vf,{variant:`link`,size:`xs`}),children:r.label}),(0,S.jsxs)(xb,{className:`w-xl max-w-[calc(100vw-2rem)]`,children:[(0,S.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,S.jsxs)(Sb,{children:[(0,S.jsx)(Cb,{children:r.title}),(0,S.jsx)(wb,{children:t})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsxs)(`a`,{className:`text-xs underline underline-offset-4`,href:i,target:`_blank`,rel:`noreferrer`,children:[`Open raw `,r.noun]}),(0,S.jsx)(bb,{render:(0,S.jsx)(vf,{variant:`ghost`,size:`icon-sm`,"aria-label":`Close`}),children:(0,S.jsx)(Fd,{})})]})]}),(0,S.jsx)(Db,{url:i,noun:r.noun})]})]})}function Db({url:e,noun:t}){let[n,r]=(0,v.useState)(),[i,a]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{let t=new AbortController;return(async()=>{try{let n=await fetch(e,{signal:t.signal});if(!n.ok)throw Error(`Request failed: ${n.status}`);let i=await n.text();t.signal.aborted||r(Ob(i))}catch{t.signal.aborted||a(!0)}})(),()=>t.abort()},[e]),i?(0,S.jsxs)(`p`,{role:`status`,className:`text-destructive`,children:[`Could not load the `,t,`. Reopen it to try again.`]}):n===void 0?(0,S.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-muted-foreground`,children:[(0,S.jsx)(Vy,{}),` Loading `,t,`…`]}):n.trim()?(0,S.jsx)(`pre`,{tabIndex:0,className:`max-h-[min(28rem,50dvh)] overflow-auto rounded-md border bg-muted/50 p-3 font-mono text-xs leading-relaxed wrap-anywhere whitespace-pre-wrap focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none`,children:n}):(0,S.jsxs)(`p`,{className:`text-muted-foreground`,children:[`The `,t,` is empty.`]})}function Ob(e){if(!e.trimStart().startsWith(`{`))return e;try{let t=JSON.parse(e);return t?.type===`result`&&typeof t.result==`string`&&t.result.trim()?t.result:JSON.stringify(t,null,2)}catch{return e}}function kb({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=v.useRef(e!==void 0),[a,o]=v.useState(()=>t);return[i&&e!==void 0?e:a,v.useCallback(e=>{i||o(e)},[])]}var Ab=v.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function jb(){return v.useContext(Ab)}function Mb(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=Y(i),[,o]=v.useState(0),s=H(Pb).current,c=H(Nb).current,l=v.useRef(0),u=v.useRef(!0),d=v.useRef(null),f=v.useRef(null),p=Y(()=>{u.current||(u.current=!0,o(e=>e+1))}),m=Y((e,t)=>{c.set(e,t),p()}),h=Y(e=>{c.delete(e),p()}),g=Y(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(!Lb(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&Rb(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=Ib(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let y=Y(()=>{let[e,t]=Fb(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&&y()}),q(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let b=Y(e=>(s.add(e),()=>{s.delete(e)})),x=v.useMemo(()=>({register:m,unregister:h,subscribeMapChange:b,nextIndexRef:l}),[m,h,b,l]);return(0,S.jsx)(Ab.Provider,{value:x,children:t})}function Nb(){return new Map}function Pb(){return new Set}function Fb(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)=>Rb(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 Ib(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function Lb(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 Rb(e,t){return e.nextElementSibling===t?-1:t.nextElementSibling===e?1:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}var zb=v.createContext(void 0);function Bb(){let e=v.useContext(zb);if(e===void 0)throw Error(J(64));return e}var Vb=`data-activation-direction`,Hb={tabActivationDirection:e=>({[Vb]:e})},Ub=v.forwardRef(function(e,t){let{className:n,defaultValue:r=0,onValueChange:i,orientation:a=`horizontal`,render:o,value:s,style:c,...l}=e,u=e.defaultValue!==void 0,d=v.useRef([]),[f,p]=v.useState(()=>new Map),[m,h]=kb({controlled:s,default:r,name:`Tabs`,state:`value`}),g=s!==void 0,[_,y]=v.useState(()=>new Map),b=v.useRef(void 0),x=v.useCallback(e=>Wb(_,e),[_]),[C,w]=v.useState(()=>({previousValue:m,tabActivationDirection:`none`})),{previousValue:T,tabActivationDirection:E}=C,D=E,O=!1;T!==m&&(D=Gb(T,m,a,_),O=T!=null&&m!=null&&x(m)==null);let k=O?T:m,A=T!==k||E!==D;q(()=>{A&&w({previousValue:k,tabActivationDirection:D})},[k,A,D]);let j=Y((e,t)=>{t.activationDirection=Gb(m,e,a,_),i?.(e,t),!t.isCanceled&&h(()=>e)}),M=Y((e,t)=>{i?.(e,Jt(t,void 0,void 0,{activationDirection:`none`}))}),N=Y((e,t)=>(p(n=>{let r=new Map(n);return r.set(e,t),r}),()=>{p(n=>{if(n.get(e)!==t)return n;let r=new Map(n);return r.delete(e),r})})),P=v.useCallback(e=>f.get(e),[f]),F=v.useCallback(e=>{for(let t of _.values())if(e===t.value)return t.id},[_]),I=v.useMemo(()=>({getTabElementBySelectedValue:x,getTabIdByPanelValue:F,getTabPanelIdByValue:P,onValueChange:j,orientation:a,registerMountedTabPanel:N,setTabMap:y,tabActivationDirection:D,value:m}),[x,F,P,j,a,N,y,D,m]),L=v.useMemo(()=>{for(let e of _.values())if(e.value===m)return e},[_,m]),R=v.useMemo(()=>{for(let e of _.values())if(!e.disabled)return e.value},[_]),z=v.useRef(!u),B=v.useRef(r),V=v.useRef(u),H=v.useRef(!1);q(()=>{if(g)return;function e(e,t){h(()=>e),w({previousValue:e,tabActivationDirection:`none`}),M(e,t),z.current=!1}if(_.size===0){H.current&&m!==null&&!b.current?.isConnected&&e(null,gn);return}H.current=!0,b.current=_.keys().next().value;let t=L?.disabled,n=L==null&&m!==null;if(!t&&m===B.current&&(V.current=!1),V.current&&t&&m===B.current)return;let r=z.current;if(t||n){let n=R??null;if(m===n){z.current=!1;return}let i=gn;r?i=_n:t&&(i=hn),e(n,i)}else r&&L!=null&&(M(m,_n),z.current=!1)},[R,g,M,L,h,_,m]);let U=Hi(`div`,e,{state:{orientation:a,tabActivationDirection:D},ref:t,props:l,stateAttributesMapping:Hb});return(0,S.jsx)(zb.Provider,{value:I,children:(0,S.jsx)(Mb,{elementsRef:d,children:U})})});function Wb(e,t){for(let[n,r]of e.entries())if(t===r.value)return n;return null}function Gb(e,t,n,r){if(e==null||t==null)return`none`;let[i,a,o]=n===`horizontal`?[`left`,`left`,`right`]:[`top`,`up`,`down`],s=Wb(r,e),c=Wb(r,t);if(s==null||c==null)return s!==c&&(typeof e==`number`||typeof e==`string`)&&typeof e==typeof t?t>e?o:a:`none`;let l=s.getBoundingClientRect()[i],u=c.getBoundingClientRect()[i];return u<l?a:u>l?o:`none`}var Kb=`data-composite-item-active`;function qb(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=jb(),u=v.useRef(-1),[d,f]=v.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=v.useRef(null),h=v.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}}function Jb(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=uf(),{ref:i,index:a}=qb(e),o=n===a,s=v.useRef(null),c=En(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 Yb=v.createContext(void 0);function Xb(){let e=v.useContext(Yb);if(e===void 0)throw Error(J(65));return e}var Zb=v.forwardRef(function(e,t){let{className:n,disabled:r=!1,render:i,value:a,id:o,nativeButton:s=!0,style:c,...l}=e,{value:u,getTabPanelIdByValue:d,onValueChange:f,orientation:p,tabActivationDirection:m}=Bb(),{activateOnFocus:h,registerTabResizeObserverElement:g,tabsListElement:_}=Xb(),{highlightedIndex:y,onHighlightedIndexChange:b}=uf(),x=lc(o),{compositeProps:S,compositeRef:C,index:w}=Jb({metadata:v.useMemo(()=>({disabled:r,id:x,value:a}),[r,x,a])}),T=a===u,E=v.useRef(!1),D=v.useRef(null),O=Y(e=>{D.current?.(),D.current=e?g(e):null});q(()=>{if(E.current){E.current=!1;return}if(!(T&&w>-1&&y!==w))return;let e=_;if(e!=null){let t=at(Un(e));if(t&&ot(e,t))return}r||b(w)},[T,w,y,b,r,_]);let{getButtonProps:k,buttonRef:A}=pf({disabled:r,native:s,focusableWhenDisabled:!0}),j=d(a),M=v.useRef(!1),N=v.useRef(!1);function P(e){f(a,Jt(Xt,e.nativeEvent,void 0,{activationDirection:`none`}))}function F(e){T||r||P(e)}function I(e){T||r||h&&(!M.current||N.current)&&P(e)}function L(e){if(T||r)return;M.current=!0,N.current=e.button===0;let t=Un(e.currentTarget);function n(){M.current=!1,N.current=!1,t.removeEventListener(`pointerup`,n),t.removeEventListener(`pointercancel`,n)}t.addEventListener(`pointerup`,n),t.addEventListener(`pointercancel`,n)}return Hi(`button`,e,{state:{disabled:r,active:T,orientation:p,tabActivationDirection:m},ref:[t,A,C,O],props:[S,{role:`tab`,"aria-controls":j,"aria-selected":T,id:x,onClick:F,onFocus:I,onPointerDown:L,[Kb]:T?``:void 0,onKeyDownCapture(){E.current=!0}},l,k],stateAttributesMapping:Hb})}),Qb=v.createContext(void 0),$b={disableStyleElements:!1};function ex(){return v.useContext(Qb)??$b}var tx=`data-index`,nx={...Hb,...yt},rx=v.forwardRef(function(e,t){let{className:n,value:r,render:i,keepMounted:a=!1,style:o,...s}=e,{value:c,getTabIdByPanelValue:l,orientation:u,tabActivationDirection:d,registerMountedTabPanel:f}=Bb(),p=lc(),{ref:m,index:h}=qb(),g=r===c,{mounted:_,transitionStatus:y,setMounted:b}=Na(g),x=!_,S=l(r),C={hidden:x,orientation:u,tabActivationDirection:d,transitionStatus:y},w=v.useRef(null),T=Hi(`div`,e,{state:C,ref:[t,m,w],props:[{"aria-labelledby":S,hidden:x,id:p,role:`tabpanel`,tabIndex:g?0:-1,inert:Kc(!g),[tx]:h},s],stateAttributesMapping:nx});return Ra({open:g,ref:w,onComplete(){g||b(!1)}}),q(()=>{if(!(p==null||x&&!a))return f(r,p)},[x,a,r,p,f]),a||_?T:null});function ix(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}function ax(e){let{loopFocus:t=!0,orientation:n=`both`,grid:r,onLoop:i,direction:a,highlightedIndex:o,onHighlightedIndexChange:s,rootRef:c,enableHomeAndEndKeys:l=!1,stopEventPropagation:u,disabledIndices:d,modifierKeys:f=G}=e,[p,m]=v.useState(0),h=r!=null,g=v.useRef(null),_=En(g,c),y=v.useRef([]),b=v.useRef(!1),x=v.useRef(null),S=o??p,C=Y((e,t=!1)=>{if(x.current=y.current[e]??null,(s??m)(e),t){let t=y.current[e];ey(g.current,t,a,n)}}),w=Y(e=>{if(e.size===0)return;if(b.current){let e=y.current,t=e.indexOf(x.current);if(t===-1){let t=e[S];!t||Or(e,S,d)?C(ox(e,d)):x.current=t}else t!==S&&C(t);return}b.current=!0;let t=Array.from(e.keys()),r=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,i=r?e.get(r)?.index??-1:-1;if(i!==-1)C(i);else if(Or(t,S,d)){let e=Er(t,{disabledIndices:d});Sr(t,e)||C(e)}ey(g.current,r,a,n)});q(()=>{if(d==null||o!=null||!b.current)return;let e=y.current;if(Or(e,S,d)){let t=Er(e,{disabledIndices:d});Sr(e,t)||C(t)}},[d,o,S,y,C]);let T=Y((e,t,n)=>i?i(e,t,n,y):n),E=Y(e=>{let o=e.key===`Home`||e.key===`End`;if(!Xv.has(e.key)||!l&&o||sx(e,f)||!g.current)return;let s=a===`rtl`,c=s?Jv:Yv,p=s?Yv:Jv,m=n===`vertical`?qv:c,_=n===`vertical`?Kv:p,v=ct(e.nativeEvent);if(v!=null&&$v(v)&&!ix(v)){let t=v.selectionStart,n=v.selectionEnd,r=v.value;if(t==null||e.shiftKey||t!==n||e.key!==_&&t<r.length||e.key!==m&&t>0)return}let b=S,x=Cr(y,d),w=wr(y,d);r!=null&&(b=r({disabledIndices:d,elementsRef:y,event:e,highlightedIndex:S,loopFocus:t,maxIndex:w,minIndex:x,onLoop:T,orientation:n,rtl:s}));let E=n!==`vertical`&&e.key===c||n!==`horizontal`&&e.key===`ArrowDown`,D=n!==`vertical`&&e.key===p||n!==`horizontal`&&e.key===`ArrowUp`;l&&(e.key===`Home`?b=x:e.key===`End`&&(b=w)),b===S&&(E||D)&&(t&&b===w&&E?(b=x,i&&(b=i(e,S,b,y))):t&&b===x&&D?(b=w,i&&(b=i(e,S,b,y))):b=Er(y.current,{startingIndex:b,decrement:D,disabledIndices:d})),b!==S&&!Sr(y.current,b)&&(u&&e.stopPropagation(),(h||o||E||D)&&e.preventDefault(),C(b,!0),queueMicrotask(()=>{y.current[b]?.focus()}))});return{props:{ref:_,onFocus(e){let t=g.current,n=ct(e.nativeEvent);t&&n!=null&&$v(n)&&n.setSelectionRange(0,n.value.length)},onKeyDown:E},highlightedIndex:S,onHighlightedIndexChange:C,elementsRef:y,onMapChange:w,relayKeyboardEvent:E}}function ox(e,t){let n=-1;for(let r=0;r<e.length;r+=1){let i=e[r];if(i&&!Or(e,r,t)){if(i.hasAttribute(`data-composite-item-active`))return r;n===-1&&(n=r)}}return Math.max(n,0)}function sx(e,t){for(let n of Zv)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function cx(e){let{render:t,className:n,style:r,refs:i=G,props:a=G,state:o=K,stateAttributesMapping:s,highlightedIndex:c,onHighlightedIndexChange:l,orientation:u,grid:d,loopFocus:f,onLoop:p,enableHomeAndEndKeys:m,onMapChange:h,stopEventPropagation:g=!0,rootRef:_,disabledIndices:y,modifierKeys:b,highlightItemOnHover:x=!1,tag:C=`div`,...w}=e,{props:T,highlightedIndex:E,onHighlightedIndexChange:D,elementsRef:O,onMapChange:k,relayKeyboardEvent:A}=ax({grid:d,loopFocus:f,onLoop:p,orientation:u,highlightedIndex:c,onHighlightedIndexChange:l,rootRef:_,stopEventPropagation:g,enableHomeAndEndKeys:m,direction:Cc(),disabledIndices:y,modifierKeys:b}),j=Hi(C,e,{state:o,ref:i,props:[T,...a,w],stateAttributesMapping:s}),M=v.useMemo(()=>({highlightedIndex:E,onHighlightedIndexChange:D,highlightItemOnHover:x,relayKeyboardEvent:A}),[E,D,x,A]);return(0,S.jsx)(lf.Provider,{value:M,children:(0,S.jsx)(Mb,{elementsRef:O,onMapChange:e=>{h?.(e),k(e)},children:j})})}var lx=v.forwardRef(function(e,t){let{activateOnFocus:n=!1,className:r,loopFocus:i=!0,render:a,style:o,...s}=e,{orientation:c,setTabMap:l,tabActivationDirection:u}=Bb(),[d,f]=v.useState(0),[p,m]=v.useState(null),h=v.useRef(new Set),g=v.useRef(new Set),_=v.useRef(null);q(()=>{if(typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>{h.current.forEach(e=>{e()})});return _.current=e,p&&e.observe(p),g.current.forEach(t=>{e.observe(t)}),()=>{e.disconnect(),_.current=null}},[p]);let y=Y(e=>(h.current.add(e),()=>{h.current.delete(e)})),b=Y(e=>(g.current.add(e),_.current?.observe(e),()=>{g.current.delete(e),_.current?.unobserve(e)})),x={orientation:c,tabActivationDirection:u},C={"aria-orientation":c===`vertical`?`vertical`:void 0,role:`tablist`},w=v.useMemo(()=>({activateOnFocus:n,registerIndicatorUpdateListener:y,registerTabResizeObserverElement:b,tabsListElement:p}),[n,y,b,p]);return(0,S.jsx)(Yb.Provider,{value:w,children:(0,S.jsx)(cx,{render:a,className:r,style:o,state:x,refs:[t,m],props:[C,s],stateAttributesMapping:Hb,highlightedIndex:d,enableHomeAndEndKeys:!0,loopFocus:i,orientation:c,onHighlightedIndexChange:f,onMapChange:l,disabledIndices:G})})});function ux({className:e,orientation:t=`horizontal`,...n}){return(0,S.jsx)(Ub,{"data-slot":`tabs`,"data-orientation":t,className:X(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var dx=Bd(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function fx({className:e,variant:t=`default`,...n}){return(0,S.jsx)(lx,{"data-slot":`tabs-list`,"data-variant":t,className:X(dx({variant:t}),e),...n})}function px({className:e,...t}){return(0,S.jsx)(Zb,{"data-slot":`tabs-trigger`,className:X(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function mx({className:e,...t}){return(0,S.jsx)(rx,{"data-slot":`tabs-content`,className:X(`flex-1 text-sm outline-none`,e),...t})}var hx=`max-h-[60dvh] overflow-auto rounded-md border bg-muted/50 p-3 font-mono text-xs leading-relaxed`,gx={wrapper:null,overrides:{h1:{props:{className:`mt-3 text-base font-semibold first:mt-0`}},h2:{props:{className:`mt-3 font-semibold first:mt-0`}},h3:{props:{className:`mt-2 font-medium first:mt-0`}},ul:{props:{className:`list-disc pl-5`}},ol:{props:{className:`list-decimal pl-5`}},a:{props:{className:`underline underline-offset-4`,target:`_blank`,rel:`noreferrer`}},code:{props:{className:`rounded bg-muted px-1 font-mono text-xs`}},pre:{props:{className:`overflow-auto rounded-md bg-muted p-2`}},blockquote:{props:{className:`border-l-2 pl-3 text-muted-foreground`}},table:{props:{className:`border-collapse text-xs`}},th:{props:{className:`border px-2 py-1 text-left font-medium`}},td:{props:{className:`border px-2 py-1`}}}};function _x({jobId:e,url:t,pr:n}){return(0,S.jsxs)(My,{children:[(0,S.jsx)(Ny,{render:(0,S.jsx)(vf,{variant:`link`,size:`xs`}),children:`Review`}),(0,S.jsxs)(Iy,{className:`sm:max-w-4xl`,children:[(0,S.jsxs)(Ly,{className:`mr-8`,children:[(0,S.jsx)(zy,{children:n.title}),(0,S.jsx)(By,{children:(0,S.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1`,children:[t.replace(`https://github.com/`,``),` `,(0,S.jsx)(Vu,{className:`size-3`})]})})]}),(0,S.jsx)(vx,{jobId:e,pr:n})]})]})}function vx({jobId:e,pr:t}){let[n,r]=(0,v.useState)(),[i,a]=(0,v.useState)();return(0,v.useEffect)(()=>{let t=!0;return rf.prDetails(e).then(e=>t&&r(e),e=>t&&a(e.message)),()=>{t=!1}},[e]),i?(0,S.jsxs)(`p`,{role:`status`,className:`text-destructive`,children:[`Could not load the PR: `,i]}):n?(0,S.jsxs)(ux,{defaultValue:`description`,className:`min-w-0`,children:[(0,S.jsxs)(fx,{children:[(0,S.jsx)(px,{value:`description`,children:`Description`}),(0,S.jsxs)(px,{value:`diff`,children:[`Diff`,(0,S.jsxs)(`span`,{className:`text-success`,children:[`+`,t.additions]}),(0,S.jsxs)(`span`,{className:`text-destructive`,children:[`−`,t.deletions]})]})]}),(0,S.jsx)(mx,{value:`description`,children:(0,S.jsx)(`div`,{tabIndex:0,className:`${hx} flex flex-col gap-2 font-sans text-sm wrap-anywhere`,children:n.body.trim()?(0,S.jsx)(Dv,{options:gx,children:n.body}):`This PR has no description.`})}),(0,S.jsx)(mx,{value:`diff`,children:(0,S.jsx)(`pre`,{tabIndex:0,className:hx,children:n.diff.split(`
58
+ `).map((e,t)=>(0,S.jsx)(`span`,{className:`block ${yx(e)}`,children:e||` `},t))})})]}):(0,S.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-muted-foreground`,children:[(0,S.jsx)(Vy,{}),` Asking GitHub…`]})}function yx(e){return e.startsWith(`diff --git`)?`mt-3 font-semibold text-foreground first:mt-0`:/^(\+\+\+|---|index |@@)/.test(e)?`text-muted-foreground`:e.startsWith(`+`)?`bg-success/10 text-success`:e.startsWith(`-`)?`bg-destructive/10 text-destructive`:``}function bx(e,t){let n=new URLSearchParams(location.search);t?n.set(e,t):n.delete(e),history.replaceState(null,``,n.size?`?${n}`:location.pathname)}function xx(e,t){let[n,r]=(0,v.useState)(()=>new URLSearchParams(location.search).get(e)??t);return[n,n=>{bx(e,n===t?``:n),r(n)}]}function Sx(e){if(!e)return null;for(let t of e.elements){let e=t.tagName;if(e===`BUTTON`||e===`INPUT`){let e=t;if(e.type===`submit`)return e}}return null}var Cx=`data-checked`,wx=`data-unchecked`;function Tx(e){return{checked(t){return e.indeterminate?{}:t?{[Cx]:``}:{[wx]:``}},...wf}}var Ex=v.createContext(void 0);function Dx(){return v.useContext(Ex)}var Ox=v.createContext(void 0);function kx(){let e=v.useContext(Ox);if(e===void 0)throw Error(J(14));return e}var Ax=`data-parent`,jx=v.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i=!1,"aria-labelledby":a,disabled:o=!1,form:s,id:c,indeterminate:l=!1,inputRef:u,name:d,onCheckedChange:f,parent:p=!1,readOnly:m=!1,render:h,required:g=!1,uncheckedValue:_,value:y,nativeButton:b=!1,style:x,...C}=e,{clearErrors:w}=kf(),{disabled:T,name:E,setDirty:D,setFilled:O,setTouched:k,state:A,validationMode:j,validityData:M,validation:N}=Df(),P=Lf(),{labelId:F,registerControlId:I,getDescriptionProps:L}=jf(),R=Dx(),z=R?.allValues===void 0?void 0:R.parent,B=z!==void 0,V=T||P.disabled||R?.disabled||o,H=E??d,U=y??H,ee=lc(),te=R?.registerControlId!==I,ne=Ff({id:c||void 0,enabled:te}),W=b?ne:ee,re={};B&&(p?re=z.getParentProps():U!==void 0&&(re=z.getChildProps(U)));let{checked:ie=n,indeterminate:ae=l,onCheckedChange:G,...oe}=re,J=R?.value,se=v.useRef(null),ce=Rf(V,se),{getButtonProps:le,buttonRef:ue}=pf({disabled:V,native:b}),de=R?.validation??N,[fe,pe]=kb({controlled:U!==void 0&&J!==void 0&&!p?J.includes(U):ie,default:i,name:`Checkbox`,state:`checked`}),me=B?!!ie:fe,he=B&&ae||l;zf(se,ee,fe,void 0,!R&&!V,d);let ge=z?.registerChildId,_e=v.useRef(null),ve=de.registerInput,ye=R?U:void 0,be=v.useCallback(e=>ve(e,{controlRef:se,value:ye}),[ve,ye]),xe=En(u,_e,p?void 0:be),Se=Mf(a,F,_e,!b,ne,C[`aria-label`]);q(()=>{_e.current&&(_e.current.indeterminate=he),R||O(fe)},[fe,he,R,O]),Bf(fe,()=>{R||(w(H),D(fe!==M.initialValue),de.change(fe))});let Ce=ki({checked:fe,disabled:V,form:s,name:p?void 0:H,id:b?void 0:ne,required:g,ref:xe,style:H?Kn:Gn,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(m){e.preventDefault();return}let t=e.currentTarget.checked,n=Jt(Xt,e.nativeEvent);if(f?.(t,n),!n.isCanceled&&(G?.(t,n),!n.isCanceled&&(pe(t),U!==void 0&&R!==void 0&&!p&&!B))){let e=t?[...R.value,U]:R.value.filter(e=>e!==U);R.setValue(e,n)}},onClick(e){e.stopPropagation()},onFocus(){se.current?.focus()}},y===void 0?K:{value:(R?fe&&y:y)||``},L,e=>de.getValidationProps(V,e));v.useEffect(()=>{if(!z||U===void 0)return;let e=z.disabledStatesRef.current;return e.set(U,V),()=>{e.delete(U)}},[z,V,U]);let we=v.useMemo(()=>({...A,checked:me,disabled:V,readOnly:m,required:g,indeterminate:he}),[A,me,V,m,g,he]),Te=Tx(we),Ee=Hi(`span`,e,{state:we,ref:[ue,se,t],props:[{id:W,role:`checkbox`,"aria-checked":he?`mixed`:me,"aria-readonly":m||void 0,"aria-required":g||void 0,"aria-labelledby":Se,[Ax]:p?``:void 0,onFocus(){ce(!0)},onBlur(){let e=_e.current;e&&(k(!0),ce(!1),j===`onBlur`&&de.commit(R?J:e.checked))},onKeyDown(e){if(e.key!==`Enter`||(e.preventBaseUIHandler(),e.defaultPrevented))return;let t=_e.current?.form??null,n=e.currentTarget,r=e.nativeEvent,i=e.preventDefault,a=r.preventDefault,o=!1;e.preventDefault=()=>{o=!0,i.call(e)},r.preventDefault=()=>{o=!0,a.call(r)},a.call(r),Ie(n).queueMicrotask(()=>{e.preventDefault=i,r.preventDefault=a,o||Sx(t)?.click()})},onClick(e){if(m||V)return;e.preventDefault();let t=_e.current;t&&ff(t,e)}},C,oe,le,L,e=>de.getValidationProps(V,e)],stateAttributesMapping:Te}),De=Ee.props.id;return q(()=>{if(ge&&!p&&U!==void 0&&De!==void 0)return ge(U,De)},[ge,p,U,De]),(0,S.jsxs)(Ox.Provider,{value:we,children:[Ee,!fe&&!R&&H&&!p&&_!==void 0&&(0,S.jsx)(`input`,{type:`hidden`,form:s,name:H,value:_,disabled:V}),(0,S.jsx)(`input`,{...Ce,suppressHydrationWarning:!0})]})}),Mx=v.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=kx(),c=s.checked||s.indeterminate,{mounted:l,transitionStatus:u,setMounted:d}=Na(c),f=v.useRef(null),p={...s,transitionStatus:u};Ra({batch:!0,enabled:!c,open:c,ref:f,onComplete(){c||d(!1)}});let m={...Tx(s),...yt},h=a||l,g=Hi(`span`,e,{ref:[t,f],state:p,stateAttributesMapping:m,props:o});return h?g:null});function Nx({className:e,...t}){return(0,S.jsx)(jx,{"data-slot":`checkbox`,className:X(`peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary`,e),...t,children:(0,S.jsx)(Mx,{"data-slot":`checkbox-indicator`,className:`grid place-content-center text-current transition-none [&>svg]:size-3.5`,children:(0,S.jsx)(Cu,{})})})}function Px({className:e,...t}){return(0,S.jsx)(Nx,{className:X(`data-checked:border-foreground data-checked:bg-foreground data-checked:text-background dark:data-checked:bg-foreground`,e),...t})}var Fx=v.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return Hi(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})});function Ix({className:e,...t}){return(0,S.jsx)(`div`,{role:`list`,"data-slot":`item-group`,className:X(`group/item-group flex w-full flex-col gap-4 has-data-[size=sm]:gap-2.5 has-data-[size=xs]:gap-2`,e),...t})}var Lx=Bd(`group/item flex w-full flex-wrap items-center rounded-lg border text-sm transition-colors duration-100 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 [a]:transition-colors [a]:hover:bg-muted`,{variants:{variant:{default:`border-transparent`,outline:`border-border`,muted:`border-transparent bg-muted/50`},size:{default:`gap-2.5 px-3 py-2.5`,sm:`gap-2.5 px-3 py-2.5`,xs:`gap-2 px-2.5 py-2 in-data-[slot=dropdown-menu-content]:p-0`}},defaultVariants:{variant:`default`,size:`default`}});function Rx({className:e,variant:t=`default`,size:n=`default`,render:r,...i}){return of({defaultTagName:`div`,props:ki({className:X(Lx({variant:t,size:n,className:e}))},i),render:r,state:{slot:`item`,variant:t,size:n}})}var zx=Bd(`flex shrink-0 items-center justify-center gap-2 group-has-data-[slot=item-description]/item:translate-y-0.5 group-has-data-[slot=item-description]/item:self-start [&_svg]:pointer-events-none`,{variants:{variant:{default:`bg-transparent`,icon:`[&_svg:not([class*='size-'])]:size-4`,image:`size-10 overflow-hidden rounded-sm group-data-[size=sm]/item:size-8 group-data-[size=xs]/item:size-6 [&_img]:size-full [&_img]:object-cover`}},defaultVariants:{variant:`default`}});function Bx({className:e,variant:t=`default`,...n}){return(0,S.jsx)(`div`,{"data-slot":`item-media`,"data-variant":t,className:X(zx({variant:t,className:e})),...n})}function Vx({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`item-content`,className:X(`flex flex-1 flex-col gap-1 group-data-[size=xs]/item:gap-0 [&+[data-slot=item-content]]:flex-none`,e),...t})}function Hx({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`item-title`,className:X(`line-clamp-1 flex w-fit items-center gap-2 text-sm leading-snug font-medium underline-offset-4`,e),...t})}function Ux({className:e,...t}){return(0,S.jsx)(`p`,{"data-slot":`item-description`,className:X(`line-clamp-2 text-left text-sm leading-normal font-normal text-muted-foreground group-data-[size=xs]/item:text-xs [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}function Wx({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`item-actions`,className:X(`flex items-center gap-2`,e),...t})}function Gx({leading:e,title:t,meta:n,below:r,progress:i,children:a}){return(0,S.jsxs)(Rx,{variant:`outline`,size:`sm`,className:`relative overflow-hidden`,children:[i!==void 0&&(0,S.jsx)(`span`,{"aria-hidden":!0,className:`absolute bottom-0 left-0 h-0.5 w-(--progress) bg-primary transition-all duration-700`,style:{"--progress":`${Math.min(i,1)*100}%`}}),e&&(0,S.jsx)(Bx,{children:e}),(0,S.jsxs)(Vx,{children:[(0,S.jsx)(Hx,{children:t}),(0,S.jsx)(Ux,{children:n}),r]}),a&&(0,S.jsx)(Wx,{children:a})]})}function Kx({title:e,children:t}){return(0,S.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,S.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground`,children:e}),t]})}var qx=Object.keys({claude:/usage limit|You've hit your [\w' ]*limit|You've reached your [\w ]*limit|rate_limit_error/i,pi:/usage limit|usage_limit_reached|usage_not_included|rate_limit_exceeded/i}),Jx={claude:[`low`,`medium`,`high`,`xhigh`,`max`],pi:[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`]};function Yx(e){let{open:t,defaultOpen:n=!1,onOpenChange:r,disabled:i}=e,[a,o]=kb({controlled:t,default:n,name:`Collapsible`,state:`open`}),{mounted:s,setMounted:c,transitionStatus:l}=Na(a,!0,!0),u=lc(),[d,f]=v.useState(),p=d===null?void 0:d??u,m=Y(e=>{let t=!a,n=Jt(Zt,e.nativeEvent);r(t,n),!n.isCanceled&&o(t)});return v.useMemo(()=>({defaultPanelId:u,disabled:i,handleTrigger:m,mounted:s,open:a,panelId:p,setMounted:c,setOpen:o,setPanelIdState:f,transitionStatus:l}),[u,i,m,s,a,p,c,o,f,l])}var Xx=v.createContext(void 0);function Zx(){let e=v.useContext(Xx);if(e===void 0)throw Error(J(15));return e}var Qx=`data-open`,$x=`data-closed`,eS=ht,tS=`data-panel-open`,nS={[Qx]:``},rS={[$x]:``},iS={open(e){return e?{[tS]:``}:null}},aS={open(e){return e?nS:rS}},oS={height:void 0,width:void 0};function sS(e){let{externalRef:t,hiddenUntilFound:n,id:r,keepMounted:i,mounted:a,onOpenChange:o,open:s,setMounted:c,setOpen:l,transitionStatus:u}=e,d=v.useRef(null),f=v.useRef(null),[p,m]=v.useState(oS),h=v.useRef(oS),g=v.useRef(!1),_=v.useRef(s),y=v.useRef(!1),[b,x]=v.useState(!1),S=v.useRef(null),C=En(t,d),w=Mn(s),T=La(d),E=!s&&!a,D=b?`idle`:u,O=s&&(_.current||y.current),k=!s&&a&&f.current===`css-animation`&&p.height===void 0&&p.width===void 0?h.current:p,A=n&&E&&f.current!==`css-animation`,j=Y((e,t=!0)=>{t&&(h.current=e),m(e)}),M=Y(()=>{S.current?.(),S.current=null}),N=Y(e=>{M(),S.current=()=>{S.current=null,e()}}),P=Y(()=>{s&&a&&f.current===`css-animation`&&(y.current=!0)});q(()=>{b&&u!==`starting`&&x(!1)},[b,u]),v.useEffect(()=>()=>{P(),M()},[P,M]),q(()=>{s||(_.current=!1,y.current=!1);let e=d.current;if(!e)return;!s&&S.current&&M();let t=lS(e,O);if(f.current=t,s&&u===`idle`&&_.current&&t===`css-animation`){h.current=cS(e);return}if(s&&u===`starting`){let n=g.current;if(g.current=!1,t===`none`){j(cS(e)),x(!0);return}if(t===`css-transition`){let t=fS(e);if(j(cS(e)),!n)return t;let r=dS(e,`transition-duration`,`0s`);return N(r),x(!0),t}j(cS(e));let r=dS(e,`animation-name`,`none`);if(!n){r();return}let i=dS(e,`animation-duration`,`0s`);r(),N(i),x(!0);return}if(!s&&a&&(u===`idle`||u===`starting`)){if(t===`none`){j(oS,!1),c(!1);return}j(cS(e));return}if(u!==`ending`)return;if(t===`none`){c(!1);return}let n=cS(e);n.height>0||n.width>0?(j(n),t===`css-animation`&&dS(e,`animation-name`,`none`)()):c(!1)},[a,s,M,j,c,N,O,u]),Ra({enabled:s&&a&&D===`idle`,open:!0,ref:d,onComplete(){s&&j(oS,!1)}}),v.useEffect(()=>{if(s||!a||D!==`ending`)return;if(!d.current){c(!1),j(oS,!1);return}let e=new AbortController,t=-1;function n(){w.current||(c(!1),j(oS,!1))}return t=Vn.request(()=>{T(n,e.signal)}),()=>{Vn.cancel(t),e.abort()}},[w,a,s,D,T,j,c]),q(()=>{let e=d.current;e&&n&&E&&e.setAttribute(`hidden`,`until-found`)},[E,n]),v.useEffect(function(){let e=d.current;if(!e)return;let t=de.create(),n=-1,r=(r,i)=>{t.start(0,()=>{w.current||(n=Vn.request(()=>{w.current||(r&&(g.current=!1),i&&e.setAttribute(eS,``),e.setAttribute(`hidden`,`until-found`))}))})},i=wn(e,`beforematch`,t=>{let n=Jt(Xt,t);if(o(!0,n),n.isCanceled){r(!1,!1);return}g.current=!0;let i=e.hasAttribute(eS);e.removeAttribute(eS),l(!0),r(!0,i)});return()=>{t.clear(),Vn.cancel(n),i()}},[w,o,l]);let F=i||n||a||s;return{height:k.height,props:{...A?{[eS]:``}:void 0,hidden:E,id:r},ref:C,shouldPreventOpenAnimation:O,shouldRender:F,transitionStatus:D,width:k.width}}function cS(e){return{height:e.scrollHeight,width:e.scrollWidth}}function lS(e,t){let n=Ie(e).getComputedStyle(e),r=(n.animationName.split(`,`).map(e=>e.trim()).some(e=>e!==``&&e!==`none`)||t)&&uS(n.animationDuration),i=uS(n.transitionDuration);return r&&i||i?`css-transition`:r?`css-animation`:`none`}function uS(e){return e.split(`,`).map(e=>e.trim()).some(e=>e!==``&&Number.parseFloat(e)>0)}function dS(e,t,n){let r=e.style.getPropertyValue(t),i=e.style.getPropertyPriority(t);return e.style.setProperty(t,n),()=>{r===``?e.style.removeProperty(t):e.style.setProperty(t,r,i)}}function fS(e){let t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(t=>{e.style.setProperty(t,`initial`,`important`)});function n(){Object.entries(t).forEach(([t,n])=>{n===``?e.style.removeProperty(t):e.style.setProperty(t,n)})}let r=Vn.request(n);return()=>{Vn.cancel(r),n()}}function pS(e){let t=v.useRef(!0);t.current&&(t.current=!1,e())}function mS(e,t,n,r,i,a,o,s,c,l=2){let u=Dr(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 Sr(n.current,u)?void 0:u}function hS(e){return e==null?Xt:e.type.startsWith(`key`)?dn:e.type.startsWith(`mouse`)||e.type.startsWith(`pointer`)?fn:Xt}var gS=v.createContext(void 0),_S=v.createContext(void 0),vS=v.createContext(void 0),yS=v.createContext(!1),bS=v.createContext(``);function xS(){let e=v.useContext(gS);if(!e)throw Error(J(22));return e}function SS(){let e=v.useContext(_S);if(!e)throw Error(J(23));return e}function CS(){let e=v.useContext(vS);if(!e)throw Error(J(24));return e}function wS(){return v.useContext(bS)}function TS(){return v.useContext(yS)}function ES(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 DS=(e,t)=>Object.is(e,t);function OS(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function kS(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!ES(e,t,(e,t)=>OS(e,t,n)):e!==t}function AS(e,t,n){return e?e.some(e=>e!==void 0&&OS(t,e,n)):!1}function jS(e,t,n){return e?e.findIndex(e=>e!==void 0&&OS(e,t,n)):-1}function MS(e,t){if(t!==DS)return n=>AS(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 NS(e,t,n,r){let i=r&&Array.isArray(t)?e.findIndex(MS(t,n)):jS(e,t,n);return i===-1?null:i}function PS(e,t,n,r,i,a){return AS(r,t,i)?a!=null&&e>a&&AS(r,n[a],i)?a:e:e===a?NS(n,r,i,!0):a}function FS(e,t,n){return e.filter(e=>!OS(t,e,n))}function IS(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function LS(e){return typeof e==`object`&&!!e&&Array.isArray(e.items)}function RS(e){return LS(e?.[0])}function zS(e){return RS(e)?e.flatMap(e=>e.items):e}function BS(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(RS(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 VS(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 IS(e)}function HS(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?IS(e.value):IS(e)}function US(e,t,n){function r(){return VS(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return(Object.hasOwn(t,e)?t[e]:void 0)??r();if(Array.isArray(t)){let n=zS(t);if(typeof e!=`object`||!e){let t=n.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=n.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function WS(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,S.jsx)(v.Fragment,{children:US(r,t,n)},i)),e),[])}var GS={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?BS(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=>OS(t,e,n)):OS(t,r,n)},transitionStatus:e=>e.transitionStatus,popupProps:e=>e.popupProps,listProps:e=>e.listProps,inputProps:e=>e.inputProps,triggerProps:e=>e.triggerProps,itemRoot:e=>e.itemRoot,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 KS(e){return e==null?void 0:`${e}-popup`}function qS(e,t){return(n,r)=>n!=null&&e.contains(n,r,t)}function JS(e){return Array.isArray(e)?e.map(e=>JS(e)).join(`,`):e==null?``:String(e)}var YS=new Map;function XS(e={}){let{locale:t,...n}=e,r={usage:`search`,sensitivity:`base`,ignorePunctuation:!0,...n},i=`${JS(t)}|${JSON.stringify(r)}`,a=YS.get(i);if(a)return a;let o=new Intl.Collator(t,r),s={contains(e,t,n){if(!t)return!0;let r=VS(e,n);for(let e=0;e<=r.length-t.length;e+=1)if(o.compare(r.slice(e,e+t.length),t)===0)return!0;return!1},startsWith(e,t,n){if(!t)return!0;let r=VS(e,n);return o.compare(r.slice(0,t.length),t)===0},endsWith(e,t,n){if(!t)return!0;let r=VS(e,n),i=t.length;return r.length>=i&&o.compare(r.slice(r.length-i),t)===0}};return YS.set(i,s),s}var ZS=XS;function QS(e,t=!1){let{overflowY:n}=$e(e);return n!==`auto`&&n!==`scroll`?!1:t?e.clientHeight>0:e.scrollHeight>e.clientHeight}var $S=Symbol(`none`),eC={value:$S,index:-1};function tC(e,t,n){let r=e.get(t);if(r!==void 0||n===DS)return r;for(let[r,i]of e)if(OS(r,t,n))return i}function nC(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:y=!1,items:b,filteredItems:x,filter:C,filterQuery:w,openOnInputClick:T=!0,autoHighlight:E=!1,keepHighlight:D=!1,highlightItemOnHover:O=!0,loopFocus:k=!0,itemToStringLabel:A,itemToStringValue:j,isItemEqualToValue:M=DS,virtualized:N=!1,inline:P=!1,fillInputOnItemPress:F=!0,modal:I=!1,limit:L=-1,autoComplete:R=`list`,formAutoComplete:z,locale:B,submitOnItemClick:V=!1}=e,{clearErrors:U}=kf(),{setDirty:ee,validityData:te,setFilled:ne,name:W,disabled:re,setTouched:ie,setFocused:oe,validationMode:se,validation:ce}=Df(),le=Cc(),ue=Ff({id:t}),de=ZS({locale:B}),fe=Array.isArray(b)?null:b;if(fe&&typeof fe.label!=`function`)throw Error(J(100));let pe=fe?fe.data:b,me=fe?.value,he=me?void 0:pe,ge=v.useMemo(()=>{if(!x||!me)return;let e=zS(x),t=e.map(me),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 tC(n,r,i)}}},[x,me]),_e=v.useMemo(()=>fe?e=>fe.label(e,M,e=>{let t=ge?.findItem(e,M);return t==null?VS(e,A):fe.itemLabel(t)}):A,[fe,A,ge,M]),ve=v.useMemo(()=>fe?Object.assign(e=>fe.itemLabel(e),{selected:e=>VS(e,_e)}):A,[fe,_e,A]);function ye(e){return VS(e,_e)}let[be,xe]=v.useState(!1),[Se,Ce]=v.useState(null),we=v.useRef(Se),Te=v.useRef([]),Ee=v.useRef([]),De=v.useRef(null),Oe=v.useRef(null),ke=v.useRef(null),Ae=v.useRef(null),je=v.useRef(null),Me=v.useRef(!1),Ne=v.useRef(null),Pe=v.useRef(null),Fe=v.useRef(null),Ie=v.useRef(eC),Le=v.useRef(null),Re=v.useRef([]),ze=v.useRef(null),Ve=re||m,He=W??f,Ue=u===`multiple`,We=u===`single`,Ge=s!==void 0||o!==void 0,Ke=pe!==void 0,qe=x!==void 0,Je;Je=E===`always`?`always`:E?`input-change`:!1;let[Ye,Xe]=kb({controlled:i,default:Ue?r??G:r,name:`Combobox`,state:`selectedValue`}),Ze=v.useMemo(()=>C===null?()=>!0:C===void 0?qS(de,ve):C,[C,de,ve]),Qe=H(()=>Ge?o??``:We?ye(Ye):``).current,[$e,et]=kb({controlled:s,default:Qe,name:`Combobox`,state:`inputValue`}),[tt,nt]=kb({controlled:c,default:l,name:`Combobox`,state:`open`}),it=RS(pe),lt=!tt&&Se!==null?Se:String($e).trim(),ut=We?ye(Ye):``,dt=We&&!be&&lt!==``&&ut.length===lt.length&&de.contains(ut,lt),ft=dt?``:w??lt,pt=Ke&&qe&&dt&&(!fe||fe.hasValue(Ye,M)),mt=v.useMemo(()=>pe?zS(pe):G,[pe]),ht=v.useMemo(()=>{if(x&&!pt)return x;if(!pe)return G;if(it){let e=pe,t=[],n=0;for(let r of e){if(L>-1&&n>=L)break;let e=L>-1?L-n:1/0,i=ft===``?r.items.slice(0,e):[];if(ft!==``)for(let t of r.items){if(i.length>=e)break;Ze(t,ft,ve)&&i.push(t)}if(i.length>0){let e={...r,items:i};t.push(e),n+=i.length}}return t}if(ft===``)return L>-1?mt.slice(0,L):mt;let e=[];for(let t of mt){if(L>-1&&e.length>=L)break;Ze(t,ft,ve)&&e.push(t)}return e},[x,pt,pe,it,ft,L,Ze,ve,mt]),gt=v.useMemo(()=>{if(ge&&ht===x)return ge.values;let e=zS(ht);return me?e.map(e=>me(e)):e},[ht,x,ge,me]),_t=H(()=>{let e=null;return P&&tt&&Ke&&u!==`none`&&(e=NS(gt,Ye,M,Ue)),new mo({id:ue,labelId:void 0,selectedValue:Ye,open:tt,items:he,selectionMode:u,name:He,form:p,disabled:Ve,readOnly:h,required:g,grid:y,virtualized:N,openOnInputClick:T,itemToStringLabel:_e,isItemEqualToValue:M,modal:I,autoHighlight:Je,submitOnItemClick:V,hasInputValue:Ge,mounted:!1,forceMounted:!1,transitionStatus:`idle`,inline:P,activeIndex:null,selectedIndex:e,popupProps:{},listProps:{},inputProps:{},triggerProps:{},itemRoot:{props:K,id:ue,selectionMode:u,disabled:Ve,readOnly:h,isItemEqualToValue:M},positionerElement:null,listElement:null,popupId:void 0,triggerElement:null,inputElement:null,inputGroupElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,inputOwnsFormValue:u===`none`},{onOpenChangeComplete:ae,setOpen:ae,setInputValue:ae,setSelectedValue:ae,setIndices:ae,handleSelection:ae,forceMount:ae,requestSubmit:ae,listRef:Te,labelsRef:Ee,popupRef:De,emptyRef:je,inputRef:Oe,startDismissRef:ke,endDismissRef:Ae,chipsContainerRef:Ne,clearRef:Pe,valuesRef:Re,pointerDownItemRef:ze,selectionEventRef:Fe},GS)}).current,vt=u===`none`?$e:Ye,yt=v.useMemo(()=>u===`none`?vt:Array.isArray(Ye)?Ye.map(e=>HS(e,j)):HS(Ye,j),[vt,j,u,Ye]),bt=Y(d),xt=Y(n),St=_t.useState(`activeIndex`),Ct=_t.useState(`selectedIndex`),wt=_t.useState(`positionerElement`),Tt=_t.useState(`listElement`),Et=_t.useState(`triggerElement`),Dt=_t.useState(`inputElement`),Ot=_t.useState(`inputGroupElement`),kt=_t.useState(`inline`),At=_t.useState(`inputInsidePopup`),jt=_t.useState(`inputOwnsFormValue`),Mt=We&&!At&&$e===ut,Nt=Mn(Et),{openMethod:Pt,triggerProps:Ft}=Ay(tt),It=Y(()=>yt);zf(At?Nt:Oe,ue,vt,It,!Ve,f);let Lt=Y(()=>{pe?Ee.current=gt.map(ye):_t.set(`forceMounted`,!0)}),Rt=Y((e,t,n,r)=>{if(t===-1){if(Ie.current===eC)return;Ie.current=eC}else Ie.current={value:e,index:t};bt(e,Yt(n,r,{index:t}))}),zt=Y(e=>{let t={};e.activeIndex!==void 0&&(t.activeIndex=e.activeIndex),e.selectedIndex!==void 0&&(t.selectedIndex=e.selectedIndex),_t.update(t);let n=e.activeIndex;if(n===void 0)return;let r=e.type||`none`;n===null?Rt(void 0,-1,r,e.event):Rt(Re.current[n],n,r,e.event)}),Bt=Y((t,n)=>{if(e.onInputValueChange?.(t,n),!n.isCanceled){if(Me.current=n.reason===on,n.reason===`input-change`){tt&&Se!==null&&Ce(null);let e=n.event,r=e.inputType;if(e.type===`compositionend`||r!=null&&r!==``&&r!==`insertReplacementText`){let e=t.trim()!==``;e&&xe(!0),Le.current={hasQuery:e};let n=_t.state.listElement;if(!_t.state.virtualized&&n){let e=De.current;for(let t of rt(n.firstElementChild??n)){if(!Be(t)||(e?!ot(e,t):t.getAttribute(`role`)===`dialog`))break;if(QS(t)){t.scrollTop=0;break}}}e&&Je&&_t.state.activeIndex==null&&(tt||kt)&&_t.set(`activeIndex`,0)}}else n.reason===`input-clear`&&t===``&&_t.state.inputInsidePopup&&(Le.current={hasQuery:!1,selection:!0});et(t)}}),Vt=Y(e=>{let t=!e&&At&&!kt&&$e!==``&&(String($e).trim()===Se||$e===ut);!e&&(t||$e===``||Mt)&&xe(!1),Ce(null),t&&Bt(``,Jt(on))}),[Ht,Ut]=v.useState(!1),Wt=Y((t,n)=>{if(tt===t)return;n.reason===`escape-key`&&Ke&&gt.length===0&&!je.current&&n.allowPropagation();let r=n,i=qa(r);if(e.onOpenChange?.(t,r),Le.current?.hasQuery&&n.reason===`input-change`===n.isCanceled&&(Le.current=null),!n.isCanceled&&(t&&Se!==null&&Vt(n.reason===an),!t&&be&&(We?(kt||Ce(lt),lt===``&&xe(!1)):Ue&&(kt||Ce(lt),At&&zt({activeIndex:null}),(!At||kt)&&Bt(``,Jt(on,n.event,void 0,{isItemPress:n.reason===tn})))),t||Ut(i()),nt(t),!t&&At&&(n.reason===`focus-out`||n.reason===`outside-press`)&&(ie(!0),oe(!1),se===`onBlur`))){let e=u===`none`?$e:Ye;ce.commit(e)}}),Gt=Y((e,t)=>{a?.(e,t),!t.isCanceled&&(Xe(e),(u===`none`&&De.current&&F||We&&!_t.state.inputInsidePopup)&&Bt(ye(e),Jt(t.reason,t.event)))}),Kt=Y((e,t)=>{let n=ct(e),r=Fe.current??e;Fe.current=null;let i=Jt(tn,r),a=st(n,`a`)?.getAttribute(`href`);if(a)a.startsWith(`#`)&&Wt(!1,i);else if(Ue){let e=Array.isArray(Ye)?Ye:[],n=AS(e,t,M),r=n?FS(e,t,M):[...e,t];if(Gt(r,i),i.isCanceled||!(Oe.current&&Oe.current.value.trim()!==``))return;if(_t.state.inputInsidePopup){Bt(``,Jt(on,i.event,void 0,{isItemPress:!0}));let e=Le.current;e&&!n&&(e.toggledValue=t)}else Wt(!1,i)}else{if(Gt(t,i),i.isCanceled)return;Wt(!1,i)}}),qt=Y(()=>{let e=ce.inputRef.current?.form??_t.state.inputElement?.form;e&&typeof e.requestSubmit==`function`&&e.requestSubmit()}),Zt=Y(()=>{if(xt?.(!1),xe(!1),Ce(null),zt(u===`none`?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),Ue&&Oe.current&&Oe.current.value!==``&&!Me.current&&Bt(``,Jt(on)),We){if(_t.state.inputInsidePopup)Oe.current&&Oe.current.value!==``&&Bt(``,Jt(on));else{let e=ye(Ye);Oe.current&&Oe.current.value!==e&&Bt(e,Jt(e===``?on:Xt))}}}),Qt=v.useMemo(()=>kt&&wt?{current:st(wt,`[role="dialog"]`)}:De,[kt,wt]),{mounted:$t,transitionStatus:en,forceUnmount:nn}=za({open:tt,ref:Qt,preventUnmountOnClose:Ht,setPreventUnmountOnClose:Ut,onUnmount:Zt});v.useImperativeHandle(e.actionsRef,()=>({unmount:nn,close:()=>Wt(!1,Jt(vn))}),[nn,Wt]),q(function(){let e=we.current!==null&&Se===null;if(we.current=Se,tt&&(!e||!Ke)||(tt||(ze.current=null),u===`none`))return;let t=Ke?gt:Re.current;zt({selectedIndex:NS(t,Ye,M,Ue)})},[tt,Se,Ye,u,Ue,Ke,gt,M,zt]),q(()=>{pe&&(Re.current=gt,Te.current.length=gt.length)},[pe,gt]),q(()=>{!tt&&Le.current?.hasQuery&&(Le.current=null)},[tt]),q(()=>{if(!tt&&kt&&Qt.current){Le.current=null;return}let e=Ke||qe?gt:Re.current,t=Le.current;if(t){let n=tt||kt||_t.state.positionerElement?.hidden===!1;if(t.hasQuery){let t=Oe.current;!Je||String($e).trim()===``||kt&&Je!==`always`&&(!t||at(t.ownerDocument)!==t)?Le.current=null:n&&(e[0]!==void 0||!Ke&&!qe)&&(_t.set(`activeIndex`,0),Le.current=null)}else if(String($e).trim()===``&&(Le.current=null,n)){let e=t.selection;Je===`always`&&!e&&_t.state.selectionMode===`none`&&_t.set(`activeIndex`,0),queueMicrotask(()=>{if(!_t.state.open&&(!_t.state.inline||Qt.current)||Oe.current&&Oe.current.value.trim()!==``)return;let n=_t.state.selectedValue,r=_t.state.selectionMode===`multiple`;if(r&&Array.isArray(n)?n.length>0:_t.state.selectionMode!==`none`&&n!=null){let e=Ke||qe?gt:Re.current,i=jS(e,t.toggledValue,_t.state.isItemEqualToValue);_t.set(`activeIndex`,i===-1?NS(e,n,_t.state.isItemEqualToValue,r):i)}else e?_t.set(`activeIndex`,null):Je===`always`&&_t.set(`activeIndex`,0)})}}if(!tt&&!kt)return;let n=_t.state.activeIndex;if(n==null){if(Je===`always`&&e.length>0){_t.set(`activeIndex`,0);return}Rt(void 0,-1,Xt);return}if(n>=e.length){Rt(void 0,-1,Xt),_t.set(`activeIndex`,null);return}let r=e[n],i=Ie.current.value,a=i!==$S&&OS(r,i,_t.state.isItemEqualToValue);(Ie.current.index!==n||!a)&&Rt(r,n,Xt)},[St,Je,Rt,qe,Ke,gt,kt,tt,Qt,_t,$e]),q(()=>{ne(u===`none`?String($e)!==``:Ue?Array.isArray(Ye)&&Ye.length>0:Ye!=null)},[ne,u,$e,Ye,Ue]),v.useEffect(()=>{Ke&&Je&&gt.length===0&&zt({activeIndex:null})},[Ke,Je,gt.length,zt]);function rn(){tt&&lt!==``&&lt!==String(Qe)&&!Mt&&xe(!0)}function cn(){tt&&Se!==null&&Vt(!1)}let ln=!1;function un(){!ln&&$e!==ut&&(ln=!0,Bt(ut,Jt(Xt)))}function dn(){u!==`none`&&(U(He),ee(kS(Ye,te.initialValue,M)),ce.change(Ye),We&&!Ge&&!At&&un())}function fn(){We&&!Ge&&!At&&!be&&un()}function pn(){u===`none`&&(U(He),ee($e!==te.initialValue),ce.change($e))}Bf(lt,rn),Bf(tt,cn),Bf(Ye,dn),Bf(ut,fn),Bf(pe,fn),Bf($e,pn);let mn=To({open:kt?!0:tt,onOpenChange:Wt,elements:{reference:At?Et:Dt,floating:wt}}),hn=y?`grid`:`listbox`,gn=tt||kt,_n=gn?`true`:`false`,yn=v.useMemo(()=>{let e=Dt?.tagName===`INPUT`,t=Dt==null||e,n=t||gn,r=t?{autoComplete:`off`,spellCheck:`false`,autoCorrect:`off`,autoCapitalize:`none`}:{};return n&&(r.role=`combobox`,r[`aria-expanded`]=_n,r[`aria-haspopup`]=hn,r[`aria-controls`]=gn?Tt?.id:void 0,r[`aria-autocomplete`]=h?`none`:R),{reference:r,floating:{role:`presentation`}}},[Dt,gn,_n,hn,Tt?.id,R,h]),bn=wa(mn,{enabled:!Ve&&T,event:`mousedown-only`,toggle:!1,touchOpenDelay:At?0:100,reason:sn}),xn=Aa(mn,{enabled:!Ve&&!kt,outsidePressEvent:{mouse:`sloppy`,touch:`intentional`},bubbles:kt?!0:void 0,outsidePress(e){let t=ct(e);return!ot(Et,t)&&!ot(Pe.current,t)&&!ot(Ne.current,t)&&!ot(Ot,t)}}),Sn=Ho(mn,{enabled:!Ve,id:ue,listRef:Te,activeIndex:St,selectedIndex:Ct,virtual:!0,loopFocus:k,allowEscape:k&&!Je,focusItemOnOpen:be||u===`none`&&!Je?!1:`auto`,focusItemOnHover:O,resetOnPointerLeave:!D,orientation:y?`horizontal`:void 0,rtl:le===`rtl`,disabledIndices:G,grid:y?mS:void 0,onNavigate(e,t){(t||tt||kt&&e===null)&&en!==`ending`&&zt({activeIndex:e,type:hS(t),event:t?.nativeEvent})}}),Cn=v.useMemo(()=>ki(Sn.reference,{onKeyDown(e){y&&_t.state.activeIndex==null&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&e.preventBaseUIHandler()}},xn.reference,bn.reference,yn.reference),[Sn.reference,xn.reference,bn.reference,yn.reference,y,_t]),wn=v.useMemo(()=>ki(Ba,xn.floating),[xn.floating]),Tn=v.useMemo(()=>ki(Sn.floating,yn.floating),[Sn.floating,yn.floating]),Dn=v.useMemo(()=>{let e=Sn.item;return{props:e?{...e,onFocus:void 0}:K,id:ue,selectionMode:u,disabled:Ve,readOnly:h,isItemEqualToValue:M}},[Sn.item,ue,u,Ve,h,M]);_t.useContextCallback(`setOpen`,Wt),_t.useContextCallback(`setInputValue`,Bt),_t.useContextCallback(`setSelectedValue`,Gt),_t.useContextCallback(`setIndices`,zt),_t.useContextCallback(`handleSelection`,Kt),_t.useContextCallback(`forceMount`,Lt),_t.useContextCallback(`requestSubmit`,qt),_t.useContextCallback(`onOpenChangeComplete`,n),pS(()=>{_t.update({inline:P,popupProps:wn,listProps:Tn,inputProps:Cn,triggerProps:Ft,itemRoot:Dn})});let On={id:ue,selectedValue:Ye,open:tt,mounted:$t,transitionStatus:en,items:he,inline:P,popupProps:wn,listProps:Tn,inputProps:Cn,triggerProps:Ft,itemRoot:Dn,openMethod:Pt,selectionMode:u,name:He,form:p,disabled:Ve,readOnly:h,required:g,grid:y,virtualized:N,openOnInputClick:T,itemToStringLabel:_e,modal:I,autoHighlight:Je,isItemEqualToValue:M,submitOnItemClick:V,hasInputValue:Ge};q(()=>{_t.update({...On,inputOwnsFormValue:u===`none`&&(P||!_t.state.inputInsidePopup)})},[_t,...Object.values(On)]);let kn=En(_,ce.inputRef),An=v.useMemo(()=>({query:lt,hasItems:Ke,filteredItems:ht,flatFilteredValues:gt}),[lt,Ke,ht,gt]),jn=v.useMemo(()=>Array.isArray(vt)?``:HS(vt,j),[vt,j]),Nn=Ue&&Array.isArray(Ye)&&Ye.length>0,Pn=Ue||u===`none`&&jt?void 0:He,Fn=v.useMemo(()=>!Ue||!Array.isArray(Ye)||!He?null:Ye.map(e=>{let t=HS(e,j);return(0,S.jsx)(`input`,{type:`hidden`,form:p,name:He,value:t,disabled:Ve},t)}),[Ue,Ye,p,He,j,Ve]),In=(0,S.jsxs)(v.Fragment,{children:[e.children,(0,S.jsx)(`input`,{...ce.getValidationProps(Ve,{onFocus(){At?Et?.focus():(Oe.current||Et)?.focus()},onChange(e){if(e.nativeEvent.defaultPrevented||Ve||h)return;let t=e.currentTarget.value,n=t.toLowerCase(),r=Jt(Xt,e.nativeEvent),i=()=>Re.current.findIndex(e=>HS(e,j).toLowerCase()===n||ye(e).toLowerCase()===n);function a(){if(Ue)return;if(u===`none`){Bt(t,r);return}let e=i();e===-1&&(e=Re.current.findIndex((e,t)=>{let r=Ee.current[t];return r!=null&&r.toLowerCase()===n}));let a=e===-1?void 0:Re.current[e];a!=null&&Gt?.(a,r)}We&&(Lt(),pe&&i()===-1&&_t.set(`forceMounted`,!0)),queueMicrotask(a)}}),id:ue&&Pn==null?`${ue}-hidden-input`:void 0,form:p,name:Pn,autoComplete:z,disabled:Ve,required:g&&!Nn,readOnly:h,value:jn,ref:kn,style:Pn?Kn:Gn,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Fn]});return(0,S.jsx)(gS.Provider,{value:_t,children:(0,S.jsx)(_S.Provider,{value:mn,children:(0,S.jsx)(yS.Provider,{value:Ke,children:(0,S.jsx)(vS.Provider,{value:An,children:(0,S.jsx)(bS.Provider,{value:$e,children:In})})})})})}var rC=`data-popup-side`,iC=`data-list-empty`,aC={...jt,...wf,popupSide:e=>e?{[rC]:e}:null,listEmpty:e=>e?{[iC]:``}:null},oC=5;function sC(e,t){let n=cC(t);return e.clientX>=n.left-oC&&e.clientX<=n.right+oC&&e.clientY>=n.top-oC&&e.clientY<=n.bottom+oC}function cC(e){let t=e.getBoundingClientRect(),n=Ie(e);if(De)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}}function lC(e,t){return e??t}function uC(e){let t=e.useState(`mounted`),n=e.useState(`popupSide`),r=e.useState(`positionerElement`);return t&&r?n:null}function dC(){return CS().filteredItems.length===0}function fC(e){return e===`rtl`?[`ArrowRight`,`ArrowLeft`]:[`ArrowLeft`,`ArrowRight`]}function pC(e,t,n){let r=e.context.listRef.current[t];r&&(e.context.selectionEventRef.current=n,r.click(),e.context.selectionEventRef.current=null)}var mC=v.forwardRef(function(e,t){let{render:n,className:r,nativeButton:i=!0,disabled:a=!1,id:o,style:s,...c}=e,{state:l,disabled:u,setTouched:d,validationMode:f,validation:p}=Df(),{labelId:m}=jf(),h=xS(),g=h.useState(`selectionMode`),_=h.useState(`disabled`),y=h.useState(`readOnly`),b=h.useState(`required`),x=h.useState(`positionerElement`),S=h.useState(`listElement`),C=h.useState(`popupId`),w=h.useState(`triggerProps`),T=h.useState(`inputInsidePopup`),E=h.useState(`id`),D=h.useState(`labelId`),O=h.useState(`open`),k=h.useState(`selectedValue`),A=h.useState(`activeIndex`),j=h.useState(`selectedIndex`),M=h.useState(`hasSelectedValue`),N=SS(),P=wS(),F=fe(),I=u||_||a,L=dC(),R=uC(h),z=v.useRef(null),B=Rf(I,z);Ff({id:T?o:void 0});let V=T?o??E:o,H=lC(m,D),U;O&&T?U=C??KS(E):O&&(U=S?.id);let ee=v.useRef(``);function te(e){ee.current=e.pointerType}let{reference:ne}=Uo(N,{enabled:!O&&!y&&!_&&g===`single`,listRef:h.context.labelsRef,activeIndex:A,selectedIndex:j,onMatch(e){let t=h.context.valuesRef.current[e];t!==void 0&&h.context.setSelectedValue(t,Jt(Xt))}}),{reference:W}=wa(N,{enabled:!_,event:`mousedown`}),{buttonRef:re,getButtonProps:ie}=pf({native:i,disabled:I}),ae={...l,readOnly:y,open:O,disabled:I,popupSide:R,listEmpty:L,placeholder:g!==`none`&&!M};return Hi(`button`,e,{ref:[t,re,z,Y(e=>{h.set(`triggerElement`,e)})],state:ae,props:[w,W,ne,{id:V,tabIndex:T?0:-1,role:T?`combobox`:void 0,"aria-expanded":O,"aria-haspopup":T?`dialog`:`listbox`,"aria-controls":U,"aria-required":T&&b||void 0,"aria-readonly":T&&y||void 0,"aria-labelledby":H,onPointerDown:te,onPointerEnter:te,onFocus(){B(!0),!I&&F.start(0,h.context.forceMount)},onBlur(e){if(!ot(x,e.relatedTarget)&&(d(!0),B(!1),f===`onBlur`)){let e=g===`none`?P:k;p.commit(e)}},onMouseDown(e){if(I||(T||N.set(`domReferenceElement`,e.currentTarget),h.context.forceMount(),ee.current!==`touch`&&(h.context.inputRef.current?.focus(),T||e.preventDefault()),O))return;let t=Un(e.currentTarget);function n(e){let t=h.state.triggerElement;if(!t)return;let n=ct(e),r=h.state.positionerElement,i=h.state.listElement;ot(t,n)||ot(r,n)||ot(i,n)||sC(e,t)||h.context.setOpen(!1,Jt(pn,e))}T&&t.addEventListener(`mouseup`,n,{once:!0})},onKeyDown(e){(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(Oe(e),h.context.setOpen(!0,Jt(un,e.nativeEvent)),h.context.inputRef.current?.focus())}},p.getValidationProps(I,c),ie],stateAttributesMapping:aC})}),hC=v.createContext(void 0);function gC(){return v.useContext(hC)}var _C=v.createContext(void 0);function vC(e){let t=v.useContext(_C);if(t===void 0&&!e)throw Error(J(21));return t}var yC=v.forwardRef(function(e,t){let n=xS(),{buttonRef:r,getButtonProps:i}=pf({native:!1}),a=En(t,r);function o(e){n.context.setOpen(!1,Jt(nn,e.nativeEvent,e.currentTarget))}let s=i({onClick:o});return(0,S.jsx)(`span`,{ref:a,...s,"aria-label":`Dismiss`,tabIndex:void 0,style:Kn})}),bC=v.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,id:a,style:o,...s}=e,{state:c,disabled:l,setTouched:u,validationMode:d,validation:f}=Df(),{labelId:p}=jf(),m=gC(),h=!!vC(!0),g=xS(),_=wS(),y=Cc(),b=g.useState(`required`),x=g.useState(`disabled`),C=g.useState(`readOnly`),w=g.useState(`name`),T=g.useState(`form`),E=g.useState(`selectionMode`),D=g.useState(`autoHighlight`),O=g.useState(`inputProps`),k=g.useState(`triggerProps`),A=g.useState(`open`),j=g.useState(`mounted`),M=g.useState(`selectedValue`),N=g.useState(`id`),P=g.useState(`inline`),F=g.useState(`modal`),I=!!D,L=uC(g),R=l||x||i,z=dC(),B=Rf(R,g.context.inputRef),V=h||P,H=!V||F,U=lc(a??(V?void 0:N)),ee=h?Sf:c,[te,ne]=v.useState(null),W=v.useRef(!1),re=v.useRef(null);q(()=>{A||(re.current=null)},[A]);let ie=E===`none`&&!h,ae=Y(e=>{let t=h||g.state.inline;t&&!g.state.hasInputValue&&g.context.setInputValue(``,Jt(Xt)),g.update({inputElement:e,inputInsidePopup:t,inputOwnsFormValue:ie})}),G=h?s:f.getValidationProps(R,s);function K(e){g.context.setIndices({activeIndex:null,selectedIndex:null,type:hS(e),event:e})}let oe={...ee,open:A,disabled:R,readOnly:C,popupSide:L,listEmpty:z};function J(e){if(!m)return;let t,n=m.chipsRef.current.length,[r]=fC(y);return e.key===r&&(e.currentTarget.selectionStart??0)===0&&M.length>0&&(e.preventDefault(),t=n>0?n-1:void 0),t}let se=Hi(`input`,e,{state:oe,ref:[t,g.context.inputRef,ae],props:[O,k,{value:te??_,"aria-readonly":C||void 0,"aria-required":b||void 0,"aria-labelledby":p,disabled:R,readOnly:C,required:E===`none`?b:void 0,form:T,...ie&&w&&{name:w},id:U,onFocus(){if(B(!0),!P)return;let e=re.current;re.current=null,e!=null&&Object.hasOwn(g.context.valuesRef.current,e)&&g.context.setIndices({activeIndex:e})},onBlur(){u(!0),B(!1);let e=g.state.activeIndex;if(P&&e!==null&&D!==`always`&&(re.current=e,g.context.setIndices({activeIndex:null})),d===`onBlur`){let e=E===`none`?_:M;f.commit(e)}},onCompositionStart(e){xe||(W.current=!0,ne(e.currentTarget.value))},onCompositionEnd(e){W.current=!1;let t=e.currentTarget.value;ne(null),g.context.setInputValue(t,Jt(an,e.nativeEvent))},onChange(e){let t=e.nativeEvent,n=t.inputType,r=!n||n===`insertReplacementText`,i=W.current||!r;function a(e){!C&&!R&&e&&i&&(g.context.setOpen(!0,Jt(an,t)),I||K(t))}if(W.current){let n=e.currentTarget.value;ne(n),n===``&&!g.state.openOnInputClick&&!g.state.inputInsidePopup&&g.context.setOpen(!1,Jt(on,t));let r=n.trim(),i=I&&r!==``;a(r),A&&g.state.activeIndex!==null&&!i&&K(t);return}let o=Jt(an,t);if(g.context.setInputValue(e.currentTarget.value,o),o.isCanceled)return;let s=e.currentTarget.value===``,c=Jt(on,t);s&&!g.state.inputInsidePopup&&(E===`single`&&g.context.setSelectedValue(null,c),g.state.openOnInputClick||g.context.setOpen(!1,c)),a(e.currentTarget.value.trim()),A&&g.state.activeIndex!==null&&!I&&K(t)},onKeyDown(e){if(e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)return;if(R||C){C&&e.key===`Enter`&&A&&g.state.activeIndex!==null&&Oe(e);return}let t=e.currentTarget,n=t.scrollWidth-t.clientWidth,r=y===`rtl`;if(e.key===`Home`){Oe(e);let n=Te&&r?t.value.length:0;t.setSelectionRange(n,n),t.scrollLeft=0;return}if(e.key===`End`){Oe(e);let i=Te&&r?0:t.value.length;t.setSelectionRange(i,i),t.scrollLeft=r?-n:n;return}if(!j&&e.key===`Escape`){let t=E===`multiple`&&Array.isArray(M)?M.length===0:M===null,n=Jt(ln,e.nativeEvent),r=E===`multiple`?[]:null;g.context.setInputValue(``,n),g.context.setSelectedValue(r,n),!t&&!g.state.inline&&!n.isPropagationAllowed&&e.stopPropagation();return}if(m&&e.key===`Backspace`&&t.value===``&&Array.isArray(M)&&M.length>0){let t=m.chipsRef.current.length,n=t>0?t-1:M.length-1,r=M.filter((e,t)=>t!==n);K(e.nativeEvent),g.context.setSelectedValue(r,Jt(Xt,e.nativeEvent));return}let i=J(e);if(i!==void 0&&m?.chipsRef.current[i]?.focus(),e.which!==229&&e.key===`Enter`&&A){let t=g.state.activeIndex,n=e.nativeEvent;if(t===null){if(P)return;g.context.setOpen(!1,Jt(Xt,n));return}Oe(e),pC(g,t,n)}}},G],stateAttributesMapping:aC}),ce=h?(0,S.jsx)(Ef.Provider,{value:Tf,children:se}):se;return(0,S.jsxs)(v.Fragment,{children:[A&&H&&(0,S.jsx)(yC,{ref:g.context.startDismissRef}),ce]})}),xC={...yt,...At},SC=v.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,keepMounted:o=!1,style:s,...c}=e,{disabled:l}=Df(),u=xS(),d=u.useState(`selectionMode`),f=u.useState(`disabled`),p=u.useState(`readOnly`),m=u.useState(`open`),h=u.useState(`selectedValue`),g=u.useState(`hasSelectionChips`),_=wS(),v=!1;v=d===`none`?_!==``:d===`single`?h!=null:g;let y=l||f||i,{buttonRef:b,getButtonProps:x}=pf({native:a,disabled:y}),{mounted:S,transitionStatus:C,setMounted:w}=Na(v),T={disabled:y,visible:v,open:m,transitionStatus:C};Ra({open:v,ref:u.context.clearRef,onComplete(){v||w(!1)}});let E=Hi(`button`,e,{state:T,ref:[t,b,u.context.clearRef],props:[{tabIndex:-1,children:`x`,onMouseDown(e){e.preventDefault()},onClick(e){if(y||p)return;let t=hS(e);u.context.setInputValue(``,Jt(rn,e.nativeEvent)),d===`none`?u.context.setIndices({activeIndex:null,type:t,event:e.nativeEvent}):(u.context.setSelectedValue(Array.isArray(h)?[]:null,Jt(rn,e.nativeEvent)),u.context.setIndices({activeIndex:null,selectedIndex:null,type:t,event:e.nativeEvent})),u.context.inputRef.current?.focus()}},c,x],stateAttributesMapping:xC});return o||S?E:null}),CC=v.createContext(null);function wC(){return v.useContext(CC)}function TC(e){let{children:t,items:n}=e,r=v.useMemo(()=>({items:n}),[n]);return(0,S.jsx)(CC.Provider,{value:r,children:t})}function EC(e){let{children:t}=e,{filteredItems:n}=CS(),r=wC(),i=r?r.items:n;return(0,S.jsx)(v.Fragment,{children:i.map(t)})}var DC=v.forwardRef(function(e,t){var n;let{render:r,className:i,style:a,children:o,...s}=e,c=xS(),l=SS(),u=!!vC(!0),{filteredItems:d,hasItems:f}=CS(),p=c.useState(`selectionMode`),m=c.useState(`grid`),h=c.useState(`readOnly`),g=c.useState(`listProps`),_=c.useState(`virtualized`),y=c.useState(`forceMounted`),b=p===`multiple`,x=d.length===0,C=Y(e=>{c.set(`positionerElement`,e)}),w=Y(e=>{c.set(`listElement`,e)}),T=v.useMemo(()=>typeof o==`function`?n||=(0,S.jsx)(EC,{children:o}):o,[o]),E={empty:x},D=l.useState(`floatingId`),O=Hi(`div`,e,{state:E,ref:[t,w,u?null:C],props:[g,{children:T,tabIndex:-1,id:D,role:m?`grid`:`listbox`,"aria-multiselectable":b?`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;Oe(e),pC(c,t,e.nativeEvent)}}},s]});if(_)return O;let k=f&&!y?void 0:c.context.labelsRef;return(0,S.jsx)(Mb,{elementsRef:c.context.listRef,labelsRef:k,children:O})}),OC=`⁠`;function kC(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 AC(e=!0){let t=fe(),n=v.useRef(null);return v.useEffect(()=>{if(!e||ye)return;let r=n.current;if(r==null)return;let i=kC(r);if(i==null)return;let a=i.data,o=`${a}${OC}`;return i.nodeValue=o,t.start(200,()=>{i.nodeValue===o&&(i.nodeValue=a)}),()=>{t.clear(),i.nodeValue===o&&(i.nodeValue=a)}},[e,n,t]),n}var jC=v.createContext(void 0);function MC(){let e=v.useContext(jC);if(e===void 0)throw Error(J(20));return e}var NC=v.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=xS(),a=i.useState(`mounted`),o=i.useState(`forceMounted`);return a||n||o?(0,S.jsx)(jC.Provider,{value:n,children:(0,S.jsx)(ia,{ref:t,...r})}):null}),PC=v.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=Zi,style:g,..._}=e,v=xS(),y=SS(),b=MC(),x=v.useState(`modal`),C=v.useState(`open`),w=v.useState(`mounted`),T=v.useState(`openMethod`),E=v.useState(`positionerElement`),D=v.useState(`triggerElement`),O=v.useState(`inputElement`),k=v.useState(`inputGroupElement`),A=v.useState(`inputInsidePopup`),j=v.useState(`transitionStatus`),M=dC(),N=Lc({anchor:i??(A?D:k??O),floatingRootContext:y,positionMethod:a,mounted:w,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m,keepMounted:b,collisionAvoidance:h,lazyFlip:!0});sb(C&&x,T===`touch`,E,D);let P={open:C,side:N.side,align:N.align,anchorHidden:N.anchorHidden,empty:M};q(()=>{v.set(`popupSide`,N.side)},[v,N.side]);let F=Y(e=>{v.set(`positionerElement`,e)}),I=Vc(e,P,{styles:N.positionerStyles,transitionStatus:j,props:_,refs:[t,F],hidden:!w,inert:!C});return(0,S.jsxs)(_C.Provider,{value:N,children:[w&&x&&(0,S.jsx)(sy,{inert:Kc(!C),cutout:k??O??D}),I]})}),FC={...Mt,...yt},IC=v.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=xS(),l=vC(),u=SS(),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`),y=c.useState(`modal`),b=c.useState(`id`),x=dC(),C=s.id??(g?KS(b):void 0);q(()=>(c.set(`popupId`,c.context.popupRef.current?.id||C),()=>{c.set(`popupId`,void 0)}),[c,C]),Ra({open:f,ref:c.context.popupRef,onComplete(){f&&c.context.onOpenChangeComplete(!0)}});let w=Hi(`div`,e,{state:{open:f,side:l.side,align:l.align,anchorHidden:l.anchorHidden,transitionStatus:h,empty:x},ref:[t,c.context.popupRef],props:[m,{id:C,role:g?`dialog`:`presentation`,onFocus(e){let t=ct(e.nativeEvent);p!==`touch`&&(ot(c.state.listElement,t)||t===e.currentTarget)&&c.context.inputRef.current?.focus()}},Bc(h),s],stateAttributesMapping:FC}),T=a===void 0?g?e=>e===`touch`?c.context.popupRef.current:_:!1:a,E;E=o??(g?void 0:!1);let D=!g||y;return(0,S.jsx)(Ca,{context:u,disabled:!d,modal:D,openInteractionType:p,initialFocus:T,returnFocus:E,getInsideElements:()=>[c.context.startDismissRef.current,c.context.endDismissRef.current],children:(0,S.jsxs)(v.Fragment,{children:[w,D&&(0,S.jsx)(yC,{ref:c.context.endDismissRef})]})})}),LC=v.createContext(void 0);function RC(){let e=v.useContext(LC);if(e===void 0)throw Error(J(18));return e}var zC=v.forwardRef(function(e,t){let{render:n,className:r,style:i,items:a,...o}=e,s=xS().useState(`grid`),[c,l]=v.useState(),u=v.useMemo(()=>({labelId:c,setLabelId:l,items:a}),[c,l,a]),d=Hi(`div`,e,{ref:t,props:[{role:s?`rowgroup`:`group`,"aria-labelledby":c},o]}),f=(0,S.jsx)(LC.Provider,{value:u,children:d});return a?(0,S.jsx)(TC,{items:a,children:f}):f}),BC=v.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{setLabelId:s}=RC(),c=lc(a);return q(()=>(s(c),()=>{s(e=>e===c?void 0:e)}),[c,s]),Hi(`div`,e,{ref:t,props:[{id:c,"aria-hidden":!0},o]})}),VC=v.createContext(void 0);function HC(){let e=v.useContext(VC);if(!e)throw Error(J(19));return e}var UC=v.createContext(!1);function WC(){return v.useContext(UC)}function GC(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=v.useRef(null),m=qb({guess:!0,index:l,textRef:p}),h=xS(),g=WC(),_=TS(),{props:y,id:b,selectionMode:x,disabled:C,readOnly:w,isItemEqualToValue:T}=h.useState(`itemRoot`),E=C||u,D=x!==`none`,O=l??i??m.index,k=O!==-1,A=h.useState(`isActive`,O),j=h.useState(`isSelected`,c),M=v.useRef(null),N=b!=null&&k?`${b}-${O}`:void 0,P=j&&D;q(()=>{if(!k||!r&&l==null)return;let e=h.context.listRef.current;return e[O]=M.current,()=>{delete e[O]}},[k,r,O,l,h]),q(()=>{if(!k||_)return;let e=h.context.valuesRef.current;return e[O]=c,()=>{delete e[O]}},[k,_,O,c,h]),q(()=>{if(!k||_)return;let e=h.state.selectedValue,t=h.state.selectedIndex;h.state.selectionMode===`multiple`&&Array.isArray(e)?t=PS(O,c,h.context.valuesRef.current,e,T,t):OS(c,e,T)&&(t=O),h.set(`selectedIndex`,t)},[k,_,h,O,c,T]);let{getButtonProps:F,buttonRef:I}=pf({disabled:E,focusableWhenDisabled:!0,native:d,composite:!0}),L={disabled:E,selected:P,highlighted:A};function z(e){function t(){h.context.handleSelection(e,c)}h.state.submitOnItemClick?(R.flushSync(t),h.context.requestSubmit()):t()}let B={id:N,role:g?`gridcell`:`option`,"aria-selected":D?P:void 0,tabIndex:void 0,onPointerDownCapture(e){e.isPrimary&&(h.context.pointerDownItemRef.current=e.currentTarget),e.preventDefault()},onMouseDown(e){e.preventDefault()},onClick(e){E||w||z(e.nativeEvent)},onMouseUp(e){let t=h.context.pointerDownItemRef.current===e.currentTarget;h.context.pointerDownItemRef.current=null,!(E||w||e.button!==0||t||!A)&&z(e.nativeEvent)}},V=Hi(`div`,t,{ref:[I,n,m.ref,M],state:L,props:[y,B,f,F]}),H=v.useMemo(()=>({selected:P,textRef:p}),[P,p]);return(0,S.jsx)(VC.Provider,{value:H,children:V})}function KC(e){let{componentProps:t,forwardedRef:n}=e,r=xS().useState(`isItemEqualToValue`),{flatFilteredValues:i}=CS(),a=jS(i,t.value??null,r);return(0,S.jsx)(GC,{componentProps:t,forwardedRef:n,virtualized:!0,indexFromFilter:a})}var qC=v.memo(v.forwardRef(function(e,t){let n=xS().useState(`virtualized`);return n&&e.index==null?(0,S.jsx)(KC,{componentProps:e,forwardedRef:t}):(0,S.jsx)(GC,{componentProps:e,forwardedRef:t,virtualized:n,indexFromFilter:void 0})})),JC=v.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,{filteredItems:s}=CS(),c=xS(),l=AC(),u=s.length===0?a:null;return Hi(`div`,e,{ref:[t,c.context.emptyRef,l],props:[{children:u,role:`status`,"aria-live":`polite`,"aria-atomic":!0},o]})}),YC=v.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return Hi(`div`,e,{state:{orientation:i},ref:t,props:[{role:`presentation`},o]})}),XC={...aS,...yt},ZC=v.forwardRef(function(e,t){let{render:n,className:r,defaultOpen:i=!1,disabled:a=!1,onOpenChange:o,open:s,style:c,...l}=e,u=Y(o),d=Yx({open:s,defaultOpen:i,onOpenChange:u,disabled:a}),f=v.useMemo(()=>({open:d.open,disabled:d.disabled,transitionStatus:d.transitionStatus}),[d.open,d.disabled,d.transitionStatus]),p=v.useMemo(()=>({...d,onOpenChange:u,state:f}),[d,u,f]),m=Hi(`div`,e,{state:f,ref:t,props:l,stateAttributesMapping:XC});return(0,S.jsx)(Xx.Provider,{value:p,children:m})}),QC={...iS,...yt},$C=v.forwardRef(function(e,t){let{panelId:n,open:r,handleTrigger:i,state:a,disabled:o}=Zx(),{className:s,disabled:c=o,render:l,nativeButton:u=!0,style:d,...f}=e,{getButtonProps:p,buttonRef:m}=pf({disabled:c,native:u});return Hi(`button`,e,{state:a,ref:[t,m],props:[{"aria-controls":r?n:void 0,"aria-expanded":r,onClick:i},f,p],stateAttributesMapping:QC})}),ew=`--collapsible-panel-height`,tw=`--collapsible-panel-width`,nw=v.forwardRef(function(e,t){let{className:n,hiddenUntilFound:r,keepMounted:i,render:a,id:o,style:s,...c}=e,{defaultPanelId:l,mounted:u,onOpenChange:d,open:f,setMounted:p,setPanelIdState:m,setOpen:h,state:g,transitionStatus:_}=Zx(),v=r??!1,y=i??!1,b=o||void 0,x=b??l;q(()=>(m(e=>b??(e===null?void 0:e)),()=>{m(e=>e===b?null:e)}),[b,m]);let{height:S,props:C,ref:w,shouldPreventOpenAnimation:T,shouldRender:E,transitionStatus:D,width:O}=sS({externalRef:t,hiddenUntilFound:v,id:x,keepMounted:y,mounted:u,onOpenChange:d,open:f,setMounted:p,setOpen:h,transitionStatus:_}),k={...g,transitionStatus:D},A=Di(s,k),j=Hi(`div`,{...e,style:void 0},{state:k,ref:w,props:[C,{style:{[ew]:S===void 0?`auto`:`${S}px`,[tw]:O===void 0?`auto`:`${O}px`}},c,A?{style:A}:void 0,T?{style:{animationName:`none`}}:void 0],stateAttributesMapping:XC});return E?j:null});function rw(e){let{multiple:t=!1,defaultValue:n,value:r,onValueChange:i,autoComplete:a,...o}=e;return(0,S.jsx)(nC,{...o,selectionMode:t?`multiple`:`single`,selectedValue:r,defaultSelectedValue:n,onSelectedValueChange:i,formAutoComplete:a})}var iw=v.memo(v.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a,selected:o,...s}=e,c=v.useRef(null),{transitionStatus:l,setMounted:u}=Na(o),d=Hi(`span`,e,{ref:[t,c],state:{selected:o,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},s],stateAttributesMapping:yt});return Ra({batch:!0,enabled:!o,open:o,ref:c,onComplete(){o||u(!1)}}),d})),aw=v.forwardRef(function(e,t){let{selected:n}=HC();return e.keepMounted||n?(0,S.jsx)(iw,{...e,selected:n,ref:t}):null}),ow=v.createContext(void 0);function sw(e=!0){let t=v.useContext(ow);if(t===void 0&&!e)throw Error(J(25));return t}var cw=v.createContext(void 0);function lw(e){let t=v.useContext(cw);if(t===void 0&&!e)throw Error(J(33));return t}var uw=v.createContext(void 0);function dw(e){let t=v.useContext(uw);if(t===void 0&&!e)throw Error(J(36));return t}var fw=v.createContext(null);function pw(e=`root`){let t=v.useContext(fw),n=v.useContext(uw);return t===null||n===void 0?null:(e===`submenu-trigger`?n.virtualFocus||n.parentVirtualFocus:n.virtualFocus)?t:null}var mw={visible:!0,ref:null};function hw(){return mw}function gw(e,t,n=`root`){let r=pw(n),i=((n===`submenu-trigger`?r?.useSubmenuTrigger:r?.useItem)??hw)({label:e.label,children:e.children,render:e.render}),a=En(t,i.ref);return{visible:i.visible,ref:a,props:i.props}}function _w(e){e.preventDefault()}function vw(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,l=dw(),u=sw(!0),d=c.type===`submenu-trigger`,f=d?l.parentVirtualFocus:l.virtualFocus,p=(d&&l.parent.type===`menu`?l.parent.store:l.store).useState(`webkitAriaSelected`,n),{events:m}=a.useState(`floatingTreeRoot`),h=a.useState(`open`),g=u!==void 0,_=!f&&h&&n?0:-1;return v.useMemo(()=>({id:r,role:`menuitem`,tabIndex:_,"aria-selected":p,onMouseDown:f?_w:void 0,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&m.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&m.emit(`close`,{domEvent:e.nativeEvent,reason:tn})},onMouseUp(e){if(u){let t=u.initialCursorPointRef.current;if(u.initialCursorPointRef.current=null,g&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||g&&!Se&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!g||e.button===2)&&c.type===`regular-item`&&ff(s.current,e,{detail:1,pointerType:`mouse`})}}),[t,_,r,m,i,a.context.allowMouseUpTriggerRef,o,s,u,g,c.type,p,f])}var yw={type:`regular-item`};function bw(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=v.useRef(null),{getButtonProps:d,buttonRef:f}=pf({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=vw({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=v.useCallback(e=>ki(p,{onMouseEnter(e){c.type===`submenu-trigger`&&c.setActive(e.nativeEvent)}},e,d),[p,d,c]),h=En(u,f);return v.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var xw=v.createContext(void 0);function Sw(){let e=v.useContext(xw);if(e===void 0)throw Error(J(31));return e}var Cw=v.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=v.useState(void 0),c=Hi(`div`,e,{ref:t,props:{role:`group`,"aria-labelledby":o,...a}});return(0,S.jsx)(xw.Provider,{value:s,children:c})}),ww=v.forwardRef(function(e,t){let n=pw()?.Group??Cw;return(0,S.jsx)(n,{...e,ref:t})}),Tw=v.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=lc(a),c=Sw();return q(()=>(c(s),()=>{c(e=>e===s?void 0:e)}),[c,s]),Hi(`div`,e,{ref:t,props:{id:s,"aria-hidden":!0,...o}})}),Ew=v.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,{store:d}=dw(),f=qb({guess:!0,label:a}),p=lc(i),m=d.useState(`disabled`),h=d.useState(`isActive`,f.index),g=d.useState(`floatingNodeId`),_=d.useState(`itemProps`),v=s||m,{getItemProps:y,itemRef:b}=bw({closeOnClick:c,disabled:v,highlighted:h,id:p,store:d,nativeButton:o,nodeId:g,itemMetadata:yw});return Hi(`div`,e,{state:{disabled:v,highlighted:h},props:[_,u,y],ref:[b,t,f.ref]})}),Dw=v.forwardRef(function(e,t){let n=gw(e,t);return n.visible?(0,S.jsx)(Ew,{...e,ref:n.ref}):null}),Ow=v.createContext(void 0);function kw(){return v.useContext(Ow)}function Aw(e,t){let n=Ki(e.render);if(v.isValidElement(n)){let e=n.props;if(Object.hasOwn(e,`id`))return e.id??``}return e.id??t}function jw(e,t,n){let r=Aw(e,t),i=r===t?void 0:r;return[r,v.useCallback(e=>n?.(e?i:void 0),[i,n])]}function Mw(e,t,n){let r=Ki(e.render),i=v.isValidElement(r)?r.props:void 0,a=e[`aria-label`]??i?.[`aria-label`],o=e[`aria-labelledby`]??i?.[`aria-labelledby`];return o==null&&!a&&(o=t?t.id||void 0:n||void 0),o}var Nw=v.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,id:o,initialFocus:s,...c}=e,{store:l,defaultFloatingId:u,setRenderedFloatingId:d,virtualFocus:f,orientation:p}=dw(),m=kw(),{side:h,align:g}=lw(),_=ub(!0)!=null,y=l.useState(`open`),b=l.useState(`transitionStatus`),x=l.useState(`popupProps`),C=l.useState(`mounted`),w=l.useState(`instantType`),T=l.useState(`activeTriggerElement`),E=l.useState(`parent`),D=l.useState(`lastOpenChangeReason`),O=l.useState(`rootId`),k=l.useState(`floatingRootContext`),A=l.useState(`floatingTreeRoot`),j=l.useState(`closeDelay`),M=l.useState(`hoverEnabled`),N=l.useState(`disabled`),P=l.useState(`openMethod`),F=l.useState(`activeTriggerId`),I=l.useState(`listElement`),[L,R]=jw(e,u,d),z=Mw(e,T,F),B=E.type===`menu`?m:void 0,V=E.type===`context-menu`,H=s??E.type!==`menu`;s===void 0&&I&&E.type!==`menu`&&(H=()=>l.state.activeIndex===null&&I),Ra({open:y,ref:l.context.popupRef,onComplete(){y&&l.context.onOpenChangeComplete?.(!0)}}),v.useEffect(()=>{function e(e){l.setOpen(!1,Jt(e.reason,e.domEvent))}return A.events.on(`close`,e),()=>{A.events.off(`close`,e)}},[A.events,l]),No(k,{enabled:M&&!N&&!V&&E.type!==`menubar`,closeDelay:j});let U=l.useStateSetter(`popupElement`),{parentVirtualFocusRef:ee,handleFocus:te}=(v.useContext(fw)?.useParentHandoff??Fw)(l,E,y,f),ne=Hi(`div`,e,{state:{transitionStatus:b,side:h,align:g,open:y,nested:E.type===`menu`,instant:w},ref:[t,l.context.popupRef,U,R],stateAttributesMapping:Nt,props:[x,{id:L,...I?{role:`presentation`}:{role:`menu`,"aria-orientation":p===`horizontal`?`horizontal`:void 0,"aria-labelledby":z},onKeyDown(e){B?.onPopupKeyDown?.(e),_&&Xv.has(e.key)&&e.stopPropagation()},onFocus:te},Bc(b),c,{"data-rootownerid":O}]}),W=E.type===void 0||V;(T||E.type===`menubar`&&D!==`outside-press`)&&(W=!0);let re=B?.getReturnElement??ee;return(0,S.jsx)(Ca,{context:k,openInteractionType:P,modal:V,disabled:!C,returnFocus:a??re??W,explicitReturnFocus:a===void 0&&re?!1:void 0,initialFocus:H,restoreFocus:!0,getInsideElements:E.type===void 0?()=>[l.context.beforeTriggerFocusGuardRef.current]:void 0,externalTree:E.type===`menubar`?void 0:A,previousFocusableElement:T,nextFocusableElement:E.type===void 0?l.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:l.context.beforeContentFocusGuardRef,children:ne})}),Pw={parentVirtualFocusRef:void 0,handleFocus:void 0};function Fw(){return Pw}var Iw=v.forwardRef(function(e,t){let n=pw()?.Popup??Nw;return(0,S.jsx)(n,{...e,ref:t})}),Lw=v.createContext(void 0);function Rw(){let e=v.useContext(Lw);if(e===void 0)throw Error(J(32));return e}var zw=v.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i,parent:a}=dw();if(!(i.useState(`mounted`)||n))return null;let o=a.type===`menu`||a.type===`menubar`?`group`:void 0;return(0,S.jsx)(Lw.Provider,{value:n,children:(0,S.jsx)(ia,{ref:t,...r,portalOwnerRole:o})})}),Bw=v.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=Zi,style:g,..._}=e,{store:y,virtualFocus:b,syncHighlightedItem:x}=dw(),C=Rw(),w=sw(!0),T=y.useState(`parent`),E=y.useState(`floatingRootContext`),D=y.useState(`floatingTreeRoot`),O=y.useState(`mounted`),k=y.useState(`open`),A=y.useState(`modal`),j=y.useState(`openMethod`),M=y.useState(`activeTriggerElement`),N=y.useState(`transitionStatus`),P=y.useState(`positionerElement`),F=y.useState(`instantType`),I=y.useState(`adaptiveOrigin`),L=y.useState(`lastOpenChangeReason`),R=y.useState(`floatingNodeId`),z=y.useState(`floatingParentNodeId`),B=E.useState(`domReferenceElement`),V=n,H=c,U=l,ee=s,te=h;T.type===`context-menu`&&(V=n??T.context?.anchor,ee??=`start`,!o&&ee!==`center`&&(U=e.alignOffset??2,H=e.sideOffset??-5));let ne=o,W=ee;T.type===`menu`?(ne??=`inline-end`,W??=`start`,te=e.collisionAvoidance??Qi):T.type===`menubar`&&(ne??=T.context.orientation===`vertical`?`inline-end`:`bottom`,W??=`start`);let re=T.type===`context-menu`,ie=Lc({anchor:V,floatingRootContext:E,positionMethod:w?`fixed`:r,mounted:O,side:ne,sideOffset:H,align:W,alignOffset:U,arrowPadding:re?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:R,keepMounted:C,disableAnchorTracking:m,collisionAvoidance:te,shift:re?{crossAxis:!(`side`in te&&te.side===`flip`),rootBoundary:`layoutViewport`}:void 0,externalTree:D,adaptiveOrigin:I,lazyFlip:b?`placement`:!1});v.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===R&&y.set(`hoverEnabled`,!1),e.nodeId!==R&&e.parentNodeId===y.select(`floatingParentNodeId`)&&y.setOpen(!1,Jt(mn)))}return D.events.on(`menuopenchange`,e),()=>{D.events.off(`menuopenchange`,e)}},[y,D.events,R]),v.useEffect(()=>{if(y.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==y.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;y.setOpen(!1,Jt(t))}return D.events.on(`menuopenchange`,e),()=>{D.events.off(`menuopenchange`,e)}},[D.events,y]);let ae=fe();v.useEffect(()=>{k||ae.clear()},[k,ae]),v.useEffect(()=>{function e(e){if(k&&e.nodeId===y.select(`floatingParentNodeId`)){if(e.target&&M&&M!==e.target){let e=y.select(`closeDelay`);e>0?ae.isStarted()||ae.start(e,()=>{y.setOpen(!1,Jt(mn))}):y.setOpen(!1,Jt(mn))}else ae.clear()}}return D.events.on(`itemhover`,e),()=>{D.events.off(`itemhover`,e)}},[D.events,k,M,y,ae]),v.useEffect(()=>{let e={open:k,nodeId:R,parentNodeId:z,reason:y.select(`lastOpenChangeReason`)};D.events.emit(`menuopenchange`,e)},[D.events,k,y,R,z]),ab({store:y,domReference:B,positionerElement:P,open:k});let G={open:k,side:ie.side,align:ie.align,anchorHidden:ie.anchorHidden,nested:T.type===`menu`,instant:F},K=T.type===`menubar`&&T.context.modal;sb(k&&(K||A&&L!==`trigger-hover`),j===`touch`,P,M);let q=Vc(e,G,{styles:ie.positionerStyles,transitionStatus:N,props:_,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!O,inert:!k}),oe=O&&T.type!==`menu`&&(T.type!==`menubar`&&A&&L!==`trigger-hover`||T.type===`menubar`&&T.context.modal),J=null;return T.type===`menubar`?J=T.context.contentElement:T.type===void 0&&(J=M),(0,S.jsxs)(cw.Provider,{value:ie,children:[oe&&(0,S.jsx)(sy,{ref:T.type===`context-menu`||T.type===`nested-context-menu`?T.context.internalBackdropRef:null,inert:Kc(!k),cutout:J}),(0,S.jsx)(fa,{id:R,children:(0,S.jsx)(Mb,{elementsRef:y.context.itemDomElements,labelsRef:y.context.itemLabels,onMapChange:x,children:q})})]})}),Vw=v.createContext(null);function Hw(e){let t=v.useContext(Vw);if(t===null&&!e)throw Error(J(5));return t}var Uw={...Co,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,keyboardOpen:e=>e.keyboardOpen,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,listElement:e=>e.listElement,triggerControlsId:(e,t)=>{let n=Co.triggerPopupId(e,t);return n?e.listElement?.id||n:void 0},filterTriggerProps:e=>e.filterTriggerProps,inputProps:e=>e.inputProps,webkitAriaSelected:(e,t)=>we&&e.inputFocused&&t?!0:void 0,highlightedItemId:e=>e.highlightedItem?.id||void 0,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType===`trigger-change`&&!Co.open(e)?void 0: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`)}},Ww=class extends mo{constructor(e,t,n=!1){let r=new eo,i=Kw(r,t,n,e);super(i,Gw(r),Uw),this.observe(`parent`,e=>{e.type===`menu`?this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef:e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef)})}subscribeToParentMenu(){let e=this.state.parent;if(e.type!==`menu`)return;let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);return 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())})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}setActiveIndex(e,t,n){if(this.state.activeIndex!==e){let r=(e===null?void 0:this.context.itemDomElements.current[e])===this.context.reportedItem;this.context.highlightReason=r?`none`:t,this.context.highlightEvent=r?void 0:n}this.set(`activeIndex`,e)}highlightItem(e,t,n){let r=this.context.itemDomElements.current.indexOf(e);r>-1&&this.setActiveIndex(r,t,n)}};function Gw(e){return{positionerRef:v.createRef(),popupRef:v.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},highlightReason:`none`,highlightEvent:void 0,reportedItem:void 0,allowMouseUpTriggerRef:{current:!1},virtualFocusRef:void 0,triggerFocusTargetRef:v.createRef(),beforeTriggerFocusGuardRef:v.createRef(),beforeContentFocusGuardRef:v.createRef(),onOpenChangeComplete:void 0,triggerElements:e}}function Kw(e,t,n=!1,r){return{..._o(e,t,n),disabled:!1,modal:!0,openMethod:null,keyboardOpen:!1,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,listElement:null,filterTriggerProps:K,inputProps:K,inputFocused:!1,highlightedItem:void 0,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new oa,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:K,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...r}}var qw=v.createContext(null);function Jw(e,t){return(e===`trigger-press`||e===`item-press`)&&t?.detail===0}function Yw(e,t){return e===`list-navigation`||Jw(e,t)}var Xw=W(function(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,onItemHighlighted:a,defaultOpen:o=!1,disabled:s=!1,modal:c,loopFocus:l=!0,orientation:u=`vertical`,actionsRef:d,closeParentOnEsc:f=!1,handle:p,triggerId:m,defaultTriggerId:h=null,highlightItemOnHover:g=!0,isSubmenu:_=!1,virtualFocus:y=!1,virtualFocusRef:b,allowEscape:x=!0,resetOnPointerLeave:C=!0}=e,w=sw(!0),T=dw(!0),E=Hw(!0),D=T?.store,O=T?.virtualFocus??!1,k=v.useMemo(()=>_&&D?{type:`menu`,store:D}:E?{type:`menubar`,context:E}:w&&!D?{type:`context-menu`,context:w}:{type:void 0},[w,D,E,_]),A=lc(),j=lc(),[M,N]=v.useState(void 0),P=(M??j)||void 0,F=la(),I=k.type===`menu`?k.store:void 0,L=(n??o)&&I?.state.transitionStatus===`starting`,R=H(()=>L?I?.state.instantType:void 0).current,z=H(()=>{let e=new Ww({open:o,openProp:n,activeTriggerId:h,triggerIdProp:m,parent:k,disabled:s,highlightItemOnHover:g,modal:k.type===void 0?c:void 0,rootId:A,instantType:R},P,F!=null);return e.context.virtualFocusRef=b,e}).current;z.useControlledProp(`openProp`,n),z.useControlledProp(`triggerIdProp`,m),z.useContextCallback(`onOpenChangeComplete`,i);let B=z.useState(`floatingTreeRoot`),V=da(B),U=z.useState(`open`),ee=z.useState(`activeTriggerElement`),te=z.useState(`positionerElement`),ne=z.useState(`hoverEnabled`),W=z.useState(`disabled`),re=z.useState(`lastOpenChangeReason`),ie=z.useState(`parent`),ae=z.useState(`activeIndex`),oe=z.useState(`keyboardOpen`),J=z.useState(`payload`),se=z.useState(`floatingParentNodeId`),ce=v.useRef(null),le=v.useRef(ie.type!==`context-menu`),ue=fe(),de=v.useRef(!0),pe=fe(),me=se!=null,{openMethod:he,triggerProps:ge}=Ay(U);z.useSyncedValues({disabled:s,highlightItemOnHover:g,modal:ie.type===void 0?c:void 0,openMethod:he,rootId:A}),Xa(z);let{forceUnmount:_e,transitionStatus:ve}=Za(U,z,()=>{z.set(`allowMouseEnter`,!1)},L),ye=La(z.context.popupRef);v.useEffect(()=>{if(R===void 0)return;let e=()=>{z.state.instantType===R&&z.set(`instantType`,void 0)};if(!U){e();return}if(ve!==void 0)return;if(z.context.popupRef.current==null){e();return}let t=new AbortController;return ye(e,t.signal),()=>{t.abort()}},[R,U,ve,ye,z]),q(()=>{w&&!T?z.update({parent:{type:`context-menu`,context:w},floatingNodeId:V,floatingParentNodeId:F}):(T||!z.select(`activeTriggerElement`))&&z.update({floatingNodeId:V,floatingParentNodeId:F})},[w,T,V,F,ee,z]),v.useEffect(()=>{U||(ce.current=null),ie.type===`context-menu`&&(U?ue.start(500,()=>{le.current=!0}):(ue.clear(),le.current=!1))},[ue,U,ie.type]),q(()=>{!U&&!ne&&z.set(`hoverEnabled`,!0)},[U,ne,z]);let be=Y((e,t)=>{let n=t.reason;if(!e&&!z.select(`open`)||U===e&&t.trigger===ee&&re===n)return;let i=qa(t);if(!e&&t.trigger==null&&(t.trigger=ee??void 0),r?.(e,t),t.isCanceled)return;z.state.floatingRootContext.dispatchOpenChange(e,t);let a=t.event;if(e===!1&&n!==`item-press`&&a?.type===`click`&&a.pointerType===`touch`&&!de.current)return;e&&n===`trigger-focus`?(de.current=!1,pe.start(300,()=>{de.current=!0})):(de.current=!0,pe.clear());let o=!e&&(n===`escape-key`||n==null);ce.current=t.event;let s=Ka(z.state,e,t.trigger,i());s.openChangeReason=n,s.keyboardOpen=e&&Yw(n,a),s.instantType=ie.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?`group`:Jw(n,a)?`click`:o?`dismiss`:void 0,z.update(s)}),xe=Ma({popupStore:z,floatingRootContext:z.state.floatingRootContext,floatingId:P,nested:F!=null,onOpenChange:be}),Se=xe.context.events;q(()=>{let e=({open:e,eventDetails:t})=>be(e,t);return Se.on(`setOpen`,e),()=>{Se?.off(`setOpen`,e)}},[Se,be]),q(()=>z.subscribeToParentMenu(),[z]);let Ce=v.useCallback(()=>{z.setOpen(!1,Jt(vn))},[z]);v.useImperativeHandle(d,()=>({unmount:_e,close:Ce}),[_e,Ce]);let we;ie.type===`context-menu`&&(we=ie.context),v.useImperativeHandle(we?.positionerRef,()=>te,[te]),v.useImperativeHandle(we?.actionsRef,()=>({setOpen:be}),[be]);let Te=Aa(xe,{enabled:!W,bubbles:{escapeKey:f&&ie.type===`menu`},outsidePress(){return ie.type!==`context-menu`||ce.current?.type===`contextmenu`||le.current},externalTree:me?B:void 0}),Ee=Cc(),De=Ho(xe,{enabled:!W,listRef:z.context.itemDomElements,activeIndex:ae,virtual:y,nested:ie.type===`menubar`||!y&&ie.type!==void 0,parentOrientation:ie.type===`menubar`?ie.context.orientation:void 0,loopFocus:l,focusItemOnOpen:y?oe:void 0,allowEscape:y&&l&&x,orientation:u,triggerOrientation:y?`vertical`:u,rtl:Ee===`rtl`,disabledIndices:G,onNavigate(e,t){z.setActiveIndex(e,hS(t),t?.nativeEvent)},openOnArrowKeyDown:ie.type!==`context-menu`&&!(y&&_),externalTree:!y&&me?B:void 0,nestedReturnFocusRef:I?.context.virtualFocusRef,focusItemOnHover:g,resetOnPointerLeave:C}),Oe=v.useCallback(e=>{z.context.typingRef.current=e},[z]),ke=Uo(xe,{enabled:!W&&!y,listRef:z.context.itemLabels,elementsRef:z.context.itemDomElements,activeIndex:ae,resetMs:500,onMatch:(e,t)=>{U&&e!==ae&&z.setActiveIndex(e,dn,t.nativeEvent)},onTyping:Oe}),Ae=Y(a),je=v.useRef(-1),Me=Y(()=>{let e=z.state.activeIndex,t=e===null?void 0:z.context.itemDomElements.current[e]??void 0;if(t?.isConnected===!1)return;let n=t===void 0?-1:e;if(je.current===n&&z.context.reportedItem===t)return;je.current=n,z.context.reportedItem=t,y&&z.set(`highlightedItem`,t);let{highlightReason:r,highlightEvent:i}=z.context;z.context.highlightReason=Xt,z.context.highlightEvent=void 0,a&&Ae(t,Yt(r,i,{label:t===void 0?void 0:z.context.itemLabels.current[n]??void 0}))});q(()=>{Me()},[ae,Me]);let Ne=v.useMemo(()=>{if(!y)return De.reference;if(!De.trigger)return K;let{onFocus:e,...t}=De.trigger;return t},[y,De.reference,De.trigger]);z.useSyncedValue(`inputProps`,y?De.reference??K:K);let Pe=v.useMemo(()=>{let e=ki(ke.reference,Ne,Te.reference,{onMouseMove(){z.set(`allowMouseEnter`,!0)}},ge);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=U,e},[z,ke.reference,Ne,Te.reference,ge,U]),Fe=v.useMemo(()=>{let e=ki(De.trigger,Te.trigger,ge);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[De.trigger,Te.trigger,ge]);H(()=>(z.update({inactiveTriggerProps:Fe}),null)),Qa(z,{floatingRootContext:xe,activeTriggerProps:Pe,inactiveTriggerProps:Fe,popupProps:v.useMemo(()=>ki(Ba,{onMouseMove(){z.set(`allowMouseEnter`,!0),ie.type===`menu`&&z.set(`hoverEnabled`,!1)},onClick(){z.select(`hoverEnabled`)&&z.set(`hoverEnabled`,!1)},onKeyDown(e){let t=z.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},ke.floating,De.floating,Te.floating),[ie.type,z,ke.floating,De.floating,Te.floating]),itemProps:De.item??K});let Ie=v.useMemo(()=>({store:z,parent:k,orientation:u,loopFocus:l,allowEscape:x,defaultFloatingId:j,setRenderedFloatingId:N,virtualFocus:y,parentVirtualFocus:O,syncHighlightedItem:Me}),[z,k,u,l,x,j,y,O,Me]),Le=typeof t==`function`?t({payload:J}):t,Re=(0,S.jsxs)(uw.Provider,{value:Ie,children:[p&&(0,S.jsx)(Ua,{handle:p,store:z}),Le]});return(ie.type===void 0||ie.type===`context-menu`)&&(Re=(0,S.jsx)(pa,{externalTree:B,children:Re})),Re});function Zw(e){let t=v.useContext(qw);if(t===null)return(0,S.jsx)(Xw,{...e});let n=t.Root;return(0,S.jsx)(qw.Provider,{value:null,children:(0,S.jsx)(n,{...t.options,...e})})}function Qw(e){let{render:t,className:n,style:r,state:i=K,props:a=G,refs:o=G,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=Jb({metadata:s});return Hi(l,e,{state:i,ref:[f,...o],props:[d,...a,u],stateAttributesMapping:c})}function $w(e){if(Be(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`);if(!Qe(e))return $w(tt(e))}function eT(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=v.useRef(!1);return v.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,Un(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:K,[t,n,r])}var tT=re(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=dw(!0),h=wo(d)??m?.store;if(!h)throw Error(J(85));let g=lc(s),_=h.useState(`isTriggerActive`,g),y=h.useState(`floatingRootContext`),b=h.useState(`isOpenedByTrigger`,g),x=h.useState(`triggerControlsId`,g),C=v.useRef(null),w=rT(),T=uf(!0),E=ua(),D=v.useMemo(()=>E??new oa,[E]),{registerTrigger:O,isMountedByThisTrigger:k}=Ya(g,C,h,{payload:f,closeDelay:u,parent:w,floatingTreeRoot:D,floatingNodeId:da(D),floatingParentNodeId:la(),keyboardEventRelay:T?.relayKeyboardEvent}),A=w.type===`menubar`,j=h.useState(`disabled`),M=a||j||A&&w.context.disabled,{getButtonProps:N,buttonRef:P}=pf({disabled:M,native:o});v.useEffect(()=>{!b&&w.type===void 0&&(h.context.allowMouseUpTriggerRef.current=!1)},[h,b,w.type]);let F=v.useRef(null),I=fe(),L=Y(e=>{if(!F.current)return;I.clear(),h.context.allowMouseUpTriggerRef.current=!1;let t=e.target;ot(F.current,t)||ot(h.select(`positionerElement`),t)||t===F.current||(t==null||$w(t)!==h.select(`rootId`))&&(sC(e,F.current)||D.events.emit(`close`,{domEvent:e,reason:pn}))});v.useEffect(()=>{let e=Un(F.current);if(b&&h.select(`lastOpenChangeReason`)===`trigger-hover`)return e.addEventListener(`mouseup`,L,{once:!0}),()=>{e.removeEventListener(`mouseup`,L)}},[b,L,h]);let R=A&&w.context.hasSubmenuOpen,z=Fo(y,{enabled:(c??R)&&!M&&(!A||R&&!k),handleClose:Zo({blockPointerEvents:!A}),mouseOnly:!0,move:!1,restMs:w.type===void 0?l:void 0,delay:{close:u},triggerElementRef:C,externalTree:D,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),B=nT(b,h.select(`lastOpenChangeReason`)),V=wa(y,{enabled:!M,event:b&&A?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:w.type===void 0&&B}),H=Do(y,{enabled:!M&&R}),U=eT({open:b,enabled:A,mouseDownAction:`open`}),ee=v.useMemo(()=>ki(H.reference,V.reference),[H.reference,V.reference]),te=h.useState(`triggerProps`,k),ne=h.useState(`filterTriggerProps`),{handlePreFocusGuardFocus:W,handleFocusTargetFocus:re}=Qy(h,C),ie={disabled:M,open:b},ae=[F,t,P,O,C],G=[ee,z??K,te,{"aria-haspopup":`menu`,"aria-controls":x,id:g,onMouseDown:e=>{h.select(`open`)||(I.start(200,()=>{h.context.allowMouseUpTriggerRef.current=!0}),Un(e.currentTarget).addEventListener(`mouseup`,L,{once:!0}))}},ne,A?{role:`menuitem`}:{},U,p,N],q=Hi(`button`,e,{enabled:!A,stateAttributesMapping:jt,state:ie,ref:ae,props:G});return A?(0,S.jsx)(Qw,{tag:`button`,render:n,className:r,style:i,state:ie,refs:ae,props:G,stateAttributesMapping:jt}):b?(0,S.jsxs)(v.Fragment,{children:[(0,S.jsx)(qn,{ref:h.context.beforeTriggerFocusGuardRef,onFocus:W},`${g}-pre-focus-guard`),(0,S.jsx)(v.Fragment,{children:q},g),(0,S.jsx)(qn,{ref:h.context.triggerFocusTargetRef,onFocus:re},`${g}-post-focus-guard`)]}):(0,S.jsx)(v.Fragment,{children:q},g)});function nT(e,t){let n=fe(),[r,i]=v.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 rT(){let e=Hw(!0);return v.useMemo(()=>e?{type:`menubar`,context:e}:{type:void 0},[e])}function iT(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}var aT=`base-ui-disable-scrollbar`,oT={className:aT,getElement(e){return(0,S.jsx)(`style`,{nonce:e,href:aT,precedence:`base-ui:low`,children:`.${aT}{scrollbar-width:none}.${aT}::-webkit-scrollbar{display:none}`})}};function sT(e,t){return Math.max(0,e-t)}function cT(e,t){if(t<=0)return 0;let n=iT(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 lT=v.createContext(void 0),uT=v.createContext(void 0);function dT(){let e=v.useContext(lT);if(e===void 0)throw Error(J(60));return e}function fT(){let e=v.useContext(uT);if(e===void 0)throw Error(J(61));return e}var pT={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,multiple:e=>e.multiple,disabled:e=>e.disabled,readOnly:e=>e.readOnly,required:e=>e.required,highlightItemOnHover:e=>e.highlightItemOnHover,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:HS(t,r)!==``},hasNullItemLabel:(e,t)=>t?BS(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=>OS(t,e,n)):OS(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,itemRoot:e=>e.itemRoot,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 mT(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:y,multiple:b=!1,itemToStringLabel:x,itemToStringValue:C,isItemEqualToValue:w=DS,highlightItemOnHover:T=!0,children:E}=e,{clearErrors:D}=kf(),{setDirty:O,setTouched:k,setFocused:A,validityData:j,setFilled:M,name:N,disabled:P,validation:F,validationMode:I}=Df(),L=Ff({id:t}),R=P||d,z=N??c,[B,V]=kb({controlled:n,default:b?r??G:r,name:`Select`,state:`value`}),[U,ee]=kb({controlled:a,default:o,name:`Select`,state:`open`}),te=v.useRef([]),ne=v.useRef([]),W=v.useRef(null),re=v.useRef(null),ie=v.useRef(0),oe=v.useRef(null),J=v.useRef([]),se=v.useRef(!1),ce=v.useRef(null),le=v.useRef(null),ue=v.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),de=v.useRef(!1),fe=v.useRef(B),{openMethod:pe,triggerProps:me}=Ay(U),he=H(()=>new mo({id:L,labelId:void 0,modal:m,multiple:b,disabled:R,readOnly:f,required:p,highlightItemOnHover:T,itemToStringLabel:x,itemToStringValue:C,isItemEqualToValue:w,value:B,open:U,mounted:U,transitionStatus:void 0,items:y,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:K,triggerProps:K,itemRoot:{props:K,multiple:b,disabled:R,readOnly:f,isItemEqualToValue:w},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:ae,setOpen:ae,handleScrollArrowVisibility:ae,onOpenChangeComplete:ae,listRef:te,popupRef:W,scrollHandlerRef:re,scrollArrowsMountedCountRef:ie,valueRef:oe,valuesRef:J,labelsRef:ne,typingRef:se,selectionRef:ue,firstItemTextRef:ce,selectedItemTextRef:le,alignItemWithTriggerActiveRef:de,initialValueRef:fe},pT)).current,[ge,_e]=v.useState(!1),{mounted:ve,transitionStatus:ye,forceUnmount:be}=za({open:U,ref:W,preventUnmountOnClose:ge,setPreventUnmountOnClose:_e,onUnmount(){he.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),_?.(!1)}}),xe=he.useState(`activeIndex`),Se=he.useState(`selectedIndex`),Ce=he.useState(`triggerElement`),we=he.useState(`positionerElement`),Te=qc(pe),Ee=pe??Te,De=v.useMemo(()=>b?``:HS(B,C),[b,B,C]),Oe=v.useMemo(()=>b&&Array.isArray(B)?B.map(e=>HS(e,C)):HS(B,C),[b,B,C]);zf(Mn(Ce),L,B,Y(()=>Oe),!R,c);let ke=b?Array.isArray(B)&&B.length>0:B!=null&&De!==``;q(()=>{M(ke)},[ke,M]),q(function(){let e=NS(J.current,B,w,b);e===null&&(le.current=null),!U&&he.set(`selectedIndex`,e)},[b,U,B,w,he]),Bf(B,()=>{D(z),O(kS(B,j.initialValue,w)),F.change(B)});let Ae=Y((e,t)=>{let n=t,r=qa(n);s?.(e,n),!t.isCanceled&&(e||_e(r()),ee(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(k(!0),A(!1),I===`onBlur`&&F.commit(B)))});v.useImperativeHandle(h,()=>({unmount:be,close:()=>{he.state.open&&Ae(!1,Jt(vn))}}),[be,Ae,he]);let je=Y((e,t)=>{i?.(e,t),!t.isCanceled&&V(e)}),Me=Y(e=>{let t=sT(e.scrollHeight,e.clientHeight),n=cT(e.scrollTop,t),r=n>0,i=n<t;he.set(`scrollUpArrowVisible`,r),he.set(`scrollDownArrowVisible`,i)}),Ne=To({open:U,onOpenChange:Ae,elements:{reference:Ce,floating:we}}),Pe=wa(Ne,{enabled:!R,event:`mousedown`}),Fe=Aa(Ne),Ie=Ho(Ne,{enabled:!R,listRef:te,activeIndex:xe,selectedIndex:Se,disabledIndices:G,onNavigate(e){(e!==null||U)&&he.set(`activeIndex`,e)},focusItemOnHover:T}),Le=Uo(Ne,{enabled:!R&&(U||!f&&!b),listRef:ne,activeIndex:xe,selectedIndex:Se,disabledIndices:e=>ix(te.current[e]),onMatch(e){U?he.set(`activeIndex`,e):je(J.current[e],Jt(Xt))},onTyping(e){se.current=e}}),Re=v.useMemo(()=>ki(Le.reference,Ie.reference,Fe.reference,Pe.reference,me),[Pe.reference,Le.reference,Ie.reference,Fe.reference,me]),ze=v.useMemo(()=>ki(Ba,Le.floating,Ie.floating,Fe.floating),[Le.floating,Ie.floating,Fe.floating]),Be=Ie.item??K,Ve=v.useMemo(()=>({props:Be,multiple:b,disabled:R,readOnly:f,isItemEqualToValue:w}),[Be,b,R,f,w]);he.useContextCallback(`setValue`,je),he.useContextCallback(`setOpen`,Ae),he.useContextCallback(`handleScrollArrowVisibility`,Me),he.useContextCallback(`onOpenChangeComplete`,_),pS(()=>{he.update({popupProps:ze,triggerProps:Re,itemRoot:Ve})}),he.useSyncedValues({id:L,modal:m,multiple:b,disabled:R,readOnly:f,required:p,highlightItemOnHover:T,value:B,open:U,mounted:ve,transitionStatus:ye,popupProps:ze,triggerProps:Re,itemRoot:Ve,items:y,itemToStringLabel:x,itemToStringValue:C,isItemEqualToValue:w,openMethod:Ee});let He=En(g,F.inputRef),Ue=b?void 0:z,We=v.useMemo(()=>!b||!Array.isArray(B)||!z?null:B.map(e=>{let t=HS(e,C);return(0,S.jsx)(`input`,{type:`hidden`,form:l,name:z,value:t,disabled:R},t)}),[b,B,l,z,C,R]);return(0,S.jsxs)(lT.Provider,{value:he,children:[(0,S.jsx)(uT.Provider,{value:Ne,children:E}),(0,S.jsx)(`input`,{...F.getValidationProps(R,{onFocus(){he.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented||R||f)return;let t=e.currentTarget.value,n=Jt(Xt,e.nativeEvent);function r(){if(b)return;let e=t.toLowerCase(),r=J.current.findIndex(t=>HS(t,C).toLowerCase()===e||VS(t,x).toLowerCase()===e);r===-1&&(r=J.current.findIndex((t,n)=>{let r=ne.current[n];return r!=null&&r.toLowerCase()===e}));let i=J.current[r];i!=null&&je(i,n)}he.set(`forceMount`,!0),queueMicrotask(r)}}),id:L&&Ue==null?`${L}-hidden-input`:void 0,form:l,name:Ue,autoComplete:u,value:De,disabled:R,required:p&&!(b&&ke),readOnly:f,ref:He,style:z?Kn:Gn,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),We]})}var hT=`data-popup-side`,gT=400,_T={...jt,...wf,popupSide:e=>e?{[hT]:e}:null,value:()=>null},vT=v.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{setTouched:l,validationMode:u,validation:d,state:f,disabled:p}=Df(),{labelId:m}=jf(),h=dT(),g=h.useState(`readOnly`),_=h.useState(`required`),y=h.useState(`disabled`),b=p||y||a,x=h.useState(`open`),S=h.useState(`mounted`),C=h.useState(`value`),w=h.useState(`triggerProps`),T=h.useState(`positionerElement`),E=h.useState(`listElement`),D=h.useState(`popupSide`),O=h.useState(`id`),k=h.useState(`labelId`),A=h.useState(`hasSelectedValue`),j=S&&T?D:null,M=i??O,N=lC(m,k);Ff({id:i});let P=Mn(T),F=v.useRef(null),I=Rf(b,F),{getButtonProps:L,buttonRef:R}=pf({disabled:b,native:o}),z=h.useStateSetter(`triggerElement`),B=fe(),V=fe(),H=fe();v.useEffect(()=>{if(x)return H.start(gT,()=>{h.context.selectionRef.current.allowUnselectedMouseUp=!0,h.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{H.clear()};h.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},V.clear()},[x,h,V,H]);let U=ki(w,{id:M,role:`combobox`,"aria-expanded":x,"aria-haspopup":`listbox`,"aria-controls":x?E?.id??Ht(T)?.id:void 0,"aria-labelledby":N,"aria-readonly":g||void 0,"aria-required":_||void 0,tabIndex:b?-1:0,onFocus(e){I(!0),x&&h.context.alignItemWithTriggerActiveRef.current&&h.context.setOpen(!1,Jt(Xt,e.nativeEvent)),B.start(0,()=>{h.set(`forceMount`,!0)})},onBlur(e){ot(T,e.relatedTarget)||(l(!0),I(!1),u===`onBlur`&&d.commit(C))},onMouseDown(e){if(x)return;let t=Un(e.currentTarget);function n(e){if(!F.current)return;let t=e.target;ot(F.current,t)||ot(P.current,t)||sC(e,F.current)||h.context.setOpen(!1,Jt(pn,e))}V.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},c,L),ee=d.getValidationProps(b,U);ee.role=`combobox`;let te={...f,open:x,disabled:b,value:C,readOnly:g,popupSide:j,placeholder:!A};return Hi(`button`,e,{ref:[t,F,R,z],state:te,stateAttributesMapping:_T,props:ee})}),yT={value:()=>null},bT=v.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,c=dT(),l=c.useState(`value`),u=c.useState(`items`),d=c.useState(`itemToStringLabel`),f=c.useState(`hasSelectedValue`),p=!f&&a!=null&&i==null,m=c.useState(`hasNullItemLabel`,p),h={value:l,placeholder:!f},g=null;return g=typeof i==`function`?i(l):i??(p&&!m?a:Array.isArray(l)?WS(l,u,d):US(l,u,d)),Hi(`span`,e,{state:h,ref:[t,c.context.valueRef],props:[{children:g},s],stateAttributesMapping:yT})}),xT=v.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e;return Hi(`span`,e,{state:{open:dT().useState(`open`)},ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:At})}),ST=v.forwardRef(function(e,t){let n=dT(),r=n.useState(`mounted`),i=n.useState(`forceMount`);return r||i?(0,S.jsx)(ia,{ref:t,...e}):null}),CT=v.createContext(void 0);function wT(){let e=v.useContext(CT);if(!e)throw Error(J(59));return e}function TT(e,t){e&&Object.assign(e.style,t)}var ET={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},DT={position:`fixed`},OT=v.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=Zi,style:_,...y}=e,b=dT(),x=fT(),C=b.useState(`open`),w=b.useState(`mounted`),T=b.useState(`modal`),E=b.useState(`value`),D=b.useState(`openMethod`),O=b.useState(`positionerElement`),k=b.useState(`triggerElement`),A=b.useState(`isItemEqualToValue`),j=b.useState(`transitionStatus`),M=v.useRef(null),N=v.useRef(null),[P,F]=v.useState(h),I=w&&P&&D!==`touch`;!w&&P!==h&&F(h),v.useImperativeHandle(b.context.alignItemWithTriggerActiveRef,()=>I),sb((I||T)&&C,D===`touch`,O,k);let L=Lc({anchor:n,floatingRootContext:x,positionMethod:a,mounted:w,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??I,collisionAvoidance:g,keepMounted:!0}),R=I?`none`:L.side,z=I?DT:L.positionerStyles,B={open:C,side:R,align:L.align,anchorHidden:L.anchorHidden};q(()=>{b.set(`popupSide`,L.side)},[b,L.side]);let V=Vc(e,B,{styles:z,transitionStatus:j,props:y,refs:[t,b.useStateSetter(`positionerElement`)],hidden:!w,inert:!C}),H=v.useRef(0),U=Y(e=>{if(b.context.valuesRef.current.length===0)return;let t=H.current;H.current=e.size;let n=Jt(Xt);if(t!==0&&!b.state.multiple&&E!==null&&jS(b.context.valuesRef.current,E,A)===-1){let e=b.context.initialValueRef.current,t=e!=null&&jS(b.context.valuesRef.current,e,A)!==-1?e:null;b.context.setValue(t,n),t===null&&(b.set(`selectedIndex`,null),b.context.selectedItemTextRef.current=null)}if(t!==0&&b.state.multiple&&Array.isArray(E)){let e=E.filter(e=>jS(b.context.valuesRef.current,e,A)!==-1);e.length!==E.length&&(b.context.setValue(e,n),e.length===0&&(b.set(`selectedIndex`,null),b.context.selectedItemTextRef.current=null))}if(C&&I){b.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};TT(O,e),TT(b.context.popupRef.current,e)}}),ee=v.useMemo(()=>({...L,side:R,alignItemWithTriggerActive:I,setControlledAlignItemWithTrigger:F,scrollUpArrowRef:M,scrollDownArrowRef:N}),[L,R,I,F]);return(0,S.jsx)(Mb,{elementsRef:b.context.listRef,labelsRef:b.context.labelsRef,onMapChange:U,children:(0,S.jsxs)(CT.Provider,{value:ee,children:[w&&T&&(0,S.jsx)(sy,{inert:Kc(!C),cutout:k}),V]})})}),kT=`--transform-origin`,AT={...Mt,...yt},jT=v.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,s=dT(),c=s.useState(`multiple`),l=s.useState(`readOnly`),u=s.useState(`highlightItemOnHover`),d=fT(),{side:f,align:p,alignItemWithTriggerActive:m,isPositioned:h,setControlledAlignItemWithTrigger:g}=wT(),_=ub(!0)!=null,y=Cc(),{nonce:b,disableStyleElements:x}=ex(),C=s.useState(`id`),w=s.useState(`open`),T=s.useState(`openMethod`),E=s.useState(`mounted`),D=s.useState(`popupProps`),O=s.useState(`transitionStatus`),k=s.useState(`triggerElement`),A=s.useState(`positionerElement`),j=s.useState(`listElement`),M=v.useRef(!1),N=v.useRef(!1),P=v.useRef({}),F=Hn(),I=Y(e=>{if(!A||!s.context.popupRef.current||!N.current)return;let t=A.style.top===`0px`,n=A.style.bottom===`0px`;if(M.current||!m||!t&&!n){s.context.handleScrollArrowVisibility(e);return}let r=PT(A),i=FT(A.getBoundingClientRect().height,`y`,r),a=Un(A),o=Ie(A),c=o.getComputedStyle(A),l=parseFloat(c.marginTop),u=parseFloat(c.marginBottom),d=MT(o.getComputedStyle(s.context.popupRef.current)),f=Math.min(a.documentElement.clientHeight-l-u,d),p=e.scrollTop,h=NT(e),g=null,_=e=>{A.style.height=`${e}px`},v=t?h-p:p,y=Math.min(i+v,f);if(v<=1){let n=iT(v,0,f-i);n>0&&_(i+n),e.scrollTop=t?h:0,f-(i+n)<=1&&(M.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=iT(g,0,NT(e));Math.abs(e.scrollTop-t)>1&&(e.scrollTop=t)}b>=f-1&&(M.current=!0),s.context.handleScrollArrowVisibility(e)});v.useImperativeHandle(s.context.scrollHandlerRef,()=>I,[I]),Ra({open:w,ref:s.context.popupRef,onComplete(){w&&s.context.onOpenChangeComplete(!0)}});let L={open:w,transitionStatus:O,side:f,align:p};q(()=>{A&&s.context.popupRef.current&&!Object.keys(P.current).length&&(P.current={top:A.style.top||`0`,left:A.style.left||`0`,right:A.style.right,height:A.style.height,bottom:A.style.bottom,minHeight:A.style.minHeight,maxHeight:A.style.maxHeight,marginTop:A.style.marginTop,marginBottom:A.style.marginBottom})},[s,A]),q(()=>{w||m||(N.current=!1,M.current=!1,TT(A,P.current))},[w,m,A]),q(()=>{let e=s.context.popupRef.current;if(!w||!k||!A||!e||m&&!h||s.state.transitionStatus===`ending`)return;if(N.current=!0,e.style.removeProperty(kT),!m){F.request(()=>s.context.handleScrollArrowVisibility(j||e));return}let t=RT(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=Ie(A),i=r.getComputedStyle(A),a=r.getComputedStyle(e),o=Un(k),c=PT(k),l=IT(k.getBoundingClientRect(),c),d=IT(A.getBoundingClientRect(),c),f=l.height,p=j||e,m=p.scrollHeight,h=parseFloat(a.borderBottomWidth),_=parseFloat(i.marginTop)||10,v=parseFloat(i.marginBottom)||10,b=parseFloat(i.minHeight)||100,x=MT(a),S=o.documentElement.clientHeight-_-v,C=o.documentElement.clientWidth,w=S-l.bottom+f,T,E=y===`rtl`?l.right-d.width:l.left,D=0;if(t&&n){let e=IT(n.getBoundingClientRect(),c);T=IT(t.getBoundingClientRect(),c),E=d.left+(y===`rtl`?e.right-T.right:e.left-T.left);let r=e.top-l.top+e.height/2;D=T.top-d.top+T.height/2-r}let O=w+D+v+h,N=Math.min(S,O),F=S-_-v,I=O-N,L=C-5;A.style.left=`${iT(E,5,L-d.width)}px`,A.style.height=`${N}px`,A.style.maxHeight=`none`,A.style.marginTop=`${_}px`,A.style.marginBottom=`${v}px`,e.style.height=`100%`;let R=NT(p),z=I>=R-1;z&&(N=Math.min(S,d.height)-(I-R));let B=l.top<20||l.bottom>S-20||Math.ceil(N)+1<Math.min(m,b),V=(r.visualViewport?.scale??1)!==1&&we;if(B||V){TT(A,P.current),g(!1);return}let H=Math.max(b,N);if(z){let e=Math.max(0,S-O);A.style.top=d.height>=F?`0`:`${e}px`,A.style.height=`${N}px`,p.scrollTop=NT(p)}else A.style.bottom=`0`,p.scrollTop=I;if(T){let t=d.top,n=d.height,r=T.top+T.height/2,i=iT(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(kT,`50% ${i}%`)}(H===S||N>=x)&&(M.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,w,A,k,m,g,F,j,u,y,h]),v.useEffect(()=>{if(!m||!A||!w)return;let e=Ie(A);function t(e){s.context.setOpen(!1,Jt(yn,e))}return wn(e,`resize`,t)},[s,m,A,w]);let R={...j?{role:`presentation`}:{role:`listbox`,"aria-multiselectable":c||void 0,"aria-readonly":l||void 0,id:`${C}-list`},onKeyDown(e){_&&Xv.has(e.key)&&e.stopPropagation()},onScroll(e){j||I(e.currentTarget)},...m&&{style:j?{height:`100%`}:ET},className:!j&&m?oT.className:void 0},z=Hi(`div`,e,{ref:[t,s.context.popupRef],state:L,stateAttributesMapping:AT,props:[D,R,Bc(O),o]});return(0,S.jsxs)(v.Fragment,{children:[!x&&oT.getElement(b),(0,S.jsx)(Ca,{context:d,modal:!1,disabled:!E,openInteractionType:T,returnFocus:a,restoreFocus:!0,children:z})]})});function MT(e){let t=e.maxHeight;return t.endsWith(`px`)&&parseFloat(t)||1/0}function NT(e){return sT(e.scrollHeight,e.clientHeight)}function PT(e){return Ps.getScale(e)}function FT(e,t,n){return e/n[t]}function IT(e,t){return br({x:FT(e.x,`x`,t),y:FT(e.y,`y`,t),width:FT(e.width,`x`,t),height:FT(e.height,`y`,t)})}var LT=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function RT(e){let{style:t}=e,n={};for(let[e,r]of LT)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of LT){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var zT=v.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=dT(),s=o.useState(`multiple`),c=o.useState(`readOnly`),{alignItemWithTriggerActive:l}=wT(),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:ET},className:u&&d!==`touch`?oT.className:void 0};return Hi(`div`,e,{ref:[t,o.useStateSetter(`listElement`)],props:[f,a]})}),BT=v.createContext(void 0);function VT(){let e=v.useContext(BT);if(!e)throw Error(J(57));return e}var HT=v.memo(v.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=v.useRef(null),d=qb({guess:!0,label:o,textRef:u}),f=dT(),{props:p,multiple:m,disabled:h,readOnly:g,isItemEqualToValue:_}=f.useState(`itemRoot`),y=h||s,b=f.useState(`isActive`,d.index),x=f.useState(`open`),C=f.useState(`isSelected`,a),w=f.useState(`isSelectedByFocus`,d.index),T=d.index,E=v.useRef(null);q(()=>{let e=f.context.valuesRef.current;return e[T]=a,()=>{delete e[T]}},[T,a,f]),q(()=>{let e=f.state.value,t=f.state.selectedIndex,n=t,r;m&&Array.isArray(e)?(n=PS(T,a,f.context.valuesRef.current,e,_,t),r=n===T,T===t&&!r&&(f.context.selectedItemTextRef.current=null)):(r=e!==void 0&&OS(a,e,_),r&&(n=T)),f.set(`selectedIndex`,n),r&&u.current&&(f.context.selectedItemTextRef.current=u.current)},[T,m,_,f,a]);let D=v.useRef(`mouse`),O=v.useRef(!1),{getButtonProps:k,buttonRef:A}=pf({disabled:y,focusableWhenDisabled:!0,native:c,composite:!0}),j={disabled:y,selected:C,highlighted:b};function M(e){if(h||g)return;let t=f.state.value;if(m){let n=Array.isArray(t)?t:[],r=C?FS(n,a,_):[...n,a];f.context.setValue(r,Jt(tn,e))}else f.context.setValue(a,Jt(tn,e)),f.context.setOpen(!1,Jt(tn,e))}function N(){f.context.selectionRef.current.dragY=0}let P={role:`option`,"aria-selected":C,tabIndex:x&&b?0:-1,onKeyDown(e){f.set(`activeIndex`,T),e.key===` `&&f.context.typingRef.current&&e.preventDefault()},onClick(e){let t=D.current!==`touch`,n=e.nativeEvent.pointerType,r=t&&Ae(e.nativeEvent)&&(n!==void 0||b),i=t&&!r&&!O.current;O.current=!1,!(y||i)&&M(e.nativeEvent)},onPointerEnter(e){D.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){D.current=e.pointerType,O.current=!0,N()},onMouseUp(){if(N(),y||D.current===`touch`||O.current)return;let e=!f.context.selectionRef.current.allowSelectedMouseUp&&C,t=!f.context.selectionRef.current.allowUnselectedMouseUp&&!C;e||t||(O.current=!0,E.current?.click(),O.current=!1)}},F=Hi(`div`,e,{ref:[A,t,d.ref,E],state:j,props:[p,P,l,k]}),I=v.useMemo(()=>({selected:C,index:T,textRef:u,selectedByFocus:w}),[C,T,u,w]);return(0,S.jsx)(BT.Provider,{value:I,children:F})})),UT=v.forwardRef(function(e,t){let{selected:n}=VT();return e.keepMounted||n?(0,S.jsx)(iw,{...e,selected:n,ref:t}):null}),WT=v.memo(v.forwardRef(function(e,t){let{index:n,textRef:r,selectedByFocus:i}=VT(),a=dT(),{render:o,className:s,style:c,...l}=e;return Hi(`div`,e,{ref:[v.useCallback(e=>{e&&(n===0&&(a.context.firstItemTextRef.current=e),i&&(a.context.selectedItemTextRef.current=e))},[a,n,i]),t,r],props:l})})),GT=v.forwardRef(function(e,t){let{render:n,className:r,style:i,direction:a,keepMounted:o,...s}=e,c=a===`up`,l=dT(),{side:u,scrollDownArrowRef:d,scrollUpArrowRef:f}=wT(),p=c?`scrollUpArrowVisible`:`scrollDownArrowVisible`,m=l.useState(p),h=l.useState(`openMethod`),g=m&&h!==`touch`,_=fe(),v=c?f:d,{mounted:y,transitionStatus:b,setMounted:x}=Na(g);q(()=>(l.context.scrollArrowsMountedCountRef.current+=1,l.set(`hasScrollArrows`,!0),()=>{l.context.scrollArrowsMountedCountRef.current=Math.max(0,l.context.scrollArrowsMountedCountRef.current-1),l.context.scrollArrowsMountedCountRef.current===0&&l.set(`hasScrollArrows`,!1)}),[l]),Ra({open:g,ref:v,onComplete(){g||x(!1)}});let S=Hi(`div`,e,{ref:[t,v],state:{direction:a,visible:g,side:u,transitionStatus:b},props:[{"aria-hidden":!0,children:c?`▲`:`▼`,style:{position:`absolute`},onMouseMove(e){if(e.movementX===0&&e.movementY===0||_.isStarted())return;l.set(`activeIndex`,null);function t(){let e=l.state.listElement??l.context.popupRef.current;if(!e)return;l.set(`activeIndex`,null),l.context.handleScrollArrowVisibility(e);let n=sT(e.scrollHeight,e.clientHeight),r=cT(e.scrollTop,n),i=r===(c?0:n),a=l.context.listRef.current;if(r!==e.scrollTop&&(e.scrollTop=r),i)_.clear();else{if(a.length>0){let t=v.current?.offsetHeight||0;e.scrollTop=KT(a,c,r,e.clientHeight,t,n)}_.start(40,t)}}_.start(40,t)},onMouseLeave(){_.clear()}},s],stateAttributesMapping:yt});return y||o?S:null});function KT(e,t,n,r,i,a){if(t){let t=0,r=n+i-1;for(let n=0;n<e.length;n+=1){let i=e[n];if(i&&i.offsetTop>=r){t=n;break}}let o=Math.max(0,t-1),s=e[o];return o<t&&s?cT(s.offsetTop-i,a):0}let o=e.length-1,s=n+r-i+1;for(let t=0;t<e.length;t+=1){let n=e[t];if(n&&n.offsetTop+n.offsetHeight>s){o=Math.max(0,t-1);break}}let c=Math.min(e.length-1,o+1),l=e[c];return c>o&&l?cT(l.offsetTop+l.offsetHeight-r+i,a):a}var qT=v.forwardRef(function(e,t){return(0,S.jsx)(GT,{...e,ref:t,direction:`down`})}),JT=v.forwardRef(function(e,t){return(0,S.jsx)(GT,{...e,ref:t,direction:`up`})}),YT=v.createContext(void 0),XT=v.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=v.useState(),c=v.useMemo(()=>({labelId:o,setLabelId:s}),[o,s]),l=Hi(`div`,e,{ref:t,props:[{role:`group`,"aria-labelledby":o},a]});return(0,S.jsx)(YT.Provider,{value:c,children:l})}),ZT=YC,QT=v.createContext(void 0);function $T(){return v.useContext(QT)}var eE=v.forwardRef(function(e,t){let{className:n,defaultPressed:r=!1,disabled:i=!1,form:a,onPressedChange:o,pressed:s,render:c,type:l,value:u,nativeButton:d=!0,style:f,...p}=e,m=lc(u||void 0),h=$T(),g=h?.value??[],_=(i||h?.disabled)??!1,[y,b]=kb({controlled:h?m!==void 0&&g.indexOf(m)>-1:s,default:r,name:`Toggle`,state:`pressed`}),{getButtonProps:x,buttonRef:C}=pf({disabled:_,native:d}),w={disabled:_,pressed:y},T=[C,t],E=[{"aria-pressed":y,onClick(e){let t=!y,n=Jt(Xt,e.nativeEvent);o?.(t,n),!n.isCanceled&&(m&&h?.setGroupValue?.(m,t,n),!n.isCanceled&&b(t))}},p,x],D=Hi(`button`,e,{enabled:!h,state:w,ref:T,props:E}),O=v.useMemo(()=>({disabled:_,focusableWhenDisabled:!1}),[_]);return h?(0,S.jsx)(Qw,{tag:`button`,render:c,className:n,style:f,metadata:O,state:w,refs:T,props:E}):D}),tE=v.createContext(void 0);function nE(){return v.useContext(tE)}var rE=v.forwardRef(function(e,t){let{defaultValue:n,disabled:r=!1,loopFocus:i=!0,onValueChange:a,orientation:o=`horizontal`,multiple:s=!1,value:c,className:l,render:u,style:d,...f}=e,p=ub(!0),m=nE(),h=n??G,g=c!==void 0||n!==void 0,_=(p?.disabled??!1)||(m?.disabled??!1)||r,[y,b]=kb({controlled:c,default:h,name:`ToggleGroup`,state:`value`}),x=Y((e,t,n)=>{let r;s?(r=y.slice(),t?r.push(e):r.splice(y.indexOf(e),1)):r=t?[e]:[],a?.(r,n),!n.isCanceled&&b(r)}),C={disabled:_,multiple:s,orientation:o},w=v.useMemo(()=>({disabled:_,setGroupValue:x,value:y,isValueInitialized:g}),[_,x,y,g]),T={role:`group`},E=Hi(`div`,e,{enabled:!!p,state:C,ref:t,props:[T,f]});return(0,S.jsx)(QT.Provider,{value:w,children:p?E:(0,S.jsx)(cx,{render:u,className:l,style:d,state:C,refs:[t],props:[T,f],loopFocus:i,enableHomeAndEndKeys:!0,orientation:o})})});function iE({className:e,...t}){return(0,S.jsx)(`textarea`,{"data-slot":`textarea`,className:X(`flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...t})}function aE({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`input-group`,role:`group`,className:X(`group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5`,e),...t})}var oE=Bd(`flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4`,{variants:{align:{"inline-start":`order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]`,"inline-end":`order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]`,"block-start":`order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2`,"block-end":`order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2`}},defaultVariants:{align:`inline-start`}});function sE({className:e,align:t=`inline-start`,...n}){return(0,S.jsx)(`div`,{role:`group`,"data-slot":`input-group-addon`,"data-align":t,className:X(oE({align:t}),e),onClick:e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...n})}var cE=Bd(`flex items-center gap-2 text-sm shadow-none`,{variants:{size:{xs:`h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5`,sm:``,"icon-xs":`size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0`,"icon-sm":`size-8 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});function lE({className:e,type:t=`button`,variant:n=`ghost`,size:r=`xs`,...i}){return(0,S.jsx)(vf,{type:t,"data-size":r,variant:n,className:X(cE({size:r}),e),...i})}function uE({className:e,...t}){return(0,S.jsx)(Uf,{"data-slot":`input-group-control`,className:X(`flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent`,e),...t})}function dE({className:e,...t}){return(0,S.jsx)(iE,{"data-slot":`input-group-control`,className:X(`flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent`,e),...t})}var fE=rw;function pE({className:e,children:t,...n}){return(0,S.jsxs)(mC,{"data-slot":`combobox-trigger`,className:X(`[&_svg:not([class*='size-'])]:size-4`,e),...n,children:[t,(0,S.jsx)(Tu,{className:`pointer-events-none size-4 text-muted-foreground`})]})}function mE({className:e,...t}){return(0,S.jsx)(SC,{"data-slot":`combobox-clear`,render:(0,S.jsx)(lE,{variant:`ghost`,size:`icon-xs`}),className:X(e),...t,children:(0,S.jsx)(Fd,{className:`pointer-events-none`})})}function hE({className:e,children:t,disabled:n=!1,showTrigger:r=!0,showClear:i=!1,...a}){return(0,S.jsxs)(aE,{className:X(`w-auto`,e),children:[(0,S.jsx)(bC,{render:(0,S.jsx)(uE,{disabled:n}),...a}),(0,S.jsxs)(sE,{align:`inline-end`,children:[r&&(0,S.jsx)(lE,{size:`icon-xs`,variant:`ghost`,render:(0,S.jsx)(pE,{}),"data-slot":`input-group-button`,className:`group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent`,disabled:n}),i&&(0,S.jsx)(mE,{disabled:n})]}),t]})}function gE({className:e,side:t=`bottom`,sideOffset:n=6,align:r=`start`,alignOffset:i=0,anchor:a,...o}){return(0,S.jsx)(NC,{children:(0,S.jsx)(PC,{side:t,sideOffset:n,align:r,alignOffset:i,anchor:a,className:`isolate z-50`,children:(0,S.jsx)(IC,{"data-slot":`combobox-content`,"data-chips":!!a,className:X(`group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[chips=true]:min-w-(--anchor-width) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:border-input/30 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:shadow-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...o})})})}function _E({className:e,...t}){return(0,S.jsx)(DC,{"data-slot":`combobox-list`,className:X(`no-scrollbar max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0`,e),...t})}function vE({className:e,children:t,...n}){return(0,S.jsxs)(qC,{"data-slot":`combobox-item`,className:X(`relative flex w-full cursor-default items-center gap-2 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...n,children:[t,(0,S.jsx)(aw,{render:(0,S.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`}),children:(0,S.jsx)(Cu,{className:`pointer-events-none`})})]})}function yE({className:e,...t}){return(0,S.jsx)(zC,{"data-slot":`combobox-group`,className:X(e),...t})}function bE({className:e,...t}){return(0,S.jsx)(BC,{"data-slot":`combobox-label`,className:X(`px-2 py-1.5 text-xs text-muted-foreground`,e),...t})}function xE({...e}){return(0,S.jsx)(EC,{"data-slot":`combobox-collection`,...e})}function SE({className:e,...t}){return(0,S.jsx)(JC,{"data-slot":`combobox-empty`,className:X(`hidden w-full justify-center py-2 text-center text-sm text-muted-foreground group-data-empty/combobox-content:flex`,e),...t})}function CE({className:e,...t}){return(0,S.jsx)(`label`,{"data-slot":`label`,className:X(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function wE({className:e,...t}){return(0,S.jsx)(`fieldset`,{"data-slot":`field-set`,className:X(`flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3`,e),...t})}function TE({className:e,variant:t=`legend`,...n}){return(0,S.jsx)(`legend`,{"data-slot":`field-legend`,"data-variant":t,className:X(`mb-1.5 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base`,e),...n})}function EE({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`field-group`,className:X(`group/field-group @container/field-group flex w-full flex-col gap-5 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,e),...t})}var DE=Bd(`group/field flex w-full gap-2 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function OE({className:e,orientation:t=`vertical`,...n}){return(0,S.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":t,className:X(DE({orientation:t}),e),...n})}function kE({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`field-content`,className:X(`group/field-content flex flex-1 flex-col gap-0.5 leading-snug`,e),...t})}function AE({className:e,...t}){return(0,S.jsx)(CE,{"data-slot":`field-label`,className:X(`group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-muted/50 has-[>[data-slot=field]]:has-[:focus-visible]:border-ring has-[>[data-slot=field]]:has-[:focus-visible]:ring-3 has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/50 *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,e),...t})}function jE({className:e,...t}){return(0,S.jsx)(`p`,{"data-slot":`field-description`,className:X(`text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5`,`last:mt-0 nth-last-2:-mt-1`,`[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}var ME=mT;function NE({className:e,...t}){return(0,S.jsx)(XT,{"data-slot":`select-group`,className:X(`scroll-my-1 p-1`,e),...t})}function PE({className:e,...t}){return(0,S.jsx)(bT,{"data-slot":`select-value`,className:X(`flex flex-1 text-left`,e),...t})}function FE({className:e,size:t=`default`,children:n,...r}){return(0,S.jsxs)(vT,{"data-slot":`select-trigger`,"data-size":t,className:X(`flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,S.jsx)(xT,{render:(0,S.jsx)(Tu,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function IE({className:e,children:t,side:n=`bottom`,sideOffset:r=4,align:i=`center`,alignOffset:a=0,alignItemWithTrigger:o=!0,...s}){return(0,S.jsx)(ST,{children:(0,S.jsx)(OT,{side:n,sideOffset:r,align:i,alignOffset:a,alignItemWithTrigger:o,className:`isolate z-50`,children:(0,S.jsxs)(jT,{"data-slot":`select-content`,"data-align-trigger":o,className:X(`relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...s,children:[(0,S.jsx)(zE,{}),(0,S.jsx)(zT,{children:t}),(0,S.jsx)(BE,{})]})})})}function LE({className:e,children:t,...n}){return(0,S.jsxs)(HT,{"data-slot":`select-item`,className:X(`relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,S.jsx)(WT,{className:`flex flex-1 shrink-0 gap-2 whitespace-nowrap`,children:t}),(0,S.jsx)(UT,{render:(0,S.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`}),children:(0,S.jsx)(Cu,{className:`pointer-events-none`})})]})}function RE({className:e,...t}){return(0,S.jsx)(ZT,{"data-slot":`select-separator`,className:X(`pointer-events-none -mx-1 my-1 h-px bg-border`,e),...t})}function zE({className:e,...t}){return(0,S.jsx)(JT,{"data-slot":`select-scroll-up-button`,className:X(`top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,S.jsx)(ku,{})})}function BE({className:e,...t}){return(0,S.jsx)(qT,{"data-slot":`select-scroll-down-button`,className:X(`bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,S.jsx)(Tu,{})})}var VE=`default`,HE=[{value:`1`,label:`Stop that agent`},{value:`2`,label:`Wait for 1 reset, then stop`},{value:`3`,label:`Wait for 2 resets, then stop`},{value:`4`,label:`Wait for 3 resets, then stop`},{value:`5`,label:`Wait for 4 resets, then stop`},{value:`none`,label:`Wait and always continue`}];function UE({value:e,onChange:t}){let n=(n,r)=>{let i={...e.agents};r?i[n]=r:delete i[n],t({...e,agents:i})};return(0,S.jsxs)(EE,{children:[(0,S.jsxs)(wE,{children:[(0,S.jsx)(TE,{variant:`label`,children:`Agents`}),qx.map(t=>{let r=e.agents[t];return(0,S.jsxs)(OE,{orientation:`horizontal`,children:[(0,S.jsx)(Px,{id:`agent-${t}`,checked:r!==void 0,onCheckedChange:e=>n(t,e?{}:void 0)}),(0,S.jsx)(AE,{htmlFor:`agent-${t}`,className:`w-14 flex-none!`,children:t}),(0,S.jsx)(KE,{agent:t,value:r,onChange:e=>n(t,e)})]},t)})]}),(0,S.jsxs)(OE,{children:[(0,S.jsxs)(kE,{children:[(0,S.jsx)(AE,{children:`When an agent hits its usage limit`}),(0,S.jsx)(jE,{children:`Waiting pauses that agent until its plan resets, then it goes on. Once every agent has stopped, the factory turns off.`})]}),(0,S.jsxs)(ME,{items:HE,value:e.limit===null?`none`:String(e.limit),onValueChange:n=>t({...e,limit:n===`none`?null:Number(n)}),children:[(0,S.jsx)(FE,{className:`w-56`,children:(0,S.jsx)(PE,{})}),(0,S.jsx)(IE,{children:HE.map(e=>(0,S.jsx)(LE,{value:e.value,children:e.label},e.value))})]})]}),(0,S.jsxs)(OE,{orientation:`horizontal`,children:[(0,S.jsxs)(kE,{children:[(0,S.jsx)(AE,{htmlFor:`until`,children:`Start nothing new after`}),(0,S.jsx)(jE,{children:`Leave empty to keep going.`})]}),(0,S.jsx)(Uf,{id:`until`,type:`time`,className:`w-28`,value:e.until??``,onChange:n=>t({...e,until:n.target.value||void 0})})]})]})}var WE;function GE(){let[e,t]=(0,v.useState)({});return(0,v.useEffect)(()=>{WE??=rf.models(),WE.then(t,()=>WE=void 0)},[]),e}function KE({agent:e,value:t,onChange:n}){let r=GE()[e]??[],i=t=>r.find(e=>e.value===t)?.efforts??Jx[e],a=[{value:VE,label:`Default effort`}].concat(i(t?.model).map(e=>({value:e,label:e}))),o=e=>e===VE?void 0:e??void 0;return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(qE,{label:`${e} model`,offered:r,disabled:!t,value:t?.model??VE,onChange:e=>{let r=o(e),a=t?.effort&&i(r).includes(t.effort)?t.effort:void 0;n({...t,model:r,effort:a})}}),(0,S.jsx)(JE,{label:`${e} effort`,items:a,disabled:!t,value:t?.effort??VE,onChange:e=>n({...t,effort:o(e)})})]})}function qE({label:e,offered:t,disabled:n,value:r,onChange:i}){let[a,o]=(0,v.useState)(null),s=[{value:VE,label:`Default model`,efforts:[],scoped:!0}];r!==VE&&!t.some(e=>e.value===r)&&s.push({value:r,label:r,efforts:[],scoped:!0});let c=[{value:``,items:s},{value:`Scoped`,items:t.filter(e=>e.scoped)},{value:`All models`,items:t.filter(e=>!e.scoped)}].filter(e=>e.items.length>0),l=c.flatMap(e=>e.items).find(e=>e.value===r);return(0,S.jsxs)(fE,{items:c,disabled:n,value:l,inputValue:a??l?.label??``,onInputValueChange:(e,{reason:t})=>{t===`input-change`&&o(e)},onOpenChange:e=>{e||o(null)},onValueChange:e=>e&&i(e.value),isItemEqualToValue:(e,t)=>e.value===t.value,autoHighlight:!0,filter:(e,t)=>t.toLowerCase().split(/\s+/).every(t=>`${e.label} ${e.value}`.toLowerCase().includes(t)),children:[(0,S.jsx)(hE,{"aria-label":e,className:`w-full min-w-0 flex-1`,disabled:n,onFocus:e=>e.target.select(),onBlur:()=>o(null)}),(0,S.jsxs)(gE,{className:`min-w-72`,children:[(0,S.jsx)(SE,{children:`No model matches`}),(0,S.jsx)(_E,{children:e=>(0,S.jsxs)(yE,{items:e.items,children:[e.value&&(0,S.jsx)(bE,{children:e.value}),(0,S.jsx)(xE,{children:e=>(0,S.jsx)(vE,{value:e,children:(0,S.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,S.jsx)(`span`,{className:`truncate`,children:e.label}),e.value!==VE&&e.value!==e.label&&(0,S.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:e.value})]})},e.value)})]},e.value)})]})]})}function JE({label:e,className:t,items:n,disabled:r,value:i,onChange:a}){return(0,S.jsxs)(ME,{items:n,disabled:r,value:i,onValueChange:a,children:[(0,S.jsx)(FE,{"aria-label":e,className:t,children:(0,S.jsx)(PE,{})}),(0,S.jsx)(IE,{children:n.map(e=>(0,S.jsx)(LE,{value:e.value,children:e.label},e.value))})]})}var YE={blocked:{label:`Waiting for you`,shows:e=>e.state===`blocked`},review:{label:`Needs review`,shows:(e,t)=>{let n=Nv(e);return n!==void 0&&(t[n]?.state??`OPEN`)===`OPEN`}},failed:{label:`Failed`,shows:e=>e.state===`failed`},nothing:{label:`Nothing to do`,shows:e=>{let t=e.attempts.at(-1);return e.state===`done`&&!t.url&&!t.branch}},all:{label:`All`,shows:()=>!0}},XE={passing:{label:`checks passing`,Icon:ju,className:`text-success`},failing:{label:`checks failing`,Icon:Lu,className:`text-destructive`},pending:{label:`checks running`,Icon:Nu,className:void 0},none:{label:`no checks`,Icon:zu,className:void 0}};function ZE(e){return e.state===`done`||e.state===`failed`||e.state===`blocked`}var QE=`factory.results.seen`;function $E(){let[e]=(0,v.useState)(()=>{try{return localStorage.getItem(QE)??``}catch{return``}});return(0,v.useEffect)(()=>{let e=()=>{try{localStorage.setItem(QE,new Date().toISOString())}catch{}};return e(),e},[]),e}function eD(e,t,n){let r=Nv(e),i=r?t[r]:void 0;return i?.state===`OPEN`&&!i.draft&&i.checks!==`failing`&&!(i.conflicts&&i.fork)&&!Mv(n[e.id])}function tD({snapshot:e,act:t,onAsk:n}){let[r,i]=xx(`filter`,`all`),[a,o]=(0,v.useState)(()=>new Set),[s,c]=(0,v.useState)(!1),l=$E(),{prs:u,train:d}=e,f=e.jobs.filter(e=>e.state!==`removed`),p=new Set(f.filter(e=>e.item.play===`review`).map(e=>jv(e.item))),m=Object.keys(e.settings.agents),h=f.filter(e=>e.attempts.length>0).sort((e,t)=>t.attempts.at(-1).start.localeCompare(e.attempts.at(-1).start));if(h.length===0)return(0,S.jsx)(Vd,{children:(0,S.jsxs)(Hd,{children:[(0,S.jsx)(Ud,{children:`Nothing done yet`}),(0,S.jsx)(Wd,{children:`What the agents did shows up here, with their PRs to review and merge.`})]})});let g=h.filter(e=>(YE[r]??YE.all).shows(e,u)),_=g.filter(ZE),y=_.filter(e=>a.has(e.id)),b=y.length===_.length,x=y.filter(e=>eD(e,u,d)),C=(e,t)=>{o(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})};return(0,S.jsxs)(`div`,{className:`flex flex-col gap-4 pt-2`,children:[(0,S.jsxs)(`div`,{className:`flex min-h-8 flex-wrap items-center gap-3 border border-transparent px-3`,children:[_.length>0&&(0,S.jsx)(Px,{"aria-label":b?`Clear selection`:`Select all`,checked:y.length>0&&b,disabled:s,onCheckedChange:e=>o(new Set(e?_.map(e=>e.id):[]))}),y.length===0?(0,S.jsx)(JE,{label:`Filter`,className:`w-56`,items:Object.entries(YE).map(([e,{label:t,shows:n}])=>({value:e,label:`${t} (${h.filter(e=>n(e,u)).length})`})),value:r,onChange:e=>e&&i(e)}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`span`,{className:`text-sm font-medium`,children:[y.length,` of `,_.length,` selected`]}),(0,S.jsxs)(`div`,{role:`group`,"aria-label":`Batch actions`,className:`flex items-center gap-2 sm:ml-auto`,children:[(0,S.jsx)(vf,{variant:`outline`,size:`sm`,disabled:s,onClick:async()=>{if(!y.some(e=>e.attempts.some(e=>e.branch))||window.confirm(`Dismiss selected results and delete their unpushed branches?`)){c(!0);try{await t(async()=>{let e=(await Promise.allSettled(y.map(e=>rf.remove(e.id)))).find(e=>e.status===`rejected`);if(e)throw e.reason})}finally{c(!1)}}},children:s?`Dismissing…`:`Dismiss`}),x.length>0&&(0,S.jsxs)(Xl,{children:[(0,S.jsx)(Gl,{render:(0,S.jsx)(`span`,{}),children:(0,S.jsxs)(vf,{variant:`outline`,size:`sm`,disabled:s,onClick:()=>{let e=x.length===1?`1 PR`:`${x.length} PRs`;window.confirm(`Merge ${e} one after another? Conflicting ones get rebased; ones that still conflict are skipped.`)&&(t(()=>rf.mergeTrain(x.map(e=>e.id))),o(new Set))},children:[`Merge `,x.length<y.length&&`(${x.length})`]})}),(0,S.jsx)(Kl,{children:`Merges one after another per repo, smallest first`})]})]})]})]}),(0,S.jsx)(Ix,{children:g.map(r=>(0,S.jsx)(nD,{job:r,snapshot:e,act:t,car:d[r.id],onAsk:n,asked:e.settings.chat.agent,unread:l!==``&&r.attempts.at(-1).end>l,reviewer:r.item.play!==`review`&&!p.has(jv(r.item))?m.find(e=>e!==r.agent):void 0,disabled:s&&a.has(r.id),selection:ZE(r)&&(0,S.jsx)(Px,{"aria-label":`Select ${Xd(r.item)}`,checked:a.has(r.id),disabled:s,onCheckedChange:e=>C(r.id,e)})},r.id))})]})}function nD({job:e,snapshot:t,act:n,car:r,onAsk:i,asked:a,unread:o,reviewer:s,disabled:c,selection:l}){let[u,d]=(0,v.useState)(),f=e.attempts.at(-1),p=Nv(e),m=p?t.prs[p]:void 0,h=fD(e,t.prs),g=m?.state===`OPEN`,_=c||u!==void 0||Mv(r),y=m&&(Fv(m)?`rebase`:Pv(m)?`merge`:void 0),b=r?.step===`skipped`?`The merge train skipped ${p}, "${Xd(e.item)}": ${r.reason}. Why, and what should I do about it?`:e.state===`failed`?`Job ${e.id}, "${Xd(e.item)}" (workwork ${e.item.id} in ${e.item.repo}), failed${f.error?`: ${f.error}`:``}. Its log is ${f.log}. Why did it fail, and should I retry it, pin another agent, or drop it?`:void 0;async function x(t){d(t);try{await n(()=>rf[t](e.id))}finally{d(void 0)}}let C={merge:`Merging…`,rebase:`Rebasing…`,close:`Closing…`},w=y&&(0,S.jsx)(vf,{variant:`outline`,size:`sm`,disabled:_,onClick:()=>x(y),children:u?C[u]:y===`rebase`?`Rebase`:`Merge`}),T=e.state===`failed`&&(0,S.jsx)(vf,{variant:`outline`,size:`sm`,disabled:_,onClick:()=>n(()=>rf.retry(e.id)),children:`Retry`}),E=()=>n(()=>rf.remove(e.id)),D=e.state===`blocked`?e.notes.findLast(e=>e.kind===`ask`):void 0;return(0,S.jsxs)(Gx,{leading:(0,S.jsxs)(S.Fragment,{children:[l,(0,S.jsx)(uD,{state:h})]}),title:(0,S.jsxs)(S.Fragment,{children:[o&&(0,S.jsx)(`span`,{role:`img`,"aria-label":`new`,className:`mr-1 inline-block size-2 rounded-full bg-primary align-middle`}),(0,S.jsx)(mD,{item:e.item,job:e,snapshot:t,act:n,actions:(0,S.jsxs)(S.Fragment,{children:[ZE(e)&&(0,S.jsx)(vf,{variant:`ghost`,size:`sm`,className:`sm:mr-auto`,disabled:_,onClick:E,children:`Dismiss`}),g&&(0,S.jsx)(vf,{variant:`outline`,size:`sm`,disabled:_,onClick:()=>x(`close`),children:u===`close`?C.close:`Close PR`}),g&&s&&(0,S.jsxs)(vf,{variant:`outline`,size:`sm`,disabled:_,onClick:()=>n(()=>rf.review(e.id,s)),children:[`Review with `,tf(s)]}),b&&(0,S.jsxs)(vf,{variant:`outline`,size:`sm`,onClick:()=>i(b),children:[`Ask `,tf(a)]}),T,w]})})]}),meta:(0,S.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,S.jsx)(dD,{state:h,label:h===`failed`&&f.outcome!==`failed`?f.outcome:void 0}),(0,S.jsx)(rD,{job:e,last:f,pr:m,url:p,car:r})]}),below:D&&(0,S.jsx)(Kf,{job:e,question:D,act:n}),children:[w,T,ZE(e)&&(0,S.jsxs)(Xl,{children:[(0,S.jsx)(Gl,{render:(0,S.jsx)(vf,{variant:`ghost`,size:`icon-sm`,"aria-label":`Dismiss ${Xd(e.item)}`,disabled:_,onClick:E}),children:(0,S.jsx)(Fd,{"aria-hidden":`true`})}),(0,S.jsx)(Kl,{children:e.attempts.some(e=>e.branch)?`Dismiss: hide from results and delete its unpushed branch`:`Dismiss: hide from results, its PR stays as it is`})]})]})}function rD({job:e,last:t,pr:n,url:r,car:i}){let a=e.notes.findLast(e=>e.kind===`result`),o=n?.state===`OPEN`&&XE[n.checks],s=r?[n?.state===`OPEN`&&(n.level??e.item.level),n&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`span`,{className:`text-success`,children:[`+`,n.additions]}),` `,(0,S.jsxs)(`span`,{className:`text-destructive`,children:[`−`,n.deletions]})]}),o&&(0,S.jsx)(`span`,{className:o.className,children:o.label},`checks`),n?.state===`OPEN`&&n.conflicts&&(0,S.jsx)(`span`,{className:`text-destructive`,children:`conflicts`},`conflicts`),n?.draft&&`draft`,i&&(0,S.jsx)(aD,{car:i},`train`),`#${r.split(`/`).at(-1)}`]:e.state===`failed`?[t.error&&(0,S.jsx)(`span`,{className:`text-destructive`,children:t.error.split(`
59
+ `)[0]},`error`),e.attempts.length>1&&`${e.attempts.length} attempts`]:[e.state===`done`&&(a?.text??`nothing to change`)];return(0,S.jsx)(`span`,{className:`min-w-0 truncate`,children:[...s,tf(t.agent),qd(t.end)].filter(Boolean).map((e,t)=>(0,S.jsxs)(`span`,{children:[t>0&&` · `,e]},t))})}var iD={queued:`on the merge train`,waiting:`merge train: waiting for checks`,rebasing:`merge train: rebasing`,merging:`merge train: merging`,merged:void 0};function aD({car:e}){return e?.step===`skipped`?(0,S.jsxs)(`span`,{className:`text-destructive`,children:[`merge train skipped it: `,e.reason.replaceAll(`
60
+ `,` `)]}):e&&iD[e.step]?(0,S.jsx)(`span`,{children:iD[e.step]}):null}function oD({jobId:e,url:t,pr:n}){let r=n?.state===`OPEN`&&XE[n.checks];return(0,S.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-3`,children:[(0,S.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1`,children:[(0,S.jsx)(Zu,{className:`size-3.5`,"aria-hidden":`true`}),t.replace(`https://github.com/`,``)]}),n?(0,S.jsxs)(S.Fragment,{children:[r&&(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-1 ${r.className??``}`,children:[(0,S.jsx)(r.Icon,{className:`size-3.5`,"aria-hidden":`true`}),r.label]}),n.draft&&(0,S.jsx)(`span`,{children:`draft`}),n.state===`OPEN`&&n.conflicts===null&&(0,S.jsx)(`span`,{children:`checking mergeability…`}),n.state===`OPEN`&&n.conflicts&&(0,S.jsx)(`span`,{className:`text-destructive`,children:n.fork?`conflicts · resolve in fork`:`conflicts`}),(0,S.jsxs)(`span`,{children:[(0,S.jsxs)(`span`,{className:`text-success`,children:[`+`,n.additions]}),` `,(0,S.jsxs)(`span`,{className:`text-destructive`,children:[`−`,n.deletions]}),` in `,n.files.length,` `,n.files.length===1?`file`:`files`]}),(0,S.jsx)(_x,{jobId:e,url:t,pr:n})]}):(0,S.jsx)(`span`,{children:`asking GitHub…`})]})}var sD={auto:`a check defines correct, so a digest is enough`,skim:`same behavior and a small diff, to skim and accept`,decide:`changes behavior or needs your product judgment`},cD={candidate:{Icon:Nu,icon:`text-muted-foreground`,pill:`bg-muted text-muted-foreground`},queued:{Icon:zu,icon:`text-muted-foreground`,pill:`bg-muted text-muted-foreground`},running:{Icon:sd,icon:`animate-spin text-primary`,pill:`bg-primary/15 text-primary`},blocked:{Icon:Fu,icon:`text-warning`,pill:`bg-warning text-background`},review:{Icon:Zu,icon:`text-primary`,pill:`bg-primary/15 text-primary`},done:{Icon:ju,icon:`text-success`,pill:`bg-success/15 text-success`},merged:{Icon:qu,icon:`text-success`,pill:`bg-success/15 text-success`},failed:{Icon:Lu,icon:`text-destructive`,pill:`bg-destructive/15 text-destructive`},closed:{Icon:Yu,icon:`text-muted-foreground`,pill:`bg-muted text-muted-foreground`},removed:{Icon:Lu,icon:`text-muted-foreground`,pill:`bg-muted text-muted-foreground`}},lD={blocked:`waiting for you`,review:`needs review`};function uD({state:e}){let{Icon:t,icon:n}=cD[e];return(0,S.jsx)(t,{role:`img`,"aria-label":e,className:`size-4 shrink-0 ${n}`})}function dD({state:e,label:t}){return(0,S.jsx)(`span`,{className:`inline-flex h-5 items-center rounded-full px-2 text-xs font-medium whitespace-nowrap ${cD[e].pill}`,children:t??lD[e]??e})}function fD(e,t){if(!e)return`candidate`;let n=Nv(e);if(!n||e.state!==`done`)return e.state;let r=t[n]?.state;return r===`MERGED`?`merged`:r===`CLOSED`?`closed`:`review`}function pD({item:e,bare:t}){return(0,S.jsxs)(S.Fragment,{children:[!t&&(0,S.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[Yd(e.repo),`: `]}),e.title||e.id]})}function mD({item:e,job:t,play:n,snapshot:r,act:i,actions:a,bare:o}){let s=fD(t,r.prs);return(0,S.jsxs)(My,{children:[(0,S.jsx)(Ny,{render:(0,S.jsx)(`button`,{type:`button`,className:`cursor-pointer truncate text-left underline-offset-4 hover:underline`}),children:(0,S.jsx)(pD,{item:e,bare:o})}),(0,S.jsxs)(Iy,{className:t?`sm:max-w-5xl`:`sm:max-w-3xl`,children:[(0,S.jsx)(Ly,{className:`mr-8`,children:(0,S.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,S.jsx)(`span`,{className:`mt-0.5`,children:(0,S.jsx)(uD,{state:s})}),(0,S.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,S.jsx)(zy,{children:(0,S.jsx)(pD,{item:e})}),(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-muted-foreground`,children:[(0,S.jsx)(dD,{state:s}),(0,S.jsxs)(By,{children:[e.label,` · `,e.play,` · `,e.level]})]})]})]})}),t?(0,S.jsxs)(`div`,{className:`-mx-4 -mb-4 grid border-t md:max-h-[65dvh] md:grid-cols-[3fr_2fr]`,children:[(0,S.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 overflow-auto p-4`,children:[(0,S.jsx)(bD,{children:`The task`}),(0,S.jsx)(hD,{item:e,jobId:t.id}),(0,S.jsx)(xD,{item:e,play:n})]}),(0,S.jsx)(`div`,{className:`flex min-w-0 flex-col gap-3 overflow-auto bg-muted/30 p-4 md:border-l`,children:(0,S.jsx)(gD,{job:t,snapshot:r,act:i})})]}):(0,S.jsxs)(`div`,{className:`flex max-h-[65dvh] flex-col gap-3 overflow-auto`,children:[(0,S.jsx)(hD,{item:e}),(0,S.jsx)(xD,{item:e,play:n})]}),a&&(0,S.jsx)(Ry,{children:a})]})]})}function hD({item:e,jobId:t}){let[n,r]=(0,v.useState)(),[i,a]=(0,v.useState)();return(0,v.useEffect)(()=>{let n=!0;return(t?rf.jobPrompt(t):rf.prompt(e)).then(e=>n&&r(e),e=>n&&a(e.message)),()=>{n=!1}},[e,t]),i?(0,S.jsxs)(`p`,{role:`status`,className:`text-destructive`,children:[`Could not load the task: `,i]}):n===void 0?(0,S.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-muted-foreground`,children:[(0,S.jsx)(Vy,{}),` Asking workwork…`]}):(0,S.jsx)(`div`,{className:`flex flex-col gap-2 text-sm wrap-anywhere`,children:(0,S.jsx)(Dv,{options:gx,children:n.split(`
61
+ ## Standard`)[0].replace(/^# workwork[^]*?(?=^## )/m,``)})})}function gD({job:e,snapshot:t,act:n}){let{status:r,prs:i,train:a}=t,o=e.attempts.at(-1),s=new Set(t.jobs.filter(e=>e.state!==`removed`&&e.item.play===`followup`).map(e=>e.item.title)),c=r?.workers.find(t=>t.job===e.id),l=e.notes.findLast(t=>t.kind===`step`&&t.attempt===e.attempts.length+1),u=e.state===`blocked`?e.notes.findLast(e=>e.kind===`ask`):void 0,d=Nv(e),f=wD(e).sort((e,t)=>t.at.localeCompare(e.at)),p=new Map;for(let e of f){let t=DD(e.at);p.set(t,[...p.get(t)??[],e])}return(0,S.jsxs)(S.Fragment,{children:[c&&r&&(0,S.jsxs)(yD,{className:`border-primary/40`,children:[(0,S.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,children:[(0,S.jsx)(uD,{state:`running`}),c.id,` working, `,Jd(c.since),` min`]}),l&&(0,S.jsxs)(`span`,{children:[l.text,l.of?` (${l.done??0}/${l.of})`:``]}),(0,S.jsx)(`span`,{className:`text-muted-foreground`,children:[c.activity,c.context&&`${Math.round(c.context/1e3)}k context`].filter(Boolean).join(` · `)})]}),(0,S.jsx)(_D,{job:e,act:n}),u&&(0,S.jsx)(Kf,{job:e,question:u,act:n}),o?.error&&(0,S.jsx)(yD,{className:`border-destructive/40 text-destructive`,children:o.error.split(`
62
+ `)[0]}),d&&(0,S.jsxs)(yD,{className:i[d]?.state===`MERGED`?`border-success/40`:``,children:[(0,S.jsx)(oD,{jobId:e.id,url:d,pr:i[d]}),(0,S.jsx)(aD,{car:a[e.id]})]}),(0,S.jsx)(Gf,{job:e,act:n,queued:s}),(0,S.jsx)(bD,{children:`Log`}),(0,S.jsx)(`div`,{className:`flex flex-col gap-3 text-sm`,children:[...p].map(([e,t])=>(0,S.jsxs)(`section`,{className:`flex flex-col gap-1.5`,children:[(0,S.jsx)(`h4`,{className:`text-xs text-muted-foreground`,children:e}),(0,S.jsx)(`ol`,{className:`flex flex-col`,children:t.map(e=>(0,S.jsxs)(`li`,{className:`group grid grid-cols-[4.5rem_0.75rem_1fr] gap-x-2`,children:[(0,S.jsx)(`time`,{dateTime:e.at,className:`text-right whitespace-nowrap text-muted-foreground tabular-nums`,children:Kd(e.at)}),(0,S.jsx)(`span`,{"aria-hidden":!0,className:`relative flex justify-center before:absolute before:inset-y-0 before:w-px before:bg-border group-first:before:top-2 group-last:before:bottom-auto group-last:before:h-2 ${e.tone??`text-muted-foreground`}`,children:(0,S.jsx)(`span`,{className:`relative mt-1.5 size-2 rounded-full border-2 border-current bg-popover`})}),(0,S.jsxs)(`span`,{className:`pb-3 wrap-anywhere ${e.tone??``}`,children:[e.step&&(0,S.jsx)(ED,{step:e.step}),e.text,` `,e.ended&&(0,S.jsx)(Eb,{log:e.ended.log,agent:e.ended.agent,kind:`log`})]})]},`${e.at} ${e.text}`))})]},e))})]})}function _D({job:e,act:t}){let n=e.notes.flatMap((t,n)=>t.kind===`assume`&&!e.notes.some(e=>e.kind===`answer`&&e.re===n)?[t]:[]),r=[e.tier&&`tier ${e.tier}${e.escalations?`, moved up ${e.escalations}×`:``}`,e.gates.length>0&&`gates ${e.gates.map(e=>`\`${e}\``).join(`, `)}`,e.touches&&`touches ${e.touches.length?e.touches.join(`, `):`anything`}`,e.needs.length>0&&`needs ${e.needs.join(`, `)}`].filter(Boolean);return r.length===0&&e.unverified.length===0&&n.length===0?null:(0,S.jsxs)(`div`,{className:`flex flex-col gap-2 text-sm`,children:[r.length>0&&(0,S.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r.join(` · `)}),e.unverified.map(n=>(0,S.jsx)(yD,{className:`border-warning/40`,children:(0,S.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsxs)(`span`,{className:`flex-1`,children:[`Not verified: `,n]}),(0,S.jsx)(vf,{size:`sm`,variant:`outline`,onClick:()=>t(()=>rf.verify(e.id,n)),children:`Checked`})]})},n)),n.map(n=>(0,S.jsxs)(yD,{className:`border-warning/40`,children:[(0,S.jsxs)(`span`,{children:[`Assumed `,(0,S.jsx)(`strong`,{children:n.assumed}),`, asked: `,n.text]}),(0,S.jsxs)(`span`,{className:`flex gap-2`,children:[(0,S.jsx)(vf,{size:`sm`,onClick:()=>t(()=>rf.answer(e.id,`fine`)),children:`Fine`}),(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`or answer below to queue a change`})]}),(0,S.jsx)(vD,{job:e,act:t})]},n.at))]})}function vD({job:e,act:t}){let[n,r]=(0,v.useState)(``);return(0,S.jsxs)(`form`,{className:`flex gap-2`,onSubmit:r=>{r.preventDefault(),t(()=>rf.answer(e.id,n))},children:[(0,S.jsx)(Uf,{value:n,onChange:e=>r(e.target.value),placeholder:`Your answer`}),(0,S.jsx)(vf,{type:`submit`,size:`sm`,variant:`outline`,disabled:!n.trim(),children:`Answer`})]})}function yD({className:e,children:t}){return(0,S.jsx)(`div`,{className:`flex flex-col gap-2 rounded-md border bg-popover p-2 text-sm ${e}`,children:t})}function bD({children:e}){return(0,S.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:e})}function xD({item:e,play:t}){return(0,S.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[t&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`span`,{className:`font-medium text-foreground`,children:e.play}),`: `,t,` `]}),sD[e.level]&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`span`,{className:`font-medium text-foreground`,children:e.level}),`: `,sD[e.level],`.`]})]})}var SD=200;function CD(e){if(!e.turns)return``;let t=(e,t)=>`${e} ${t}${e===1?``:`s`}`;return[t(e.turns,`turn`),e.followups?t(e.followups,`follow-up`):``,e.peak?`peak ${Math.round(e.peak/1e3)}k`:``,e.compactions?t(e.compactions,`compaction`):``].filter(Boolean).join(`, `)}function wD(e){return[{at:e.added,job:e,text:`queued${e.agent?` for ${e.agent}`:``}`},...e.attempts.flatMap(t=>[{at:t.start,job:e,text:`${t.agent} started`},{at:t.end,job:e,text:[`${t.preset??t.agent} ${t.outcome}`,t.url?.replace(`https://github.com/`,``),CD(t)].filter(Boolean).join(` · `),tone:t.outcome===`done`?void 0:`text-destructive`,ended:t}]),...e.notes.map(t=>{if(t.kind!==`step`)return{at:t.at,job:e,text:`${Wf[t.kind]}: ${t.text}`,tone:t.kind===`ask`?`text-foreground font-medium`:t.kind===`result`?`text-foreground`:void 0};let n=e.notes.filter(e=>e.kind===`step`&&e.attempt===t.attempt&&e.at<=t.at).length;return{at:t.at,job:e,text:t.text,tone:`text-foreground`,step:t.of?`${t.done??n}/${t.of}`:String(n)}})]}function TD(e){return e.filter(e=>e.state!==`removed`).flatMap(wD).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,SD)}function ED({step:e}){return(0,S.jsx)(`span`,{className:`mr-2 inline-flex min-w-5 justify-center rounded-full bg-primary/15 px-1.5 text-xs font-medium text-primary tabular-nums`,children:e})}var DD=e=>new Date(e).toLocaleDateString([],{weekday:`long`,day:`numeric`,month:`short`});function OD({snapshot:e,act:t}){let n=TD(e.jobs);if(n.length===0)return(0,S.jsx)(Vd,{children:(0,S.jsxs)(Hd,{children:[(0,S.jsx)(Ud,{children:`Nothing happened yet`}),(0,S.jsx)(Wd,{children:`Jobs queued, started and finished show up here, with what their agents said.`})]})});let r=new Map;for(let e of n){let t=DD(e.at);r.set(t,[...r.get(t)??[],e])}return(0,S.jsx)(`div`,{className:`flex flex-col gap-6 pt-2`,children:[...r].map(([n,r])=>(0,S.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,S.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground`,children:n}),(0,S.jsx)(`ol`,{className:`flex flex-col gap-1.5 text-sm`,children:r.map(n=>(0,S.jsxs)(`li`,{className:`grid grid-cols-[4.5rem_1fr] gap-x-3 sm:grid-cols-[4.5rem_16rem_1fr]`,children:[(0,S.jsx)(`time`,{dateTime:n.at,className:`whitespace-nowrap text-muted-foreground tabular-nums`,children:Kd(n.at)}),(0,S.jsx)(mD,{item:n.job.item,job:n.job,snapshot:e,act:t}),(0,S.jsxs)(`span`,{className:`col-start-2 wrap-anywhere sm:col-start-3 ${n.tone??`text-muted-foreground`}`,children:[n.step&&(0,S.jsx)(ED,{step:n.step}),n.text]})]},`${n.at} ${n.job.id} ${n.text}`))})]},n))})}function kD(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var AD=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,jD=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,MD={};function ND(e,t){return((t||MD).jsx?jD:AD).test(e)}var PD=/[ \t\n\f\r]/g;function FD(e){return typeof e==`object`?e.type===`text`&&ID(e.value):ID(e)}function ID(e){return e.replace(PD,``)===``}var LD=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};LD.prototype.normal={},LD.prototype.property={},LD.prototype.space=void 0;function RD(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new LD(n,r,t)}function zD(e){return e.toLowerCase()}var BD=class{constructor(e,t){this.attribute=t,this.property=e}};BD.prototype.attribute=``,BD.prototype.booleanish=!1,BD.prototype.boolean=!1,BD.prototype.commaOrSpaceSeparated=!1,BD.prototype.commaSeparated=!1,BD.prototype.defined=!1,BD.prototype.mustUseProperty=!1,BD.prototype.number=!1,BD.prototype.overloadedBoolean=!1,BD.prototype.property=``,BD.prototype.spaceSeparated=!1,BD.prototype.space=void 0;var VD=s({boolean:()=>UD,booleanish:()=>WD,commaOrSpaceSeparated:()=>JD,commaSeparated:()=>qD,number:()=>$,overloadedBoolean:()=>GD,spaceSeparated:()=>KD}),HD=0,UD=YD(),WD=YD(),GD=YD(),$=YD(),KD=YD(),qD=YD(),JD=YD();function YD(){return 2**++HD}var XD=Object.keys(VD),ZD=class extends BD{constructor(e,t,n,r){let i=-1;if(super(e,t),QD(this,`space`,r),typeof n==`number`)for(;++i<XD.length;){let e=XD[i];QD(this,XD[i],(n&VD[e])===VD[e])}}};ZD.prototype.defined=!0;function QD(e,t,n){n&&(e[t]=n)}function $D(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new ZD(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[zD(r)]=r,n[zD(a.attribute)]=r}return new LD(t,n,e.space)}var eO=$D({properties:{ariaActiveDescendant:null,ariaAtomic:WD,ariaAutoComplete:null,ariaBusy:WD,ariaChecked:WD,ariaColCount:$,ariaColIndex:$,ariaColSpan:$,ariaControls:KD,ariaCurrent:null,ariaDescribedBy:KD,ariaDetails:null,ariaDisabled:WD,ariaDropEffect:KD,ariaErrorMessage:null,ariaExpanded:WD,ariaFlowTo:KD,ariaGrabbed:WD,ariaHasPopup:null,ariaHidden:WD,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:KD,ariaLevel:$,ariaLive:null,ariaModal:WD,ariaMultiLine:WD,ariaMultiSelectable:WD,ariaOrientation:null,ariaOwns:KD,ariaPlaceholder:null,ariaPosInSet:$,ariaPressed:WD,ariaReadOnly:WD,ariaRelevant:null,ariaRequired:WD,ariaRoleDescription:KD,ariaRowCount:$,ariaRowIndex:$,ariaRowSpan:$,ariaSelected:WD,ariaSetSize:$,ariaSort:null,ariaValueMax:$,ariaValueMin:$,ariaValueNow:$,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function tO(e,t){return t in e?e[t]:t}function nO(e,t){return tO(e,t.toLowerCase())}var rO=$D({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:qD,acceptCharset:KD,accessKey:KD,action:null,allow:null,allowFullScreen:UD,allowPaymentRequest:UD,allowUserMedia:UD,alpha:UD,alt:null,as:null,async:UD,autoCapitalize:null,autoComplete:KD,autoFocus:UD,autoPlay:UD,blocking:KD,capture:null,charSet:null,checked:UD,cite:null,className:KD,closedBy:null,colorSpace:null,cols:$,colSpan:$,command:null,commandFor:null,content:null,contentEditable:WD,controls:UD,controlsList:KD,coords:$|qD,crossOrigin:null,data:null,dateTime:null,decoding:null,default:UD,defer:UD,dir:null,dirName:null,disabled:UD,download:GD,draggable:WD,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:UD,formTarget:null,headers:KD,height:$,hidden:GD,high:$,href:null,hrefLang:null,htmlFor:KD,httpEquiv:KD,id:null,imageSizes:null,imageSrcSet:null,inert:UD,inputMode:null,integrity:null,is:null,isMap:UD,itemId:null,itemProp:KD,itemRef:KD,itemScope:UD,itemType:KD,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:UD,low:$,manifest:null,max:null,maxLength:$,media:null,method:null,min:null,minLength:$,multiple:UD,muted:UD,name:null,nonce:null,noModule:UD,noValidate:UD,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:UD,optimum:$,pattern:null,ping:KD,placeholder:null,playsInline:UD,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:UD,referrerPolicy:null,rel:KD,required:UD,reversed:UD,rows:$,rowSpan:$,sandbox:KD,scope:null,scoped:UD,seamless:UD,selected:UD,shadowRootClonable:UD,shadowRootCustomElementRegistry:UD,shadowRootDelegatesFocus:UD,shadowRootMode:null,shadowRootSerializable:UD,shape:null,size:$,sizes:null,slot:null,span:$,spellCheck:WD,src:null,srcDoc:null,srcLang:null,srcSet:null,start:$,step:null,style:null,tabIndex:$,target:null,title:null,translate:null,type:null,typeMustMatch:UD,useMap:null,value:WD,width:$,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:KD,axis:null,background:null,bgColor:null,border:$,borderColor:null,bottomMargin:$,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:UD,declare:UD,event:null,face:null,frame:null,frameBorder:null,hSpace:$,leftMargin:$,link:null,longDesc:null,lowSrc:null,marginHeight:$,marginWidth:$,noResize:UD,noHref:UD,noShade:UD,noWrap:UD,object:null,profile:null,prompt:null,rev:null,rightMargin:$,rules:null,scheme:null,scrolling:WD,standby:null,summary:null,text:null,topMargin:$,valueType:null,version:null,vAlign:null,vLink:null,vSpace:$,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:UD,disablePictureInPicture:UD,disableRemotePlayback:UD,exportParts:qD,part:KD,prefix:null,property:null,results:$,security:null,unselectable:null},space:`html`,transform:nO}),iO=$D({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:JD,accentHeight:$,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:$,amplitude:$,arabicForm:null,ascent:$,attributeName:null,attributeType:null,azimuth:$,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:$,by:null,calcMode:null,capHeight:$,className:KD,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:$,diffuseConstant:$,direction:null,display:null,dur:null,divisor:$,dominantBaseline:null,download:UD,dx:null,dy:null,edgeMode:null,editable:null,elevation:$,enableBackground:null,end:null,event:null,exponent:$,externalResourcesRequired:null,fill:null,fillOpacity:$,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:qD,g2:qD,glyphName:qD,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:$,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:$,horizOriginX:$,horizOriginY:$,id:null,ideographic:$,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:$,k:$,k1:$,k2:$,k3:$,k4:$,kernelMatrix:JD,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:$,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:$,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:$,overlineThickness:$,paintOrder:null,panose1:null,path:null,pathLength:$,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:KD,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:$,pointsAtY:$,pointsAtZ:$,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:JD,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:JD,rev:JD,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:JD,requiredFeatures:JD,requiredFonts:JD,requiredFormats:JD,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:$,specularExponent:$,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:$,strikethroughThickness:$,string:null,stroke:null,strokeDashArray:JD,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:$,strokeOpacity:$,strokeWidth:null,style:null,surfaceScale:$,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:JD,tabIndex:$,tableValues:null,target:null,targetX:$,targetY:$,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:JD,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:$,underlineThickness:$,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:$,values:null,vAlphabetic:$,vMathematical:$,vectorEffect:null,vHanging:$,vIdeographic:$,version:null,vertAdvY:$,vertOriginX:$,vertOriginY:$,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:$,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:tO}),aO=$D({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),oO=$D({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:nO}),sO=$D({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),cO={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},lO=/[A-Z]/g,uO=/-[a-z]/g,dO=/^data[-\w.:]+$/i;function fO(e,t){let n=zD(t),r=t,i=BD;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&dO.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(uO,mO);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!uO.test(e)){let n=e.replace(lO,pO);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=ZD}return new i(r,t)}function pO(e){return`-`+e.toLowerCase()}function mO(e){return e.charAt(1).toUpperCase()}var hO=RD([eO,rO,aO,oO,sO],`html`),gO=RD([eO,iO,aO,oO,sO],`svg`);function _O(e){return e.join(` `).trim()}var vO=/\/\*(?:[^*]|\*(?!\/))*\*\//g,yO=/\n/g,bO=/^\s*/,xO=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,SO=/^:\s*/,CO=/^((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|url\((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|[^)]*)\)|[^};])+)/,wO=/^[;\s]*/,TO=`
63
+ `,EO=`/`,DO=`*`,OO=``,kO=`comment`,AO=`declaration`;function jO(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var n=1,r=1;function i(e){var t=e.match(yO);t&&(n+=t.length);var i=e.lastIndexOf(TO);r=~i?e.length-i:r+e.length}function a(){var e={line:n,column:r};return function(t){return t.position=new o(e),l(),t}}function o(e){this.start=e,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function s(i){var a=Error(t.source+`:`+n+`:`+r+`: `+i);if(a.reason=i,a.filename=t.source,a.line=n,a.column=r,a.source=e,!t.silent)throw a}function c(t){var n=t.exec(e);if(n){var r=n[0];return i(r),e=e.slice(r.length),n}}function l(){c(bO)}function u(e){for(var t;t=d();)e.push(t);return e}function d(){var t=a();if(EO==e.charAt(0)&&DO==e.charAt(1)){for(var n=2;OO!=e.charAt(n)&&(DO!=e.charAt(n)||EO!=e.charAt(n+1));)++n;if(n+=2,OO===e.charAt(n-1))return s(`End of comment missing`);var o=e.slice(2,n-2);return r+=2,i(o),e=e.slice(n),r+=2,t({type:kO,comment:o})}}function f(){var e=a(),t=c(xO);if(t){if(d(),!c(SO))return s(`property missing ':'`);var n=c(CO),r=e({type:AO,property:t[0].replace(vO,OO).trim(),value:n?n[0].replace(vO,OO).trim():OO});return c(wO),r}}function p(){var e=[];u(e);for(var t;t=f();)e.push(t),u(e);return e}return l(),p()}function MO(e,t){let n=null;if(!e||typeof e!=`string`)return n;let r=jO(e),i=typeof t==`function`;return r.forEach(e=>{if(e.type!==`declaration`)return;let{property:r,value:a}=e;i?t(r,a,e):a&&(n??={},n[r]=a)}),n}var NO=FO(`end`),PO=FO(`start`);function FO(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function IO(e){let t=PO(e),n=NO(e);if(t&&n)return{start:t,end:n}}function LO(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?zO(e.position):`start`in e||`end`in e?zO(e):`line`in e||`column`in e?RO(e):``}function RO(e){return BO(e&&e.line)+`:`+BO(e&&e.column)}function zO(e){return RO(e&&e.start)+`-`+RO(e&&e.end)}function BO(e){return e&&typeof e==`number`?e:1}var VO=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=LO(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};Object.defineProperties(VO.prototype,{file:{configurable:!0,enumerable:!0,value:``,writable:!0},name:{configurable:!0,enumerable:!0,value:``,writable:!0},reason:{configurable:!0,enumerable:!0,value:``,writable:!0},message:{configurable:!0,enumerable:!0,value:``,writable:!0},stack:{configurable:!0,enumerable:!0,value:``,writable:!0},column:{configurable:!0,enumerable:!0,writable:!0},line:{configurable:!0,enumerable:!0,writable:!0},ancestors:{configurable:!0,enumerable:!0,writable:!0},cause:{configurable:!0,enumerable:!0,writable:!0},fatal:{configurable:!0,enumerable:!0,writable:!0},place:{configurable:!0,enumerable:!0,writable:!0},ruleId:{configurable:!0,enumerable:!0,writable:!0},source:{configurable:!0,enumerable:!0,writable:!0}});var HO={}.hasOwnProperty,UO=new Map,WO=/[A-Z]/g,GO=/-([a-z])/g,KO=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),qO=new Set([`td`,`th`]),JO=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function YO(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=ok(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=ak(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?gO:hO,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=XO(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function XO(e,t,n){if(t.type===`element`)return ZO(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return QO(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return ek(e,t,n);if(t.type===`mdxjsEsm`)return $O(e,t);if(t.type===`root`)return tk(e,t,n);if(t.type===`text`)return nk(e,t)}function ZO(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=gO,e.schema=i),e.ancestors.push(t);let a=fk(e,t.tagName,!1),o=sk(e,t),s=lk(e,t);return KO.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!FD(e)})),rk(e,o,a,t),ik(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function QO(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}pk(e,t.position)}function $O(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);pk(e,t.position)}function ek(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=gO,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:fk(e,t.name,!0),o=ck(e,t),s=lk(e,t);return rk(e,o,a,t),ik(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function tk(e,t,n){let r={};return ik(r,lk(e,t)),e.create(t,e.Fragment,r,n)}function nk(e,t){return t.value}function rk(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function ik(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function ak(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function ok(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=PO(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function sk(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&HO.call(t.properties,i)){let a=uk(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&qO.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function ck(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`){if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else pk(e,t.position)}else{let{name:i}=r,a;if(r.value&&typeof r.value==`object`){if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else pk(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function lk(e,t){let n=[],r=-1,i=e.passKeys?new Map:UO;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=XO(e,a,o);s!==void 0&&n.push(s)}return n}function uk(e,t,n){if(n==null||typeof n==`number`&&Number.isNaN(n))return;let r=fO(e.schema,t);return Array.isArray(n)&&(n=r.commaSeparated?kD(n):_O(n)),r.property===`style`?[`style`,typeof n==`object`?e.stylePropertyNameCase===`dom`?n:mk(n):dk(e,String(n))]:[e.elementAttributeNameCase===`react`&&r.space?cO[r.property]||r.property:r.attribute,n]}function dk(e,t){let n={};try{MO(t,function(t,r){if(t&&r){let i=t;i.slice(0,2)!==`--`&&(i=i.toLowerCase(),e.stylePropertyNameCase===`dom`&&(i.slice(0,4)===`-ms-`&&(i=i.slice(1)),i=i.replace(GO,_k))),n[i]=r}})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new VO("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=JO+`#cannot-parse-style-attribute`,r}return n}function fk(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=ND(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=ND(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return HO.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);pk(e)}function pk(e,t){let n=new VO("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=JO+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function mk(e){let t={},n;for(n in e)HO.call(e,n)&&(t[hk(n)]=e[n]);return t}function hk(e){if(e.slice(0,2)===`--`)return e;let t=e.replace(WO,gk);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function gk(e){return`-`+e.toLowerCase()}function _k(e,t){return t.toUpperCase()}var vk={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},yk={};function bk(e,t){let n=t||yk;return xk(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function xk(e,t,n){if(Ck(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return Sk(e.children,t,n)}return Array.isArray(e)?Sk(e,t,n):``}function Sk(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=xk(e[i],t,n);return r.join(``)}function Ck(e){return!!(e&&typeof e==`object`)}var wk=document.createElement(`i`);function Tk(e){let t=`&`+e+`;`;wk.innerHTML=t;let n=wk.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`?!1:n!==t&&n}function Ek(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function Dk(e,t){return e.length>0?(Ek(e,e.length,0,t),e):t}var Ok={}.hasOwnProperty;function kk(e){let t={},n=-1;for(;++n<e.length;)Ak(t,e[n]);return t}function Ak(e,t){let n;for(n in t){let r=(Ok.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){Ok.call(r,a)||(r[a]=[]);let e=i[a];jk(r[a],Array.isArray(e)?e:e?[e]:[])}}}function jk(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);Ek(e,0,0,r)}function Mk(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function Nk(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var Pk=Kk(/[A-Za-z]/),Fk=Kk(/[\dA-Za-z]/),Ik=Kk(/[#-'*+\--9=?A-Z^-~]/);function Lk(e){return e!==null&&(e<32||e===127)}var Rk=Kk(/\d/),zk=Kk(/[\dA-Fa-f]/),Bk=Kk(/[!-/:-@[-`{-~]/);function Vk(e){return e!==null&&e<-2}function Hk(e){return e!==null&&(e<0||e===32)}function Uk(e){return e===-2||e===-1||e===32}var Wk=Kk(/\p{P}|\p{S}/u),Gk=Kk(/\s/);function Kk(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function qk(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&Fk(e.charCodeAt(n+1))&&Fk(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function Jk(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Uk(r)?(e.enter(n),s(r)):t(r)}function s(r){return Uk(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}function Yk(e,t,n,r,i,a){let o=0;return s;function s(t){return a>0&&Uk(t)?(e.enter(r),c(t)):l(t)}function c(t){return Uk(t)&&o<a?(e.consume(t),o++,c):(e.exit(r),l(t))}function l(e){return o>=i?t(e):n(e)}}var Xk={tokenize:Zk};function Zk(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null)e.consume(n);else return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Jk(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null)e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);else return Vk(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Qk=class{constructor(){this.index=new Map,this.map=[]}add(e,t,n){$k(this,e,t,n,!1)}addBefore(e,t,n){$k(this,e,t,n,!0)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0,this.index.clear()}};function $k(e,t,n,r,i){if(n===0&&r.length===0)return;let a=e.index.get(t);if(a){a[1]+=n,i?(r.push(...a[2]),a[2]=r):a[2].push(...r);return}let o=[t,n,r];e.map.push(o),e.index.set(t,o)}var eA={tokenize:nA},tA={tokenize:rA};function nA(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;let c=new Qk;return c.add(a+1,0,t.events.slice(n)),c.add(n,s-n,[]),c.consume(t.events),l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!(!i.currentConstruct||i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(tA,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(tA,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null)i&&v(),_(0),e.consume(n);else return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null)g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);else return Vk(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;let l=new Qk;l.add(a+1,0,t.events.slice(n)),l.add(n,e-n,[]),l.consume(t.events)}}function _(r){let i=n.length;for(;i-->r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function rA(e,t,n){return Jk(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function iA(e){if(e===null||Hk(e)||Gk(e))return 1;if(Wk(e))return 2}function aA(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var oA={name:`attention`,resolveAll:sA,tokenize:cA};function sA(e,t){let n=-1,r;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){let i=n;for(;i--;)if(e[i][0]===`exit`&&e[i][1].type===`attentionSequence`&&e[i][1]._open&&t.sliceSerialize(e[i][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[i][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;let a=e[i][1].end.offset-e[i][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1,o={...e[i][1].end},s={...e[n][1].start};lA(o,-a),lA(s,a);let c={type:a>1?`strongSequence`:`emphasisSequence`,start:o,end:{...e[i][1].end}},l={type:a>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:s},u={type:a>1?`strongText`:`emphasisText`,start:{...e[i][1].end},end:{...e[n][1].start}},d={type:a>1?`strong`:`emphasis`,start:{...c.start},end:{...l.end}};e[i][1].end={...c.start},e[n][1].start={...l.end},r=[],e[i][1].end.offset-e[i][1].start.offset&&(r=Dk(r,[[`enter`,e[i][1],t],[`exit`,e[i][1],t]])),r=Dk(r,[[`enter`,d,t],[`enter`,c,t],[`exit`,c,t],[`enter`,u,t]]),r=Dk(r,aA(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),r=Dk(r,[[`exit`,u,t],[`enter`,l,t],[`exit`,l,t],[`exit`,d,t]]);let f=0;e[n][1].end.offset-e[n][1].start.offset&&(f=2,r=Dk(r,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])),Ek(e,i-1,n-i+3,r),n=i+r.length-f-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function cA(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=iA(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=iA(o),u=!l||l===2&&i||n.includes(o)&&o!==42&&o!==95,d=!i||i===2&&l||n.includes(r)&&r!==42&&r!==95;return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function lA(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var uA={name:`autolink`,tokenize:dA};function dA(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return Pk(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||Fk(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||Fk(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||Lk(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):Ik(t)?(e.consume(t),l):n(t)}function u(e){return Fk(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||Fk(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var fA={partial:!0,tokenize:pA};function pA(e,t,n){return r;function r(t){return Uk(t)?Jk(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||Vk(e)?t(e):n(e)}}var mA={continuation:{tokenize:gA},exit:_A,name:`blockQuote`,tokenize:hA};function hA(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return Uk(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function gA(e,t,n){let r=this;return i;function i(t){return Uk(t)?Jk(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(mA,t,n)(r)}}function _A(e){e.exit(`blockQuote`)}var vA={name:`characterEscape`,tokenize:yA};function yA(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return Bk(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var bA={name:`characterReference`,tokenize:xA};function xA(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=Fk,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=zk,u):(e.enter(`characterReferenceValue`),a=7,o=Rk,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===Fk&&!Tk(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var SA={partial:!0,tokenize:CA};function CA(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var wA={concrete:!0,name:`codeFenced`,tokenize:TA};function TA(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),Uk(t)?Jk(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||Vk(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(SA,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||Vk(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):Uk(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),Jk(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||Vk(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||Vk(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&Uk(t)?Jk(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||Vk(t)?e.check(SA,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||Vk(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Uk(t)?Jk(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Uk(t)?Jk(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||Vk(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}var EA={name:`codeIndented`,tokenize:OA},DA={partial:!0,tokenize:kA};function OA(e,t,n){return r;function r(t){return e.enter(`codeIndented`),Yk(e,i,n,`linePrefix`,4,4)(t)}function i(t){return t===null?o(t):Vk(t)?e.attempt(DA,i,o)(t):(e.enter(`codeFlowValue`),a(t))}function a(t){return t===null||Vk(t)?(e.exit(`codeFlowValue`),i(t)):(e.consume(t),a)}function o(n){return e.exit(`codeIndented`),t(n)}}function kA(e,t,n){let r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):Vk(o)?(e.enter(`lineEnding`),e.consume(o),e.exit(`lineEnding`),i):Yk(e,t,a,`linePrefix`,4,4)(o)}function a(e){return Vk(e)?i(e):n(e)}}var AA={name:`codeText`,previous:MA,resolve:jA,tokenize:NA};function jA(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function MA(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function NA(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):Vk(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||Vk(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var PA=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&FA(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),FA(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),FA(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0)){if(e<this.left.length){let t=this.left.splice(e,1/0);FA(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);FA(this.left,t.reverse())}}}};function FA(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function IA(e){let t={},n=-1,r,i,a,o,s,c,l,u=new PA(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,LA(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(o[1].type!==`linePrefix`&&o[1].type!==`listItemIndent`)break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return Ek(e,0,1/0,u.slice(0)),!l}function LA(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var RA={resolve:BA,tokenize:VA},zA={partial:!0,tokenize:HA};function BA(e){return IA(e),e}function VA(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):Vk(t)?e.check(zA,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function HA(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Jk(e,a,`linePrefix`)}function a(i){if(i===null||Vk(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function UA(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||Lk(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||Vk(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||Hk(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||Lk(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function WA(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):Vk(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||Vk(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Uk(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function GA(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):Vk(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Jk(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||Vk(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function KA(e,t){let n;return r;function r(i){return Vk(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Uk(i)?Jk(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var qA={name:`definition`,tokenize:YA},JA={partial:!0,tokenize:XA};function YA(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return WA.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=Nk(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return Hk(t)?KA(e,l)(t):l(t)}function l(t){return UA(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(JA,d,d)(t)}function d(t){return Uk(t)?Jk(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||Vk(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function XA(e,t,n){return r;function r(t){return Hk(t)?KA(e,i)(t):n(t)}function i(t){return GA(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Uk(t)?Jk(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||Vk(e)?t(e):n(e)}}var ZA={name:`hardBreakEscape`,tokenize:QA};function QA(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return Vk(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var $A={name:`headingAtx`,resolve:ej,tokenize:tj};function ej(e,t){let n=e.length-2,r=3;if(e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r){let i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`};Ek(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])}return e}function tj(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||Hk(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||Vk(n)?(e.exit(`atxHeading`),t(n)):Uk(n)?Jk(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||Hk(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var nj=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),rj=[`pre`,`script`,`style`,`textarea`],ij={concrete:!0,name:`htmlFlow`,resolveTo:oj,tokenize:sj},aj={partial:!0,tokenize:cj};function oj(e){let t=e.length;for(;t--&&(e[t][0]!==`enter`||e[t][1].type!==`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function sj(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:I):Pk(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):Pk(a)?(e.consume(a),i=4,r.interrupt?t:I):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:I):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return Pk(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||Hk(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&rj.includes(l)?(i=1,r.interrupt?t(s):O(s)):nj.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||Fk(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return Uk(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||Pk(t)?(e.consume(t),b):Uk(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||Fk(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Uk(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Uk(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||Vk(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||Hk(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Uk(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||Vk(t)?O(t):Uk(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),N):t===62&&i===4?(e.consume(t),L):t===63&&i===3?(e.consume(t),I):t===93&&i===5?(e.consume(t),F):Vk(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(aj,R,k)(t)):t===null||Vk(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(SA,A,R)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||Vk(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),I):O(t)}function N(t){return t===47?(e.consume(t),o=``,P):O(t)}function P(t){if(t===62){let n=o.toLowerCase();return rj.includes(n)?(e.consume(t),L):O(t)}return Pk(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),P):O(t)}function F(t){return t===93?(e.consume(t),I):O(t)}function I(t){return t===62?(e.consume(t),L):t===45&&i===2?(e.consume(t),I):O(t)}function L(t){return t===null||Vk(t)?(e.exit(`htmlFlowData`),R(t)):(e.consume(t),L)}function R(n){return e.exit(`htmlFlow`),t(n)}}function cj(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(fA,t,n)}}var lj={name:`htmlText`,tokenize:uj};function uj(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):Pk(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):Pk(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):Vk(t)?(o=d,N(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):Vk(t)?(o=h,N(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):Vk(t)?(o=v,N(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):Vk(t)?(o=y,N(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return Pk(t)?(e.consume(t),S):n(t)}function S(t){return t===45||Fk(t)?(e.consume(t),S):C(t)}function C(t){return Vk(t)?(o=C,N(t)):Uk(t)?(e.consume(t),C):M(t)}function w(t){return t===45||Fk(t)?(e.consume(t),w):t===47||t===62||Hk(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||Pk(t)?(e.consume(t),E):Vk(t)?(o=T,N(t)):Uk(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||Fk(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):Vk(t)?(o=D,N(t)):Uk(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):Vk(t)?(o=O,N(t)):Uk(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):Vk(t)?(o=k,N(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||Hk(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||Hk(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function N(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),P}function P(t){return Uk(t)?Jk(e,F,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):F(t)}function F(t){return e.enter(`htmlTextData`),o(t)}}var dj={name:`labelEnd`,resolveAll:hj,resolveTo:gj,tokenize:_j},fj={tokenize:vj},pj={tokenize:yj},mj={tokenize:bj};function hj(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&Ek(e,0,e.length,n),e}function gj(e,t){let n=e.length,r=0,i,a,o;for(;n--;){let t=e[n][1];if(i){if(t.type===`link`||t.type===`labelLink`&&t._inactive)break;e[n][0]===`enter`&&t.type===`labelLink`&&(t._inactive=!0)}else if(a){if(e[n][0]===`enter`&&(t.type===`labelImage`||t.type===`labelLink`)&&!t._balanced&&(i=n,t.type!==`labelLink`)){r=2;break}}else t.type===`labelEnd`&&(a=n)}let s={type:e[i][1].type===`labelLink`?`link`:`image`,start:{...e[i][1].start},end:{...e[e.length-1][1].end}},c={type:`label`,start:{...e[i][1].start},end:{...e[a][1].end}},l={type:`labelText`,start:{...e[i+r+2][1].end},end:{...e[a-2][1].start}};return o=[[`enter`,s,t],[`enter`,c,t]],o=Dk(o,e.slice(i+1,i+r+3)),o=Dk(o,[[`enter`,l,t]]),o=Dk(o,aA(t.parser.constructs.insideSpan.null,e.slice(i+r+4,a-3),t)),o=Dk(o,[[`exit`,l,t],e[a-2],e[a-1],[`exit`,c,t]]),o=Dk(o,e.slice(a+1)),o=Dk(o,[[`exit`,s,t]]),Ek(e,i,e.length,o),e}function _j(e,t,n){let r=this,i=r._labelStarts,a,o;if(i){for(;i.length>0&&i[i.length-1]._balanced;)i.pop();a=i[i.length-1]}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(Nk(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(fj,u,o?u:d)(t):t===91?e.attempt(pj,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(mj,u,d)(t)}function u(e){return i.pop(),t(e)}function d(e){return a._balanced=!0,n(e)}}function vj(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return Hk(t)?KA(e,a)(t):a(t)}function a(t){return t===41?u(t):UA(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return Hk(t)?KA(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?GA(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return Hk(t)?KA(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function yj(e,t,n){let r=this;return i;function i(t){return WA.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(Nk(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function bj(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var xj={name:`labelStartImage`,resolveAll:dj.resolveAll,tokenize:Sj};function Sj(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),o}function o(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelImage`),s):n(t)}function s(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var Cj={name:`labelStartLink`,resolveAll:dj.resolveAll,tokenize:wj};function wj(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelLink`),o}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var Tj={name:`lineEnding`,tokenize:Ej};function Ej(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Jk(e,t,`linePrefix`)}}var Dj={name:`thematicBreak`,tokenize:Oj};function Oj(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||Vk(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Uk(t)?Jk(e,s,`whitespace`)(t):s(t))}}var kj={continuation:{tokenize:Nj},exit:Fj,name:`list`,tokenize:Mj},Aj={partial:!0,tokenize:Ij},jj={partial:!0,tokenize:Pj};function Mj(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:Rk(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(Dj,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return Rk(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(fA,r.interrupt?n:u,e.attempt(Aj,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Uk(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function Nj(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(fA,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Jk(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Uk(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(jj,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,Jk(e,e.attempt(kj,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function Pj(e,t,n){let r=this;return Jk(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function Fj(e){e.exit(this.containerState.type)}function Ij(e,t,n){let r=this;return Jk(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Uk(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var Lj={name:`setextUnderline`,resolveTo:Rj,tokenize:zj};function Rj(e,t){let n=new Qk,r=e.length,i,a,o;for(;r--;)if(e[r][0]===`enter`){if(e[r][1].type===`content`){i=r;break}e[r][1].type===`paragraph`&&(a=r)}else e[r][1].type===`content`&&n.add(r,1,[]),!o&&e[r][1].type===`definition`&&(o=r);let s={type:`setextHeading`,start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type=`setextHeadingText`,o?(n.add(a,0,[[`enter`,s,t]]),n.add(o+1,0,[[`exit`,e[i][1],t]]),e[i][1].end={...e[o][1].end}):e[i][1]=s,n.add(e.length,0,[[`exit`,s,t]]),n.consume(e),e}function zj(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Uk(t)?Jk(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||Vk(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var Bj={tokenize:Vj};function Vj(e){let t=this,n=e.attempt(fA,r,e.attempt(this.parser.constructs.flowInitial,i,Jk(e,e.attempt(this.parser.constructs.flow,i,e.attempt(RA,i)),`linePrefix`)));return n;function r(r){if(r===null)e.consume(r);else return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null)e.consume(r);else return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var Hj={resolveAll:Kj()},Uj=Gj(`string`),Wj=Gj(`text`);function Gj(e){return{resolveAll:Kj(e===`text`?qj:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null)t.consume(e);else return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function Kj(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function qj(e,t){let n=new Qk,r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type===`lineEnding`)&&e[r-1][1].type===`data`){let i=e[r-1][1],a=t.sliceStream(i),o=a.length,s=-1,c=0,l;for(;o--;){let e=a[o];if(typeof e==`string`){for(s=e.length;e.charCodeAt(s-1)===32;)c++,s--;if(s)break;s=-1}else if(e===-2)l=!0,c++;else if(e!==-1){o++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(c=0),c){let a={type:r===e.length||l||c<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:o?s:i.start._bufferIndex+s,_index:i.start._index+o,line:i.end.line,column:i.end.column-c,offset:i.end.offset-c},end:{...i.end}};i.end={...a.start},i.start.offset===i.end.offset?Object.assign(i,a):n.add(r,0,[[`enter`,a,t],[`exit`,a,t]])}r++}return n.consume(e),e}var Jj=s({attentionMarkers:()=>nM,contentInitial:()=>Xj,disable:()=>rM,document:()=>Yj,flow:()=>Qj,flowInitial:()=>Zj,insideSpan:()=>tM,string:()=>$j,text:()=>eM}),Yj={42:kj,43:kj,45:kj,48:kj,49:kj,50:kj,51:kj,52:kj,53:kj,54:kj,55:kj,56:kj,57:kj,62:mA},Xj={91:qA},Zj={[-2]:EA,[-1]:EA,32:EA},Qj={35:$A,42:Dj,45:[Lj,Dj],60:ij,61:Lj,95:Dj,96:wA,126:wA},$j={38:bA,92:vA},eM={[-5]:Tj,[-4]:Tj,[-3]:Tj,33:xj,38:bA,42:oA,60:[uA,lj],91:Cj,92:[ZA,vA],93:dj,95:oA,96:AA},tM={null:[oA,Hj]},nM={null:[42,95]},rM={null:[]};function iM(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=Dk(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=aA(a,l.events,l),l.events):[]}function f(e,t){return oM(p(e),t)}function p(e){return aM(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){for(;r._index<o.length;){let e=o[r._index];if(typeof e==`string`){let t=r._index;for(r._bufferIndex<0&&(r._bufferIndex=0);r._index===t&&r._bufferIndex<e.length;)_(e.charCodeAt(r._bufferIndex))}else _(e)}}function _(e){u=u(e)}function v(e){Vk(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&Ek(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function aM(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function oM(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
64
64
  `;break;case-3:o=`\r
65
- `;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function aM(e){let t={constructs:Dk([Kj,...(e||{}).extensions||[]]),content:n(Jk),defined:[],document:n(Qk),flow:n(Rj),lazy:{},string:n(Vj),text:n(Hj)};return t;function n(e){return n;function n(n){return nM(t,e,n)}}}function oM(e){for(;!PA(e););return e}var sM=/[\0\t\n\r]/g;function cM(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i));let s=[],c=0;for(t=``,n&&=(i.charCodeAt(0)===65279&&c++,void 0);c<i.length;){sM.lastIndex=c;let n=sM.exec(i),a=n&&n.index!==void 0?n.index:i.length,o=i.charCodeAt(a);if(!n){t=i.slice(c);break}if(o===10&&c===a&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),c<a&&(s.push(i.slice(c,a)),e+=a-c),o){case 0:s.push(65533),e++;break;case 9:{let t=Math.ceil(e/4)*4;for(s.push(-2);e++<t;)s.push(-1);break}case 10:s.push(-4),e=1;break;default:r=!0,e=1}c=a+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var lM=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function uM(e){return e.replace(lM,dM)}function dM(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return Ak(n.slice(t?2:1),t?16:10)}return Ck(n)||e}var fM={}.hasOwnProperty;function pM(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),mM(n)(oM(aM(n).document().write(cM()(e,t,!0))))}function mM(e){let t={afterExit:[],beforeEnter:[],transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:o(se),autolinkProtocol:E,autolinkEmail:E,atxHeading:o(K),blockQuote:o(W),characterEscape:E,characterReference:E,codeFenced:o(re),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:o(re,s),codeText:o(ie,s),codeTextData:E,data:E,codeFlowValue:E,definition:o(ae),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:o(G),hardBreakEscape:o(q),hardBreakTrailing:o(q),htmlFlow:o(oe,s),htmlFlowData:E,htmlText:o(oe,s),htmlTextData:E,image:o(J),label:s,link:o(se),listItem:o(le),listItemValue:p,listOrdered:o(ce,f),listUnordered:o(ce),paragraph:o(ue),reference:B,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:o(K),strong:o(de),thematicBreak:o(pe)},exit:{atxHeading:l(),atxHeadingSequence:S,autolink:l(),autolinkEmail:ne,autolinkProtocol:te,blockQuote:l(),characterEscapeValue:D,characterReferenceMarkerHexadecimal:H,characterReferenceMarkerNumeric:H,characterReferenceValue:U,characterReference:ee,codeFenced:l(_),codeFencedFence:g,codeFencedFenceInfo:m,codeFencedFenceMeta:h,codeFlowValue:D,codeIndented:l(v),codeText:l(M),codeTextData:D,data:D,definition:l(),definitionDestinationString:x,definitionLabelString:y,definitionTitleString:b,emphasis:l(),hardBreakEscape:l(k),hardBreakTrailing:l(k),htmlFlow:l(A),htmlFlowData:D,htmlText:l(j),htmlTextData:D,image:l(P),label:I,labelText:F,lineEnding:O,link:l(N),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:V,resourceDestinationString:L,resourceTitleString:R,resource:z,setextHeading:l(T),setextHeadingLineSequence:w,setextHeadingText:C,strong:l(),thematicBreak:l()}};gM(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[],position:void 0},o={stack:[r],tokenStack:[],config:t,enter:c,exit:u,buffer:s,resume:d,data:n},l=[],f=[],p=-1;for(;++p<e.length;)f.push(e[p]),(e[p][1].type===`listOrdered`||e[p][1].type===`listUnordered`)&&(e[p][0]===`enter`?l.push(f.length-1):a(f,l.pop()));for(e=f,p=-1;++p<e.length;){let n=t[e[p][0]];e[p][0]===`enter`&&t.beforeEnter.length>0&&i(t.beforeEnter,{...o,sliceSerialize:e[p][2].sliceSerialize},e[p][1]),fM.call(n,e[p][1].type)&&n[e[p][1].type].call({...o,sliceSerialize:e[p][2].sliceSerialize},e[p][1]),e[p][0]===`exit`&&t.afterExit.length>0&&i(t.afterExit,{...o,sliceSerialize:e[p][2].sliceSerialize},e[p][1])}if(o.tokenStack.length>0){let e=o.tokenStack[o.tokenStack.length-1];(e[1]||vM).call(o,void 0,e[0])}for(r.position={start:hM(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:hM(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},p=-1;++p<t.transforms.length;)r=t.transforms[p](r)||r;return r}function i(e,t,n){let r=-1;for(;++r<e.length;)e[r].call(t,n)}function a(e,t){let n=e.length-1,r=t-1,i=-1,a=!1,o,s,c,l,u=[];for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let n=r;for(s=void 0;n--;){let t=e[n];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=n}else if(t[1].type!==`linePrefix`&&t[1].type!==`blockQuotePrefix`&&t[1].type!==`blockQuotePrefixWhitespace`&&t[1].type!==`blockQuoteMarker`&&t[1].type!==`listItemIndent`)break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),u.push({at:s||r,event:[`exit`,o,t[2]]})}if(t[1].type===`listItemPrefix`){let e={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=e,u.push({at:r,event:[`enter`,e,t[2]]}),c=void 0,l=!0}}}let d=e.splice(t),f=0;for(r=-1;++r<d.length;){for(;f<u.length&&u[f].at===t+r;)e.push(u[f++].event);e.push(d[r])}e[t][1]._spread=a}function o(e,t){return n;function n(n){c.call(this,e(n),n),t&&t.call(this,n)}}function s(){this.stack.push({type:`fragment`,children:[]})}function c(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:hM(t.start),end:void 0}}function l(e){return t;function t(t){e&&e.call(this,t),u.call(this,t)}}function u(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(!r)throw Error("Cannot close `"+e.type+"` ("+FO({start:e.start,end:e.end})+`): it’s not open`);r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||vM).call(this,e,r[0])),n.position.end=hM(e.end)}function d(){return vk(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function p(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function h(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function v(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function y(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=jk(this.sliceSerialize(e)).toLowerCase()}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function x(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function S(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function C(){this.data.setextHeadingSlurpLineEnding=!0}function w(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function E(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=fe(),n.position={start:hM(e.start),end:void 0},t.push(n)),this.stack.push(n)}function D(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=hM(e.end)}function O(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=hM(e.end),this.data.atHardBreak=void 0}else!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(E.call(this,e),D.call(this,e))}function k(){this.data.atHardBreak=!0}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function M(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function N(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function P(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function F(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=uM(t),n.identifier=jk(t).toLowerCase()}function I(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function L(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function R(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function z(){this.data.inReference=void 0}function B(){this.data.referenceType=`collapsed`}function V(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=jk(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function H(e){this.data.characterReferenceType=e.type}function U(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=Ak(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=Ck(t);let i=this.stack[this.stack.length-1];i.value+=r}function ee(e){let t=this.stack.pop();t.position.end=hM(e.end)}function te(e){D.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function ne(e){D.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function W(){return{type:`blockquote`,children:[],position:void 0}}function re(){return{type:`code`,lang:null,meta:null,value:``,position:void 0}}function ie(){return{type:`inlineCode`,value:``,position:void 0}}function ae(){return{type:`definition`,identifier:``,label:null,title:null,url:``,position:void 0}}function G(){return{type:`emphasis`,children:[],position:void 0}}function K(){return{type:`heading`,depth:0,children:[],position:void 0}}function q(){return{type:`break`,position:void 0}}function oe(){return{type:`html`,value:``,position:void 0}}function J(){return{type:`image`,title:null,url:``,alt:null,position:void 0}}function se(){return{type:`link`,title:null,url:``,children:[],position:void 0}}function ce(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[],position:void 0}}function le(e){return{type:`listItem`,spread:e._spread,checked:null,children:[],position:void 0}}function ue(){return{type:`paragraph`,children:[],position:void 0}}function de(){return{type:`strong`,children:[],position:void 0}}function fe(){return{type:`text`,value:``,position:void 0}}function pe(){return{type:`thematicBreak`,position:void 0}}}function hM(e){return{line:e.line,column:e.column,offset:e.offset}}function gM(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?gM(e,r):_M(e,r)}}function _M(e,t){let n;for(n in t)if(fM.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`afterExit`:case`beforeEnter`:{let r=t[n];r&&e[n].push(r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function vM(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+FO({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+FO({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+FO({start:t.start,end:t.end})+`) is still open`)}function yM(e){let t=this;t.parser=n;function n(n){return pM(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function bM(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function xM(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
66
- `}]}function SM(e,t){let n=t.value?t.value+`
67
- `:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function CM(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function wM(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function TM(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=Gk(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function EM(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function DM(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function OM(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function kM(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return OM(e,t);let i={src:Gk(r.url||``)};t.alt!==null&&t.alt!==void 0&&(i.alt=t.alt),r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function AM(e,t){let n={src:Gk(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function jM(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function MM(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return OM(e,t);let i={href:Gk(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function NM(e,t){let n={href:Gk(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function PM(e,t,n){let r=e.all(t),i=n?FM(n):IM(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
65
+ `;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function sM(e){let t={constructs:kk([Jj,...(e||{}).extensions||[]]),content:n(Xk),defined:[],document:n(eA),flow:n(Bj),lazy:{},string:n(Uj),text:n(Wj)};return t;function n(e){return n;function n(n){return iM(t,e,n)}}}function cM(e){for(;!IA(e););return e}var lM=/[\0\t\n\r]/g;function uM(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i));let s=[],c=0;for(t=``,n&&=(i.charCodeAt(0)===65279&&c++,void 0);c<i.length;){lM.lastIndex=c;let n=lM.exec(i),a=n&&n.index!==void 0?n.index:i.length,o=i.charCodeAt(a);if(!n){t=i.slice(c);break}if(o===10&&c===a&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),c<a&&(s.push(i.slice(c,a)),e+=a-c),o){case 0:s.push(65533),e++;break;case 9:{let t=Math.ceil(e/4)*4;for(s.push(-2);e++<t;)s.push(-1);break}case 10:s.push(-4),e=1;break;default:r=!0,e=1}c=a+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var dM=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function fM(e){return e.replace(dM,pM)}function pM(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return Mk(n.slice(t?2:1),t?16:10)}return Tk(n)||e}var mM={}.hasOwnProperty;function hM(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),gM(n)(cM(sM(n).document().write(uM()(e,t,!0))))}function gM(e){let t={afterExit:[],beforeEnter:[],transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:o(se),autolinkProtocol:E,autolinkEmail:E,atxHeading:o(K),blockQuote:o(W),characterEscape:E,characterReference:E,codeFenced:o(re),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:o(re,s),codeText:o(ie,s),codeTextData:E,data:E,codeFlowValue:E,definition:o(ae),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:o(G),hardBreakEscape:o(q),hardBreakTrailing:o(q),htmlFlow:o(oe,s),htmlFlowData:E,htmlText:o(oe,s),htmlTextData:E,image:o(J),label:s,link:o(se),listItem:o(le),listItemValue:p,listOrdered:o(ce,f),listUnordered:o(ce),paragraph:o(ue),reference:B,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:o(K),strong:o(de),thematicBreak:o(pe)},exit:{atxHeading:l(),atxHeadingSequence:S,autolink:l(),autolinkEmail:ne,autolinkProtocol:te,blockQuote:l(),characterEscapeValue:D,characterReferenceMarkerHexadecimal:H,characterReferenceMarkerNumeric:H,characterReferenceValue:U,characterReference:ee,codeFenced:l(_),codeFencedFence:g,codeFencedFenceInfo:m,codeFencedFenceMeta:h,codeFlowValue:D,codeIndented:l(v),codeText:l(M),codeTextData:D,data:D,definition:l(),definitionDestinationString:x,definitionLabelString:y,definitionTitleString:b,emphasis:l(),hardBreakEscape:l(k),hardBreakTrailing:l(k),htmlFlow:l(A),htmlFlowData:D,htmlText:l(j),htmlTextData:D,image:l(P),label:I,labelText:F,lineEnding:O,link:l(N),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:V,resourceDestinationString:L,resourceTitleString:R,resource:z,setextHeading:l(T),setextHeadingLineSequence:w,setextHeadingText:C,strong:l(),thematicBreak:l()}};vM(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[],position:void 0},o={stack:[r],tokenStack:[],config:t,enter:c,exit:u,buffer:s,resume:d,data:n},l=[],f=[],p=-1;for(;++p<e.length;)f.push(e[p]),(e[p][1].type===`listOrdered`||e[p][1].type===`listUnordered`)&&(e[p][0]===`enter`?l.push(f.length-1):a(f,l.pop()));for(e=f,p=-1;++p<e.length;){let n=t[e[p][0]];e[p][0]===`enter`&&t.beforeEnter.length>0&&i(t.beforeEnter,{...o,sliceSerialize:e[p][2].sliceSerialize},e[p][1]),mM.call(n,e[p][1].type)&&n[e[p][1].type].call({...o,sliceSerialize:e[p][2].sliceSerialize},e[p][1]),e[p][0]===`exit`&&t.afterExit.length>0&&i(t.afterExit,{...o,sliceSerialize:e[p][2].sliceSerialize},e[p][1])}if(o.tokenStack.length>0){let e=o.tokenStack[o.tokenStack.length-1];(e[1]||bM).call(o,void 0,e[0])}for(r.position={start:_M(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:_M(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},p=-1;++p<t.transforms.length;)r=t.transforms[p](r)||r;return r}function i(e,t,n){let r=-1;for(;++r<e.length;)e[r].call(t,n)}function a(e,t){let n=e.length-1,r=t-1,i=-1,a=!1,o,s,c,l,u=[];for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let n=r;for(s=void 0;n--;){let t=e[n];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=n}else if(t[1].type!==`linePrefix`&&t[1].type!==`blockQuotePrefix`&&t[1].type!==`blockQuotePrefixWhitespace`&&t[1].type!==`blockQuoteMarker`&&t[1].type!==`listItemIndent`)break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),u.push({at:s||r,event:[`exit`,o,t[2]]})}if(t[1].type===`listItemPrefix`){let e={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=e,u.push({at:r,event:[`enter`,e,t[2]]}),c=void 0,l=!0}}}let d=e.splice(t),f=0;for(r=-1;++r<d.length;){for(;f<u.length&&u[f].at===t+r;)e.push(u[f++].event);e.push(d[r])}e[t][1]._spread=a}function o(e,t){return n;function n(n){c.call(this,e(n),n),t&&t.call(this,n)}}function s(){this.stack.push({type:`fragment`,children:[]})}function c(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:_M(t.start),end:void 0}}function l(e){return t;function t(t){e&&e.call(this,t),u.call(this,t)}}function u(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(!r)throw Error("Cannot close `"+e.type+"` ("+LO({start:e.start,end:e.end})+`): it’s not open`);r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||bM).call(this,e,r[0])),n.position.end=_M(e.end)}function d(){return bk(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function p(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function h(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function v(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function y(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Nk(this.sliceSerialize(e)).toLowerCase()}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function x(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function S(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function C(){this.data.setextHeadingSlurpLineEnding=!0}function w(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function E(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=fe(),n.position={start:_M(e.start),end:void 0},t.push(n)),this.stack.push(n)}function D(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=_M(e.end)}function O(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=_M(e.end),this.data.atHardBreak=void 0}else!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(E.call(this,e),D.call(this,e))}function k(){this.data.atHardBreak=!0}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function M(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function N(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function P(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function F(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=fM(t),n.identifier=Nk(t).toLowerCase()}function I(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function L(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function R(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function z(){this.data.inReference=void 0}function B(){this.data.referenceType=`collapsed`}function V(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Nk(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function H(e){this.data.characterReferenceType=e.type}function U(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=Mk(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=Tk(t);let i=this.stack[this.stack.length-1];i.value+=r}function ee(e){let t=this.stack.pop();t.position.end=_M(e.end)}function te(e){D.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function ne(e){D.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function W(){return{type:`blockquote`,children:[],position:void 0}}function re(){return{type:`code`,lang:null,meta:null,value:``,position:void 0}}function ie(){return{type:`inlineCode`,value:``,position:void 0}}function ae(){return{type:`definition`,identifier:``,label:null,title:null,url:``,position:void 0}}function G(){return{type:`emphasis`,children:[],position:void 0}}function K(){return{type:`heading`,depth:0,children:[],position:void 0}}function q(){return{type:`break`,position:void 0}}function oe(){return{type:`html`,value:``,position:void 0}}function J(){return{type:`image`,title:null,url:``,alt:null,position:void 0}}function se(){return{type:`link`,title:null,url:``,children:[],position:void 0}}function ce(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[],position:void 0}}function le(e){return{type:`listItem`,spread:e._spread,checked:null,children:[],position:void 0}}function ue(){return{type:`paragraph`,children:[],position:void 0}}function de(){return{type:`strong`,children:[],position:void 0}}function fe(){return{type:`text`,value:``,position:void 0}}function pe(){return{type:`thematicBreak`,position:void 0}}}function _M(e){return{line:e.line,column:e.column,offset:e.offset}}function vM(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?vM(e,r):yM(e,r)}}function yM(e,t){let n;for(n in t)if(mM.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`afterExit`:case`beforeEnter`:{let r=t[n];r&&e[n].push(r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function bM(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+LO({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+LO({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+LO({start:t.start,end:t.end})+`) is still open`)}function xM(e){let t=this;t.parser=n;function n(n){return hM(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function SM(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function CM(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
66
+ `}]}function wM(e,t){let n=t.value?t.value+`
67
+ `:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function TM(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function EM(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function DM(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=qk(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function OM(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function kM(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function AM(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function jM(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return AM(e,t);let i={src:qk(r.url||``)};t.alt!==null&&t.alt!==void 0&&(i.alt=t.alt),r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function MM(e,t){let n={src:qk(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function NM(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function PM(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return AM(e,t);let i={href:qk(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function FM(e,t){let n={href:qk(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function IM(e,t,n){let r=e.all(t),i=n?LM(n):RM(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
68
68
  `}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
69
- `});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function FM(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let{children:n}=e,r=-1;for(;!t&&++r<n.length;)t=IM(n[r])}return t}function IM(e){let{spread:t}=e;return t??e.children.length>1}function LM(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function RM(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function zM(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function BM(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function VM(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=MO(t.children[1]),o=jO(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function HM(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let l={type:`element`,tagName:i,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),c.push(l)}let l={type:`element`,tagName:`tr`,properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function UM(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var WM=9,GM=32;function KM(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(qM(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(qM(t.slice(i),i>0,!1)),a.join(``)}function qM(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===WM||t===GM;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===WM||t===GM;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function JM(e,t){let n={type:`text`,value:KM(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function YM(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var XM={blockquote:bM,break:xM,code:SM,delete:CM,emphasis:wM,footnoteReference:TM,heading:EM,html:DM,imageReference:kM,image:AM,inlineCode:jM,linkReference:MM,link:NM,listItem:PM,list:LM,paragraph:RM,root:zM,strong:BM,table:VM,tableCell:UM,tableRow:HM,text:JM,thematicBreak:YM,toml:ZM,yaml:ZM,definition:ZM,footnoteDefinition:ZM};function ZM(){}var{defineProperty:QM}=Object,$M=typeof self==`object`?self:globalThis,eN=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new $M[e](t)},tN=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o){let i=r(t),a=r(n);i===`__proto__`?QM(e,i,{value:a,configurable:!0,enumerable:!0,writable:!0}):e[i]=a}return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(typeof $M[e]==`function`?eN(e,t):Error(t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}case`-0`:return-0}return n(eN(a,o),i)};return r},nN=e=>tN(new Map,e)(0),rN=``,{toString:iN}={},{keys:aN,is:oN}=Object,sN=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=iN.call(e).slice(8,-1);switch(n){case`Array`:return[1,rN];case`Object`:return[2,rN];case`Date`:return[3,rN];case`RegExp`:return[4,rN];case`Map`:return[5,rN];case`Set`:return[6,rN];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:e instanceof Error?[7,e.name||`Error`]:[2,n]},cN=([e,t])=>e===0&&(t===`function`||t===`symbol`),lN=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=o=>{if(n.has(o))return n.get(o);let[s,c]=sN(o);switch(s){case 0:{let t=o;switch(c){case`bigint`:s=8,t=o.toString();break;case`number`:if(!o&&oN(o,-0))return r.push([`-0`])-1;break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+c);t=null;break;case`undefined`:return i([-1],o)}return i([s,t],o)}case 1:{if(c){let e=o;return c===`DataView`?e=new Uint8Array(o.buffer):c===`ArrayBuffer`&&(e=new Uint8Array(o)),i([c,[...e]],o)}let e=[],t=i([s,e],o);for(let t of o)e.push(a(t));return t}case 2:{if(c)switch(c){case`BigInt`:return i([c,o.toString()],o);case`Boolean`:case`Number`:case`String`:return i([c,o.valueOf()],o)}if(t&&`toJSON`in o)return a(o.toJSON());let n=[],r=i([s,n],o);for(let t of aN(o))(e||!cN(sN(o[t])))&&n.push([a(t),a(o[t])]);return r}case 3:return i([s,isNaN(o.getTime())?rN:o.toISOString()],o);case 4:{let{source:e,flags:t}=o;return i([s,{source:e,flags:t}],o)}case 5:{let t=[],n=i([s,t],o);for(let[n,r]of o)(e||!(cN(sN(n))||cN(sN(r))))&&t.push([a(n),a(r)]);return n}case 6:{let t=[],n=i([s,t],o);for(let n of o)(e||!cN(sN(n)))&&t.push(a(n));return n}}let{message:l}=o;return i([s,{name:c,message:l}],o)};return a},uN=(e,{json:t,lossy:n}={})=>{let r=[];return lN(!(t||n),!!t,new Map,r)(e),r},dN=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?nN(uN(e,t)):structuredClone(e):(e,t)=>nN(uN(e,t));function fN(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function pN(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function mN(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||fN,r=e.options.footnoteBackLabel||pN,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=[],l=-1;for(;++l<e.footnoteOrder.length;){let t=e.footnoteById.get(e.footnoteOrder[l]);t&&(s[l]=e.all(t))}for(l=-1;++l<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[l]);if(!i)continue;let a=s[l],o=String(i.identifier).toUpperCase(),u=Gk(o.toLowerCase()),d=0,f=[],p=e.footnoteCounts.get(o);for(;p!==void 0&&++d<=p;){f.length>0&&f.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(l,d);typeof e==`string`&&(e={type:`text`,value:e}),f.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+u+(d>1?`-`+d:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(l,d),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let m=a[a.length-1];if(m&&m.type===`element`&&m.tagName===`p`){let e=m.children[m.children.length-1];e&&e.type===`text`?e.value+=` `:m.children.push({type:`text`,value:` `}),m.children.push(...f)}else a.push(...f);let h={type:`element`,tagName:`li`,properties:{id:t+`fn-`+u},children:e.wrap(a,!0)};e.patch(i,h),c.push(h)}if(c.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...dN(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
69
+ `});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function LM(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let{children:n}=e,r=-1;for(;!t&&++r<n.length;)t=RM(n[r])}return t}function RM(e){let{spread:t}=e;return t??e.children.length>1}function zM(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function BM(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function VM(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function HM(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function UM(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=PO(t.children[1]),o=NO(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function WM(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let l={type:`element`,tagName:i,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),c.push(l)}let l={type:`element`,tagName:`tr`,properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function GM(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var KM=9,qM=32;function JM(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(YM(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(YM(t.slice(i),i>0,!1)),a.join(``)}function YM(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===KM||t===qM;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===KM||t===qM;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function XM(e,t){let n={type:`text`,value:JM(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function ZM(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var QM={blockquote:SM,break:CM,code:wM,delete:TM,emphasis:EM,footnoteReference:DM,heading:OM,html:kM,imageReference:jM,image:MM,inlineCode:NM,linkReference:PM,link:FM,listItem:IM,list:zM,paragraph:BM,root:VM,strong:HM,table:UM,tableCell:GM,tableRow:WM,text:XM,thematicBreak:ZM,toml:$M,yaml:$M,definition:$M,footnoteDefinition:$M};function $M(){}var{defineProperty:eN}=Object,tN=typeof self==`object`?self:globalThis,nN=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new tN[e](t)},rN=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o){let i=r(t),a=r(n);i===`__proto__`?eN(e,i,{value:a,configurable:!0,enumerable:!0,writable:!0}):e[i]=a}return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(typeof tN[e]==`function`?nN(e,t):Error(t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}case`-0`:return-0}return n(nN(a,o),i)};return r},iN=e=>rN(new Map,e)(0),aN=``,{toString:oN}={},{keys:sN,is:cN}=Object,lN=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=oN.call(e).slice(8,-1);switch(n){case`Array`:return[1,aN];case`Object`:return[2,aN];case`Date`:return[3,aN];case`RegExp`:return[4,aN];case`Map`:return[5,aN];case`Set`:return[6,aN];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:e instanceof Error?[7,e.name||`Error`]:[2,n]},uN=([e,t])=>e===0&&(t===`function`||t===`symbol`),dN=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=o=>{if(n.has(o))return n.get(o);let[s,c]=lN(o);switch(s){case 0:{let t=o;switch(c){case`bigint`:s=8,t=o.toString();break;case`number`:if(!o&&cN(o,-0))return r.push([`-0`])-1;break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+c);t=null;break;case`undefined`:return i([-1],o)}return i([s,t],o)}case 1:{if(c){let e=o;return c===`DataView`?e=new Uint8Array(o.buffer):c===`ArrayBuffer`&&(e=new Uint8Array(o)),i([c,[...e]],o)}let e=[],t=i([s,e],o);for(let t of o)e.push(a(t));return t}case 2:{if(c)switch(c){case`BigInt`:return i([c,o.toString()],o);case`Boolean`:case`Number`:case`String`:return i([c,o.valueOf()],o)}if(t&&`toJSON`in o)return a(o.toJSON());let n=[],r=i([s,n],o);for(let t of sN(o))(e||!uN(lN(o[t])))&&n.push([a(t),a(o[t])]);return r}case 3:return i([s,isNaN(o.getTime())?aN:o.toISOString()],o);case 4:{let{source:e,flags:t}=o;return i([s,{source:e,flags:t}],o)}case 5:{let t=[],n=i([s,t],o);for(let[n,r]of o)(e||!(uN(lN(n))||uN(lN(r))))&&t.push([a(n),a(r)]);return n}case 6:{let t=[],n=i([s,t],o);for(let n of o)(e||!uN(lN(n)))&&t.push(a(n));return n}}let{message:l}=o;return i([s,{name:c,message:l}],o)};return a},fN=(e,{json:t,lossy:n}={})=>{let r=[];return dN(!(t||n),!!t,new Map,r)(e),r},pN=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?iN(fN(e,t)):structuredClone(e):(e,t)=>iN(fN(e,t));function mN(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function hN(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function gN(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||mN,r=e.options.footnoteBackLabel||hN,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=[],l=-1;for(;++l<e.footnoteOrder.length;){let t=e.footnoteById.get(e.footnoteOrder[l]);t&&(s[l]=e.all(t))}for(l=-1;++l<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[l]);if(!i)continue;let a=s[l],o=String(i.identifier).toUpperCase(),u=qk(o.toLowerCase()),d=0,f=[],p=e.footnoteCounts.get(o);for(;p!==void 0&&++d<=p;){f.length>0&&f.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(l,d);typeof e==`string`&&(e={type:`text`,value:e}),f.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+u+(d>1?`-`+d:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(l,d),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let m=a[a.length-1];if(m&&m.type===`element`&&m.tagName===`p`){let e=m.children[m.children.length-1];e&&e.type===`text`?e.value+=` `:m.children.push({type:`text`,value:` `}),m.children.push(...f)}else a.push(...f);let h={type:`element`,tagName:`li`,properties:{id:t+`fn-`+u},children:e.wrap(a,!0)};e.patch(i,h),c.push(h)}if(c.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...pN(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
70
70
  `},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(c,!0)},{type:`text`,value:`
71
- `}]}}var hN=(function(e){if(e==null)return bN;if(typeof e==`function`)return yN(e);if(typeof e==`object`)return Array.isArray(e)?gN(e):_N(e);if(typeof e==`string`)return vN(e);throw Error(`Expected function, string, or object as test`)});function gN(e){let t=[],n=-1;for(;++n<e.length;)t[n]=hN(e[n]);return yN(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function _N(e){let t=e;return yN(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function vN(e){return yN(t);function t(t){return t&&t.type===e}}function yN(e){return t;function t(t,n,r){return!!(xN(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function bN(){return!0}function xN(e){return typeof e==`object`&&!!e&&`type`in e}function SN(e){return e}var CN=[];function wN(e,t,n,r){if(!e||typeof e!=`object`)throw Error("Unexpected value `"+e+"` for `tree`, expected node");let i=!0,a,o,s,c;if(typeof n==`function`||n&&typeof n==`object`?(a=t,o=n,r&&(i=!1)):(o=t,n&&(i=!1)),typeof o==`function`)s=o;else if(o&&typeof o==`object`){if(o.enter!==null&&o.enter!==void 0){if(typeof o.enter==`function`)s=o.enter;else throw Error("Unexpected value `"+o.enter+"` for `visitors.enter`, expected optional visitor")}if(typeof o.exit==`function`)c=o.exit;else throw Error("Unexpected value `"+o.exit+"` for `visitors.exit`, expected visitor (pass a visitor directly if you only want an enter visitor)")}else throw Error("Unexpected value `"+o+"` for `enter` or `visitors`, expected visitor or object with visitors");let l=hN(a),u=i?1:-1;d(e,void 0,[])();function d(e,t,n){let r=e&&typeof e==`object`?e:{};if(typeof r.type==`string`){let t=typeof r.tagName==`string`?r.tagName:typeof r.name==`string`?r.name:void 0;Object.defineProperty(o,"name",{value:`node (`+SN(e.type+(t?`<`+t+`>`:``))+`)`})}return o;function o(){let r=!a||l(e,t,n[n.length-1]||void 0),o=CN;if(s&&r&&(o=TN(s(e,n,t)),o[0]===!1))return o;if(`children`in e&&e.children){let t=e;if(t.children&&o[0]!==`skip`){let e=(i?-1:t.children.length)+u,r=[...n,t];for(;e>-1&&e<t.children.length;){let n=t.children[e],i=d(n,e,r)();if(i[0]===!1)return i;e=typeof i[1]==`number`?i[1]:e+u}}}if(c&&r){let r=TN(c(e,n,t));if(r[0]===`skip`)throw Error("Unexpected value `"+r[0]+"` from `exit`, expected `CONTINUE`, `EXIT`, index, or nothing");if(r[0]===!1||typeof r[1]==`number`)return r}return o}}}function TN(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?CN:[e]}function EN(e,t,n,r){let i,a,o;typeof n==`function`||n&&typeof n==`object`?(i=t,a=n,o=r):(a=t,o=n),typeof a==`function`?wN(e,i,ON(a),o):wN(e,i,DN(a),o)}function DN(e){return!e||typeof e!=`object`?e:{enter:typeof e.enter==`function`?ON(e.enter):e.enter,exit:typeof e.exit==`function`?ON(e.exit):e.exit}}function ON(e){return t;function t(t,n,r){return e(t,r,n[n.length-1])}}var kN={}.hasOwnProperty,AN={};function jN(e,t){let n=t||AN,r=new Map,i=new Map,a={all:s,applyData:NN,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...XM,...n.handlers},one:o,options:n,patch:MN,wrap:FN};return EN(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=String(e.identifier).toUpperCase();e.type===`definition`?r.has(t)||r.set(t,e):i.has(t)||i.set(t,e)}}),a;function o(e,t){let{type:n}=e,r=a.handlers[n];if(kN.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e;return{...dN(n),children:a.all(e)}}return dN(e)}return(a.options.unknownHandler||PN)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=IN(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=IN(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function MN(e,t){e.position&&(t.position=PO(e))}function NN(e,t){let n=t;if(e&&e.data){let{hChildren:t,hName:r,hProperties:i}=e.data;typeof r==`string`&&(n.type===`element`?n.tagName=r:n={type:`element`,tagName:r,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,dN(i)),`children`in n&&n.children&&t!=null&&(n.children=t)}return n}function PN(e,t){let n=t.data||{},r=`value`in t&&!(kN.call(n,`hProperties`)||kN.call(n,`hChildren`))?{type:`text`,value:t.value}:{type:`element`,tagName:`div`,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function FN(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
71
+ `}]}}var _N=(function(e){if(e==null)return SN;if(typeof e==`function`)return xN(e);if(typeof e==`object`)return Array.isArray(e)?vN(e):yN(e);if(typeof e==`string`)return bN(e);throw Error(`Expected function, string, or object as test`)});function vN(e){let t=[],n=-1;for(;++n<e.length;)t[n]=_N(e[n]);return xN(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function yN(e){let t=e;return xN(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function bN(e){return xN(t);function t(t){return t&&t.type===e}}function xN(e){return t;function t(t,n,r){return!!(CN(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function SN(){return!0}function CN(e){return typeof e==`object`&&!!e&&`type`in e}function wN(e){return e}var TN=[];function EN(e,t,n,r){if(!e||typeof e!=`object`)throw Error("Unexpected value `"+e+"` for `tree`, expected node");let i=!0,a,o,s,c;if(typeof n==`function`||n&&typeof n==`object`?(a=t,o=n,r&&(i=!1)):(o=t,n&&(i=!1)),typeof o==`function`)s=o;else if(o&&typeof o==`object`){if(o.enter!==null&&o.enter!==void 0){if(typeof o.enter==`function`)s=o.enter;else throw Error("Unexpected value `"+o.enter+"` for `visitors.enter`, expected optional visitor")}if(typeof o.exit==`function`)c=o.exit;else throw Error("Unexpected value `"+o.exit+"` for `visitors.exit`, expected visitor (pass a visitor directly if you only want an enter visitor)")}else throw Error("Unexpected value `"+o+"` for `enter` or `visitors`, expected visitor or object with visitors");let l=_N(a),u=i?1:-1;d(e,void 0,[])();function d(e,t,n){let r=e&&typeof e==`object`?e:{};if(typeof r.type==`string`){let t=typeof r.tagName==`string`?r.tagName:typeof r.name==`string`?r.name:void 0;Object.defineProperty(o,"name",{value:`node (`+wN(e.type+(t?`<`+t+`>`:``))+`)`})}return o;function o(){let r=!a||l(e,t,n[n.length-1]||void 0),o=TN;if(s&&r&&(o=DN(s(e,n,t)),o[0]===!1))return o;if(`children`in e&&e.children){let t=e;if(t.children&&o[0]!==`skip`){let e=(i?-1:t.children.length)+u,r=[...n,t];for(;e>-1&&e<t.children.length;){let n=t.children[e],i=d(n,e,r)();if(i[0]===!1)return i;e=typeof i[1]==`number`?i[1]:e+u}}}if(c&&r){let r=DN(c(e,n,t));if(r[0]===`skip`)throw Error("Unexpected value `"+r[0]+"` from `exit`, expected `CONTINUE`, `EXIT`, index, or nothing");if(r[0]===!1||typeof r[1]==`number`)return r}return o}}}function DN(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?TN:[e]}function ON(e,t,n,r){let i,a,o;typeof n==`function`||n&&typeof n==`object`?(i=t,a=n,o=r):(a=t,o=n),typeof a==`function`?EN(e,i,AN(a),o):EN(e,i,kN(a),o)}function kN(e){return!e||typeof e!=`object`?e:{enter:typeof e.enter==`function`?AN(e.enter):e.enter,exit:typeof e.exit==`function`?AN(e.exit):e.exit}}function AN(e){return t;function t(t,n,r){return e(t,r,n[n.length-1])}}var jN={}.hasOwnProperty,MN={};function NN(e,t){let n=t||MN,r=new Map,i=new Map,a={all:s,applyData:FN,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...QM,...n.handlers},one:o,options:n,patch:PN,wrap:LN};return ON(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=String(e.identifier).toUpperCase();e.type===`definition`?r.has(t)||r.set(t,e):i.has(t)||i.set(t,e)}}),a;function o(e,t){let{type:n}=e,r=a.handlers[n];if(jN.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e;return{...pN(n),children:a.all(e)}}return pN(e)}return(a.options.unknownHandler||IN)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=RN(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=RN(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function PN(e,t){e.position&&(t.position=IO(e))}function FN(e,t){let n=t;if(e&&e.data){let{hChildren:t,hName:r,hProperties:i}=e.data;typeof r==`string`&&(n.type===`element`?n.tagName=r:n={type:`element`,tagName:r,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,pN(i)),`children`in n&&n.children&&t!=null&&(n.children=t)}return n}function IN(e,t){let n=t.data||{},r=`value`in t&&!(jN.call(n,`hProperties`)||jN.call(n,`hChildren`))?{type:`text`,value:t.value}:{type:`element`,tagName:`div`,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function LN(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
72
72
  `});++r<e.length;)r&&n.push({type:`text`,value:`
73
73
  `}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
74
- `}),n}function IN(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function LN(e,t){let n=jN(e,t),r=n.one(e,void 0),i=mN(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
75
- `},i)),a}function RN(e,t){return e&&`run`in e?async function(n,r){let i=LN(n,{file:r,...t});await e.run(i,r)}:function(n,r){return LN(n,{file:r,...e||t})}}function zN(e){if(e)throw e}var BN=o(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function VN(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function HN(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a)r(a);else{for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?UN(s,i)(...o):r(null,...o)}}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function UN(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var WN={basename:GN,dirname:KN,extname:qN,join:JN,sep:`/`};function GN(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);ZN(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function KN(e){if(ZN(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function qN(e){ZN(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}}else n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function JN(...e){let t=-1,n;for(;++t<e.length;)ZN(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:YN(n)}function YN(e){ZN(e);let t=e.codePointAt(0)===47,n=XN(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function XN(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(i!==o-1&&a!==1){if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1}i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function ZN(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var QN={cwd:$N};function $N(){return`/`}function eP(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function tP(e){if(typeof e==`string`)e=new URL(e);else if(!eP(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return nP(e)}function nP(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var rP=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],iP=class{constructor(e){let t;t=e?eP(e)?{path:e}:typeof e==`string`||cP(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:QN.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<rP.length;){let e=rP[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)rP.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?WN.basename(this.path):void 0}set basename(e){oP(e,`basename`),aP(e,`basename`),this.path=WN.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?WN.dirname(this.path):void 0}set dirname(e){sP(this.basename,`dirname`),this.path=WN.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?WN.extname(this.path):void 0}set extname(e){if(aP(e,`extname`),sP(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=WN.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){eP(e)&&(e=tP(e)),oP(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?WN.basename(this.path,this.extname):void 0}set stem(e){oP(e,`stem`),aP(e,`stem`),this.path=WN.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new zO(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function aP(e,t){if(e&&e.includes(WN.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+WN.sep+"`")}function oP(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function sP(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function cP(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var lP=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),uP=l(BN(),1),dP={}.hasOwnProperty,fP=new class e extends lP{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=HN()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,uP.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(hP(`data`,this.frozen),this.namespace[e]=t,this):dP.call(this.namespace,e)&&this.namespace[e]||void 0:e?(hP(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=vP(e),n=this.parser||this.Parser;return pP(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),pP(`process`,this.parser||this.Parser),mP(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=vP(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);bP(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),pP(`processSync`,this.parser||this.Parser),mP(`processSync`,this.compiler||this.Compiler),this.process(e,r),_P(`processSync`,`process`,t),n;function r(e,r){t=!0,zN(e),n=r}}run(e,t,n){gP(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=vP(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),_P(`runSync`,`run`,n),r;function i(e,t){zN(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=vP(t),r=this.compiler||this.Compiler;return mP(`stringify`,r),gP(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(hP(`use`,this.frozen),e!=null){if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`")}return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`){if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e)}else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,uP.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null){if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];VN(o)&&VN(r)&&(r=(0,uP.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function pP(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function mP(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function hP(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function gP(e){if(!VN(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function _P(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function vP(e){return yP(e)?e:new iP(e)}function yP(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function bP(e){return typeof e==`string`||xP(e)}function xP(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var SP=[],CP={allowDangerousHtml:!0},wP=/^(https?|ircs?|mailto|xmpp)$/i,TP=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function EP(e){let t=DP(e),n=OP(e);return kP(t.runSync(t.parse(n),n),e)}function DP(e){let t=e.rehypePlugins||SP,n=e.remarkPlugins||SP,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...CP}:CP;return fP().use(yM).use(n).use(RN,r).use(t)}function OP(e){let t=e.children||``,n=new iP;return typeof t==`string`?n.value=t:``+t,n}function kP(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||AP;for(let e of TP)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return EN(e,l),qO(e,{Fragment:S.Fragment,components:i,ignoreInvalidStyle:!0,jsx:S.jsx,jsxs:S.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in gk)if(Object.hasOwn(gk,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=gk[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function AP(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||wP.test(e.slice(0,t))?e:``}var jP=Bd(`group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-card text-card-foreground`,destructive:`bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current`}},defaultVariants:{variant:`default`}});function MP({className:e,variant:t,...n}){return(0,S.jsx)(`div`,{"data-slot":`alert`,role:`alert`,className:X(jP({variant:t}),e),...n})}function NP({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`alert-title`,className:X(`font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground`,e),...t})}function PP({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`alert-description`,className:X(`text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4`,e),...t})}var FP=Bd(`group/bubble relative flex w-fit max-w-[80%] min-w-0 flex-col gap-1 group-data-[align=end]/message:self-end data-[align=end]:self-end data-[variant=ghost]:max-w-full`,{variants:{variant:{default:`*:data-[slot=bubble-content]:bg-primary *:data-[slot=bubble-content]:text-primary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-primary/80`,secondary:`*:data-[slot=bubble-content]:bg-secondary *:data-[slot=bubble-content]:text-secondary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]`,muted:`*:data-[slot=bubble-content]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--muted),var(--foreground)_5%)]`,tinted:`*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.93_calc(c*0.4)_h)] *:data-[slot=bubble-content]:text-foreground dark:*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.3_calc(c*0.4)_h)] [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.88_calc(c*0.5)_h)] dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.35_calc(c*0.5)_h)]`,outline:`*:data-[slot=bubble-content]:border-border *:data-[slot=bubble-content]:bg-background [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-input/30`,ghost:`border-none *:data-[slot=bubble-content]:rounded-none *:data-[slot=bubble-content]:bg-transparent *:data-[slot=bubble-content]:p-0 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted/50`,destructive:`*:data-[slot=bubble-content]:bg-destructive/10 *:data-[slot=bubble-content]:text-destructive dark:*:data-[slot=bubble-content]:bg-destructive/20 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/20 dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/30`}},defaultVariants:{variant:`default`}});function IP({variant:e=`default`,align:t=`start`,className:n,...r}){return(0,S.jsx)(`div`,{"data-slot":`bubble`,"data-variant":e,"data-align":t,className:X(FP({variant:e}),n),...r})}function LP({className:e,render:t,...n}){return of({defaultTagName:`div`,props:ki({className:X(`w-fit max-w-full min-w-0 overflow-hidden rounded-xl border border-transparent px-3 py-2 text-sm leading-relaxed wrap-break-word group-data-[align=end]/bubble:self-end [button]:text-left [button,a]:transition-colors [button,a]:outline-none [button,a]:focus-visible:border-ring [button,a]:focus-visible:ring-3 [button,a]:focus-visible:ring-ring/50`,e)},n),render:t,state:{slot:`bubble-content`}})}function RP({className:e,align:t=`start`,...n}){return(0,S.jsx)(`div`,{"data-slot":`message`,"data-align":t,className:X(`group/message relative flex w-full min-w-0 gap-2 text-sm data-[align=end]:flex-row-reverse`,e),...n})}function zP({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`message-content`,className:X(`flex w-full min-w-0 flex-col gap-2.5 wrap-break-word group-data-[align=end]/message:*:data-slot:self-end`,e),...t})}function BP({defaultTagName:e,props:t,render:n,state:r={},stateAttributesMapping:i}){let a=VP(HP(r,i),t);if(!n)return v.createElement(e,a);if(typeof n==`function`)return n(a,r);if(!v.isValidElement(n))return null;let o=n.props,s={...VP(a,o),ref:GP(a.ref,o.ref)};return v.cloneElement(n,s)}function VP(...e){let t={};for(let n of e){if(!n)continue;let e=n;for(let n of Object.keys(e)){let r=e[n];if(r===void 0)continue;let i=t[n];t[n]=n===`className`?[i,r].filter(Boolean).join(` `):n===`style`?{...i,...r}:n===`ref`?GP(i,r):WP(n)&&typeof i==`function`&&typeof r==`function`?UP(r,i):r}}return t}function HP(e,t){let n={};for(let r of Object.keys(e)){let i=e[r],a=t?.[r]?.(i);if(a){Object.assign(n,a);continue}if(r===`slot`){n[`data-slot`]=i;continue}let o=`data-${String(r).replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}`;typeof i==`boolean`?n[o]=i?``:void 0:i!=null&&(n[o]=String(i))}return n}function UP(e,t){return function(n){e(n),n.defaultPrevented||t(n)}}function WP(e){return/^on[A-Z]/.test(e)}function GP(...e){let t=e.filter(Boolean);if(t.length!==0)return e=>{for(let n of t)typeof n==`function`?n(e):n&&(n.current=e)}}var KP=8,qP=64,JP=0,YP=.5,XP=180,ZP=new Set([`ArrowDown`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`,` `]),QP={start:!1,end:!1},$P={currentAnchorId:null,visibleMessageIds:[]};function eF({content:e,scrollEdgeThreshold:t,spacer:n,viewport:r}){if(!r||!e)return QP;let i=fF({content:e,spacer:n,viewport:r});return{start:r.scrollTop>t,end:i-r.scrollTop-r.clientHeight>t}}function tF({content:e,scrollMargin:t,scrollPreviousItemPeek:n,spacer:r,viewport:i,visibleMessageIds:a}){if(!e||!i)return $P;let o=i.getBoundingClientRect(),s=o.top+t+n,c=typeof IntersectionObserver>`u`,l=[],u=null;for(let t of nF(e,r)){let e=t.dataset.messageId;if(!e)continue;let n=t.dataset.scrollAnchor===`true`,r=n||c?t.getBoundingClientRect():null;(c&&r?r.bottom>s&&r.top<o.bottom:a.has(e))&&l.push(e),n&&r&&r.top<=s+YP&&(u=e)}return l.length===0&&u===null?$P:{currentAnchorId:u,visibleMessageIds:l}}function nF(e,t){return Array.from(e.children).filter(e=>e instanceof HTMLElement&&e!==t)}function rF(e,t){for(let n=t;n<e.length;n++){let t=e[n];if(t?.dataset.scrollAnchor===`true`)return t}return null}function iF(e,t){for(let n of e)if(n.dataset.scrollAnchor===`true`&&!t.has(n))return n;return null}function aF(e,t){let n=0;for(let r=t;r<e.length;r++)if(e[r]?.dataset.scrollAnchor===`true`&&(n+=1,n>1))return!0;return!1}function oF(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.dataset.scrollAnchor===`true`)return n}return null}function sF({content:e,spacer:t,viewport:n}){let r=n.getBoundingClientRect();for(let n of nF(e,t)){if(!n.dataset.messageId)continue;let e=n.getBoundingClientRect();if(e.bottom>r.top&&e.top<r.bottom)return n}return null}function cF({align:e,element:t,scrollMargin:n,spacer:r,viewport:i}){let a=lF(t,i),o=t.getBoundingClientRect().height,s=hF(r);if(e===`center`){let e=Math.max(0,i.clientHeight-s.start-s.end);return a-s.start-(e-o)/2-n}if(e===`end`)return a-i.clientHeight+o+s.end+n;if(e===`nearest`){let e=a+o,t=i.scrollTop+s.start,r=i.scrollTop+i.clientHeight-s.end;return a>=t&&e<=r?i.scrollTop:a<t?a-s.start-n:e-i.clientHeight+s.end+n}return a-s.start-n}function lF(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.top-r.top+t.scrollTop}function uF(e,t){return e.getBoundingClientRect().top-t.getBoundingClientRect().top}function dF({content:e,scrollTop:t,spacer:n,viewport:r}){let i=fF({content:e,spacer:n,viewport:r});return t+r.clientHeight-i}function fF({content:e,spacer:t,viewport:n}){let r=nF(e,t),i=mF(e),a=n.getBoundingClientRect(),o=n.scrollTop,s=i.start+i.end;for(let e of r){let t=e.getBoundingClientRect();s=Math.max(s,t.bottom-a.top+o+i.end)}return s}function pF(e){return Math.max(0,e.scrollHeight-e.clientHeight)}function mF(e){let t=window.getComputedStyle(e);return{end:_F(t.paddingBlockEnd||t.paddingBottom),start:_F(t.paddingBlockStart||t.paddingTop)}}function hF(e){let t=e?.parentElement;return t?mF(t):{end:0,start:0}}function gF(e){if(!e)return 0;let t=window.getComputedStyle(e);return _F(t.rowGap===`normal`?t.gap:t.rowGap)}function _F(e){if(!e)return 0;let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function vF(e,t){let n=e,r=new Set;return{getSnapshot:()=>n,hasListeners:()=>r.size>0,setSnapshot:e=>{t(n,e)||(n=e,r.forEach(e=>e()))},subscribe:(e,t,n)=>{let i=r.size===0;return r.add(e),i&&t?.(),()=>{r.delete(e),r.size===0&&n?.()}}}}function yF(e,t){return vF(e,t)}function bF(){return vF($P,SF)}function xF(e,t){return e.start===t.start&&e.end===t.end}function SF(e,t){return e.currentAnchorId!==t.currentAnchorId||e.visibleMessageIds.length!==t.visibleMessageIds.length?!1:e.visibleMessageIds.every((e,n)=>e===t.visibleMessageIds[n])}function CF({autoScroll:e,defaultScrollPosition:t,scrollEdgeThreshold:n,scrollMargin:r,scrollPreviousItemPeek:i}){let a=v.useRef(e),o=v.useRef(!1),s=v.useRef(null),c=v.useRef(!1),l=v.useRef(n),u=v.useRef(0),d=v.useRef(null),f=v.useRef(0),p=v.useRef(e?`following-bottom`:`free-scrolling`),m=v.useRef(new Map),h=v.useRef(null),g=v.useRef(null),_=v.useRef(null),y=v.useRef(i),b=v.useRef(!0),x=v.useRef(null),S=v.useRef(r),C=v.useRef(null),w=v.useRef(0),T=v.useRef(0),E=v.useRef(null),D=v.useRef(null),O=v.useRef(null),k=v.useRef(null),A=v.useRef(null),j=v.useRef(null),M=v.useRef(null),N=v.useRef(null),P=v.useRef(null),F=v.useRef(new Set),I=v.useRef(new WeakSet);return O.current===null&&(O.current=yF(t===`end`||t===`last-anchor`,(e,t)=>e===t)),k.current===null&&(k.current=yF(QP,xF)),P.current===null&&(P.current=bF()),a.current=e,l.current=n,S.current=r,y.current=i,{autoScrollRef:a,autoscrollingRef:o,autoscrollingTimeoutRef:A,streamingTurnRef:_,contentRef:s,defaultScrollPositionAppliedRef:c,firstItemRef:d,itemCountRef:u,lastScrollTopRef:f,messageElementsRef:m,modeRef:p,pendingScrollFrameRef:C,pendingScrollToMessageRef:h,prependRestoreRef:g,preserveScrollOnPrependRef:b,pendingDefaultScrollStore:O.current,rootRef:x,scrollEdgeThresholdRef:l,scrollMarginRef:S,scrollPreviousItemPeekRef:y,spacerGapRef:w,spacerHeightRef:T,spacerRef:E,stateFrameRef:D,stateStore:k.current,viewportRef:j,visibilityFrameRef:M,visibilityObserverRef:N,visibilityStore:P.current,visibleMessageIdsRef:F,handledScrollAnchorsRef:I}}function wF(e){e.pendingDefaultScrollStore.setSnapshot(!1)}function TF(e){e.defaultScrollPositionAppliedRef.current=!0,wF(e)}function EF({refs:e,commitScrollState:t,scheduleStateCommit:n,scheduleVisibilitySync:r}){let{streamingTurnRef:i,autoScrollRef:a,autoscrollingRef:o,autoscrollingTimeoutRef:s,contentRef:c,itemCountRef:l,messageElementsRef:u,modeRef:d,pendingScrollToMessageRef:f,prependRestoreRef:p,scrollMarginRef:m,scrollPreviousItemPeekRef:h,spacerGapRef:g,spacerHeightRef:_,spacerRef:y,viewportRef:b}=e,x=v.useCallback(e=>{s.current!==null&&(window.clearTimeout(s.current),s.current=null),o.current!==e&&(o.current=e,t()),e&&(s.current=window.setTimeout(()=>{s.current=null,o.current=!1,t()},XP))},[t]),S=v.useCallback(e=>{let t=y.current;if(!t)return;let n=Math.max(0,Math.ceil(e));_.current!==n&&(_.current=n,t.hidden=n===0,t.style.height=`${n}px`,t.style.marginTop=n>0?`${-g.current}px`:``)},[]),C=v.useCallback((e,{behavior:r=`auto`,autoscrolling:i=!1}={})=>{let a=b.current;if(!a)return;let o=Math.max(0,e);Math.abs(a.scrollTop-o)<=YP?(a.scrollTop=o,t()):(i&&x(!0),a.scrollTo({top:o,behavior:r}),n())},[t,n,x]),w=v.useCallback(({behavior:e=`auto`}={})=>b.current?(S(0),i.current=null,d.current=`free-scrolling`,C(0,{behavior:e}),r(),!0):!1,[r,C,S]),T=v.useCallback(({behavior:e=`auto`}={})=>{let t=b.current;return t?(S(0),i.current=null,d.current=a.current?`following-bottom`:`free-scrolling`,C(pF(t),{autoscrolling:!0,behavior:e}),r(),!0):!1},[r,C,S]),E=v.useCallback((e,{align:t=`start`,behavior:n=`auto`,scrollMargin:a=m.current}={},{keepPreviousPeek:o=!1}={})=>{let s=c.current,l=b.current;if(!s||!l||!s.contains(e))return!1;let u=cF({align:t,element:e,scrollMargin:o?a+h.current:a,spacer:y.current,viewport:l}),f=dF({content:s,scrollTop:u,spacer:y.current,viewport:l});return S(f),p.current={element:e,viewportTop:uF(e,l)},d.current=o?`anchored-to-message`:`settling-jump`,i.current=o?e:null,C(u,{behavior:n}),r(),!0},[r,C,S]),D=v.useCallback(()=>{let e=i.current;return!e||!e.isConnected||d.current!==`anchored-to-message`?!1:E(e,{align:`start`},{keepPreviousPeek:!0})},[E]),O=v.useCallback((t,n)=>{let r=u.current.get(t);return r?(TF(e),E(r,n)?(f.current=null,!0):(f.current={messageId:t,options:n},!0)):l.current===0&&(f.current={messageId:t,options:n},TF(e),!0)},[E]);return{flushPendingScrollToMessage:v.useCallback(()=>{let t=f.current;if(!t)return!1;let n=u.current.get(t.messageId);return!n||!E(n,t.options)?!1:(f.current=null,TF(e),!0)},[E]),reanchorToAnchoredMessage:D,scrollToElement:E,scrollToEnd:T,scrollToMessage:O,scrollToStart:w}}function DF(e,t){return v.useCallback(n=>{e.current=n,n&&t()},[e,t])}function OF({autoScroll:e=!1,defaultScrollPosition:t=`end`,scrollEdgeThreshold:n=KP,scrollPreviousItemPeek:r=qP,scrollMargin:i=JP}){let a=CF({autoScroll:e,defaultScrollPosition:t,scrollEdgeThreshold:n,scrollMargin:i,scrollPreviousItemPeek:r}),{streamingTurnRef:o,autoScrollRef:s,autoscrollingRef:c,autoscrollingTimeoutRef:l,contentRef:u,defaultScrollPositionAppliedRef:d,firstItemRef:f,itemCountRef:p,lastScrollTopRef:m,messageElementsRef:h,modeRef:g,pendingScrollFrameRef:_,pendingScrollToMessageRef:y,prependRestoreRef:b,preserveScrollOnPrependRef:x,pendingDefaultScrollStore:S,rootRef:C,scrollEdgeThresholdRef:w,scrollMarginRef:T,scrollPreviousItemPeekRef:E,spacerGapRef:D,spacerHeightRef:O,spacerRef:k,stateFrameRef:A,stateStore:j,viewportRef:M,visibilityFrameRef:N,visibilityObserverRef:P,visibilityStore:F,visibleMessageIdsRef:I,handledScrollAnchorsRef:L}=a,R=v.useRef(t);R.current!==t&&(R.current=t,d.current=!1);let z=v.useCallback(e=>{let t=C.current,n=M.current,r=[e.start&&`start`,e.end&&`end`].filter(Boolean).join(` `),i=c.current;for(let e of[t,n])e&&(r?e.setAttribute(`data-scrollable`,r):e.removeAttribute(`data-scrollable`),e.toggleAttribute(`data-autoscrolling`,i))},[]),B=v.useCallback(e=>{let t=M.current?.scrollTop??0,n=t<m.current-YP;m.current=t,s.current&&!e.end&&g.current!==`settling-jump`&&g.current!==`anchored-to-message`?g.current=`following-bottom`:g.current===`following-bottom`&&e.end&&n&&!c.current&&(g.current=`free-scrolling`)},[]),V=v.useCallback(()=>{let e=eF({content:u.current,scrollEdgeThreshold:w.current,spacer:k.current,viewport:M.current});B(e);let t=g.current===`following-bottom`?{...e,end:!1}:e;z(t),j.setSnapshot(t)},[B,j,z]),H=v.useCallback(()=>{A.current===null&&(A.current=window.requestAnimationFrame(()=>{A.current=null,V()}))},[V]),U=v.useCallback(()=>{F.hasListeners()&&N.current===null&&(N.current=window.requestAnimationFrame(()=>{N.current=null,F.hasListeners()&&F.setSnapshot(tF({content:u.current,scrollMargin:T.current,scrollPreviousItemPeek:E.current,spacer:k.current,viewport:M.current,visibleMessageIds:I.current}))}))},[F]),{flushPendingScrollToMessage:ee,reanchorToAnchoredMessage:te,scrollToElement:ne,scrollToEnd:W,scrollToMessage:re,scrollToStart:ie}=EF({refs:a,commitScrollState:V,scheduleStateCommit:H,scheduleVisibilitySync:U}),ae=v.useCallback(()=>{let e=b.current,t=M.current;if(!e||!t||!e.element.isConnected)return!1;let n=uF(e.element,t)-e.viewportTop;return Math.abs(n)<=YP?!1:(t.scrollTop+=n,e.viewportTop=uF(e.element,t),H(),U(),!0)},[H,U]),G=v.useCallback(()=>{let e=u.current,t=M.current;if(!e||!t){b.current=null;return}let n=sF({content:e,spacer:k.current,viewport:t});b.current=n?{element:n,viewportTop:uF(n,t)}:null},[]),K=v.useCallback(()=>{_.current===null&&(_.current=window.requestAnimationFrame(()=>{_.current=null,ee()&&G()}))},[G,ee]),q=v.useCallback(()=>{if(!t||d.current||p.current===0)return!1;let e=!1;if(t===`last-anchor`){let t=u.current,n=M.current,r=t&&n?oF(nF(t,k.current)):null;if(!t||!n||!r)e=W({behavior:`auto`});else{let i=lF(r,n);e=fF({content:t,spacer:k.current,viewport:n})-i<=n.clientHeight?W({behavior:`auto`}):ne(r,{align:`start`},{keepPreviousPeek:!0})}}else e=t===`end`?W({behavior:`auto`}):ie({behavior:`auto`});return e?(TF(a),!0):!1},[t,ne,W,ie]),oe=v.useCallback(()=>{let e=u.current;if(!e)return;let t=nF(e,k.current),n=p.current,r=f.current;p.current=t.length,f.current=t[0]??null,(()=>{if(ee())return;if(n===0){if(q()||t.length>0&&s.current&&W({behavior:`auto`}))return;V(),U();return}let e=r?t.indexOf(r):-1;if(x.current&&e>0)ae();else{if(t.length>n){let e=rF(t,n);if(e){if(s.current&&g.current===`following-bottom`&&aF(t,n)){W({behavior:`auto`});return}ne(e,{align:`start`},{keepPreviousPeek:!0}),L.current.add(e);return}}if(t.length===n){let e=iF(t,L.current);if(e){ne(e,{align:`start`},{keepPreviousPeek:!0}),L.current.add(e);return}}g.current===`following-bottom`&&s.current?W({behavior:`auto`}):(V(),U())}})(),G()},[q,G,V,ee,ae,U,ne,W]),J=v.useCallback(()=>{if(g.current===`following-bottom`&&s.current){W({behavior:`auto`});return}let e=O.current;te()?s.current&&e>0&&O.current===0&&W({behavior:`auto`}):(H(),U())},[te,H,U,W]),se=v.useCallback(()=>{let e=M.current;if(e&&F.hasListeners()){if(typeof IntersectionObserver>`u`){U();return}P.current||=new IntersectionObserver(e=>{for(let t of e){let e=t.target.dataset.messageId;e&&(t.isIntersecting?I.current.add(e):I.current.delete(e))}U()},{root:e,rootMargin:`${-(T.current+E.current)}px 0px 0px 0px`,threshold:[0,.01,.5,1]}),h.current.forEach(e=>{P.current?.observe(e)}),U()}},[U,F]),ce=v.useCallback(()=>{N.current!==null&&(window.cancelAnimationFrame(N.current),N.current=null),P.current?.disconnect(),P.current=null,I.current.clear(),F.setSnapshot($P)},[F]),le=v.useCallback((e,t,n)=>{t?(h.current.set(e,t),P.current?.observe(t),U(),y.current?.messageId===e&&K()):n&&h.current.get(e)===n&&(h.current.delete(e),I.current.delete(e),P.current?.unobserve(n),U())},[K,U]),ue=v.useCallback(()=>{(g.current===`following-bottom`||g.current===`anchored-to-message`||g.current===`settling-jump`)&&(o.current=null,g.current=`free-scrolling`)},[]),de=v.useCallback(()=>z(j.getSnapshot()),[j,z]),fe=DF(C,de),pe=DF(M,de),me=v.useCallback(e=>{u.current=e},[]),he=v.useCallback(e=>{k.current=e,D.current=gF(e?.parentElement??null)},[]),ge=v.useCallback(()=>{V(),U(),G()},[G,V,U]),_e=v.useMemo(()=>({handleContentChange:oe,handleResize:J,observeVisibility:se,pendingDefaultScrollStore:S,preserveScrollOnPrependRef:x,scrollToEnd:W,scrollToMessage:re,scrollToStart:ie,setContentElement:me,setRootElement:fe,setSpacerElement:he,setViewportElement:pe,stateStore:j,syncAfterScroll:ge,unobserveVisibility:ce,userScrollIntent:ue,viewportRef:M,visibilityStore:F}),[oe,J,se,S,W,re,ie,me,fe,he,pe,j,ge,ce,ue,F]);return v.useLayoutEffect(()=>{q()||p.current===0&&wF(a)},[q]),v.useEffect(()=>()=>{A.current!==null&&(window.cancelAnimationFrame(A.current),A.current=null),N.current!==null&&(window.cancelAnimationFrame(N.current),N.current=null),l.current!==null&&(window.clearTimeout(l.current),l.current=null),_.current!==null&&(window.cancelAnimationFrame(_.current),_.current=null),P.current?.disconnect(),P.current=null},[]),v.useLayoutEffect(()=>{e&&g.current===`following-bottom`&&p.current>0?W({behavior:`auto`}):V()},[e,V,W]),{context:_e,registerMessage:le}}function kF(e){let t=v.useRef(e);return t.current=e,t}var AF=v.createContext(null),jF=v.createContext(null);function MF(){let e=v.useContext(AF);if(!e)throw Error(`useMessageScroller must be used within a MessageScroller.`);return e}function NF(){let e=v.useContext(jF);if(!e)throw Error(`MessageScrollerItem must be used within a MessageScroller.`);return e}function PF({autoScroll:e=!1,children:t,defaultScrollPosition:n=`end`,scrollEdgeThreshold:r,scrollPreviousItemPeek:i,scrollMargin:a}){let{context:o,registerMessage:s}=OF({autoScroll:e,defaultScrollPosition:n,scrollEdgeThreshold:r,scrollPreviousItemPeek:i,scrollMargin:a});return(0,S.jsx)(AF.Provider,{value:o,children:(0,S.jsx)(jF.Provider,{value:s,children:t})})}function FF(){let{pendingDefaultScrollStore:e}=MF();return v.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function IF({children:e,...t}){let{setRootElement:n}=MF(),r=FF();return(0,S.jsx)(`div`,{ref:n,...t,...r?{"data-pending-scroll":``}:null,children:e})}function LF({"aria-label":e,children:t,onKeyDown:n,onScroll:r,onTouchMove:i,onWheel:a,preserveScrollOnPrepend:o=!0,ref:s,role:c,tabIndex:l,...u}){let{handleResize:d,preserveScrollOnPrependRef:f,setViewportElement:p,syncAfterScroll:m,userScrollIntent:h,viewportRef:g}=MF(),_=FF();f.current=o;let y=v.useCallback(e=>{p(e),GP(s)?.(e)},[s,p]);function b(e){m(),r?.(e)}function x(e){h(),a?.(e)}function C(e){h(),i?.(e)}function w(e){ZP.has(e.key)&&h(),n?.(e)}return v.useEffect(()=>{let e=g.current;if(!e||typeof ResizeObserver>`u`)return;let t=0,n=new ResizeObserver(()=>{window.cancelAnimationFrame(t),t=window.requestAnimationFrame(d)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.disconnect()}},[d,g]),(0,S.jsx)(`div`,{ref:y,role:c??`region`,"aria-label":e??`Messages`,tabIndex:l??0,onKeyDown:w,onScroll:b,onTouchMove:C,onWheel:x,...u,..._?{"data-pending-scroll":``}:null,children:t})}function RF({"aria-relevant":e,children:t,ref:n,role:r,spacerClassName:i,...a}){let{handleContentChange:o,handleResize:s,setContentElement:c,setSpacerElement:l}=MF(),u=v.useRef(null),d=v.useCallback(e=>{u.current=e,c(e),GP(n)?.(e)},[n,c]);return v.useLayoutEffect(()=>{let e=u.current;if(!e||(o(),typeof MutationObserver>`u`))return;let t=new MutationObserver(()=>{o()});return t.observe(e,{childList:!0}),()=>t.disconnect()},[o]),v.useEffect(()=>{let e=u.current;if(!e||typeof ResizeObserver>`u`)return;let t=0,n=new ResizeObserver(()=>{window.cancelAnimationFrame(t),t=window.requestAnimationFrame(s)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.disconnect()}},[s]),(0,S.jsxs)(`div`,{ref:d,role:r??`log`,"aria-relevant":e??`additions`,...a,children:[t,(0,S.jsx)(`div`,{ref:l,"aria-hidden":`true`,"data-message-scroller-spacer":``,hidden:!0,className:i})]})}function zF({messageId:e,ref:t,scrollAnchor:n=!1,...r}){let i=NF(),a=v.useRef(null),o=v.useCallback(n=>{let r=a.current;a.current=n,e&&i(e,n,r),GP(t)?.(n)},[e,t,i]);return(0,S.jsx)(`div`,{ref:o,"data-message-id":e,"data-scroll-anchor":n?`true`:`false`,...r})}function BF({behavior:e=`smooth`,children:t,direction:n=`end`,onClick:r,render:i,tabIndex:a,type:o=`button`,...s}){let{scrollToEnd:c,scrollToStart:l,stateStore:u}=MF(),d=kF(r),f=v.useCallback(e=>u.subscribe(e),[u]),p=v.useCallback(()=>{let e=u.getSnapshot();return n===`start`?e.start:e.end},[n,u]),m=v.useSyncExternalStore(f,p,p),h=v.useCallback(t=>{m&&(d.current?.(t),t.defaultPrevented||(t.currentTarget.blur(),n===`start`?l({behavior:e}):c({behavior:e})))},[e,n,m,d,c,l]);return BP({defaultTagName:`button`,props:VP({type:o,inert:!m,tabIndex:m?a:-1,children:t??(0,S.jsxs)(`span`,{children:[`Scroll to `,n]}),onClick:h},s),render:i,state:{active:m,direction:n},stateAttributesMapping:{active:e=>({"data-active":e?`true`:`false`})}})}var VF={Provider:PF,Root:IF,Viewport:LF,Content:RF,Item:zF,Button:BF};function HF(e){return(0,S.jsx)(VF.Provider,{...e})}function UF({className:e,...t}){return(0,S.jsx)(VF.Root,{"data-slot":`message-scroller`,className:X(`group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden`,e),...t})}function WF({className:e,...t}){return(0,S.jsx)(VF.Viewport,{"data-slot":`message-scroller-viewport`,className:X(`size-full min-h-0 min-w-0 scroll-fade-b scrollbar-thin scrollbar-gutter-stable overflow-y-auto overscroll-contain contain-content data-autoscrolling:scrollbar-thumb-transparent data-autoscrolling:scrollbar-track-transparent data-pending-scroll:invisible`,e),...t})}function GF({className:e,...t}){return(0,S.jsx)(VF.Content,{"data-slot":`message-scroller-content`,className:X(`flex h-max min-h-full flex-col gap-6`,e),...t})}function KF({className:e,scrollAnchor:t=!1,...n}){return(0,S.jsx)(VF.Item,{"data-slot":`message-scroller-item`,scrollAnchor:t,className:X(`min-w-0 shrink-0 [contain-intrinsic-size:auto_10rem] [content-visibility:auto]`,e),...n})}function qF({direction:e=`end`,className:t,children:n,render:r,variant:i=`secondary`,size:a=`icon-sm`,...o}){return(0,S.jsx)(VF.Button,{"data-slot":`message-scroller-button`,"data-direction":e,"data-variant":i,"data-size":a,direction:e,className:X(`absolute inset-s-1/2 -translate-x-1/2 border-border bg-background text-foreground transition-[translate,scale,opacity] duration-200 hover:bg-muted hover:text-foreground data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[active=false]:duration-400 data-[active=false]:ease-[cubic-bezier(0.7,0,0.84,0)] data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100 data-[active=true]:ease-[cubic-bezier(0.23,1,0.32,1)] data-[direction=end]:bottom-4 data-[direction=end]:data-[active=false]:translate-y-full data-[direction=start]:top-4 data-[direction=start]:data-[active=false]:-translate-y-full rtl:translate-x-1/2 data-[direction=start]:[&_svg]:rotate-180`,t),render:r??(0,S.jsx)(vf,{variant:i,size:a}),...o,children:n??(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(hu,{}),(0,S.jsx)(`span`,{className:`sr-only`,children:e===`end`?`Scroll to end`:`Scroll to start`})]})})}function JF({...e}){return(0,S.jsx)(XC,{"data-slot":`collapsible`,...e})}function YF({...e}){return(0,S.jsx)(QC,{"data-slot":`collapsible-trigger`,...e})}function XF({...e}){return(0,S.jsx)(tw,{"data-slot":`collapsible-content`,...e})}function ZF({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`trace`,className:X(`flex w-full min-w-0 flex-col gap-2 *:has-[>[data-slot=trace-line]]:flex *:has-[>[data-slot=trace-line]]:w-fit *:has-[>[data-slot=trace-line]]:max-w-full *:has-[>[data-slot=trace-line]]:min-w-0 *:has-[>[data-slot=trace-line]]:rounded-md *:has-[>[data-slot=trace-line]]:text-left *:has-[>[data-slot=trace-line]]:outline-none *:has-[>[data-slot=trace-line]]:focus-visible:ring-3 *:has-[>[data-slot=trace-line]]:focus-visible:ring-ring/50`,e),...t})}function QF({className:e,status:t,...n}){return(0,S.jsx)(`span`,{"data-slot":`trace-line`,"data-status":t,className:X(`flex w-fit max-w-full min-w-0 items-center gap-2 text-sm text-muted-foreground transition-colors in-[a,button]:cursor-pointer in-[a:hover,button:hover]:text-foreground data-[status=error]:text-destructive data-[status=error]:in-[a:hover,button:hover]:text-destructive data-[status=pending]:opacity-60 data-[status=running]:*:data-[slot=trace-title]:shimmer`,e),...n})}function $F({className:e,...t}){return(0,S.jsx)(`span`,{"data-slot":`trace-icon`,"aria-hidden":`true`,className:X(`flex size-4 shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [[data-slot=trace-title]~&]:-ml-1`,e),...t})}function eI({className:e,...t}){return(0,S.jsx)(`span`,{"data-slot":`trace-title`,className:X(`min-w-0 truncate motion-reduce:shimmer-none`,e),...t})}function tI({className:e,...t}){return(0,S.jsx)(JF,{"data-slot":`trace-collapsible`,className:X(`flex w-full min-w-0 flex-col`,e),...t})}function nI({className:e,children:t,...n}){return(0,S.jsxs)(YF,{"data-slot":`trace-collapsible-trigger`,className:X(`group/trace-collapsible-trigger flex w-fit max-w-full min-w-0 cursor-pointer items-center gap-1 rounded-md text-left text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50 has-[[data-status=error]]:text-destructive`,e),...n,children:[t,(0,S.jsx)($F,{className:`transition-transform group-aria-expanded/trace-collapsible-trigger:rotate-90`,children:(0,S.jsx)(Du,{})})]})}function rI({className:e,children:t,...n}){return(0,S.jsx)(XF,{"data-slot":`trace-collapsible-content`,className:`h-(--collapsible-panel-height) min-w-0 overflow-hidden transition-[height] duration-200 data-ending-style:h-0 data-starting-style:h-0`,...n,children:(0,S.jsx)(`div`,{"data-slot":`trace-collapsible-content-inner`,className:X(`mt-2 mb-1 ml-[calc(--spacing(2)-1px)] min-w-0 border-l pr-1 pl-4 leading-relaxed wrap-break-word text-muted-foreground`,e),children:t})})}function iI(e){let t=[];for(let n of e){let e=t.at(-1);n.role===`assistant`&&e?.role===`assistant`?e.messages.push(n):t.push({id:n.id,role:n.role,messages:[n]})}return t}function aI(e,t){let n=[];for(let r of e){r.text&&n.push({type:`text`,text:r.text});for(let e of r.tools??[]){let r=t?.(e),i=n.at(-1);r==null?i?.type===`steps`?i.tools.push(e):n.push({type:`steps`,tools:[e]}):n.push({type:`result`,id:e.id,node:r})}}return n}function oI({host:e}){let[t,n]=(0,v.useState)(!1);return t?(0,S.jsx)($u,{}):(0,S.jsx)(`img`,{src:`https://icons.duckduckgo.com/ip3/${e}.ico`,alt:``,className:`size-3 shrink-0 rounded-sm`,onError:()=>n(!0)})}var sI=6;function cI({sources:e}){let t=new Map;for(let n of e){let e=new URL(n.url).hostname;t.has(e)||t.set(e,n)}let n=t.size-sI;return(0,S.jsxs)(`ul`,{"aria-label":`Sources`,className:`flex flex-wrap gap-1 pl-6`,children:[[...t].slice(0,sI).map(([e,t])=>(0,S.jsx)(`li`,{children:(0,S.jsxs)(Xl,{children:[(0,S.jsxs)(Gl,{render:(0,S.jsx)(cf,{variant:`outline`,render:(0,S.jsx)(`a`,{href:t.url,target:`_blank`,rel:`noopener noreferrer`})}),children:[(0,S.jsx)(oI,{host:e}),e.replace(/^www\./,``)]}),(0,S.jsx)(Kl,{className:`wrap-anywhere`,children:t.title??t.url})]})},e)),n>0&&(0,S.jsx)(`li`,{children:(0,S.jsxs)(cf,{variant:`secondary`,children:[`+`,n]})})]})}function lI({tool:e}){let t=(0,S.jsxs)(QF,{status:e.status===`complete`?void 0:e.status,children:[(0,S.jsx)($F,{children:e.sources?(0,S.jsx)($u,{}):(0,S.jsx)(Nd,{})}),(0,S.jsx)(eI,{children:e.label})]}),n=e.output?(0,S.jsxs)(tI,{children:[(0,S.jsx)(nI,{children:t}),(0,S.jsx)(rI,{children:(0,S.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap text-xs`,children:e.output})})]}):t;return e.sources?.length?(0,S.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[n,(0,S.jsx)(cI,{sources:e.sources})]}):n}function uI({quote:e}){return(0,S.jsx)(ZF,{children:(0,S.jsxs)(tI,{defaultOpen:!0,children:[(0,S.jsx)(nI,{children:(0,S.jsxs)(QF,{children:[(0,S.jsx)($F,{children:(0,S.jsx)(kd,{})}),(0,S.jsx)(eI,{children:e.source})]})}),(0,S.jsxs)(rI,{children:[(0,S.jsx)(`p`,{className:`max-h-48 overflow-auto whitespace-pre-wrap text-foreground`,children:e.text}),e.href&&(0,S.jsx)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,className:`block truncate text-xs underline underline-offset-4`,children:e.href})]})]})})}var dI=(0,v.memo)(function({text:e}){return(0,S.jsx)(`div`,{className:`flex min-w-0 flex-col gap-2 text-sm leading-relaxed wrap-break-word`,children:(0,S.jsx)(EP,{skipHtml:!0,allowedElements:[`p`,`strong`,`em`,`a`,`ul`,`ol`,`li`,`code`,`pre`,`br`,`blockquote`],components:{a:({children:e,href:t})=>(0,S.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,className:`underline underline-offset-4`,children:e}),ul:({children:e})=>(0,S.jsx)(`ul`,{className:`list-disc pl-5`,children:e}),ol:({children:e})=>(0,S.jsx)(`ol`,{className:`list-decimal pl-5`,children:e}),pre:({children:e})=>(0,S.jsx)(`pre`,{className:`overflow-auto whitespace-pre-wrap`,children:e})},children:e})})});function fI({messages:e,prompt:t,onPromptChange:n,busy:r,disabled:i=!1,error:a,onSend:o,onStop:s,renderTool:c,model:l,placeholder:u=`Ask the agent…`,emptyTitle:d=`What would you like to do?`,emptyDescription:f=`Ask a question or describe a change. You stay in control of what gets applied.`}){let[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(``),_=a||h,y=(0,v.useId)(),b=r||p;async function x(){let e=t.trim();if(!(!e||b||i)){m(!0),g(``);try{await o(e)&&n(t=>t.trim()===e?``:t)}catch(e){g(e instanceof Error?e.message:`Could not send. Please try again.`)}finally{m(!1)}}}return(0,S.jsxs)(`section`,{"aria-label":`Agent conversation`,className:`flex min-h-0 min-w-0 flex-1 flex-col gap-4`,children:[(0,S.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,S.jsx)(HF,{autoScroll:!0,children:(0,S.jsxs)(UF,{children:[(0,S.jsx)(WF,{children:(0,S.jsx)(GF,{children:e.length===0?(0,S.jsx)(KF,{messageId:`empty`,children:(0,S.jsx)(Vd,{children:(0,S.jsxs)(Hd,{children:[(0,S.jsx)(Ud,{children:d}),(0,S.jsx)(Wd,{children:f})]})})}):iI(e).map(e=>(0,S.jsx)(KF,{messageId:e.id,scrollAnchor:e.role===`user`,children:(0,S.jsx)(RP,{align:e.role===`user`?`end`:`start`,children:(0,S.jsx)(zP,{children:e.role===`user`?(0,S.jsxs)(`div`,{className:`flex min-w-0 flex-col items-end gap-2`,children:[e.messages[0].quote&&(0,S.jsx)(uI,{quote:e.messages[0].quote}),(0,S.jsx)(IP,{align:`end`,variant:`muted`,children:(0,S.jsx)(LP,{className:`whitespace-pre-wrap`,children:e.messages[0].text})})]}):(0,S.jsx)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:aI(e.messages,c).map((e,t)=>e.type===`text`?(0,S.jsx)(dI,{text:e.text},t):e.type===`steps`?(0,S.jsx)(ZF,{children:e.tools.map(e=>(0,S.jsx)(lI,{tool:e},e.id))},e.tools[0].id):(0,S.jsx)(`div`,{className:`min-w-0`,children:e.node},e.id))})})})},e.id))})}),(0,S.jsx)(qF,{})]})})}),_&&(0,S.jsxs)(MP,{variant:`destructive`,children:[(0,S.jsx)(NP,{children:`The agent could not continue`}),(0,S.jsx)(PP,{children:_})]}),(0,S.jsxs)(`form`,{className:`shrink-0`,onSubmit:e=>{e.preventDefault(),x()},children:[(0,S.jsx)(`label`,{htmlFor:y,className:`sr-only`,children:`Message the agent`}),(0,S.jsxs)(iE,{children:[(0,S.jsx)(uE,{id:y,value:t,onChange:e=>n(e.target.value),className:`max-h-40`,onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),x())},placeholder:u,disabled:i,maxLength:4e3,rows:2}),(0,S.jsx)(oE,{align:`block-end`,className:`justify-end`,children:b?(0,S.jsxs)(cE,{type:`button`,size:`sm`,variant:`outline`,onClick:s,disabled:p||i,children:[(0,S.jsx)(Td,{"data-icon":`inline-start`}),`Stop`]}):(0,S.jsxs)(cE,{type:`submit`,size:`sm`,variant:t.trim()?`default`:`secondary`,disabled:i,"aria-disabled":i||!t.trim(),children:[(0,S.jsx)(yu,{"data-icon":`inline-start`}),`Send`]})})]})]}),(0,S.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-2`,children:[(0,S.jsx)(`p`,{role:`status`,className:`truncate text-xs text-muted-foreground`,children:b?`Agent working. You can stop it at any time.`:`Enter to send. Shift+Enter for a new line.`}),l&&(0,S.jsxs)(Xl,{children:[(0,S.jsxs)(Gl,{render:(0,S.jsx)(cf,{variant:`secondary`}),children:[(0,S.jsx)(xu,{}),l.name,` · `,l.thinking]}),(0,S.jsxs)(Kl,{children:[`Model `,l.name,`, thinking `,l.thinking]})]})]})]})}var pI=768;function mI(){let[e,t]=v.useState(void 0);return v.useEffect(()=>{let e=window.matchMedia(`(max-width: 767px)`),n=()=>{t(window.innerWidth<pI)};return e.addEventListener(`change`,n),t(window.innerWidth<pI),()=>e.removeEventListener(`change`,n)},[]),!!e}function hI({...e}){return(0,S.jsx)(Ty,{"data-slot":`sheet`,...e})}function gI({...e}){return(0,S.jsx)(sy,{"data-slot":`sheet-portal`,...e})}function _I({className:e,...t}){return(0,S.jsx)(Bv,{"data-slot":`sheet-overlay`,className:X(`fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs`,e),...t})}function vI({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,S.jsxs)(gI,{children:[(0,S.jsx)(_I,{}),(0,S.jsxs)(ay,{"data-slot":`sheet-content`,"data-side":n,className:X(`fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm`,e),...i,children:[t,r&&(0,S.jsxs)(Vv,{"data-slot":`sheet-close`,render:(0,S.jsx)(vf,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`}),children:[(0,S.jsx)(Fd,{}),(0,S.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function yI({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`sheet-header`,className:X(`flex flex-col gap-0.5 p-4`,e),...t})}function bI({className:e,...t}){return(0,S.jsx)(Ey,{"data-slot":`sheet-title`,className:X(`font-heading text-base font-medium text-foreground`,e),...t})}function xI({className:e,...t}){return(0,S.jsx)(Hv,{"data-slot":`sheet-description`,className:X(`text-sm text-muted-foreground`,e),...t})}var SI=`sidebar_state`,CI=604800,wI=`16rem`,TI=`18rem`,EI=`3rem`,DI=`b`,OI=v.createContext(null);function kI(){let e=v.useContext(OI);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function AI({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:a,...o}){let s=mI(),[c,l]=v.useState(!1),[u,d]=v.useState(e),f=t??u,p=v.useCallback(e=>{let t=typeof e==`function`?e(f):e;n?n(t):d(t),document.cookie=`${SI}=${t}; path=/; max-age=${CI}`},[n,f]),m=v.useCallback(()=>s?l(e=>!e):p(e=>!e),[s,p,l]);v.useEffect(()=>{let e=e=>{e.key===DI&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),m())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[m]);let h=f?`expanded`:`collapsed`,g=v.useMemo(()=>({state:h,open:f,setOpen:p,isMobile:s,openMobile:c,setOpenMobile:l,toggleSidebar:m}),[h,f,p,s,c,l,m]);return(0,S.jsx)(OI.Provider,{value:g,children:(0,S.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:{"--sidebar-width":wI,"--sidebar-width-icon":EI,...i},className:X(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),...o,children:a})})}function jI({side:e=`left`,variant:t=`sidebar`,collapsible:n=`offcanvas`,className:r,children:i,dir:a,...o}){let{isMobile:s,state:c,openMobile:l,setOpenMobile:u}=kI();return n===`none`?(0,S.jsx)(`div`,{"data-slot":`sidebar`,className:X(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),...o,children:i}):s?(0,S.jsx)(hI,{open:l,onOpenChange:u,...o,children:(0,S.jsxs)(vI,{dir:a,"data-sidebar":`sidebar`,"data-slot":`sidebar`,"data-mobile":`true`,className:`w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden`,style:{"--sidebar-width":TI},side:e,children:[(0,S.jsxs)(yI,{className:`sr-only`,children:[(0,S.jsx)(bI,{children:`Sidebar`}),(0,S.jsx)(xI,{children:`Displays the mobile sidebar.`})]}),(0,S.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:i})]})}):(0,S.jsxs)(`div`,{className:`group peer hidden text-sidebar-foreground md:block`,"data-state":c,"data-collapsible":c===`collapsed`?n:``,"data-variant":t,"data-side":e,"data-slot":`sidebar`,children:[(0,S.jsx)(`div`,{"data-slot":`sidebar-gap`,className:X(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,t===`floating`||t===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`)}),(0,S.jsx)(`div`,{"data-slot":`sidebar-container`,"data-side":e,className:X(`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex`,t===`floating`||t===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,r),...o,children:(0,S.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:i})})]})}function MI({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:X(`flex flex-col gap-2 p-2`,e),...t})}function NI({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:X(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,e),...t})}function PI({children:e,agent:t,title:n=`Agent`}){return(0,S.jsx)(AI,{defaultOpen:!1,style:{"--sidebar-width":`24rem`},children:(0,S.jsx)(FI,{agent:t,title:n,children:e})})}function FI({children:e,agent:t,title:n}){let{open:r,openMobile:i,isMobile:a,toggleSidebar:o}=kI(),s=a?i:r,[c,l]=(0,v.useState)(!1),u=(0,v.useRef)(null);return(0,v.useEffect)(()=>{s?l(!0):c&&u.current?.focus()},[s,c]),(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`min-w-0 flex-1`,children:e}),(0,S.jsx)(`div`,{hidden:s,className:`fixed right-6 bottom-6 z-20`,children:(0,S.jsxs)(vf,{ref:u,"aria-label":`Open agent`,"aria-expanded":s,onClick:o,children:[(0,S.jsx)(ld,{"data-icon":`inline-start`}),n]})}),(0,S.jsx)(jI,{side:`right`,collapsible:`offcanvas`,children:(0,S.jsxs)(`div`,{inert:!s,className:`flex h-full min-h-0 flex-col`,children:[(0,S.jsx)(MI,{children:(0,S.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,S.jsx)(`h2`,{className:`text-sm font-medium`,children:n}),(0,S.jsx)(vf,{variant:`ghost`,size:`icon-sm`,"aria-label":`Minimize agent`,onClick:o,children:(0,S.jsx)(hd,{})})]})}),(0,S.jsx)(NI,{className:`overflow-hidden`,children:(0,S.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 p-4`,children:c?t:null})})]})})]})}function II(e){let t=e.match(/https?:\/\/[^\s"'<>()[\]]+/g)??[];return[...new Set(t.map(e=>e.replace(/[.,;:!?]+$/,``)))].filter(e=>URL.canParse(e)).map(e=>({url:e}))}var LI=e=>typeof e==`string`?e.split(`
76
- `)[0]:void 0,RI=e=>e>1?` and ${e-1} more`:``,zI=({url:e,urls:t})=>[e,t].flat().filter(e=>typeof e==`string`&&URL.canParse(e)),BI={running:`Running`,complete:`Ran`,error:`Failed to run`},VI={bash:{verbs:BI,subject:({command:e})=>LI(e)},read:{verbs:{running:`Reading`,complete:`Read`,error:`Failed to read`},subject:({path:e})=>LI(e)},edit:{verbs:{running:`Editing`,complete:`Edited`,error:`Failed to edit`},subject:({path:e})=>LI(e)},write:{verbs:{running:`Writing`,complete:`Wrote`,error:`Failed to write`},subject:({path:e})=>LI(e)},grep:{verbs:{running:`Searching for`,complete:`Searched for`,error:`Failed to search for`},subject:({pattern:e})=>LI(e)},find:{verbs:{running:`Finding`,complete:`Found`,error:`Failed to find`},subject:({pattern:e})=>LI(e)},ls:{verbs:{running:`Listing`,complete:`Listed`,error:`Failed to list`},subject:({path:e})=>LI(e)},web_search:{verbs:{running:`Searching`,complete:`Searched`,error:`Failed to search`},subject:({query:e,queries:t})=>{let n=Array.isArray(t)?t:[e];return typeof n[0]==`string`?`for “${n[0]}”${RI(n.length)}`:`the web`},sources:(e,t)=>t?II(t):void 0},fetch_content:{verbs:{running:`Reading`,complete:`Read`,error:`Failed to read`},subject:e=>{let t=zI(e);return t.length?`${new URL(t[0]).hostname}${RI(t.length)}`:`a page`},sources:e=>zI(e).map(e=>({url:e}))}};function HI(e,t,n,r=VI){let i=r[e.name];return i?{label:`${i.verbs[t]} ${i.subject(e.arguments)??``}`.trim(),sources:i.sources?.(e.arguments,n)}:{label:`${BI[t]} ${e.name}`}}var UI=(0,v.createContext)({});function WI(e){let t=(0,v.useRef)(null);return t.current===null&&(t.current=e()),t.current}var GI=typeof window<`u`?v.useLayoutEffect:v.useEffect,KI=(0,v.createContext)(null);function qI(e,t){e.indexOf(t)===-1&&e.push(t)}function JI(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var YI=(e,t,n)=>n>t?t:n<e?e:n,XI={},ZI=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),QI=e=>typeof e==`object`&&!!e,$I=e=>/^0[^.\s]+$/u.test(e);function eL(e){let t;return()=>(t===void 0&&(t=e()),t)}var tL=e=>e,nL=(...e)=>e.reduce((e,t)=>n=>t(e(n))),rL=(e,t,n)=>{let r=t-e;return r?(n-e)/r:1},iL=class{constructor(){this.subscriptions=[]}add(e){return qI(this.subscriptions,e),()=>this.remove(e)}remove(e){JI(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r){if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){let r=this.subscriptions[i];r&&r(e,t,n)}}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},aL=e=>e*1e3,oL=e=>e/1e3,sL=(e,t)=>t?1e3/t*e:0,cL=(e,t,n)=>{let r=t-e;return((n-e)%r+r)%r+e},lL=(e,t,n)=>e*(3*(1-e)*((1-e)*t+e*n)+e*e);function uL(e,t,n,r){return e===t&&n===r?tL:i=>{let a=0,o=1,s=i;for(let t=0;;t++){s>=a&&s<=o||(s=(a+o)/2);let r=lL(s,e,n)-i;if(r*r<1e-28||t===40)break;r>0?o=s:a=s,s-=r*1e-7/(lL(s+1e-7,e,n)-i-r)}return lL(s,t,r)}}var dL=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,fL=e=>t=>1-e(1-t),pL=uL(.33,1.53,.69,.99),mL=fL(pL),hL=dL(mL),gL=e=>e>=1?1:(e*=2)<1?.5*mL(e):.5*(2-2**(-10*(e-1))),_L=e=>1-Math.sin(Math.acos(e)),vL=fL(_L),yL=dL(_L),bL=uL(.42,0,1,1),xL=uL(0,0,.58,1),SL=uL(.42,0,.58,1),CL=e=>Array.isArray(e)&&typeof e[0]!=`number`;function wL(e,t){return CL(e)?e[cL(0,e.length,t)]:e}var TL=e=>Array.isArray(e)&&typeof e[0]==`number`,EL={linear:tL,easeIn:bL,easeInOut:SL,easeOut:xL,circIn:_L,circInOut:yL,circOut:vL,backIn:mL,backInOut:hL,backOut:pL,anticipate:gL},DL=e=>typeof e==`string`,OL=e=>{if(TL(e)){let[t,n,r,i]=e;return uL(t,n,r,i)}return DL(e)?EL[e]:e},kL={delta:0,timestamp:0,isProcessing:!1},AL;function jL(){AL=void 0}var ML={now:()=>(AL===void 0&&ML.set(kL.isProcessing||XI.useManualTiming?kL.timestamp:performance.now()),AL),set:e=>{AL=e,queueMicrotask(jL)}},NL=e=>Math.round(e*1e5)/1e5,PL=e=>t=>typeof t==`string`&&t.startsWith(e),FL=PL(`--`),IL=PL(`var(--`),LL=e=>IL(e)?RL.test(e.split(`/*`)[0].trim()):!1,RL=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function zL(e){return typeof e==`string`&&e.split(`/*`)[0].includes(`var(--`)}var BL={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},VL={...BL,transform:e=>YI(0,1,e)},HL={...BL,default:1},UL=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function WL(e){return e==null}var GL=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,KL=(e,t)=>n=>!!(typeof n==`string`&&GL.test(n)&&n.startsWith(e)||t&&!WL(n)&&Object.prototype.hasOwnProperty.call(n,t)),qL=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(UL);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},JL=e=>YI(0,255,e),YL={...BL,transform:e=>Math.round(JL(e))},XL={test:KL(`rgb`,`red`),parse:qL(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+YL.transform(e)+`, `+YL.transform(t)+`, `+YL.transform(n)+`, `+NL(VL.transform(r))+`)`},ZL=(e,t,n)=>{let r=e.substring(1+t*n,1+(t+1)*n);return n>1?r:r+r};function QL(e){let t=e.length>5?2:1,n=ZL(e,3,t);return{red:parseInt(ZL(e,0,t),16),green:parseInt(ZL(e,1,t),16),blue:parseInt(ZL(e,2,t),16),alpha:n?parseInt(n,16)/255:1}}var $L={test:KL(`#`),parse:QL,transform:XL.transform},eR=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),tR=eR(`deg`),nR=eR(`%`),rR=eR(`px`),iR=eR(`vh`),aR=eR(`vw`),oR={...nR,parse:e=>nR.parse(e)/100,transform:e=>nR.transform(e*100)},sR={test:KL(`hsl`,`hue`),parse:qL(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+nR.transform(NL(t))+`, `+nR.transform(NL(n))+`, `+NL(VL.transform(r))+`)`},cR={test:e=>XL.test(e)||$L.test(e)||sR.test(e),parse:e=>XL.test(e)?XL.parse(e):sR.test(e)?sR.parse(e):$L.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?XL.transform(e):sR.transform(e),getAnimatableNone:e=>{let t=cR.parse(e);return t.alpha=0,cR.transform(t)}},lR=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,uR=new RegExp(UL.source),dR=new RegExp(lR.source,`i`);function fR(e){return isNaN(e)&&typeof e==`string`&&(uR.test(e)||dR.test(e))}var pR=`number`,mR=`color`,hR=`var`,gR=`var(`,_R="${}",vR=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)(?![a-z]*\()/giu;function yR(e){let t=e.toString();return uR.test(t)||dR.test(t)}function bR(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(vR,e=>(cR.test(e)?(r.color.push(a),i.push(mR),n.push(cR.parse(e))):e.startsWith(gR)?(r.var.push(a),i.push(hR),n.push(e)):(r.number.push(a),i.push(pR),n.push(parseFloat(e))),++a,_R)).split(_R),indexes:r,types:i}}function xR(e){return bR(e).values}function SR({split:e,types:t}){let n=e.length;return r=>{let i=``;for(let a=0;a<n;a++)if(i+=e[a],r[a]!==void 0){let e=t[a];i+=e===pR?NL(r[a]):e===mR?cR.transform(r[a]):r[a]}return i}}function CR(e){return SR(bR(e))}var wR=e=>typeof e==`number`?0:cR.test(e)?cR.getAnimatableNone(e):e,TR=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:wR(e);function ER(e){let t=bR(e);return SR(t)(t.values.map((e,n)=>TR(e,t.split[n])))}var DR={test:fR,parse:xR,createTransformer:CR,getAnimatableNone:ER};function OR(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function kR({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=OR(s,r,e+1/3),a=OR(s,r,e),o=OR(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function AR(e,t){return n=>n>0?t:e}var jR=(e,t,n)=>e+(t-e)*n,MR=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},NR=[$L,XL,sR],PR=e=>NR.find(t=>t.test(e));function FR(e){let t=PR(e);if(!t)return!1;let n=t.parse(e);return t===sR&&(n=kR(n)),n}var IR=(e,t)=>{let n=FR(e),r=FR(t);if(!n||!r)return AR(e,t);let i={...n};return e=>(i.red=MR(n.red,r.red,e),i.green=MR(n.green,r.green,e),i.blue=MR(n.blue,r.blue,e),i.alpha=jR(n.alpha,r.alpha,e),XL.transform(i))},LR=new Set([`none`,`hidden`]);function RR(e,t){return LR.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function zR(e,t){return n=>jR(e,t,n)}function BR(e){return typeof e==`number`?zR:typeof e==`string`?LL(e)?AR:cR.test(e)?IR:WR:Array.isArray(e)?VR:typeof e==`object`?cR.test(e)?IR:HR:AR}function VR(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>BR(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function HR(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=BR(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function UR(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let a=t.types[i],o=e.indexes[a][r[a]],s=e.values[o]??0;n[i]=s,r[a]++}return n}var WR=(e,t)=>{let n=bR(e),r=bR(t);return n.indexes.var.length===r.indexes.var.length&&n.indexes.color.length===r.indexes.color.length&&n.indexes.number.length>=r.indexes.number.length?LR.has(e)&&!r.values.length||LR.has(t)&&!n.values.length?RR(e,t):nL(VR(UR(n,r),r.values),SR(r)):AR(e,t)},GR=/^(-?(?:\d+(?:\.\d*)?|\.\d+))([a-z%]*)$/iu;function KR(e,t){let n=GR.exec(e);if(!n)return;let r=GR.exec(t);if(!r||n[2]!==r[2])return;let i=n[2],a=parseFloat(n[1]),o=parseFloat(r[1]);return e=>NL(jR(a,o,e))+i}function qR(e,t,n){if(typeof e==`number`&&typeof t==`number`&&typeof n==`number`)return jR(e,t,n);if(typeof e==`string`&&typeof t==`string`){let n=KR(e,t);if(n)return n}return BR(e)(e,t)}var JR=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`];function YR(e){let t=new Set,n=new Set,r=!1,i=!1,a,o=new Set,s={delta:0,timestamp:0,isProcessing:!1};function c(t){o.has(t)&&(n.add(t),e()),(a=t)(s)}let l={schedule:(e,i=!1,s=!1)=>{let c=s&&r,l=c?t:n;return i&&o.add(e),c&&e!==a&&l.delete(e),l.add(e),e},cancel:e=>{n.delete(e),o.delete(e)},process:e=>{if(s=e,r){i=!0;return}r=!0;let o=t;t=n,n=o,t.forEach(c),t.clear(),a=void 0,r=!1,i&&(i=!1,l.process(e))}};return l}var XR=40;function ZR(e,t,n={delta:0,timestamp:0,isProcessing:!1}){let r=!1,i=!0,a=()=>r=!0,o=JR.reduce((e,t)=>(e[t]=YR(a),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=XI.useManualTiming,o=a?n.timestamp:performance.now();r=!1,a||(n.delta=i?1e3/60:Math.max(Math.min(o-n.timestamp,XR),1)),n.timestamp=o,n.isProcessing=!0,s.process(n),c.process(n),l.process(n),u.process(n),d.process(n),f.process(n),p.process(n),m.process(n),n.isProcessing=!1,r&&t&&(i=!1,e(h))},g=()=>{r=!0,i=!0,n.isProcessing||e(h)};return{schedule:JR.reduce((e,t)=>{let n=o[t];return e[t]=(e,t=!1,i=!1)=>(r||g(),n.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t<JR.length;t++)o[JR[t]].cancel(e)},state:n,steps:o}}var{schedule:QR,cancel:$R,steps:ez}=ZR(typeof requestAnimationFrame<`u`?requestAnimationFrame:tL,!0,kL),tz=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>QR.update(t,e),stop:()=>$R(t),now:()=>kL.isProcessing?kL.timestamp:ML.now()}},nz=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t<i;t++)r+=Math.round(e(t/(i-1))*1e4)/1e4+`, `;return`linear(${r.substring(0,r.length-2)})`},rz=2e4;function iz(e,t=50,n=rz,r){let i=0,a=e.next(i);for(r?.push(a.value);!a.done&&i<n;)i+=t,a=e.next(i),r?.push(a.value);return i>=n?1/0:i}function az(e,t=100,n){let{keyframes:r,velocity:i}=e,a=r&&r[r.length-1]-r[0],o=n({...e,velocity:i&&a?i*t/a:i,keyframes:[0,t]}),s=Math.min(iz(o),rz);return{type:`keyframes`,ease:e=>o.next(s*e).value/t,duration:oL(s)}}var oz=100,sz=10,cz=1,lz=800,uz=.3,dz=.3,fz=.01,pz=2,mz=.005,hz=.5,gz=.01,_z=10,vz=.05,yz=e=>e<0?1/Math.max(1+e,vz):Math.max(1-e,vz);function bz(e,t){if(!(e>1))return 1;let n=Math.sqrt(e*e-1),r=e-n,i=e+n,a=2*n*Math.exp(-t)*(1+t);return Cz(e=>i*Math.exp(-r*e)-r*Math.exp(-i*e)-a,e=>Math.exp(-i*e)-Math.exp(-r*e),t)/t}function xz(e,t){return e*Math.sqrt(1-t*t)}var Sz=12;function Cz(e,t,n){let r=n;for(let n=1;n<Sz;n++)r-=e(r)/t(r);return r}var wz=.001;function Tz({duration:e=lz,bounce:t=uz}){let n,r,i=yz(t);e=YI(gz,_z,oL(e)),i<1?(n=t=>{let n=t*i,r=n*e,a=xz(t,i),o=Math.exp(-r);return wz-n/a*o},r=t=>{let r=t*i*e,a=i*i*t*t*e,o=Math.exp(-r),s=xz(t*t,i);return(-n(t)+wz>0?-1:1)*-a*o/s}):(n=t=>-.001+Math.exp(-t*e)*(t*e+1),r=t=>Math.exp(-t*e)*(-t*(e*e)));let a=5/e,o=Cz(n,r,a),s=o*bz(i,o*e),c=s*s;return{stiffness:c,damping:i*2*Math.sqrt(c),duration:aL(e)}}var Ez=(e,t)=>(t?e>=0:e>0)&&e<1/0;function Dz(e,t){if(Ez(e,t))return e}function Oz(e){let t=Dz(e.stiffness),n=Dz(e.damping,!0),r=Dz(e.mass),i={...e,stiffness:t??oz,damping:n??sz,mass:r??cz,isResolvedFromDuration:!1,isTimeDefined:(t??n??r)===void 0&&(e.duration!==void 0||e.bounce!==void 0)};if(i.isTimeDefined){if(e.visualDuration){let t=yz(e.bounce||0),n=2*Math.PI/(e.visualDuration*1.2)*bz(t,2*Math.PI/1.2);i.stiffness=n*n,i.damping=2*t*Math.sqrt(i.stiffness)}else Object.assign(i,Tz(i)),i.isResolvedFromDuration=!0;(!Ez(i.stiffness)||!Ez(i.damping,!0))&&(i.stiffness=oz,i.damping=sz)}return i}function kz(e=dz,t=uz){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},r=n.keyframes[0],i=n.keyframes[n.keyframes.length-1],a={done:!1,value:r},{stiffness:o,damping:s,mass:c,duration:l,isResolvedFromDuration:u,isTimeDefined:d}=Oz({...n}),f=e=>u?0:-oL(e),p=s/(2*Math.sqrt(o*c)),m=oL(Math.sqrt(o/c)),h=p*m,g={target:i,delta:i-r,velocity:f(n.velocity)||0,restSpeed:0,restDelta:0},_=()=>{let e=Math.abs(g.delta)<5;g.restSpeed=n.restSpeed||(e?fz:pz),g.restDelta=n.restDelta||(e?mz:hz)};_();let v,y,b;if(p<1){let e=xz(m,p),t={A:0,sinC:0,cosC:0,t:-1,env:0,sin:0,cos:0};b=()=>{t.A=(g.velocity+h*g.delta)/e,t.sinC=h*t.A+g.delta*e,t.cosC=h*g.delta-t.A*e};let n=n=>{n!==t.t&&(t.t=n,t.env=Math.exp(-h*n),t.sin=Math.sin(e*n),t.cos=Math.cos(e*n))};v=e=>(n(e),g.target-t.env*(t.A*t.sin+g.delta*t.cos)),y=e=>(n(e),t.env*(t.sinC*t.sin+t.cosC*t.cos))}else if(p===1){v=e=>g.target-Math.exp(-m*e)*(g.delta+(g.velocity+m*g.delta)*e);let e={C:0};b=()=>{e.C=g.velocity+m*g.delta},y=t=>Math.exp(-m*t)*(m*e.C*t-g.velocity)}else{let e=m*Math.sqrt(p*p-1),t=h-e,n=h+e,r=e<1||d?1/0:300/e,i=(e,t)=>Math.exp(t>r?(h-e)*r-h*t:-e*t),a={S:0,F:0};b=()=>{let t=(g.velocity+h*g.delta)/e;a.S=(g.delta+t)/2,a.F=(g.delta-t)/2},v=e=>g.target-a.S*i(t,e)-a.F*i(n,e),y=e=>t*a.S*i(t,e)+n*a.F*i(n,e)}b();let x=u&&l||null,S={calculatedDuration:x,retarget:(e,t)=>{g.target=e[e.length-1],g.delta=g.target-e[0],g.velocity=f(t),n.restSpeed&&n.restDelta||_(),S.calculatedDuration=x,a.done=!1,b()},velocity:e=>aL(y(e)),next:e=>{let t=v(e);if(u)a.done=e>=l;else{let n=aL(y(e));a.done=Math.abs(n)<=g.restSpeed&&Math.abs(g.target-t)<=g.restDelta}return a.value=a.done?g.target:t,a},toString:()=>{let e=Math.min(iz(S),rz),t=nz(t=>S.next(e*t).value,e,30);return e+`ms `+t}};return S}var Az=Object.assign(kz,{applyToOptions:e=>{let t=az(e,100,kz);return e.ease=t.ease,e.duration=aL(t.duration),e.type=`keyframes`,e}});function jz({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>e<s||e>c,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)<Math.abs(c-e)?s:c,h=n*t,g=d+h,_=o?o(g):g;_!==g&&(h=_-d);let v=e=>-h*Math.exp(-e/r),y=e=>{let t=v(e);f.done=Math.abs(t)<=l,f.value=f.done?_:e?_+t:d},b,x,S=e=>{p(f.value)&&(b=e,x=Az({keyframes:[f.value,m(f.value)],velocity:-v(e)/r*1e3,damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return S(0),{calculatedDuration:null,next:e=>{let t=!1;return!x&&b===void 0&&(t=!0,y(e),S(e)),b!==void 0&&e>=b?x.next(e-b):(!t&&y(e),f)}}}function Mz(e,t,n){let r=[],i=XI.mix||qR,a=e.length-1;for(let o=0;o<a;o++){let a=n?.(e[o],e[o+1])||i(e[o],e[o+1]);t&&(a=nL(Array.isArray(t)?t[o]||tL:t,a)),r.push(a)}return r}function Nz(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let a=e.length;if(a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=Mz(t,r,i),c=s.length,l=n=>{if(o&&n<e[0])return t[0];let r=0;if(c>1)for(;r<e.length-2&&!(n<e[r+1]);r++);let i=rL(e[r],e[r+1],n);return s[r](i)};return n?t=>l(YI(e[0],e[a-1],t)):l}function Pz(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=rL(0,t,r);e.push(jR(n,1,i))}}function Fz(e){let t=[0];return Pz(t,e.length-1),t}function Iz(e,t){return e.map(e=>e*t)}function Lz(e,t){return e.map(()=>t||SL).splice(0,e.length-1)}function Rz({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`,mixer:i}){let a=typeof t[0]==`number`?void 0:i,o=CL(r)?r.map(OL):OL(r)||SL,s={done:!1,value:t[0]},c=-1;if(!a){for(let e=1;e<t.length;e++)if(t[e]!==t[e-1]){if(c>=0){c=-2;break}c=e-1}}if(c>=0){let r=n&&n.length===t.length?n:Fz(t),i=r[c]*e,a=r[c+1]*e,l=t[c],u=t[c+1],d=Array.isArray(o)?o[c]:o,f=(XI.mix||qR)(l,u),p=t.length-2;return{calculatedDuration:e,next:t=>(s.value=c&&t<i?f(0):c<p&&(t>=a||!e)?typeof u==`number`?u:f(1):f(d(t>=a||!e?1:t<=i?0:(t-i)/(a-i))),s.done=t>=e,s)}}let l=Nz(Iz(n&&n.length===t.length?n:Fz(t),e),t,{ease:Array.isArray(o)?o:Lz(t,o),mixer:a});return{calculatedDuration:e,next:t=>(s.value=l(t),s.done=t>=e,s)}}var zz=5;function Bz(e,t,n){let r=Math.max(t-zz,0);return sL(n-e(r),t-r)}function Vz(e,t,n=0){return t<=0?n:e.velocity?e.velocity(t):Bz(t=>e.next(t).value,t,e.next(t).value)}function Hz(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a,o,s=0;for(let t=0;t<e.length;t++){let n=e[t];n!==null&&(s++||(a=n),o=n)}let c=i<0||t&&n!==`loop`&&t%2==1?0:s-1;return!c||r===void 0?c?o:a:r}var Uz={decay:jz,inertia:jz,tween:Rz,keyframes:Rz,spring:Az};function Wz(e){typeof e.type==`string`&&(e.type=Uz[e.type])}var Gz=40,Kz=(e,t)=>t-e>Gz&&!XI.useManualTiming?t:e;function qz(e,t){return{kind:e,animation:t,timestamp:ML.now(),frameTimestamp:kL.timestamp,frameIsProcessing:kL.isProcessing}}function Jz(e,t,n){let r=globalThis.__MOTION_INSPECT__;if(r)try{r({...qz(`animation-start`,e),options:n?{...t,...n}:t})}catch{}}function Yz(e,t){let n=globalThis.__MOTION_INSPECT__;if(n)try{n({...qz(`layout-animation-start`,e),node:t})}catch{}}var Xz=class{constructor(){this.isResolved=!1}get finished(){return this._finished||=this.isResolved?Promise.resolve():new Promise(e=>{this._resolve=e}),this._finished}updateFinished(){this._finished=this._resolve=void 0,this.isResolved=!1}notifyFinished(){this.isResolved=!0,this._resolve?.()}then(e,t){return this.finished.then(e,t)}},Zz=e=>e/100,Qz=e=>Math.round(e*1e4)/1e4,$z=class extends Xz{constructor(e){super(),this.state=`idle`,this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{let{motionValue:e}=this.options,t=ML.now();e&&e.updatedAt!==t&&this.tick(e.updatedAt=t),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause(),Jz(this,this.options)}initAnimation(){let{options:e}=this;Wz(e);let{type:t=Rz,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||Rz;this.mixKeyframes=void 0,s!==Rz&&typeof o[0]!=`number`&&(this.mixKeyframes=nL(Zz,e.mixer?.(o[0],o[1])||qR(o[0],o[1])),o=[0,100]);let c=s(o===e.keyframes?e:{...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=iz(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){this.currentTime=this.holdTime??Math.round(e-this.startTime)*this.playbackSpeed}tick(e,t=!1){let{generator:n,totalDuration:r,calculatedDuration:i}=this;if(this.startTime===null)return n.next(0);let{delay:a=0,keyframes:o,type:s,onUpdate:c,finalKeyframe:l}=this.options;this.startTime===this.pendingStartTime&&(this.startTime=Kz(this.startTime,e)),this.pendingStartTime=void 0,this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let u=this.currentTime-a*(this.playbackSpeed>=0?1:-1),d=this.playbackSpeed>=0?u<0:u>r;this.currentTime=Math.max(u,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let f=this.generate(this.currentTime,d),{done:p}=f;d||(p=this.playbackSpeed>=0?i<1/0?this.currentTime>=r:p:this.currentTime<=0);let m=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&p);return m&&s!==jz&&(f.value=Hz(o,this.options,l,this.speed)),c&&c(f.value),m&&this.finish(),f}at(e){return this.holdTime??Qz((e-this.startTime)*this.playbackSpeed)}sampleAt(e,t){let{options:n,totalDuration:r}=this,i=this.at(e)-(n.delay||0);return i>=r&&n.type!==jz?Hz(n.keyframes,n,t?void 0:n.finalKeyframe):this.generate(Math.max(i,0),i<0).value}generate(e,t){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o}=this,{keyframes:s,repeat:c,repeatType:l,repeatDelay:u}=this.options,d=e,f=n;if(c){let t=Math.min(e,r)/o,n=Math.floor(t),i=t%1;!i&&t>=1&&(i=1),i===1&&n--,n=Math.min(n,c+1),n%2&&(l===`reverse`?(i=1-i,u&&(i-=u/o)):l===`mirror`&&(f=a)),d=YI(0,1,i)*o}let p;return t?(this.delayState.value=s[0],p=this.delayState):p=f.next(d),i&&!t&&(p.value=i(p.value)),p}get duration(){return oL(this.calculatedDuration)}get iterationDuration(){return this.duration+oL(this.options.delay??0)}get time(){return oL(this.currentTime)}set time(e){this.state===`finished`&&this.updateFinished(),e=aL(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state=`paused`,this.holdTime=e,this.tick(e))}getGeneratorVelocity(){return Vz(this.generator,this.currentTime,this.options.velocity)}get speed(){return this.playbackSpeed}set speed(e){let t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(ML.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=oL(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=tz,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??(this.pendingStartTime=n):this.startTime=n-this.holdTime/(this.playbackSpeed||1),this.state===`finished`&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state=`running`,this.driver.start()}pause(){this.state=`paused`,this.updateTime(ML.now()),this.holdTime=this.currentTime}complete(){this.state!==`running`&&this.play(),this.state=`finished`,this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state=`finished`,this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state=`idle`,this.driver?.stop(),this.driver=void 0,this.startTime=this.holdTime=null}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}},eB=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function tB(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(UL)||[];if(!r)return e;let i=n.replace(r,``),a=+!!eB.has(t);return r!==n&&(a*=100),t+`(`+a+i+`)`}var nB=/\b([a-z-]*)\(.*?\)/gu,rB={...DR,getAnimatableNone:e=>{let t=e.match(nB);return t?t.map(tB).join(` `):e}},iB={...DR,getAnimatableNone:e=>{let t=DR.parse(e);return DR.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},aB={...BL,transform:Math.round},oB={rotate:tR,pathRotation:tR,rotateX:tR,rotateY:tR,rotateZ:tR,scale:HL,scaleX:HL,scaleY:HL,scaleZ:HL,skew:tR,skewX:tR,skewY:tR,distance:rR,translateX:rR,translateY:rR,translateZ:rR,x:rR,y:rR,z:rR,perspective:rR,transformPerspective:rR,opacity:VL,originX:oR,originY:oR,originZ:rR},sB={borderWidth:rR,borderTopWidth:rR,borderRightWidth:rR,borderBottomWidth:rR,borderLeftWidth:rR,borderRadius:rR,borderTopLeftRadius:rR,borderTopRightRadius:rR,borderBottomRightRadius:rR,borderBottomLeftRadius:rR,width:rR,maxWidth:rR,height:rR,maxHeight:rR,top:rR,right:rR,bottom:rR,left:rR,inset:rR,insetBlock:rR,insetBlockStart:rR,insetBlockEnd:rR,insetInline:rR,insetInlineStart:rR,insetInlineEnd:rR,padding:rR,paddingTop:rR,paddingRight:rR,paddingBottom:rR,paddingLeft:rR,paddingBlock:rR,paddingBlockStart:rR,paddingBlockEnd:rR,paddingInline:rR,paddingInlineStart:rR,paddingInlineEnd:rR,margin:rR,marginTop:rR,marginRight:rR,marginBottom:rR,marginLeft:rR,marginBlock:rR,marginBlockStart:rR,marginBlockEnd:rR,marginInline:rR,marginInlineStart:rR,marginInlineEnd:rR,fontSize:rR,backgroundPositionX:rR,backgroundPositionY:rR,...oB,zIndex:aB,fillOpacity:VL,strokeOpacity:VL,numOctaves:aB},cB={...sB,color:cR,backgroundColor:cR,outlineColor:cR,fill:cR,stroke:cR,borderColor:cR,borderTopColor:cR,borderRightColor:cR,borderBottomColor:cR,borderLeftColor:cR,filter:rB,WebkitFilter:rB,mask:iB,WebkitMask:iB},lB=e=>cB[e],uB=new Set([rB,iB]),dB,fB,pB;function mB(e,t){if(e===dB&&t===fB)return pB;let n=lB(e);return uB.has(n)||(n=DR),pB=n.getAnimatableNone?n.getAnimatableNone(t):void 0,dB=e,fB=t,pB}function hB(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var gB=e=>e*180/Math.PI,_B=e=>yB(gB(Math.atan2(e[1],e[0]))),vB={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scaleZ:()=>1,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:_B,rotateZ:_B,skewX:e=>gB(Math.atan(e[1])),skewY:e=>gB(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},yB=e=>(e%=360,e<0&&(e+=360),e),bB=_B,xB=e=>Math.hypot(e[0],e[1]),SB=e=>Math.hypot(e[4],e[5]),CB={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:xB,scaleY:SB,scaleZ:e=>Math.hypot(e[8],e[9],e[10]),scale:e=>(xB(e)+SB(e))/2,rotateX:e=>yB(gB(Math.atan2(e[6],e[5]))),rotateY:e=>yB(gB(Math.atan2(-e[2],e[0]))),rotateZ:bB,rotate:bB,skewX:e=>gB(Math.atan(e[4])),skewY:e=>gB(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function wB(e){return+!!e.includes(`scale`)}function TB(e,t){if(!e||e===`none`)return wB(t);let n=e.match(/^matrix(3d)?\(([-\d.e\s,]+)\)$/u);if(!n)return wB(t);let r=(n[1]?CB:vB)[t],i=n[2].split(`,`).map(e=>parseFloat(e));return typeof r==`function`?r(i):i[r]}var EB=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return TB(n,t)},DB=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`scaleZ`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],OB=new Set([...DB,`pathRotation`]),kB=e=>e===BL||e===rR,AB=new Set([`x`,`y`,`z`]),jB=DB.filter(e=>!AB.has(e));function MB(e){let t=[];return jB.forEach(n=>{let r=e.getValue(n);if(r!==void 0){let e=r.get(),i=+!!n.startsWith(`scale`);if(e===i)return;t.push([n,e]),r.set(i)}}),t}var NB=new Set([`bottom`,`right`]);function PB(e,t,n,r,i,a){let o=parseFloat(e);if(!isNaN(o))return o;let{min:s,max:c}=t()[n],l=c-s;return a===`border-box`?l:l-parseFloat(r)-parseFloat(i)}var FB=({transform:e})=>TB(e,`x`),IB=({transform:e})=>TB(e,`y`),LB={width:({width:e,paddingLeft:t=`0`,paddingRight:n=`0`,boxSizing:r},i)=>PB(e,i,`x`,t,n,r),height:({height:e,paddingTop:t=`0`,paddingBottom:n=`0`,boxSizing:r},i)=>PB(e,i,`y`,t,n,r),top:({top:e})=>parseFloat(e),left:({left:e})=>parseFloat(e),bottom:({top:e},t)=>{let{y:n}=t();return parseFloat(e)+(n.max-n.min)},right:({left:e},t)=>{let{x:n}=t();return parseFloat(e)+(n.max-n.min)},x:FB,y:IB,translateX:FB,translateY:IB},RB=new Set,zB=!1,BB=!1,VB=!1;function HB(){if(BB){let e=[],t=new Set,n=new Set;RB.forEach(r=>{r.needsMeasurement&&(e.push(r),t.add(r.element),NB.has(r.name)&&n.add(r.element))});let r=new Map;n.forEach(e=>{let t=MB(e);t.length&&(r.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=r.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}BB=!1,zB=!1,RB.forEach(e=>e.complete(VB)),RB.clear()}function UB(){RB.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(BB=!0)})}function WB(){VB=!0,UB(),HB(),VB=!1}function GB(e,t,n){if(typeof e==`string`){if(ZI(e)||$I(e))return parseFloat(e);if(!DR.test(e)&&DR.test(n))return mB(t,n)}return e??void 0}var KB=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(RB.add(this),zB||(zB=!0,QR.read(UB),QR.resolveKeyframes(HB))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=GB(n.readValue(t,a),t,a);r!==void 0&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}hB(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),RB.delete(this)}cancel(){this.state===`scheduled`&&(RB.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},qB=e=>e.startsWith(`--`);function JB(e,t,n){qB(t)?e.style.setProperty(t,n):e.style[t]=n}var YB={};function XB(e,t){let n=eL(e);return()=>YB[t]??n()}var ZB=XB(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),QB=XB(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),$B=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,eV={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:$B([0,.65,.55,1]),circOut:$B([.55,0,1,.45]),backIn:$B([.31,.01,.66,-.59]),backOut:$B([.33,1.53,.69,.99])};function tV(e,t){if(e)return typeof e==`function`?QB()?nz(e,t):`ease-out`:TL(e)?$B(e):Array.isArray(e)?e.map(e=>tV(e,t)||eV.easeOut):eV[e]}function nV(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=tV(s,i);Array.isArray(d)&&(u.easing=d);let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};return l&&(f.pseudoElement=l),e.animate(u,f)}function rV(e){return typeof e==`function`&&`applyToOptions`in e}function iV({type:e,...t}){return rV(e)&&QB()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var aV=class extends Xz{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e;let c=iV(e);this.animation=nV(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=this.onFinish=()=>{if(this.animation.onfinish=null,this.finishedTime=this.time,!i){let e=Hz(r,this.options,o,this.speed);this.updateMotionValue?.(e),JB(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()},Jz(this,e,c)}play(){this.isStopped||(this.manualStartTime=null,this.animation.onfinish=this.onFinish,this.animation.play(),this.state===`finished`&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.isStopped||(this.animation.onfinish=this.onFinish),this.animation.finish?.()}cancel(){this.animation.onfinish=null;try{this.animation.cancel()}catch{}}stop(){this.isStopped||(this.isStopped=!0,this.state!==`idle`&&this.finishedTime===null&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel()))}commitStyles(){let e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return oL(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+oL(e)}get time(){return oL(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=aL(e),t&&(this.animation.pause(),this.updateFinished())}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,onAttach:t,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=this.onFinish=null,e&&ZB()?(this.animation.timeline=e,t?.(this.animation),tL):n(this)}},oV={anticipate:gL,backInOut:hL,circInOut:yL};function sV(e){return e in oV}function cV(e){typeof e.ease==`string`&&sV(e.ease)&&(e.ease=oV[e.ease])}var lV=class extends aV{constructor(e){cV(e),Wz(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}elapsed(){return this.state===`running`?(ML.now()-this.startTime)*this.speed:this.time*1e3}sample(e){if(!this.sampler){let{motionValue:e,onUpdate:t,onComplete:n,onPlay:r,onStop:i,element:a,...o}=this.options;this.sampler=new $z({...o,autoplay:!1}),this.sampler.stop()}return this.sampler.sample(Math.max(0,e)).value}liveValue(){let{state:e}=this;if(e===`running`||e===`paused`)return this.sample(this.elapsed())}updateMotionValue(e){let{motionValue:t,element:n,name:r}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let{speed:i}=this,a=this.elapsed(),o=this.state===`running`&&i?YI(0,10,a):0,s=this.sample(a);n&&r&&JB(n,r,s),t.setWithVelocity(this.sample(a-o*Math.sign(i)),s,o/Math.abs(i||1))}},uV=(e,t)=>t!==`zIndex`&&!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(DR.test(e)||e===`0`)&&!e.startsWith(`url(`));function dV(e){let t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function fV(e,t,n,r){let i=e[0];if(i===null)return!1;if(t===`display`||t===`visibility`)return!0;let a=e[e.length-1],o=uV(i,t),s=uV(a,t);return!o||!s?!1:dV(e)||(n===`spring`||rV(n))&&r}function pV(e){e.duration=0,e.type=`keyframes`}var mV=new Set([`opacity`,`clipPath`,`filter`,`transform`]),hV=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function gV(e){for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&hV.test(e[t]))return!0;return!1}var _V=({mixer:e,keyframes:t})=>e&&typeof t[0]!=`number`&&t.some((n,r)=>r&&e(t[r-1],n)),vV=new Set([`color`,`backgroundColor`,`outlineColor`,`fill`,`stroke`,`borderColor`,`borderTopColor`,`borderRightColor`,`borderBottomColor`,`borderLeftColor`]),yV=()=>!XI.useManualTiming&&Object.hasOwnProperty.call(Element.prototype,`animate`);function bV(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o,keyframes:s}=e;if(!n||!(mV.has(n)||vV.has(n)))return!1;let c=t?.owner?.current;if(!(c instanceof HTMLElement)&&!(c instanceof SVGElement))return!1;let{onUpdate:l,transformTemplate:u}=t.owner.getProps();return yV()&&(mV.has(n)||vV.has(n)&&gV(s))&&(n!==`transform`||!u)&&!l&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`&&!_V(e)}var xV=(e,t)=>t&&typeof e==`number`?t.transform(e):e,SV={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},CV=DB.length,wV={},TV=(e,t,n=xV(t,oB[e]))=>(wV[e]||(wV[e]=(SV[e]||e)+`(`))+n+`)`,EV=(e,t)=>(typeof t==`number`?t:parseFloat(t))===+!!e.startsWith(`scale`);function DV(e,t,n){let r=``;for(let i=0;i<CV;i++){let a=DB[i],o=e[a];if(o===void 0)continue;let s=n&&(t[a]=xV(o,sB[a]));EV(a,o)||(r+=TV(a,o,s||void 0)+` `)}let i=e.pathRotation;return i&&(r+=TV(`rotate`,i)),r=r.trim(),n?n(t,r):r||`none`}var OV=new WeakMap,kV=200,AV=.001,jV=.1,MV=.001,NV=100,PV=100,FV=new Set([`linear`,`easeIn`,`easeOut`,`easeInOut`]),IV=e=>FV.has(e),LV=new WeakMap,RV=(e,t)=>{let n=LV.get(e);return n?.[0]!==t&&(n=[t,`linear(`+Fz(Array(t+1)).map(t=>Qz(e(t))+` `+Qz(t*100)+`%`)+`)`],LV.set(e,n)),n[1]},zV=(e,t)=>Math.min(kV,Math.max(2,Math.ceil((t-e)/10))),BV=(e,t)=>Math.abs(e-t)<=AV,VV=(e,t)=>e-t,HV=(e,t,n)=>Fz(Array(n+1)).map(n=>jR(e,t,n)),UV=e=>e.motionValue.owner,WV=e=>OV.get(e),GV=({state:e})=>e===`idle`||e===`finished`,KV=(e,t)=>e.latestValues?e.latestValues[t]:e.getValue(t)?.get(),qV=({name:e,motionValue:t})=>e&&DB.includes(e)&&t?.owner?.current instanceof HTMLElement&&yV()&&QB();function JV(e){let t=UV(e),{onUpdate:n,transformTemplate:r}=t.getProps();return!e.isHandoff&&!n&&!e.hasOnUpdate&&!r&&e.type!==`inertia`&&(KV(t,`transform`)||`none`)===`none`&&!KV(t,`pathRotation`)&&!t.projection?.isProjecting()&&!_V(e)}var YV=class{constructor(e,t,n,r){this.element=e,this.update=t,this.makeDriver=n,this.animation=r}get js(){return this.driver||=this.makeDriver(this.update)}now(){return this.driver||this.makeDriver!==tz?this.js.now():kL.isProcessing?kL.timestamp:ML.now()}start(e=!0){let t=WV(this.element);!t||t.isJS?this.js.start(e):t.schedule(!1,!e)}stopJS(){this.driver?.stop()}stop(){this.stopJS();let e=WV(this.element);e&&!e.isFinishing&&e.release(this.animation)}},XV,ZV=class extends $z{constructor(e){let t=UV(e).current,{driver:n=tz}=e,r,i=JV(e);e.driver=e=>new YV(t,e,n,r),super(e),r=this;let a=this.driver;a&&(a.animation=this),this.canAccelerate=i;let{stop:o}=this;this.stop=()=>{this.isAccelerated()&&this.sync(),o()}}offsets(){let{keyframes:e,times:t}=this.options;return t||(this.offsetsOf!==e&&(this.offsetsOf=e,this.cachedOffsets=Fz(e)),this.cachedOffsets)}get group(){return WV(UV(this.options).current)}get js(){return this.driver?.js}stopJS(){this.driver?.stopJS()}get name(){return this.options.name}timing(){let{startTime:e,speed:t,totalDuration:n}=this,{delay:r=0,repeatType:i}=this.options;return this.holdTime===null?n===1/0?[e+r/t,this.resolvedDuration*(i===`loop`?1:2)/t||1]:[e+(r+n)/t,0]:[1/0,0]}isAccelerated(){let{group:e,state:t}=this;return e?.tracks.has(this)&&!e.isJS&&this.canAccelerate&&(t===`running`||t===`paused`)}liveValue(){return this.isAccelerated()?this.sampleAt(ML.now()):void 0}tween(){let{keyframes:e,type:t,repeat:n,delay:r=0}=this.options,i=-1;if(n||t!==Rz||this.holdTime!==null)return;for(let t=1;t<e.length;t++)if(e[t]!==e[t-1]){if(i>=0)return;i=t-1}let{ease:a}=this.options;CL(a)&&(a=a[i]);let o=this.offsets(),s=e=>this.startTime+(r+o[e]*this.totalDuration)/this.speed;if(i>=0){let e=TL(a)?$B(a):IV(a)?eV[a]:OL(a);return[s(i),s(i+1),typeof e==`string`||BV(e(0),0)&&BV(e(1),1)?e:void 0]}}boundaries(e,t){let{startTime:n,speed:r,resolvedDuration:i,options:a}=this,{delay:o=0,repeat:s=0,repeatDelay:c=0,repeatType:l,type:u}=a,d=(u||Rz)===Rz?this.offsets():[0,1],f=n+o/r,p=[];if(this.holdTime!==null||!(i>0))return p;for(let n=Math.max(0,Math.floor((e-f)*r/i));n<=s;n++){let a=f+n*i/r;if(a>t)break;for(let o of d){let s=a+(n%2&&l&&l!==`loop`?1-o:o)*(i-c)/r;s>e&&s<t&&p.push(s)}}return p}numberAt(e){return parseFloat(this.sampleAt(e,!0))}sync(){let e=ML.now(),t=this.sampleAt(e,!0);this.options.motionValue.setWithVelocity(this.holdTime===null?this.sampleAt(e-10,!0):t,t,10)}play(){this.isStopped||((this.group||eH(UV(this.options))).tracks.add(this),super.play())}pause(){super.pause(),this.isAccelerated()&&this.group.schedule(!1)}complete(){super.complete();let{group:e}=this;e&&!e.isJS&&this.tick(ML.now())}get time(){return this.isAccelerated()?oL(YI(0,this.totalDuration,this.at(ML.now())-(this.options.delay||0))):super.time}set time(e){(XV??=Object.getOwnPropertyDescriptor($z.prototype,`time`).set).call(this,e)}attachTimeline(e){return this.canAccelerate=!1,this.group?.demote(!0),super.attachTimeline(e)}},QV,$V=e=>{QV||queueMicrotask(()=>{let e=QV;QV=void 0,e.forEach(e=>e())}),(QV||=[]).push(e)};function eH(e){let t=e.current,n=new Set,r=new Map,i={},a=[],o=new Map,s=[],c=!1,l=!1,u=!1,d=!1,f=-1/0,p,m=1/0,h,g=e=>{for(let t of n)if(t.name===e)return!0},_=(t,n)=>{let o={};for(let s of t===void 0?DB:a){let a=r.get(s),c=t===void 0?KV(e,s):a?a.sampleAt(n>t&&!a.timing()[1]?n:t):i[s];c!==void 0&&(o[s]=c)}return o},v=(e,t)=>{let n=``;for(let r in e){let i=e[r];(!t||!EV(r,i))&&(n+=TV(r,i)+` `)}return(t?n.trim():n)||`none`},y=(e,t)=>v(_(e,t)),b=(e=_())=>{t.style.transform=v(e,!0)},x=e=>{e.onfinish=e.oncancel=null,e.cancel()},S=(e=!0)=>{clearTimeout(p),m=1/0,h=void 0,e&&b(),s.forEach(({animation:e})=>x(e)),s=[]},C=(e,n)=>new Animation(new KeyframeEffect(t,e,n)),w=(e,t,n=1/0)=>{let r={animation:e,offset:t,end:n};e.startTime=ML.now()+t,n<1/0&&(e.onfinish=()=>{r.isDone=!0,s.some(e=>e.end===1/0)&&(x(e),s=s.filter(e=>e!==r)),F.schedule(!1)}),e.oncancel=()=>s.includes(r)&&F.demote(),s.push(r)},T=(e,t,n)=>{let r=(t,n)=>Math.abs(e(n)-e(t)),i=r(t,n);for(;n-t>.01;){let e=(t+n)/2;r(t,e)>r(e,n)?n=e:t=e}return r(t,n)>i/2?[t,n]:[]},E=(e,t,n,r)=>{let i=zV(t,n);if(r.length*4>i)return;let a;for(let r of e){let e=r.numberAt(t),i=(r.numberAt((t+n)/2)-e)/(r.numberAt(n)-e);if(i===i){if(a===void 0)a=i;else if(!BV(i,a))return}}let o=HV(t,n,i).concat(r).sort(VV),s=e=>rL(t,n,e),c,l;for(let n of e){let e=n.numberAt(t),r=o.map(t=>n.numberAt(t)-e),i=r[r.length-1],a=r.some(e=>Math.abs(e)*AV>Math.abs(i))?0:i,s=r.map(e=>a?e/a:e);if(a&&!c)c=s,l=t=>(n.numberAt(t)-e)/a;else if(s.some((e,t)=>!BV(e,a&&c[t])))return}if(!c||c.every((e,t)=>BV(e,s(o[t]))))return`linear`;let u=[],d=(e,t=l(e))=>u.push(Qz(t)+` `+Qz(s(e)*100)+`%`);return c.forEach((e,t)=>{t&&Math.abs(e-c[t-1])>.2&&T(l,o[t-1],o[t]).forEach(e=>d(e)),d(o[t],e)}),`linear(`+u+`)`},D=(e,t,n,r)=>{let i=[t],a=[],o=n,s=t;for(let r of e){let e=r.tween();if(e?.[2]!==`linear`){let[i,c]=r.timing(),[l,u]=e||[t,c?n:i];o=Math.min(o,l),s=Math.max(s,u),a.push(r)}}o=Math.max(t,o),s=Math.min(n,s);let c=(e,t)=>a.every(n=>!(Math.abs(n.numberAt((e+t)/2)-(n.numberAt(e)+n.numberAt(t))/2)>(n.name.startsWith(`scale`)?MV:jV))),l=(t,n,r)=>{if(n-t<1||c(t,n))i.push(n);else if(r<4)l(t,(t+n)/2,r+1),l((t+n)/2,n,r+1);else{for(let r of e)i.push(...T(e=>r.numberAt(e),t,n));i.push(n)}},u=s>o?HV(o,s,Math.ceil((s-o)/100)):[];u.push(n);for(let e of r)u.push(e,Math.min(e+.01,n));let d=t;for(let e of u.sort(VV))e>d&&l(d,e,0),d=e;return i.sort(VV)},O=e=>{let t;for(let n of e){let e=n.tween();if(!e||t&&(Math.abs(e[0]-t[0])>1||Math.abs(e[1]-t[1])>1))return;t=[e[0],e[1],!t||e[2]===t[2]?e[2]:void 0]}return t},k=(e,t,n,r,i={fill:`both`},a)=>{let o=r?[]:e.flatMap(e=>e.boundaries(t,n)),s=r||E(e,t,n,o),c=s?[t,n]:D(e,t,n,o),l=c.map(e=>y(e,a)),u={transform:l};return s||(u.offset=c.map(e=>rL(t,n,e))),l.every(e=>e===l[0])&&(b(_(t,a)),u=null),C(u,{...i,duration:n-t,easing:s||`linear`})},A=e=>{let t=ML.now()+e;t<m&&(clearTimeout(p),m=t,p=setTimeout(()=>{m=1/0,F.schedule(!1)},e))},j=t=>{let c=t,l=0,u=0,d=[],f=[],p=new Set;r.clear(),o=new Map;for(let e of n){r.set(e.name,e);let[n,i]=e.timing(),a=n===1/0;if(o.set(e,[e.at(t),e.speed,a]),!a){if(e.speed<0)return;if(i){if(l){let e=(n-u)/i;if(Math.abs(i-l)>1||Math.abs(e-Math.round(e))*l>1)return}else l=i,u=n;f.push(e)}else p.add(n);d.push(e),c=Math.max(c,n)}}i={},a=DB.filter(t=>{if(r.has(t))return!0;let n=i[t]=KV(e,t);return n!==void 0&&!EV(t,n)}),S(!1);let m=!l&&O(d);try{if(c>t){let e;if(m&&m[1]>t){let[n,r,i]=m;if(n-t>PV)return d.forEach(e=>e.sync()),A(h=n-t-PV),!0;e=typeof i==`string`?i:i?RV(i,zV(n,r)):E(d,n,r,[]),e&&w(k(d,n,r,e,{fill:`both`,endDelay:c-r}),n-t,c-n)}e||w(k(d,t,c),0,c-t),p.forEach(e=>e<c-1&&w(C(null,{duration:e-t}),0,e-t))}if(l){let e=u+Math.floor((c-u)/l)*l;w(k(f,e,e+l,void 0,{iterations:1/0,iterationStart:(c-e)/l,fill:`forwards`},c),c-t)}}catch{return}return s.length||S(),!0},M=(e,t)=>{let r,i=0;for(let t of n){let n=o.get(t);if(!n)return!1;let[a,c,l]=n,u=t.at(e),d=t.timing()[0]===1/0;if(l){if(d&&(u===a||!s.length))continue;return!1}let f=(u-a)/c,p=d?0:t.speed/c;if(r===void 0)r=f,i=p;else if(Math.abs(f-r)>1||p!==i)return!1}if(r===void 0)return!0;if(!s.length){if(h===void 0||t&&i)return!1;if(i){let e=(h-r)/i;if(e<1)return!1;A(e)}return!0}for(let{offset:e,end:n,isDone:i}of s){let a=r-e;if(n<1/0&&(i?a<n-1:a<0&&(t||e<=0)||a>=n))return!1}for(let{animation:t,offset:n,isDone:a}of s){if(a)continue;let o=r-n;i&&t.updatePlaybackRate&&t.playState===`running`&&Math.abs(Number(t.currentTime)-o)<20?t.playbackRate!==i&&t.updatePlaybackRate(i):i?(t.playbackRate!==i&&(t.playbackRate=i),t.startTime=e-o/i):(t.startTime=null,t.currentTime=o)}return!0},N=()=>!n.size&&(u=!0,WV(t)===F&&OV.delete(t),F.isJS||S(),!0),P=()=>{let t=ML.now();if(F.isJS||(F.isFinishing=!0,n.forEach(n=>{let[r,a]=n.timing();n.state===`running`&&n.speed>0&&!a&&r<=t+1&&(n.complete(),i[n.name]=KV(e,n.name),o.has(n)||(c=!0))}),F.isFinishing=!1),l=!1,u||(n.forEach(e=>GV(e)&&n.delete(e)),N()))return;for(let e of n)if(!e.canAccelerate)return F.demote(!0);F.isJS&&(F.isJS=!1,c=!0,n.forEach(e=>e.stopJS()));let r=c,a=d;if(c=d=!1,r||!M(t,a)){if(a){if(t-f<NV)return F.demote();f=t}if(!j(t))return F.demote()}else if(h!==void 0&&!a)return;n.forEach(e=>e.timing()[0]===1/0&&e.sync())},F={tracks:n,isJS:!1,isFinishing:!1,schedule(e,t){u||(c||=e,d||=!!t,l||(l=!0,kL.isProcessing?QR.render(P,!1,!0):$V(P)))},release(e){GV(e)&&n.delete(e),N()||F.schedule(!0)},check(){if(!F.isJS){for(let t in i)if(KV(e,t)!==i[t]&&!g(t))return F.schedule(!0,!0)}},demote(e){if(!(F.isJS||u))return n.forEach(t=>{t.isAccelerated()&&t.sync(),e||(t.canAccelerate=!1)}),F.isJS=!0,o=new Map,S(),n.forEach(e=>e.state===`running`&&e.js?.start()),!0}};return OV.set(t,F),F}var tH=class extends Xz{constructor(e){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=ML.now();let{keyframes:t,name:n,motionValue:r,element:i}=e,a=e;a.autoplay??=!0,a.delay??=0,a.type??=`keyframes`,a.repeat??=0,a.repeatDelay??=0,a.repeatType??=`loop`;let o=i?.KeyframeResolver||KB;this.keyframeResolver=new o(t,(e,t,n)=>this.onKeyframesResolved(e,t,a,!n),n,r,i),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=ML.now();let u=fV(e,i,a,o);u||((XI.instantAnimations||!s)&&l?.(Hz(e,n,t)),e[0]=e[e.length-1],pV(n),n.repeat=0);let{onComplete:d}=n;n.finalKeyframe=t,n.keyframes=e,n.onComplete=()=>{d?.(),this.notifyFinished()};let f=u&&!c&&bV(n),p=!f&&qV(n);r&&(f||p||this.resolvedAt!==this.createdAt)&&(n.startTime??=Kz(this.createdAt,this.resolvedAt));let m;if(f){n.element=n.motionValue?.owner?.current;try{m=new lV(n)}catch{m=new $z(n)}}else m=p?new ZV(n):new $z(n);this.pendingTimeline&&=(this.stopTimeline=m.attachTimeline(this.pendingTimeline),void 0),this._animation=m}get finished(){return this._animation?this._animation.finished:super.finished}then(e,t){return this.finished.finally(e).then(()=>{})}liveValue(){return this._animation?.liveValue?.()}get animation(){return this._animation||(this.keyframeResolver?.resume(),WB()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation?.cancel(),this.keyframeResolver?.cancel()}},nH=class{constructor(e){this.stop=()=>{for(let e of this.animations)e.stop()},this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map(e=>e.finished))}getAll(e){return this.animations[0][e]}attachTimeline(e){let t=this.animations.map(t=>t.attachTimeline(e));return()=>{t.forEach((e,t)=>{e&&e(),this.animations[t].stop()})}}get time(){return this.getAll(`time`)}set time(e){for(let t of this.animations)t.time=e}get speed(){return this.getAll(`speed`)}set speed(e){for(let t of this.animations)t.speed=e}get state(){return this.getAll(`state`)}get startTime(){return this.getAll(`startTime`)}get duration(){return rH(this.animations,`duration`)}get iterationDuration(){return rH(this.animations,`iterationDuration`)}play(){for(let e of this.animations)e.play()}pause(){for(let e of this.animations)e.pause()}cancel(){for(let e of this.animations)e.cancel()}complete(){for(let e of this.animations)e.complete()}};function rH(e,t){let n=0;for(let r=0;r<e.length;r++){let i=e[r][t];i!==null&&i>n&&(n=i)}return n}var iH=class extends nH{then(e,t){return this.finished.finally(e).then(()=>{})}};function aH(e,t,n,r=0,i=1){let a=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),o=e.size,s=(o-1)*r;return typeof n==`function`?n(a,o):i===1?a*r:s-a*r}var oH=30,sH=e=>!isNaN(parseFloat(e)),cH={current:void 0},lH=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=ML.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.dirty(),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=ML.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=sH(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){var n;return e===`change`?this.onChangeSubscribe(t):((n=this.events)[e]||(n[e]=new iL)).add(t)}onChangeSubscribe(e){let{events:t}=this;return!t.change&&!this.changeSubscriber?this.changeSubscriber=e:(t.change||(t.change=new iL,t.change.add(this.changeSubscriber),this.changeSubscriber=void 0),t.change.add(e)),()=>{this.changeSubscriber===e?this.changeSubscriber=void 0:t.change?.remove(e),this.stopIfUnobserved()}}stopIfUnobserved(){QR.read(()=>{!this.changeSubscriber&&!this.events.change?.getSize()&&this.stop()})}clearListeners(){this.changeSubscriber=void 0;for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){t&&(this.updatedAt=ML.now(),this.stop()),this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,this.stopPassiveEffect?.()}dirty(){let{current:e,changeSubscriber:t}=this;t?t(e):this.events.change?.notify(e)}addDependent(e){(this.dependents||=new Set).add(e)}removeDependent(e){this.dependents?.delete(e)}get(){cH.current?.push(this);let e=this.animation?.liveValue?.();return e===void 0?this.current:e}getCurrent(){return this.current}getPrevious(){return this.prev}getVelocity(){let e=ML.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>oH)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,oH);return sL(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return new Promise(t=>this.run(e,t))}run(e,t){this.stop(),this.hasAnimated=!0;let n=!1,r;r=e(()=>{n=!0,this.events.animationComplete?.notify(),this.animation===r&&(this.animation=void 0),t?.()}),n||(this.animation=r),this.events.animationStart?.notify()}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel?.notify()),this.animation=void 0}isAnimating(){return!!this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect?.()}};function uH(e,t){return new lH(e,t)}function dH(e,t){if(e?.inherit&&t){let{inherit:n,...r}=e;return{...t,...r}}return e}function fH(e,t){let n=e?.[t]??e?.default??e;return n===e?n:dH(n,e)}var pH={type:`spring`,stiffness:500,damping:25,restSpeed:10},mH=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),hH={type:`keyframes`,duration:.8},gH={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},_H=(e,{keyframes:t})=>t.length>2?hH:OB.has(e)?e.startsWith(`scale`)?mH(t[1]):pH:gH,vH=new Set([`when`,`delay`,`delayChildren`,`staggerChildren`,`staggerDirection`,`repeat`,`repeatType`,`repeatDelay`,`from`,`elapsed`,`out`,`mixer`]);function yH(e){for(let t in e)if(!vH.has(t))return!0;return!1}var bH=(e,t,n,r={},i,a)=>o=>{let s=fH(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=aL(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:`easeOut`,velocity:t.getVelocity(),...s,delay:-l,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:a?void 0:i,hasOnUpdate:!!s.onUpdate};yH(s)||Object.assign(u,_H(e,u)),u.duration&&=aL(u.duration),u.repeatDelay&&=aL(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(pV(u),u.delay===0&&(d=!0)),(XI.instantAnimations||XI.skipAnimations||i?.shouldSkipAnimations||s.skipAnimations)&&(d=!0,pV(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=Hz(u.keyframes,s);if(e!==void 0){QR.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new $z(u):new tH(u)},xH=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function SH(e){let t=xH.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function CH(e,t,n=1){let[r,i]=SH(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return ZI(e)?parseFloat(e):e}return LL(i)?CH(i,t,n+1):i}function wH(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function TH(e,t,n,r){let i=t=>typeof t==`function`?t(n===void 0?e.custom:n,...wH(r)):t;return t=i(t),typeof t==`string`&&(t=e.variants&&e.variants[t]),i(t)}function EH(e,t,n){return TH(e.getProps(),t,n,e)}var DH=(e,t)=>t===`exit`?e.presenceContext?.custom:void 0,OH=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...DB]),kH=e=>Array.isArray(e);function AH(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,uH(n))}function jH(e){return kH(e)?e[e.length-1]||0:e}function MH(e,t){let{transitionEnd:n={},transition:r={},...i}=EH(e,t)||{};i={...i,...n};for(let t in i)AH(e,t,jH(i[t]))}var NH=e=>!!(e&&e.getVelocity);function PH(e){return!!(NH(e)&&e.add)}function FH(e,t){let n=e.getValue(`willChange`);if(PH(n))return n.add(t);if(!n&&XI.WillChange){let n=new XI.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}var IH=`data-framer-appear-id`;function LH(e){return e.props[IH]}var RH=typeof window<`u`;function zH({protectedKeys:e,needsAnimating:t},n){let r=n in e&&!t[n];return t[n]=!1,r}function BH(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:o,...s}=t,c=e.getDefaultTransition();a=a?dH(a,c):c;let l=a?.reduceMotion,u=a?.skipAnimations;r&&(a=r);let d=[],f=i&&e.animationState?.getState()[i],p=a?.path;p&&(p.animateValues?p.animateValues(t=>e.getValue(t,e.latestValues[t]??0),s,a,n,d):p.animateVisualElement?.(e,s,a,n,d));for(let t in s){let r=e.getValue(t,e.latestValues[t]??null),i=s[t];if(i===void 0||f&&zH(f,t))continue;let o={delay:n,...fH(f?.out[t]||a||{},t)};u&&(o.skipAnimations=!0);let c=r.get();if(c!==void 0&&!r.isAnimating()&&!Array.isArray(i)&&i===c&&!o.velocity){QR.update(()=>r.set(i));continue}let p=!1;if(RH&&window.MotionHandoffAnimation){let n=LH(e);if(n){let e=window.MotionHandoffAnimation(n,t,QR);e!==null&&(o.startTime=e,p=!0)}}FH(e,t);let m=l??e.shouldReduceMotion;r.run(bH(t,r,i,m&&OH.has(t)?{type:!1}:o,e,p));let h=r.animation;h&&d.push(h)}if(o){let t=()=>QR.update(()=>{o&&MH(e,o)});d.length?Promise.all(d).then(t):t()}return d}function VH(e,t,n={}){let r=EH(e,t,DH(e,n.type)),i=n.transitionOverride||(r?.transition??(e.getDefaultTransition()||{})),a=()=>Promise.all(r?BH(e,r,n):[]),o=(r=0)=>{let{variantChildren:a}=e,{delayChildren:o=0,staggerChildren:s,staggerDirection:c}=i,l=[];return a?.forEach(e=>{e.notify(`AnimationStart`,t),l.push(VH(e,t,{...n,delay:r+(typeof o==`function`?0:o)+aH(a,e,o,s,c)}).then(()=>e.notify(`AnimationComplete`,t)))}),Promise.all(l)},{when:s}=i;return s?s===`beforeChildren`?a().then(()=>o()):o().then(a):Promise.all([a(),o(n.delay)])}function HH(e,t,n={}){return e.notify(`AnimationStart`,t),(Array.isArray(t)?Promise.all(t.map(t=>VH(e,t,n))):typeof t==`string`?VH(e,t,n):Promise.all(BH(e,EH(e,t,n.custom),n))).then(()=>{e.notify(`AnimationComplete`,t)})}var UH={test:e=>e===`auto`,parse:e=>e},WH=e=>t=>t.test(e),GH=[BL,rR,nR,tR,aR,iR,UH],KH=e=>GH.find(WH(e));function qH(e){return typeof e==`number`?e===0:e===null||e===`none`||e===`0`||$I(e)}var JH=new Set([`auto`,`none`,`0`]);function YH(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!JH.has(t)&&yR(t)&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]!==i&&(e[r]=mB(n,i))}var XH=class extends KB{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}scheduleResolve(){if(this.canReadNow()&&(this.readKeyframes(),!this.needsMeasurement))return this.complete();super.scheduleResolve()}canReadNow(){let{unresolvedKeyframes:e,element:t,motionValue:n}=this,r=e[0]??n?.get();if(!t?.current||r===void 0)return!1;for(let t=0;t<e.length;t++)if(zL(t?e[t]:r))return!1;return!0}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:n}=this;if(!t?.current)return;super.readKeyframes();for(let n=0;n<e.length;n++){let r=e[n];if(typeof r==`string`&&(r=r.trim(),LL(r))){let i=CH(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!OH.has(n)||e.length!==2)return;let[r,i]=e;if(typeof r==`number`&&typeof i==`number`)return;let a=KH(r),o=KH(i);if(zL(r)!==zL(i)&&LB[n])this.needsMeasurement=!0;else if(a!==o){if(kB(a)&&kB(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else LB[n]&&(this.needsMeasurement=!0)}}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||qH(e[t]))&&n.push(t);n.length&&YH(e,n,t)}measure(){let{element:e,name:t}=this;return LB[t](window.getComputedStyle(e.current),()=>e.measureViewportBox())}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e?.current)return;n===`height`&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=this.measure(),t[0]=this.measuredOrigin;let r=t[t.length-1];r!==void 0&&this.motionValue?.jump(r,!1)}measureEndState(){let{element:e,unresolvedKeyframes:t}=this;if(!e?.current)return;this.motionValue?.jump(this.measuredOrigin,!1);let n=t.length-1,r=t[n];t[n]=this.measure(),r!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=r),this.resolveNoneKeyframes()}},ZH=[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomRightRadius`,`borderBottomLeftRadius`],QH=[];function $H(e){eU(e),QH.unshift(e)}function eU(e){JI(QH,e)}function tU(e){return QH.find(t=>t.test(e))}function nU(e,t,n={},r){let i=[],{velocity:a,path:o}=n,s=n.reduceMotion??r?.shouldReduceMotion;o?.animateValues&&r&&(t={...t},o.animateValues(e,t,n,0,i));for(let o in t){if(o===`transition`||o===`transitionEnd`)continue;let c=t[o];if(c===void 0)continue;let l=e(o),u=l.get();u!==void 0&&!l.isAnimating()&&!Array.isArray(c)&&c===u&&!a?QR.update(()=>l.set(c)):(l.run(bH(o,l,c,s&&OH.has(o)?{type:!1}:n,r)),l.animation&&i.push(l.animation))}let{transitionEnd:c}=t;if(c){let t=()=>QR.update(()=>{for(let t in c)e(t).set(c[t])});i.length?Promise.all(i).then(t):t()}return i}function rU(e,t,n,r,i){let a,o=!1,s=nU(r=>{let s=a?.[r]??e.get(t,r);if(!s){let c;if(!i){let i=n[r];c=iU(i)??e.read(t,r,i)}s=uH(c,{owner:i}),o?e(t,{[r]:s}):(a||={})[r]=s}return s},n,r,i);return o=!0,a&&e(t,a),s}function iU(e){let t=Array.isArray(e)?e[0]:void 0;return t===null?void 0:t}function aU(e){return QI(e)&&`offsetHeight`in e&&!(`ownerSVGElement`in e)}function oU(e){return QI(e)&&`ownerSVGElement`in e}var sU={};function cU(e){return sU.current?.add(e),e}var lU=e=>sU.current?sU.current.bind(e):e;function uU(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=t?t.current:sU.current?.root||document,i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(e=>e!=null)}var dU=class{constructor(e=QR.render){this.step=e,this.values=new Map,this.pending=[],this.numPending=0,this.flush=()=>{let{pending:e,numPending:t}=this;this.numPending=0;for(let n=0;n<t;n++)e[n]()}}set(e,t,n,r){if(this.values.get(e)?.onRemove(),r)for(let e of this.values.values())e.value===r&&(n=e.render);let i=()=>n&&this.schedule(n);t.get()!==void 0&&i();let a=t.on(`change`,i),o=()=>{a(),n&&!r&&this.cancel(n),this.values.get(e)?.onRemove===o&&this.values.delete(e)};return this.values.set(e,{value:t,render:r?void 0:n,onRemove:o}),o}get(e){return this.values.get(e)?.value}release(){let e=new Map;return this.values.forEach((t,n)=>{e.set(n,t.value),t.onRemove()}),this.transformKeys=this.transformValues=void 0,e}schedule(e){let{pending:t,numPending:n}=this;for(let r=0;r<n;r++)if(t[r]===e)return;n||this.step(this.flush),t[this.numPending++]=e}cancel(e){let{pending:t}=this;for(let n=0;n<this.numPending;n++)if(t[n]===e){t[n]=t[--this.numPending];return}}};function fU(e,{step:t,...n}={}){let r=new WeakMap;return Object.assign((n,i)=>{let a=r.get(n)??new dU(t);r.set(n,a);let o=[];for(let t in i){let r=i[t],s=e(n,a,t,r);o.push(s)}return()=>{for(let e of o)e()}},n,{get:(e,t)=>r.get(e)?.get(t),flush:e=>r.get(e)?.flush(),state:e=>r.get(e)})}function pU(e){let t=``,{transformKeys:n=[],transformValues:r={}}=e;for(let e=0;e<n.length;e++){let i=n[e],a=r[i].getCurrent();a!==void 0&&(EV(i,a)||(t+=(t&&` `)+TV(i,a)))}let i=e.get(`pathRotation`)?.get();return i&&(t+=(t&&` `)+TV(`rotate`,i)),t||`none`}var mU=new Set([`originX`,`originY`,`originZ`]),hU=(e,t)=>xV(e.get(t)?.get(),sB[t]),gU=(e,t,n,r)=>{let i,a;if(OB.has(n)){if(n!==`pathRotation`){let e=t.transformKeys??=[];(t.transformValues??={})[n]=r,e.includes(n)||(e.push(n),e.sort((e,t)=>DB.indexOf(e)-DB.indexOf(t)))}t.get(`transform`)||(!aU(e)&&!t.get(`transformBox`)&&gU(e,t,`transformBox`,new lH(`fill-box`)),t.set(`transform`,new lH(`none`),()=>{OV.get(e)?.check(),e.style.transform=pU(t)})),a=t.get(`transform`)}else mU.has(n)?(t.get(`transformOrigin`)||t.set(`transformOrigin`,new lH(``),()=>{let n=hU(t,`originX`)??`50%`,r=hU(t,`originY`)??`50%`,i=hU(t,`originZ`)??0;e.style.transformOrigin=`${n} ${r} ${i}`}),a=t.get(`transformOrigin`)):i=qB(n)?()=>{e.style.setProperty(n,r.getCurrent())}:()=>{e.style[n]=xV(r.getCurrent(),sB[n])};return t.set(n,r,i,a)},_U=e=>aU(e)||oU(e),vU=(e,t)=>{if(OB.has(t))return EB(e,t);let n=getComputedStyle(e),r=qB(t)?n.getPropertyValue(t):n[t];return typeof r==`string`&&r.trim()||0},yU=fU(gU,{test:_U,read:vU});function bU(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}function xU(e,t,n){let{style:r,vars:i,transformOrigin:a}=e,o=!1,s=!1;for(let e in t){let n=t[e];if(OB.has(e))o=!0;else if(FL(e))i[e]=n;else{let t=xV(n,sB[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=DV(t,e.transform,n):r.transform&&=`none`),s){let{originX:e=`50%`,originY:t=`50%`,originZ:n=0}=a;r.transformOrigin=`${e} ${t} ${n}`}}var SU={offset:`stroke-dashoffset`,array:`stroke-dasharray`},CU={offset:`strokeDashoffset`,array:`strokeDasharray`};function wU(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?SU:CU;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}var TU=[`transform`,`opacity`,`clipPath`,`filter`,`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function EU(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(xU(e,s,l),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:f}=e;for(let e of TU)d[e]!==void 0&&(f[e]=d[e],delete d[e]);(f.transform||d.transformOrigin)&&(f.transformOrigin=d.transformOrigin??`50% 50%`,delete d.transformOrigin),f.transform&&(f.transformBox=u?.transformBox??`fill-box`,delete d.transformBox),t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),i!==void 0&&wU(d,i,a,o,!1)}function DU(e,t){if(!(t in e))return!1;let n=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),t)||Object.getOwnPropertyDescriptor(e,t);return n&&typeof n.set==`function`}var OU=(e,t,n,r,i=n)=>{let a=DU(e,i);!a&&(i.startsWith(`data`)||i.startsWith(`aria`))&&(i=bU(i));let o=sB[n]||sB[i],s=a?()=>{e[i]=xV(r.get(),sB[n])}:()=>{let t=xV(r.get(),o);t==null?e.removeAttribute(i):e.setAttribute(i,String(t))};return t.set(n,r,s)};function kU(e,t,n,r){return QR.render(()=>e.setAttribute(`pathLength`,`1`)),n===`pathOffset`?t.set(n,r,()=>{let t=r.get();e.setAttribute(`stroke-dashoffset`,`${-t}`)}):(t.get(`stroke-dasharray`)||t.set(`stroke-dasharray`,new lH(`1 1`),()=>{let n=t.get(`pathLength`)?.get()??1,r=t.get(`pathSpacing`)?.get();e.setAttribute(`stroke-dasharray`,`${n} ${r??1-Number(n)}`)}),t.set(n,r,void 0,t.get(`stroke-dasharray`)))}var AU=fU((e,t,n,r)=>n.startsWith(`path`)&&!OB.has(n)?kU(e,t,n,r):n.startsWith(`attr`)?OU(e,t,n,r,jU(n)):n===`d`?t.set(n,r,()=>{let t=r.get()?.replace(/path\(|["')]/g,``);t===void 0?e.removeAttribute(n):e.setAttribute(n,t)}):(OB.has(n)||mU.has(n)||qB(n)||n in e.style?gU:OU)(e,t,n,r),{test:oU,read:(e,t)=>OB.has(t)?sB[t]?.default||0:qB(t)||TU.includes(t)?vU(e,t)||e.getAttribute(bU(t))||0:(t=jU(t),e.getAttribute(bU(t))??e.getAttribute(t)??void 0)});function jU(e){return e.replace(/^attr([A-Z])/,(e,t)=>t.toLowerCase())}function MU({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function NU({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function PU(e,t){if(!t)return e;let n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function FU(e){return e===void 0||e===1}function IU({scale:e,scaleX:t,scaleY:n}){return!FU(e)||!FU(t)||!FU(n)}var LU=[`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skewX`,`skewY`];function RU(e){return IU(e)||BU(e)||zU(e)}function zU(e){return e.z||e.rotate||e.rotateX||e.rotateY||e.rotateZ||e.skewX||e.skewY}function BU(e){return VU(e.x)||VU(e.y)}function VU(e){return e&&e!==`0%`}function HU(e,t,n){return n+t*(e-n)}function UU(e,t,n,r,i){return i!==void 0&&(e=HU(e,i,r)),HU(e,n,r)+t}function WU(e,t=0,n=1,r,i){e.min=UU(e.min,t,n,r,i),e.max=UU(e.max,t,n,r,i)}function GU(e,{x:t,y:n}){WU(e.x,t.translate,t.scale,t.originPoint),WU(e.y,n.translate,n.scale,n.originPoint)}var KU=.999999999999,qU=1.0000000000001;function JU(e,t,n,r=!1){let i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let s=0;s<i;s++)a=n[s],o=a.projectionDelta,a.options.visualElement?.props.style?.display!==`contents`&&(r===!0&&a.options.layoutScroll&&a.scroll&&a!==a.root&&(YU(e.x,-a.scroll.offset.x),YU(e.y,-a.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,GU(e,o)),r&&(r.path?.[s]||r)!==a&&RU(a.latestValues)&&QU(e,a.latestValues,a.layout?.layoutBox));t.x<qU&&t.x>KU&&(t.x=1),t.y<qU&&t.y>KU&&(t.y=1)}function YU(e,t){e.min+=t,e.max+=t}function XU(e,t,n,r,i=.5){WU(e,t,n,jR(e.min,e.max,i),r)}function ZU(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function QU(e,t,n){let r=n??e;XU(e.x,ZU(t.x,r.x),t.scaleX,t.scale,t.originX),XU(e.y,ZU(t.y,r.y),t.scaleY,t.scale,t.originY)}function $U(e,t){return MU(PU(e.getBoundingClientRect(),t))}function eW(e,t,n){let r=$U(e,n),{scroll:i}=t;return i&&(YU(r.x,i.offset.x),YU(r.y,i.offset.y)),r}var tW=()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),nW={},rW=e=>oU(e)?AU:yU,iW=class{constructor(e,t){this.effect=e,this.current=t,this.KeyframeResolver=XH}getValue(e){return this.effect.get(this.current,e)}readValue(e,t){return this.effect.read(this.current,e,t)}render(){this.effect.flush(this.current)}measureViewportBox(){return $U(this.current)}getProps(){return nW}};function aW(e,t,n,r){if(sU.current?.track(e),r)return nU(e=>r.getValue(e,null),t,n,r);let i=rW(e);return rU(i,e,t,n,new iW(i,e))}var oW=fU((e,t,n,r)=>t.set(n,r,()=>{e[n]=r.get()}),{test:e=>QI(e),read:(e,t)=>{let n=e[t];return typeof n==`string`||typeof n==`number`?n:void 0}}),{schedule:sW,cancel:cW}=ZR(queueMicrotask,!1);function lW(e,t,n){let r=NH(e)?e:uH(e);return r.run(bH(``,r,t,n)),r.animation}var uW={},dW={value:null,addProjectionMetrics:null,countProjection:void 0};function fW(e,t){let n=ML.now();e=lU(e);let r=({timestamp:i})=>{let a=i-n;a>=t&&($R(r),e(a-t))};return QR.setup(r,!0),cU(()=>$R(r))}function pW(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function mW(e){return oU(e)&&e.tagName===`svg`}function hW(e){return NH(e)?e.get():e}var gW=e=>typeof e==`number`?e:parseFloat(e),_W=ZH.length,vW=e=>typeof e==`number`||rR.test(e);function yW(e,t,n,r,i,a){i?(e.opacity=jR(0,n.opacity??1,xW(r)),e.opacityExit=jR(t.opacity??1,0,SW(r))):a&&(e.opacity=jR(t.opacity??1,n.opacity??1,r));for(let i=0;i<_W;i++){let a=ZH[i],o=bW(t,a),s=bW(n,a);(o!==void 0||s!==void 0)&&(o||=0,s||=0,o===0||s===0||vW(o)===vW(s)?(e[a]=Math.max(jR(gW(o),gW(s),r),0),(nR.test(s)||nR.test(o))&&(e[a]+=`%`)):e[a]=s)}for(let i=0;i<LU.length;i++){let a=LU[i];(t[a]||n[a])&&(e[a]=jR(t[a]||0,n[a]||0,r))}}function bW(e,t){return e[t]===void 0?e.borderRadius:e[t]}var xW=CW(0,.5,vL),SW=CW(.5,.95,tL);function CW(e,t,n){return r=>r<e?0:r>t?1:n(rL(e,t,r))}var wW=(e,t,{x:n,y:r})=>{let i=e*e+t*t;return i<1?0:-1e3*(n*e+r*t)/i},TW=(e,t=300)=>{let n=YI(.25,2,t/300),{stiffness:r,damping:i}=Oz({...e,duration:e.duration&&aL(e.duration)});return{...e,stiffness:r,damping:i*Math.sqrt(n),mass:n}};function EW(e,t){e.min=t.min,e.max=t.max}function DW(e,t){EW(e.x,t.x),EW(e.y,t.y)}function OW(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var kW=.9999,AW=1.0001,jW=-.01,MW=.01;function NW(e){return e.max-e.min}function PW(e,t,n){return Math.abs(e-t)<=n}function FW(e,t,n,r=.5){e.origin=r,e.originPoint=jR(t.min,t.max,e.origin),e.scale=NW(n)/NW(t),e.translate=jR(n.min,n.max,e.origin)-e.originPoint,(e.scale>=kW&&e.scale<=AW||isNaN(e.scale))&&(e.scale=1),(e.translate>=jW&&e.translate<=MW||isNaN(e.translate))&&(e.translate=0)}function IW(e,t,n,r){FW(e.x,t.x,n.x,r?.originX),FW(e.y,t.y,n.y,r?.originY)}function LW(e,t,n,r=0){e.min=(r?jR(n.min,n.max,r):n.min)+t.min,e.max=e.min+NW(t)}function RW(e,t,n,r){LW(e.x,t.x,n.x,r?.x),LW(e.y,t.y,n.y,r?.y)}function zW(e,t,n,r=0){let i=r?jR(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+NW(t)}function BW(e,t,n,r){zW(e.x,t.x,n.x,r?.x),zW(e.y,t.y,n.y,r?.y)}function VW(e,t,n,r,i){return e-=t,e=HU(e,1/n,r),i!==void 0&&(e=HU(e,1/i,r)),e}function HW(e,t=0,n=1,r=.5,i,a=e,o=e){if(nR.test(t)&&(t=parseFloat(t),t=jR(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=jR(a.min,a.max,r);e===a&&(s-=t),e.min=VW(e.min,t,n,s,i),e.max=VW(e.max,t,n,s,i)}function UW(e,t,[n,r,i],a,o){HW(e,t[n],t[r],t[i],t.scale,a,o)}var WW=[`x`,`scaleX`,`originX`],GW=[`y`,`scaleY`,`originY`];function KW(e,t,n,r){UW(e.x,t,WW,n?.x,r?.x),UW(e.y,t,GW,n?.y,r?.y)}var qW=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),JW=qW(`applewebkit/`)&&!qW(`chrome/`)?Math.round:tL;function YW(e){e.min=JW(e.min),e.max=JW(e.max)}function XW(e){YW(e.x),YW(e.y)}var ZW=()=>({translate:0,scale:1,origin:0,originPoint:0}),QW=()=>({x:ZW(),y:ZW()}),$W=()=>({min:0,max:0}),eG=()=>({x:$W(),y:$W()});function tG(e){return e.translate===0&&e.scale===1}function nG(e){return tG(e.x)&&tG(e.y)}function rG(e,t){return e.min===t.min&&e.max===t.max}function iG(e,t){return rG(e.x,t.x)&&rG(e.y,t.y)}function aG(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function oG(e,t){return aG(e.x,t.x)&&aG(e.y,t.y)}function sG(e){return NW(e.x)/NW(e.y)}function cG(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}var lG=class{constructor(){this.members=[]}add(e){qI(this.members,e);for(let t=this.members.length-1;t>=0;t--){let n=this.members[t];if(n===e||n===this.lead||n===this.prevLead)continue;let r=n.instance;(!r||r.isConnected===!1)&&!n.snapshot&&(JI(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(JI(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){let e=this.members[t];if(e.isPresent!==!1&&e.instance?.isConnected!==!1)return this.promote(e),!0}return!1}promote(e,t){let n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.updateSnapshot(),e.scheduleRender();let{layoutDependency:r}=n.options,{layoutDependency:i}=e.options;(r===void 0||r!==i)&&(e.resumeFrom=n,t&&(n.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}};function uG(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var dG={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`){if(rR.test(e))e=parseFloat(e);else return e}return`${uG(e,t.target.x)}% ${uG(e,t.target.y)}%`}},fG={borderRadius:Object.assign({},dG,{applyTo:ZH.slice()}),borderTopLeftRadius:dG,borderTopRightRadius:dG,borderBottomLeftRadius:dG,borderBottomRightRadius:dG,boxShadow:{correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=DR.parse(e);if(i.length>5)return r;let a=DR.createTransformer(e),o=typeof i[0]==`number`?0:1,s=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=s,i[1+o]/=c;let l=jR(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}}};function pG(e,t,n){let r=``,i=e.x.translate/t.x,a=e.y.translate/t.y,o=n?.z||0;(i||a||o)&&(r=`translate3d(${i}px, ${a}px, ${o}px) `);let s=``;if(n){let{transformPerspective:e}=n;e&&(r=`perspective(${e}px) ${r}`);for(let e=0;e<LU.length;e++){let t=LU[e],r=n[t];r&&(s+=`${t}(${r}deg) `),!e&&n.pathRotation&&(s+=`rotate(${n.pathRotation}deg) `)}}if(s){(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),r+=s;let n=e.x.scale*t.x,i=e.y.scale*t.y;(n!==1||i!==1)&&(r+=`scale(${n}, ${i})`)}else e.x.scale!==1||e.y.scale!==1?r+=`scale(${e.x.scale}, ${e.y.scale})`:!r&&(t.x!==1||t.y!==1)&&(r=`scale(1, 1)`);return r||`none`}function mG(e){return[e(`x`),e(`y`)]}var hG=(e,t)=>e.depth-t.depth,gG=class{constructor(){this.children=[],this.isDirty=!1}add(e){qI(this.children,e),this.isDirty=!0}remove(e){JI(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(hG),this.isDirty=!1,this.children.forEach(e)}},_G={hasAnimatedSinceResize:!0,hasEverUpdated:!1},vG=[`z`,`skew`,`skewZ`],yG=1e3,bG=0;function xG(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}var SG=e=>e.instance&&OV.get(e.instance)?.demote()&&e.resetSkewAndRotation();function CG(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=LH(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,QR,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&CG(r)}function wG(e){if(e)return e.options.allowProjection===!1?wG(e.parent):e.projection}function TG({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return Object.assign(uW,{...fG,...uW}),class{static create(e,t,n){let{layoutId:r,layout:i,drag:a,dragConstraints:o,layoutScroll:s,layoutRoot:c,layoutAnchor:l,layoutCrossfade:u}=t,d=e.projection=new this(e.latestValues,t[`data-framer-portal-id`]?void 0:wG(e.parent));d.setOptions({layoutId:r,layout:i,alwaysMeasureLayout:!!a||o&&pW(o),visualElement:e,animationType:typeof i==`string`?i:`both`,initialPromotionConfig:n,crossfade:u,layoutScroll:s,layoutRoot:c,layoutAnchor:l});let f=d.getStack()?.lead;f&&!d.root.isUpdateBlocked()&&(f.willUpdate(),f.scheduleCheckAfterUnmount())}constructor(e={},n=t?.()){this.id=bG++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(OG),this.nodes.forEach(zG),this.nodes.forEach(BG),this.nodes.forEach(kG),dW.countProjection?.()},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new gG)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new iL),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){this.eventHandlers.get(e)?.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=oU(t)&&!mW(t),this.instance=t;let{layoutId:n,layout:r,visualElement:i}=this.options;if(i&&!i.current&&i.mount(t),this.root.nodes.add(this),this.parent?.children.add(this),this.root.hasTreeAnimated&&(r||n)&&(this.isLayoutDirty=!0),e){let n,r=0,i=()=>this.root.updateBlockedByResize=!1;QR.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n?.(),n=fW(i,250),_G.hasAnimatedSinceResize&&(_G.hasAnimatedSinceResize=!1,this.nodes.forEach(RG)))})}n&&this.root.registerSharedNode(n,this),this.addLayoutListener()}addLayoutListener(){let{layoutId:e,layout:t,visualElement:n,animate:r}=this.options;this.instance&&!this.hasLayoutListener&&r!==!1&&n&&(e||t)&&(this.hasLayoutListener=!0,this.addEventListener(`didUpdate`,({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:r,layout:i})=>{if(this.isAnimationBlocked){this.target=void 0,this.relativeTarget=void 0;return}let a=this.options.transition||n.getDefaultTransition()||qG,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=n.getProps(),c=!this.targetLayout||!oG(this.targetLayout,i),l=!t&&r;if(this.options.layoutRoot||this.resumeFrom||l||t&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...fH(a,`layout`),onPlay:o,onComplete:s};(n.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,l,t.path)}else t||RG(this),this.isLead()&&this.options.onExitComplete?.();this.targetLayout=i}))}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this),this.getStack()?.remove(this),this.parent?.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),this.hasLayoutListener=!1,$R(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes?.forEach(VG),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete?.();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&CG(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;SG(this),this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,SG(t),(typeof t.latestValues.x==`string`||typeof t.latestValues.y==`string`)&&(t.isLayoutDirty=!0),t.updateScroll(`snapshot`),t.options.layoutRoot&&t.willUpdate(!1),t.isAnimationBlocked&&(t.dragSnapshot||=t.measure(),this.dragAncestor=t)}let{layoutId:t,layout:n}=this.options;if(t===void 0&&!n)return;let r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,``):void 0,this.updateSnapshot(),e&&this.notifyListeners(`willUpdate`)}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){let e=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),e&&this.nodes.forEach(MG),this.nodes.forEach(jG);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(NG);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(FG),this.nodes.forEach(IG),this.nodes.forEach(LG),this.nodes.forEach(EG),this.nodes.forEach(DG)):this.nodes.forEach(NG),this.clearAllSnapshots();let e=ML.now();kL.delta=YI(0,1e3/60,e-kL.timestamp),kL.timestamp=e,kL.isProcessing=!0,ez.update.process(kL),ez.preRender.process(kL),ez.render.process(kL),kL.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,sW.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(AG),this.sharedNodes.forEach((e,t)=>e.members.length?e.removeLeadSnapshot():this.sharedNodes.delete(t))}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,QR.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){QR.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){if(!this.snapshot&&this.instance&&(this.snapshot=this.measure(),this.snapshot&&!NW(this.snapshot.measuredBox.x)&&!NW(this.snapshot.measuredBox.y)&&(this.snapshot=void 0),this.snapshot)){let{visualElement:e}=this.options,t=this.currentAnimation?.state===`running`,n=t&&this.animationEdges;t&&this.relativeTarget&&(this.snapshot.relativeVelocity=this.relativeVelocity?.slice()||[]);let r=n&&this.motionValue?.getVelocity()||0,i=[0,1,2,3,4,5].map(t=>(t<4?n&&(this.edgeValues?this.edgeVelocity(t):-n[t]*r/1e3):e?.getValue(t<5?`x`:`y`)?.getVelocity())||0);i.some(Boolean)&&(this.snapshot.velocity=i)}}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutCorrected||=eG(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners(`measure`,this.layout.layoutBox);let{visualElement:t}=this.options;t?.notify(`LayoutMeasure`,this.layout.layoutBox,e?.layoutBox)}updateScroll(e=`measure`){let{scroll:t,instance:i}=this,{animationId:a}=this.root;if(this.options.layoutScroll&&i&&!(t&&t.animationId===a&&t.phase===e)){let o=r(i);this.scroll={animationId:a,phase:e,isRoot:o,offset:n(i),wasRoot:t?t.isRoot:o}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout;e&&SG(this);let t=this.projectionDelta&&!nG(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||RU(this.latestValues)||a)&&(i(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){let t=this.measurePageBox(),n=this.removeElementScroll(t);return e&&(n=this.removeTransform(n)),XW(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return eG();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(XG))){let{scroll:e}=this.root;e&&(YU(t.x,e.offset.x),YU(t.y,e.offset.y))}return t}removeElementScroll(e){let t=eG();if(DW(t,e),this.scroll?.wasRoot)return t;for(let n=0;n<this.path.length;n++){let r=this.path[n],{scroll:i,options:a}=r;r!==this.root&&i&&a.layoutScroll&&(i.wasRoot&&DW(t,e),YU(t.x,i.offset.x),YU(t.y,i.offset.y))}return t}applyTransform(e,t=!1,n,r,i=0){let a=n||eG();DW(a,e);for(let e=i;e<this.path.length;e++){let n=this.path[e];!t&&n.options.layoutScroll&&n.scroll&&n!==n.root&&(YU(a.x,-n.scroll.offset.x),YU(a.y,-n.scroll.offset.y)),RU(n.latestValues)&&QU(a,n.latestValues,n.layout?.layoutBox)}return!r&&RU(this.latestValues)&&QU(a,this.latestValues,this.layout?.layoutBox),a}removeTransform(e){let t=eG();DW(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!RU(n.latestValues))continue;let r;n.instance&&(IU(n.latestValues)&&n.updateSnapshot(),r=eG(),DW(r,n.measurePageBox())),KW(t,n.latestValues,n.snapshot?.layoutBox,r)}return RU(this.latestValues)&&KW(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:e.crossfade===void 0||e.crossfade},this.addLayoutListener()}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==kL.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||=t.isProjectionDirty,this.isTransformDirty||=t.isTransformDirty,this.isSharedProjectionDirty||=t.isSharedProjectionDirty;let n=!!this.resumingFrom||this!==t;if(!(e||n&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:r,layoutId:i}=this.options;if(!this.layout||!(r||i))return;this.resolvedRelativeTargetAt=kL.timestamp;let a=this.getClosestProjectingParent();!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&a&&a.layout?this.createRelativeTarget(a,this.layout.layoutBox,a.layout.layoutBox):this.removeRelativeTarget()),(this.relativeTarget||this.targetDelta)&&(this.target||(this.target=eG(),this.targetWithTransforms=eG()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),RW(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target,!0):DW(this.target,this.layout.layoutBox),GU(this.target,this.targetDelta)):DW(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&a&&(!a.resumingFrom==!this.resumingFrom||a.options.layoutRoot&&!a.resumingFrom)&&!a.options.layoutScroll&&a.target&&this.animationProgress!==1?this.createRelativeTarget(a,this.target,a.target):this.relativeParent=this.relativeTarget=void 0),dW.countProjection?.(1))}getClosestProjectingParent(){if(!(!this.parent||IU(this.parent.latestValues)||BU(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,n){this.relativeParent=e,this.forceRelativeParentToResolveTarget(),this.relativeTarget=eG(),this.relativeTargetOrigin=eG(),BW(this.relativeTargetOrigin,t,n,this.options.layoutAnchor||void 0),DW(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,n=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(n=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(n=!1),this.resolvedRelativeTargetAt===kL.timestamp&&(n=!1),n)return;let{layout:r,layoutId:i}=this.options;if(this.isTreeAnimating=!!(this.parent?.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(r||i))return;DW(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;JU(this.layoutCorrected,this.treeScale,this.path,t&&(e.relativeTarget&&!e.relativeParent.resumingFrom?e.relativeParent:!0)),e.layout&&!e.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=eG());let{target:s}=e;s?(!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(OW(this.prevProjectionDelta.x,this.projectionDelta.x),OW(this.prevProjectionDelta.y,this.projectionDelta.y)),IW(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!cG(this.projectionDelta.x,this.prevProjectionDelta.x)||!cG(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),dW.countProjection?.(2)):this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender())}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){this.options.visualElement?.scheduleRender(),e&&this.getStack()?.scheduleRender(),this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=QW(),this.projectionDelta=QW(),this.projectionDeltaWithTransform=QW()}setAnimationOrigin(e,t=!1,n){let r=this.snapshot,i=r?r.latestValues:{},a={...this.latestValues},o=QW();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let s=eG(),c=r?.source!==this.layout?.source,l=this.getStack(),u=!l||l.members.length<=1,d=!(!c||u||this.options.crossfade!==!0||this.path.some(KG));this.animationProgress=0;let f,p=n?.interpolateProjection(e),m=this.layout?.layoutBox,h=m&&[m.x.min,m.x.max,m.y.min,m.y.max].map((t,n)=>{let{translate:r,scale:i,originPoint:a}=e[n<2?`x`:`y`];return(t-a)*(i-1)+r});h?.every(isFinite)||(h=void 0),this.animationEdges=h,this.edgeValues=this.startVelocity=this.impulse=this.relativeVelocity=this.relativeStart=void 0;let g=r?.velocity,_=r?.relativeVelocity||g;if(_?.slice(0,4).some(Boolean)&&this.getClosestProjectingParent()&&(this.relativeStart=_),g&&h){let t=g.slice(0,4).map((e,t)=>e+(c?g[4+(t>>1)]:0));t.some(Boolean)&&(this.startVelocity=p?wW(e.x.translate,e.y.translate,{x:(t[0]+t[1])/2,y:(t[2]+t[3])/2}):t)}this.mixTargetDelta=t=>{let n=t/1e3,r=p?.(n),l=this.edgeValues;for(let t=0;t<2;t++){let r=t?`y`:`x`;l?HG(o[r],e[r],this.layout.layoutBox[r],l[t*2],l[t*2+1]):UG(o[r],e[r],n)}if(r&&(o.x.translate=r.x,o.y.translate=r.y),this.setTargetDelta(o),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout){BW(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0);let e=this.relativeTargetOrigin,t=s;if(GG(this.relativeTarget,e,t,n),this.isSpringLayout){let e=this.relativeTarget,t=this.impulse||0,n=this.relativeStart,r=ML.now(),i=(r-this.relativeTime)/1e3;this.relativeTime=r;let a=this.relativeVelocity||=[0,0,0,0];for(let r=0;r<4;r++){let o=r<2?`x`:`y`,s=r&1?`max`:`min`;n&&(e[o][s]+=n[r]*t),f&&i>0&&(a[r]=(e[o][s]-f[o][s])/i)}}f&&iG(this.relativeTarget,f)&&(this.isProjectionDirty=!1),f||=eG(),DW(f,this.relativeTarget)}c&&(this.animationValues=a,yW(a,i,this.latestValues,n,d,u)),r?.rotate!==void 0&&(this.animationValues||=a,this.animationValues.pathRotation=r.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners(`animationStart`);let t=this.isSpringLayout=e.type===`spring`;this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.resumingFrom&&(this.resumingFrom.edgeValues=void 0),this.pendingAnimation&&=($R(this.pendingAnimation),void 0),this.pendingAnimation=QR.update(()=>{_G.hasAnimatedSinceResize=!0,this.motionValue||=uH(0),this.motionValue.jump(0,!1);let n=this.startVelocity;this.startVelocity=void 0;let r=e,i=0;if(t){if(e.mass===`auto`){let t=this.layout?.layoutBox;r=TW(e,t&&Math.sqrt(NW(t.x)*NW(t.y)))}let t=this.relativeStart;if((n||t)&&!e.repeat){if(typeof n==`number`)i=n;else{let e=n&&this.animationEdges;r={...r,type:r=>{let i=[r.velocity,...n||[]].map((t,n)=>Az({...r,keyframes:n?[e[n-1],0]:r.keyframes,velocity:t})),a=i.length;t&&i.push(Az({...r,keyframes:[0,0],velocity:1e3,restDelta:.5,restSpeed:5}));let o=0,s=[],c={calculatedDuration:null,next:t=>{o=t;let n=i[0].next(t),r=n.done;for(let e=1;e<i.length;e++){let{value:n,done:o}=i[e].next(t);e<a?s[e-1]=n:this.impulse=n/1e3,r&&=o}return e&&(this.edgeValues=s),n.done=r,n}};return c.calculatedDuration=iz(c),c.next(0),this.edgeVelocity=e=>i[e+1].velocity(o),c}}}}}let a=lW(this.motionValue,[0,1e3],{...r,velocity:i,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}});this.currentAnimation=a,Yz(this.currentAnimation,this),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=this.edgeValues=this.edgeVelocity=this.impulse=void 0,this.notifyListeners(`animationComplete`)}finishAnimation(){this.currentAnimation&&(this.edgeValues=this.impulse=void 0,this.mixTargetDelta?.(yG),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,layout:n,latestValues:r}=e,{target:i}=e;if(t&&i&&n){if(this!==e&&this.layout&&n&&YG(this.options.animationType,this.layout.layoutBox,n.layoutBox)){let{layoutBox:e}=this.layout,t=i;i=this.target||eG(),JG(i.x,t.x,e.x),JG(i.y,t.y,e.y)}DW(t,i),QU(t,r),IW(this.projectionDeltaWithTransform,this.layoutCorrected,t,r)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new lG),this.sharedNodes.get(e).add(t);let n=t.options.initialPromotionConfig;t.promote({transition:n?.transition,preserveFollowOpacity:n?.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return!e||e.lead===this}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){this.getStack()?.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){return this.getStack()?.relegate(this)||!1}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let{latestValues:t}=e;if(!zU(t))return;let n={};for(let t=0;t<vG.length;t++)xG(vG[t],e,n,this.animationValues);for(let t=0;t<LU.length;t++)xG(LU[t],e,n,this.animationValues);e.render();for(let t in n)e.setStaticValue(t,n[t]),this.animationValues&&(this.animationValues[t]=n[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;let n=this.getLead();if(!this.isVisible&&n!==this){e.visibility=`hidden`;return}let r=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility=``,e.opacity=``,e.pointerEvents=hW(t?.pointerEvents)||``,e.transform=r?r(this.latestValues,``):`none`;return}if(!this.projectionDelta||!this.layout||!n.target){(this.options.layoutId||this.needsShow)&&(this.needsShow=!1,e.visibility=``,e.opacity=this.latestValues.opacity===void 0?1:this.latestValues.opacity,e.pointerEvents=hW(t?.pointerEvents)||``),this.hasProjected&&!RU(this.latestValues)&&(e.transform=r?r({},``):`none`,this.hasProjected=!1);return}e.visibility=``;let i=n.animationValues||n.latestValues;this.applyTransformsToTarget();let a=pG(this.projectionDeltaWithTransform,this.treeScale,i);r&&(a=r(i,a)),e.transform=a;let{x:o,y:s}=this.projectionDelta;e.transformOrigin=`${o.origin*100}% ${s.origin*100}% 0`,e.opacity=n.animationValues?n===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:n===this?i.opacity===void 0?``:i.opacity:i.opacityExit===void 0?0:i.opacityExit;for(let t in uW){if(i[t]===void 0)continue;let{correct:r,applyTo:o,isCSSVariable:s}=uW[t],c=a===`none`?i[t]:r(i[t],n);if(o){let t=o.length;for(let n=0;n<t;n++)e[o[n]]=c}else s?this.options.visualElement.renderState.vars[t]=c:e[t]=c}this.options.layoutId&&(e.pointerEvents=n===this?hW(t?.pointerEvents)||``:`none`)}clearSnapshot(){this.resumeFrom=this.snapshot=this.dragSnapshot=this.dragAncestor=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(jG),this.root.sharedNodes.clear()}}}function EG(e){e.updateLayout(),PG(e)}function DG(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners(`didUpdate`)){let{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,a=t.source!==e.layout.source,o=(r,a)=>{if(i===`size`)mG(e=>{let t=NW(r[e]);r[e].min=a[e].min,r[e].max=r[e].min+t});else if(i===`x`||i===`y`){let e=i===`x`?`y`:`x`;EW(r[e],a[e])}else YG(i,t.layoutBox,n)&&mG(t=>{let n=NW(a[t]);r[t].max=r[t].min+n,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[t].max=e.relativeTarget[t].min+n)})},s=a?t.measuredBox:t.layoutBox;o(s,n);let c=QW();IW(c,n,t.layoutBox);let l=QW();IW(l,a?e.applyTransform(r,!0):n,s);let u=!nG(c),d=!1,f=e.getClosestProjectingParent();if((!a||f?.options.layoutRoot&&e.resumeFrom?.path.includes(f))&&f&&!f.resumeFrom){let{snapshot:r,layout:i}=f;if(r&&i){let s=e.options.layoutAnchor||void 0,c=eG();BW(c,a?e.resumeFrom.applyTransform(t.layoutBox,!0,void 0,!0,f.depth+1):t.layoutBox,r.layoutBox,s);let l=eG();BW(l,n,i.layoutBox,s),a&&o(c,l),oG(c,l)||(d=!0),f.options.layoutRoot&&(e.relativeTarget=l,e.relativeTargetOrigin=c,e.relativeParent=f)}}e.notifyListeners(`didUpdate`,{layout:n,snapshot:t,delta:l,layoutDelta:c,hasLayoutChanged:u,hasRelativeLayoutChanged:d})}else e.isLead()&&e.options.onExitComplete?.();e.options.transition=void 0}function OG(e){dW.countProjection?.(0),e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty),e.isTransformDirty||=e.parent.isTransformDirty)}function kG(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function AG(e){e.clearSnapshot()}function jG(e){e.clearMeasurements()}function MG(e){e.isLayoutDirty=!0,e.updateLayout()}function NG(e){e.isLayoutDirty=!1}function PG(e){let{snapshot:t,dragAncestor:n}=e,r=n?.isAnimationBlocked&&n.layout;if(!t||!r||e.resumeFrom||e.isAnimationBlocked)return;let i=n.dragSnapshot;mG(e=>YU(t.layoutBox[e],r.layoutBox[e].min-i.layoutBox[e].min))}function FG(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.dragSnapshot||e.layout,e.isLayoutDirty=!0)}function IG(e){e.relativeTarget&&e.relativeParent?.isLayoutDirty&&(e.currentAnimation?e.isLayoutDirty=!0:(e.targetDelta=void 0,e.removeRelativeTarget()))}function LG(e){let{visualElement:t}=e.options;t?.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function RG(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function zG(e){e.resolveTargetDelta()}function BG(e){e.calcProjection()}function VG(e){e.resetSkewAndRotation()}function HG(e,t,n,r,i){let a=n.max-n.min,o=a?Math.max(0,(a+i-r)/a):1,s=e.originPoint=t.originPoint;e.origin=t.origin,e.scale=o,e.translate=n.min+r-(s+(n.min-s)*o)}function UG(e,t,n){e.translate=jR(t.translate,0,n),e.scale=jR(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function WG(e,t,n,r){e.min=jR(t.min,n.min,r),e.max=jR(t.max,n.max,r)}function GG(e,t,n,r){WG(e.x,t.x,n.x,r),WG(e.y,t.y,n.y,r)}function KG(e){return e.animationValues?.opacityExit!==void 0}var qG={duration:.45,ease:[.4,0,.1,1]};function JG(e,t,n){e.max=NW(n)+(e.min=t.min)}function YG(e,t,n){return e===`position`||e===`preserve-aspect`&&!PW(sG(t),sG(n),.2)}function XG(e){return e!==e.root&&e.scroll?.wasRoot}function ZG(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}var QG=TG({attachResizeListener:(e,t)=>ZG(e,`resize`,t),measureScroll:tW,checkIsScrollRoot:()=>!0}),$G={current:void 0},eK=TG({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!$G.current){let e=new QG({});e.mount(window),e.setOptions({layoutScroll:!0}),$G.current=e}return $G.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),tK=new WeakMap;function nK(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function rK(e){return typeof e==`string`||Array.isArray(e)}var iK=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`whilePinch`,`exit`],aK=[`initial`].concat(iK);function oK(e){if(nK(e.animate))return!0;for(let t=0;t<aK.length;t++)if(rK(e[aK[t]]))return!0;return!1}function sK(e){return!!(oK(e)||e.variants)}function cK(e,t,n){for(let r in t){let i=t[r],a=n[r];if(NH(i))e.addValue(r,i);else if(NH(a))e.addValue(r,uH(i,{owner:e}));else if(a!==i){if(e.hasValue(r)){let t=e.getValue(r);t.liveStyle===!0?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(r);e.addValue(r,uH(t===void 0?i:t,{owner:e}))}}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var lK={current:null},uK={current:!1},dK=typeof window<`u`;function fK(){if(uK.current=!0,dK){if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>lK.current=e.matches;e.addEventListener(`change`,t),t()}else lK.current=!1}}var pK=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],mK={};function hK(e){mK=e}function gK(){return mK}var _K=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,skipAnimations:i,blockInitialAnimation:a,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=KB,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify(`Update`,this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=ML.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,QR.render(this.render,!1,!0))};let{latestValues:c,renderState:l}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=t.initial?{...c}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=i,this.options=s,this.blockInitialAnimation=!!a,this.isControllingVariants=oK(t),this.isVariantNode=sK(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);let{willChange:u,...d}=this.scrapeMotionValuesFromProps(t,{},this);for(let e in d){let t=d[e];c[e]!==void 0&&NH(t)&&t.set(c[e])}}mount(e){let t=this.presenceContext;if(this.hasBeenMounted&&t?.isPresent!==!1&&!t?.keepValuesOnRemount)for(let e in this.initialValues)this.values.get(e)?.jump(this.initialValues[e]),this.latestValues[e]=this.initialValues[e];if(this.current=e,tK.set(e,this),this.projection?.instance||this.projection?.mount(e),this.isVariantNode&&!this.isControllingVariants){let e=this;do e=e.props.inherit!==!1&&e.parent;while(e&&!e.isVariantNode);if(e){let{variantChildren:t}=e;t.add(this),this.removeFromVariantTree=()=>t.delete(this)}}this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),this.reducedMotionConfig===`never`?this.shouldReduceMotion=!1:this.reducedMotionConfig===`always`?this.shouldReduceMotion=!0:(uK.current||fK(),this.shouldReduceMotion=lK.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection?.unmount(),$R(this.notifyUpdate),$R(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree?.(),this.parent?.removeChild(this);for(let e in this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),(this.enteringChildren||=new Set).add(e)}removeChild(e){this.children.delete(e),this.enteringChildren?.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.get(e)?.(),t.accelerate&&mV.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new aV({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:aL(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=OB.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&QR.preRender(this.notifyUpdate),n&&(this.projection&&(this.projection.isTransformDirty=!0),OV.get(this.current)?.check()),this.scheduleRender()}),i;typeof window<`u`&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),i?.()})}sortNodePosition(e){return!this.current||!e.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e=`animation`;for(e in mK){let t=mK[e];if(!t)continue;let{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):eG()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){let{transformTemplate:n,onUpdate:r}=this.props;(e.transformTemplate||n)&&this.scheduleRender(),(e.transformTemplate&&!n||e.onUpdate&&!r)&&OV.get(this.current)?.demote(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<pK.length;t++){let n=pK[t];this.propEventSubscriptions[n]?.(),delete this.propEventSubscriptions[n];let r=e[`on`+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=cK(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue?.()}getProps(){return this.props}getVariant(e){return this.props.variants?.[e]}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}addValue(e,t){let n=this.values.get(e);if(t!==n){n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t);let r=t.get();r!==void 0&&(this.latestValues[e]=r)}}removeValue(e){this.values.delete(e),this.valueSubscriptions.get(e)?.(),this.valueSubscriptions.delete(e),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){let n=this.props.values?.[e];return n||(n=this.values.get(e),n===void 0&&t!==void 0&&(n=uH(t??this.getDefaultValue?.(e),{owner:this}),this.addValue(e,n)),n)}readValue(e,t){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n==`string`&&(ZI(n)||$I(n))?n=parseFloat(n):typeof n!=`number`&&!DR.test(n)&&DR.test(t)&&(n=mB(e,t)),this.setBaseTarget(e,NH(n)?n.get():n)),NH(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}on(e,t){return(this.events[e]||(this.events[e]=new iL)).add(t)}notify(e,...t){this.events[e]?.notify(...t)}scheduleRenderMicrotask(){sW.render(this.render)}},vK=class extends _K{constructor(){super(...arguments),this.KeyframeResolver=XH}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){let n=e.style;return n?n[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;NH(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}};function yK(e,{style:t,vars:n},r,i){let a=e.style,o;for(o in t)a[o]=t[o];for(o in i?.applyProjectionStyles(a,r),n)a.setProperty(o,n[o])}function bK(e,{layout:t,layoutId:n}){return OB.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!uW[e]||e===`opacity`)}function xK(e,t,n){let r=e.style,i=t?.style,a={};if(!r)return a;for(let t in r)(NH(r[t])||i&&NH(i[t])||bK(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(a[t]=r[t]);return a}function SK(e){return window.getComputedStyle(e)}var CK=class extends vK{constructor(){super(...arguments),this.type=`html`,this.renderInstance=yK}mount(e){super.mount(e)}readValueFromInstance(e,t){if(OB.has(t))return this.projection?.isProjecting?wB(t):EB(e,t);{let n=SK(e),r=(FL(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return $U(e,t)}build(e,t,n){xU(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return xK(e,t,n)}},wK=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1;function TK(e){return{point:{x:e.pageX,y:e.pageY}}}var EK=e=>t=>wK(t)&&e(t,TK(t));function DK(e,t,n,r){return ZG(e,t,EK(n),r)}var OK=new WeakMap,kK,AK=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:oU(r)&&`getBBox`in r?r.getBBox()[t]:r[n],jK=AK(`inline`,`width`,`offsetWidth`),MK=AK(`block`,`height`,`offsetHeight`);function NK({target:e,borderBoxSize:t}){OK.get(e)?.forEach(n=>{n(e,{get width(){return jK(e,t)},get height(){return MK(e,t)}})})}function PK(e){e.forEach(NK)}function FK(){typeof ResizeObserver<`u`&&(kK=new ResizeObserver(PK))}function IK(e,t){kK||FK();let n=uU(e);return n.forEach(e=>{let n=OK.get(e);n||(n=new Set,OK.set(e,n)),n.add(t),kK?.observe(e)}),()=>{n.forEach(e=>{let n=OK.get(e);n?.delete(t),n?.size||kK?.unobserve(e)})}}var LK=new Set,RK;function zK(){RK=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};LK.forEach(t=>t(e))},window.addEventListener(`resize`,RK)}function BK(e){return LK.add(e),RK||zK(),()=>{LK.delete(e),!LK.size&&typeof RK==`function`&&(window.removeEventListener(`resize`,RK),RK=void 0)}}function VK(e,t){return cU(typeof e==`function`?BK(e):IK(e,t))}var HK=(e,t)=>Math.abs(e-t);function UK(e,t){let n=HK(e.x,t.x),r=HK(e.y,t.y);return Math.sqrt(n**2+r**2)}var WK=new Set([`auto`,`scroll`]),GK=class{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:a=3,element:o,immediate:s}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.hasPendingMove=!1,this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=qK(this.lastRawMoveEventInfo,this.transformPagePoint));let e=YK(this.lastMoveEventInfo,this.history),t=this.startEvent!==null,n=UK(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!n)return;let{point:r}=e;this.history.push({...r,timestamp:ML.now()});let{onStart:i,onMove:a}=this.handlers;t||(i?.(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),a?.(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.handleScroll(window),this.lastMoveEvent=e,this.lastRawMoveEventInfo=t,this.lastMoveEventInfo=qK(t,this.transformPagePoint),this.hasPendingMove=!0,QR.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.hasPendingMove&&this.updatePoint(),this.end();let{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&i?.(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let a=YK(e.type===`pointercancel`?this.lastMoveEventInfo:qK(t,this.transformPagePoint),this.history);this.startEvent&&n?.(e,a),r?.(e,a)},!wK(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=s?0:a,this.contextWindow=r||window;let c=TK(e),l=qK(c,this.transformPagePoint),{point:u}=l;this.history=[{...u,timestamp:ML.now()}];let{onSessionStart:d}=t;d&&d(e,YK(l,this.history));let f={passive:!0,capture:!0};this.removeListeners=nL(DK(this.contextWindow,`pointermove`,this.handlePointerMove,f),DK(this.contextWindow,`pointerup`,this.handlePointerUp,f),DK(this.contextWindow,`pointercancel`,this.handlePointerUp,f)),o&&this.startScrollTracking(o),s&&(this.handlePointerMove(e,c),this.updatePoint())}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(WK.has(e.overflowX)||WK.has(e.overflowY))&&this.scrollPositions.set(t,KK(t)),t=t.parentElement}this.scrollPositions.set(window,KK(window)),this.removeScrollListeners=nL(ZG(window,`scroll`,this.onElementScroll,{capture:!0}),ZG(window,`scroll`,this.onWindowScroll,{}))}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let n=e===window,r=KK(e),i={x:r.x-t.x,y:r.y-t.y};(i.x!==0||i.y!==0)&&(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,r),QR.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners?.(),this.removeScrollListeners?.(),this.scrollPositions.clear(),$R(this.updatePoint)}},KK=e=>e===window?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop};function qK(e,t){return t?{point:t(e.point)}:e}function JK(e,t){return{x:e.x-t.x,y:e.y-t.y}}function YK({point:e},t){return{point:e,delta:JK(e,ZK(t)),offset:JK(e,XK(t)),velocity:QK(t,.1)}}function XK(e){return e[0]}function ZK(e){return e[e.length-1]}function QK(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null,i=ZK(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>aL(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&i.timestamp-r.timestamp>aL(t)*2&&(r=e[1]);let a=oL(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};let o={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}var $K=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function eq(e){return $K.has(e.tagName)||e.isContentEditable===!0}var tq=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function nq(e){return tq.has(e.tagName)||e.isContentEditable===!0}var rq={x:!1,y:!1};function iq(){return rq.x||rq.y}function aq(e){return e===`x`||e===`y`?rq[e]?null:(rq[e]=!0,()=>{rq[e]=!1}):rq.x||rq.y?null:(rq.x=rq.y=!0,()=>{rq.x=rq.y=!1})}function oq(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?jR(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?jR(n,e,r.max):Math.min(e,n)),e}function sq(e,t,n){return{min:t===void 0?void 0:e.min+t,max:n===void 0?void 0:e.max+n-(e.max-e.min)}}function cq(e,{top:t,left:n,bottom:r,right:i}){return{x:sq(e.x,n,i),y:sq(e.y,t,r)}}function lq(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function uq(e,t){return{x:lq(e.x,t.x),y:lq(e.y,t.y)}}function dq(e,t){let n=.5,r=NW(e),i=NW(t);return i>r?n=rL(t.min,t.max-r,e.min):r>i&&(n=rL(e.min,e.max-i,t.min)),YI(0,1,n)}function fq(e,t){let n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}var pq=.35;function mq(e=pq){return e===!1?e=0:e===!0&&(e=pq),{x:hq(e,`left`,`right`),y:hq(e,`top`,`bottom`)}}function hq(e,t,n){return{min:gq(e,t),max:gq(e,n)}}function gq(e,t){return typeof e==`number`?e:e[t]||0}function _q(e){let t=``;for(let n of e.path){n.scroll=void 0,n.updateScroll();let{scroll:r}=n;n!==e.root&&r&&(t+=r.offset.x+`,`+r.offset.y+`,`)}return t}var vq=new WeakMap,yq=class{constructor(e,t=()=>e.getProps()){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=eG(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e,this.readProps=t}start(e,t={}){if(this.visualElement.presenceContext?.isPresent===!1)return;let n=e=>{t.snapToCursor&&this.snapToCursor(e),this.stopAnimation()},r=(e,t)=>{let{drag:n,dragConstraints:r,dragPropagation:i,onDragStart:a}=this.getProps();if(n&&!i&&(this.openDragLock?.(),this.openDragLock=aq(n),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints();let{projection:o}=this.visualElement;o&&(o.isAnimationBlocked=!0,o.target=void 0),mG(e=>{let t=this.getAxisMotionValue(e).get()||0;if(LL(t)&&(t=CH(t,this.visualElement.current)||0),rR.test(t))t=parseFloat(t);else if(nR.test(t)){let n=o?.layout?.layoutBox[e];n&&(t=NW(n)*(parseFloat(t)/100))}this.originPoint[e]=t}),this.point=typeof r==`function`&&r(this),a&&QR.update(()=>a(e,t),!1,!0),FH(this.visualElement,`transform`),this.visualElement.animationState?.setActive(`whileDrag`,!0)},i=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:a}=this.getProps();if(!n&&!this.openDragLock)return;let{offset:o}=t;if(r&&this.currentDirection===null){if(this.currentDirection=Tq(o),this.currentDirection===null)return;i&&i(this.currentDirection)}this.updateAxis(`x`,o),this.updateAxis(`y`,o),this.point&&this.point.move(),this.visualElement.render(),a&&QR.update(()=>a(e,t),!1,!0)},a=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},o=()=>{let{dragSnapToOrigin:e}=this.getProps();(e||this.constraints||this.point)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:s}=this.getProps();this.panSession=new GK(e,{onSessionStart:n,onStart:r,onMove:i,onSessionEnd:a,resumeAnimation:o},{...t,transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:s,contextWindow:this.visualElement.current?.ownerDocument.defaultView,element:this.visualElement.current})}stop(e,t,n){let r=e||this.latestPointerEvent,i=t||this.latestPanInfo,a=this.isDragging;if(this.cancel(),!a||!i||!r)return;let{velocity:o}=i;this.startAnimation(o,n);let{onDragEnd:s}=this.getProps();s&&QR.postRender(()=>s(r,i))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession(),!this.getProps().dragPropagation&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t?.setActive(`whileDrag`,!1)}endPanSession(){this.panSession?.end(),this.panSession=void 0}updateAxis(e,t){let{drag:n}=this.readProps();if(!t||!wq(e,n,this.currentDirection))return;let r=this.getAxisMotionValue(e),i=this.originPoint[e]+t[e],a=this.constraints&&this.constraints[e];a&&(i=oq(i,a,this.elastic[e])),this.point?this.point[e]=i:r.set(i)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),{projection:n}=this.visualElement,r=n&&(n.layout||n.measure(!1)),i=this.constraints;bq(e)?(!this.constraints||this.scroll!==_q(n))&&(this.constraints=this.resolveRefConstraints()):this.constraints=e&&r&&typeof e==`object`?cq(r.layoutBox,e):!1,this.elastic=mq(t),i!==this.constraints&&!bq(e)&&r&&this.constraints&&!this.hasMutatedConstraints&&mG(e=>{this.constraints!==!1&&this.getAxisMotionValue(e)&&(this.constraints[e]=fq(r.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!bq(e))return!1;let n=xq(e),{projection:r}=this.visualElement;if(!r||!r.layout)return!1;this.scroll=_q(r);let i=eW(n,r.root,this.visualElement.getTransformPagePoint()),a=uq(r.layout.layoutBox,r.removeElementScroll(i));if(t){let e=t(NU(a));this.hasMutatedConstraints=!!e,e&&(a=MU(e))}return a}startAnimation(e,t){let{drag:n,dragMomentum:r,dragElastic:i,dragTransition:a,dragSnapToOrigin:o,onDragTransitionEnd:s}=this.getProps(),c={bounceStiffness:i?200:1e6,bounceDamping:i?40:1e7,timeConstant:750,restDelta:1,restSpeed:10,...a},l=i=>r&&!(this.point&&o)&&wq(i,t||n,this.currentDirection)?e[i]:0;if(this.point&&!o)return this.point.release({x:l(`x`),y:l(`y`)},c).then(s);let u=this.constraints||{},d=mG(e=>{if(!wq(e,t||n,this.currentDirection))return;let r=u[e]||{};(o===!0||o===e)&&(r={min:0,max:0});let i={type:`inertia`,velocity:l(e),...c,...r};return this.startAxisValueAnimation(e,i)});return Promise.all(d).then(s)}startAxisValueAnimation(e,t){let n=this.getAxisMotionValue(e);return FH(this.visualElement,e),n.start(bH(e,n,0,t,this.visualElement,!1))}stopAnimation(){mG(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`;return this.readProps()[t]||this.visualElement.getValue(e,this.visualElement.latestValues[e]??0)}snapToCursor({clientX:e,clientY:t}){let{drag:n}=this.getProps(),r={x:e,y:t},i=this.visualElement.getTransformPagePoint()?.(r)||r,a=this.visualElement.measureViewportBox();mG(e=>{if(!wq(e,n,this.currentDirection))return;let t=this.getAxisMotionValue(e),{min:r,max:o}=a[e];t.set((t.get()||0)+i[e]-jR(r,o,.5))})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!bq(t)||!n||!this.constraints)return;this.stopAnimation();let r=this.constraints,i={x:0,y:0};mG(e=>{let t=this.getAxisMotionValue(e).get();i[e]=dq({min:t,max:t},r[e])});let{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},``):`none`,n.root?.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),mG(t=>{let n=this.getAxisMotionValue(t);if(!wq(t,e,null)||!n.get())return;let{min:r,max:a}=this.constraints[t];n.set(jR(r,a,i[t]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;vq.set(this.visualElement,this);let e=this.visualElement.current,t=DK(e,`pointerdown`,t=>{let{drag:n,dragListener:r=!0}=this.getProps(),i=t.target,a=i!==e&&nq(i);n&&r&&!a&&this.start(t)}),n,r=()=>{let{dragConstraints:t}=this.getProps(),r=bq(t)&&xq(t);r&&(this.constraints=this.resolveRefConstraints(),n||=Cq(e,r,()=>this.scalePositionWithinConstraints()))},{projection:i}=this.visualElement,a=i.addEventListener(`measure`,r);i.layout||(i.root?.updateScroll(),i.updateLayout()),QR.read(r);let o=ZG(window,`resize`,()=>this.scalePositionWithinConstraints()),s=i.addEventListener(`didUpdate`,(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(mG(t=>{if(!wq(t,this.getProps().drag,this.currentDirection))return;let n=this.getAxisMotionValue(t);this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate)}),this.visualElement.render())}));return()=>{o(),t(),a(),s(),n?.()}}getProps(){let e=this.readProps(),{dragElastic:t=pq,dragMomentum:n=!0}=e;return{...e,dragElastic:t,dragMomentum:n}}};function bq(e){return!!e&&typeof e==`object`&&(`current`in e||`nodeType`in e)}var xq=e=>`current`in e?e.current:e;function Sq(e){let t=!0;return()=>{t?t=!1:e()}}function Cq(e,t,n){let r=VK(e,Sq(n)),i=VK(t,Sq(n));return()=>{r(),i()}}function wq(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function Tq(e,t=10){let n=null;return Math.abs(e.y)>t?n=`y`:Math.abs(e.x)>t&&(n=`x`),n}function Eq(e,t){let n=uU(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},cU(()=>r.abort())]}function Dq(e){return!(e.pointerType===`touch`||iq())}function Oq(e,t,n={}){t=lU(t);let[r,i,a]=Eq(e,n);return r.forEach(e=>{let n=!1,r=!1,a,o=()=>{e.removeEventListener(`pointerleave`,u)},s=e=>{a&&=(a(e),void 0),o()},c=e=>{n=!1,window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),r&&(r=!1,s(e))},l=()=>{n=!0,window.addEventListener(`pointerup`,c,i),window.addEventListener(`pointercancel`,c,i)},u=e=>{e.pointerType!==`touch`&&(n?r=!0:s(e))};e.addEventListener(`pointerenter`,n=>{if(!Dq(n))return;r=!1;let o=t(e,n);typeof o==`function`&&(a=o,e.addEventListener(`pointerleave`,u,i))},i),e.addEventListener(`pointerdown`,l,i)}),a}var kq=(e,t)=>t?e===t||kq(e,t.parentElement):!1,Aq=new WeakSet;function jq(e){return t=>{t.key===`Enter`&&e(t)}}function Mq(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var Nq=(e,t)=>{let n=!1,r=jq(()=>{n||Aq.has(e)||(n=!0,Mq(e,`down`))}),i=jq(()=>{n&&(n=!1,Mq(e,`up`))});e.addEventListener(`keydown`,r,t),e.addEventListener(`keyup`,i,t),e.addEventListener(`blur`,()=>{e.removeEventListener(`keydown`,r),e.removeEventListener(`keyup`,i),n&&Mq(e,`cancel`)},{...t,once:!0})};function Pq(e){return wK(e)&&!iq()}var Fq=new WeakSet,Iq=100,Lq=8,Rq=(e,t,n)=>Math.hypot(e.clientX-t.clientX,e.clientY-t.clientY)>n,zq=e=>e.preventDefault();function Bq(e,t,n={}){t=lU(t);let[r,i,a]=Eq(e,n),o=new WeakMap,s=e=>{let r=e.currentTarget;if(!Pq(e)||Fq.has(e))return;n.stopPropagation&&Fq.add(e);let{count:a=1,countTimeout:s=.3,hold:c=0,repeat:l}=n,u=ML.now(),d=aL(c),f=aL(s),p=o.get(r);p?.expire(Rq(p.event,e,Iq))?p=void 0:p&&($R(p.expire),o.delete(r));let m=p?p.count+1:1,h=m>=a,g=h&&(c||l),_=!c,v=0,y;if(Aq.add(r),p)y=p.handlers;else{let n=t(r,e);y=typeof n==`function`?{onComplete:n}:n||{}}h&&_&&y.onActive?.();let b=aL(l),x=d||b,S=u+x,C=!0,w=()=>{if(i.signal.aborted)return $R(w);let e=Math.min(1-(S-ML.now())/x,1);C&&e<1&&(e=0),C=!1,y.onHold?.(e),!(e<1)&&(_?y.onRepeat?.(++v):(_=!0,y.onActive?.()),l?(C=!0,S+=x=b):$R(w))},T={...i,capture:!0},E=(t,n)=>{if(wK(t)){if(window.removeEventListener(`pointerup`,D,T),window.removeEventListener(`pointercancel`,O,T),window.removeEventListener(`pointermove`,k,T),r.removeEventListener(`contextmenu`,zq),$R(w),Aq.delete(r),iq()&&(n=!1),n&&!h){let n=ML.now(),a=e=>{let s=i.signal.aborted;if(s||e===!0||ML.now()-n>f)return $R(a),o.delete(r),s||y.onComplete?.(t,{success:!1}),!0};o.set(r,{count:m,event:e,handlers:y,expire:a}),QR.update(a,!0)}else y.onComplete?.(t,{success:n&&_})}},D=e=>{E(e,r===window||r===document||n.useGlobalTarget||kq(r,e.target))},O=e=>{E(e,!1)},k=t=>{wK(t)&&((l||!_)&&Rq(e,t,Lq)||a>1&&iq())&&O(t)};window.addEventListener(`pointerup`,D,T),window.addEventListener(`pointercancel`,O,T),(g||a>1)&&window.addEventListener(`pointermove`,k,T),g&&(QR.update(w,!0),r.addEventListener(`contextmenu`,zq,{...i,passive:!1}))};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,s,i),aU(e)&&(e.addEventListener(`focus`,()=>Nq(e,i),i),!eq(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function Vq(...e){let t=!Array.isArray(e[0]),n=t?0:-1,r=e[0+n],i=e[1+n],a=e[2+n],o=e[3+n],s=Nz(i,a,o);return t?s(r):s}var Hq=new Set,Uq=({timestamp:e})=>{Hq.forEach(t=>t.tick(e))},Wq=class extends Xz{constructor(e){super(),this.state=`idle`,this.startTime=0,this.currentTime=0,this.started=!1,this.hasNextTarget=!1,this.nextTarget=0,this.stop=()=>{this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},this.options=e,this.factory=e.type,this.generator=this.factory(e);let{driver:t}=e;t&&(this.driver=t(e=>this.tick(e))),this.startTime=this.now(),this.state=`running`,this.driver?this.driver.start():(Hq.size||QR.update(Uq,!0),Hq.add(this))}setTarget(e,t){this.nextTarget=e,this.nextVelocity=t,this.hasNextTarget=!0}retarget(e,t){let{options:n,generator:r}=this;n.keyframes=e,n.velocity=t,this.startTime=this.now(),this.currentTime=0,r.retarget?r.retarget(e,t):this.generator=this.factory(n)}tick(e){let{options:t,hasNextTarget:n}=this,{delay:r=0,onUpdate:i,onPlay:a}=t;this.started||(this.startTime=Kz(this.startTime,e));let o=Math.round(e-this.startTime)-r,s=this.currentTime=Math.max(0,o),c=this.generator.next(s),l=o<0?t.keyframes[0]:c.value;if(n){this.hasNextTarget=!1;let{keyframes:e}=t;e[0]=l,e[1]=this.nextTarget,this.retarget(e,this.nextVelocity??this.getGeneratorVelocity())}(n||!this.started)&&(this.started=!0,a?.()),this.state===`running`&&(i?.(l),c.done&&o>=0&&!n&&!this.hasNextTarget&&this.state===`running`&&(this.notifyFinished(),this.teardown(),this.state=`finished`,t.onComplete?.()))}getGeneratorVelocity(){return Vz(this.generator,this.currentTime,this.options.velocity)}now(){return this.driver?this.driver.now():ML.now()}teardown(){this.state=`idle`,this.driver?this.driver.stop():(Hq.delete(this),Hq.size||$R(Uq))}};function Gq(e,t,n){let r=e.get(),i=null,a,o=typeof r==`string`?r.replace(/[\d.-]/g,``):void 0,s=e=>a(o?e+o:e),c=()=>e.events.animationStart?.notify(),l=()=>{i&&=(i.stop(),null),e.animation=void 0};if(e.attach((t,r)=>{a=r;let o=gW(t);if(i?.state===`running`){i.setTarget(o,n.velocity);return}let u=gW(e.get()),d=i?i.getGeneratorVelocity():e.getVelocity();if(l(),u===o)return;let f=i=new Wq({keyframes:[u,o],velocity:d,restDelta:.001,restSpeed:.01,...n,onUpdate:s,onPlay:c});e.animation=f,f.then(()=>{i===f&&(i=null,e.animation=void 0,e.events.animationComplete?.notify())})},l),NH(t)){let r=n.skipInitialAnimation===!0,i=t=>{r?(r=!1,e.jump(Kq(t,o),!1)):e.set(Kq(t,o))},a=t.on(`change`,i),s=t.get();gW(s)-gW(e.get())&&i(s);let c=e.on(`destroy`,a);return()=>{a(),c(),l()}}return l}function Kq(e,t){return t?e+t:e}function qq(e,t,n){return Gq(e,t,{...n,type:Az})}var Jq=class{constructor(e){this.isMounted=!1,this.node=e}update(){}},Yq=new Set([`baseFrequency`,`diffuseConstant`,`kernelMatrix`,`kernelUnitLength`,`keySplines`,`keyTimes`,`limitingConeAngle`,`markerHeight`,`markerWidth`,`numOctaves`,`targetX`,`targetY`,`surfaceScale`,`specularConstant`,`specularExponent`,`stdDeviation`,`tableValues`,`viewBox`,`gradientTransform`,`pathLength`,`startOffset`,`textLength`,`lengthAdjust`]),Xq=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function Zq(e,t,n,r){yK(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(Yq.has(n)?n:bU(n),t.attrs[n])}function Qq(e,t,n){let r=xK(e,t,n);for(let n in e)if(n!==`children`&&(NH(e[n])||NH(t[n]))){let t=DB.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var $q=class extends vK{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=eG}getBaseTargetFromProps(e,t){return OB.has(t)?super.getBaseTargetFromProps(e,t)??wB(t):e[t]}getDefaultValue(e){return OB.has(e)?this.latestValues[e]??wB(e):void 0}readValueFromInstance(e,t){if(OB.has(t)){let e=lB(t);return e&&e.default||0}if(TU.includes(t)){let n=getComputedStyle(e)[t];if(typeof n==`string`&&n)return n.trim()}return t=Yq.has(t)?t:bU(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return Qq(e,t,n)}build(e,t,n){EU(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){Zq(e,t,n,r)}mount(e){this.isSVGTag=Xq(e.tagName),super.mount(e)}};function eJ(e,t){if(!Array.isArray(t))return!1;let n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}var tJ=[...iK].reverse(),nJ=e=>e?.out===!0?e:e?.out;function rJ(e){let t=t=>Promise.all(t.map(({animation:t,options:n})=>HH(e,t,n))),n=aJ(),r=!0,i=!1;function a(a){let{props:o,parent:s,manuallyAnimateOnMount:c}=e,{initial:l}=o,u=r||i,d=[],f=(t=l)=>typeof t!=`boolean`&&EH(e,Array.isArray(t)?t[0]:t,e.presenceContext?.custom)||void 0,p=new Map,m={},h=1/0,g=e;do g=g.props.inherit!==!1&&g.parent;while(g&&!g.isControllingVariants);let _=u&&nJ(f(l??(g&&g.props.initial))?.transition);if(tJ.forEach((t,r)=>{let i=n[t],l=o[t],f=g&&g.props[t],v=l===void 0?rK(f)||f===!1?f:void 0:l,y=rK(v),b=t===a?i.isActive:null,x=y&&l===void 0&&!(u&&c);if(i.protectedKeys={...m},!i.isActive&&b===null||!v&&!i.prevProp||nK(v)||typeof v==`boolean`)return;if(b===!1&&(h=r),t===`exit`&&i.isActive&&b!==!0){m={...m,...i.prevResolvedValues};return}let S=iJ(i.prevProp,v),C=S||y&&(b&&!x||r>h),w=!1,T=Array.isArray(v)?v:[v],E={},D;if(b!==!1)for(let n of T){let{transition:r,transitionEnd:i,...a}=EH(e,n,DH(e,t))||{};E={...E,...a,...i},D=nJ(r)||D}let{prevResolvedValues:O}=i;for(let t in{...O,...E}){if(t in m)continue;let n=E[t],r=O[t],a=Array.isArray(n)&&Array.isArray(r)?!eJ(n,r)||S:n!==r,o;if(a&&n==null)p.has(t)||p.set(t,i.prevOut);else if(a||n!==void 0&&p.has(t)){C=!0,o=p.get(t)||_,p.delete(t)&&(w=!0),i.needsAnimating[t]=!0;let n=e.getValue(t);n&&(n.liveStyle=!1)}else i.protectedKeys[t]=!0;i.out[t]=o}if(i.prevProp=v,i.prevResolvedValues=E,i.prevOut=D,i.isActive&&(m={...m,...E}),C&&(!(x&&S)||w))for(let n of T){let r={type:t};if(typeof n==`string`&&u&&c&&s?.enteringChildren){let t=EH(s,n)?.transition?.delayChildren;r.delay=aH(s.enteringChildren,e,t)}d.push({animation:n,options:r})}}),p.size){let t={},n=f(),r=n?.transition;p.forEach((i,a)=>{i&&(r={...r||e.getDefaultTransition(),[a]:i});let s=e.getValue(a);s&&(s.liveStyle=!0);let c=n&&!Array.isArray(l)?n[a]:void 0,u=e.getBaseTargetFromProps(o,a);t[a]=(c===void 0?u!==void 0&&!NH(u)?u:e.initialValues[a]===void 0?e.baseTarget[a]:void 0:c)??null}),r&&(t.transition=r),d.push({animation:t})}let v=u&&e.blockInitialAnimation||r&&!c&&(o.initial===!1||o.initial===o.animate);return r=i=!1,!v&&d.length?t(d):Promise.resolve()}function o(t,r){if(n[t].isActive===r)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,r)),n[t].isActive=r;let i=a(t);for(let e in n)n[e].protectedKeys={};return i}return{animateChanges:a,setActive:o,setAnimateFunction:n=>{t=n(e)},getState:()=>n,reset:()=>{n=aJ(),i=!0}}}function iJ(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!eJ(t,e):!1}function aJ(){let e={};for(let t of iK)e[t]={isActive:t===`animate`,protectedKeys:{},needsAnimating:{},prevResolvedValues:{},out:{}};return e}var oJ=(0,v.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function sJ(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function cJ(...e){return t=>{let n=!1,r=e.map(e=>{let r=sJ(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():sJ(e[t],null)}}}}function lJ(...e){return v.useCallback(cJ(...e),e)}var uJ=e=>{let{width:t,height:n}=e?.getBoundingClientRect()||{};return[t/e?.offsetWidth||1,n/e?.offsetHeight||1]},dJ=e=>{let{left:t,top:n}=e.getBoundingClientRect(),r=e;for(;r=r.parentElement||r.parentNode?.host;){let{scrollLeft:e,scrollTop:i}=r;if(e||i){let[a,o]=uJ(r);t+=e*a,n+=i*o}if(getComputedStyle(r).position===`fixed`)break}let[i,a]=uJ(e.offsetParent);return[t/i,n/a]},fJ=class extends v.Component{getSnapshotBeforeUpdate(e){let t=this.props.getElement();if(aU(t)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){let e=t.offsetParent,n=aU(e)&&e.offsetWidth||0,r=aU(e)&&e.offsetHeight||0,i=getComputedStyle(t),a=this.props.sizeRef.current;a.height=parseFloat(i.height),a.width=parseFloat(i.width),a.top=t.offsetTop,a.left=t.offsetLeft,a.right=n-a.width-a.left,a.bottom=r-a.height-a.top,a.direction=i.direction,a.point=dJ(t)}return null}componentDidUpdate(){}render(){return this.props.children}};function pJ({children:e,isPresent:t,anchorX:n,anchorY:r,root:i,pop:a,popNode:o}){let s=(0,v.useId)(),c=(0,v.useRef)(null),l=(0,v.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:`ltr`}),{nonce:u}=(0,v.useContext)(oJ),d=lJ(c,a===!1?void 0:e.props?.ref??e?.ref),f=()=>c.current||o?.current?.current,p=e=>{let{width:t,height:i,top:a,left:o,right:c,bottom:u,direction:d}=l.current,f=d===`rtl`,p=n===`left`?f?`right:${c}`:`left:${o}`:f?`left:${o}`:`right:${c}`,m=r===`bottom`?`bottom:${u}`:`top:${a}`;e?.insertRule(`[data-motion-pop-id="${s}"]{position:absolute!important;width:${t}px!important;height:${i}px!important;${p}px!important;${m}px!important}`)};return(0,v.useInsertionEffect)(()=>{let{width:e,height:n}=l.current,r=f();if(t||a===!1||!r||!e||!n)return;r.dataset.motionPopId=s;let o=r.ownerDocument,c=o.createElement(`style`);u&&(c.nonce=u);let d=i??o.head;d.appendChild(c),p(c.sheet);let m=0,h=0;return sW.setup(()=>{let[e,t]=dJ(r);m=l.current.point[0]-e,h=l.current.point[1]-t}),sW.read(()=>{let{sheet:e}=c;if(!e||!m&&!h)return;let t=l.current;t.left+=m,t.right-=m,t.top+=h,t.bottom-=h,e.deleteRule(0),p(e)}),()=>{r.removeAttribute(`data-motion-pop-id`),d.contains(c)&&d.removeChild(c)}},[t]),(0,S.jsx)(fJ,{isPresent:t,getElement:f,sizeRef:l,pop:a,children:a===!1?e:v.cloneElement(e,{ref:d})})}var mJ=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:a,mode:o,anchorX:s,anchorY:c,root:l})=>{let u=WI(hJ),d=(0,v.useId)(),f=(0,v.useRef)(),p=(0,v.useRef)(n),m=(0,v.useRef)(r);GI(()=>{p.current=n,m.current=r});let h=!0,g=(0,v.useMemo)(()=>(h=!1,{id:d,initial:t,isPresent:n,custom:i,onExitComplete:e=>{u.set(e,!0);for(let e of u.values())if(!e)return;r&&r()},register:(e,t)=>(u.set(e,!1),t&&t.parent?.presenceContext?.id!==d&&(f.current=t),()=>{u.delete(e),!p.current&&!u.size&&m.current?.()})}),[n,u,r]);return a&&h&&(g={...g}),(0,v.useMemo)(()=>{u.forEach((e,t)=>u.set(t,!1))},[n]),v.useEffect(()=>{!n&&!u.size&&r&&r()},[n]),e=(0,S.jsx)(pJ,{pop:o===`popLayout`,isPresent:n,anchorX:s,anchorY:c,root:l,popNode:f,children:e}),(0,S.jsx)(KI.Provider,{value:g,children:e})};function hJ(){return new Map}function gJ(e=!0){let t=(0,v.useContext)(KI);if(t===null)return[!0,null];let{isPresent:n,onExitComplete:r,register:i}=t,a=(0,v.useId)();(0,v.useEffect)(()=>{if(e)return i(a)},[e]);let o=(0,v.useCallback)(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,o]:[!0]}var _J=e=>e.key||``;function vJ(e){let t=[];return v.Children.forEach(e,e=>{(0,v.isValidElement)(e)&&t.push(e)}),t}var yJ=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:a=`sync`,propagate:o=!1,anchorX:s=`left`,anchorY:c=`top`,root:l})=>{let[u,d]=gJ(o),f=(0,v.useMemo)(()=>vJ(e),[e]),p=o&&!u?[]:f.map(_J),m=(0,v.useRef)(!0),h=WI(()=>new Map),g=(0,v.useRef)(new Set),[_,y]=(0,v.useState)(f),[b,x]=(0,v.useState)(f);GI(()=>{o&&!u&&!b.length&&d?.()},[u,o,b.length,d]);let C=(0,v.useRef)();(0,v.useEffect)(()=>()=>{let e=C.current;C.current=void 0,e?.()},[b]),GI(()=>{m.current=!1;for(let e=0;e<b.length;e++){let t=_J(b[e]);p.includes(t)?(h.delete(t),g.current.delete(t)):h.get(t)!==!0&&h.set(t,!1)}},[b,p.length,p.join(`-`)]);let w=[];if(f!==_){let e=[...f],t=0;for(let n of b){let r=p.indexOf(_J(n));r===-1?(e.splice(t++,0,n),w.push(n)):t=r+w.length+1}return w.every(e=>h.get(_J(e)))?e=f:a===`wait`&&(e=w),x(vJ(e)),y(f),null}let{forceRender:T}=(0,v.useContext)(UI);return(0,S.jsx)(S.Fragment,{children:b.map(e=>{let _=_J(e),v=o&&!u?!1:f===b||p.includes(_);return(0,S.jsx)(mJ,{isPresent:v,initial:!m.current||n?void 0:!1,custom:t,presenceAffectsLayout:i,mode:a,root:l,onExitComplete:v?void 0:()=>{if(g.current.has(_))return;if(h.has(_))g.current.add(_),h.set(_,!0);else return;let e=!0;h.forEach(t=>{t||(e=!1)}),e&&(T?.(),y([]),o&&d?.(),C.current=r)},anchorX:s,anchorY:c,children:e},_)})})},bJ=(0,v.createContext)({strict:!1}),xJ={animation:[`variants`,...iK],exit:[`exit`],drag:[`drag`,`dragControls`],focus:[`whileFocus`],hover:[`whileHover`,`onHoverStart`,`onHoverEnd`],tap:[`whileTap`,`onTap`,`onTapStart`,`onTapCancel`],pan:[`onPan`,`onPanStart`,`onPanSessionStart`,`onPanEnd`],inView:[`whileInView`,`onViewportEnter`,`onViewportLeave`],layout:[`layout`,`layoutId`]},SJ=!1;function CJ(){if(SJ)return;let e={};for(let t in xJ)e[t]={isEnabled:e=>xJ[t].some(t=>!!e[t])};hK(e),SJ=!0}function wJ(){return CJ(),gK()}function TJ(e){let t=wJ();for(let n in e)t[n]={...t[n],...e[n]};hK(t)}var EJ=(0,v.createContext)({});function DJ(e,t){if(oK(e)){let{initial:t,animate:n}=e;return{initial:t===!1||rK(t)?t:void 0,animate:rK(n)?n:void 0}}return e.inherit===!1?{}:t}function OJ(e){let{initial:t,animate:n}=DJ(e,(0,v.useContext)(EJ));return(0,v.useMemo)(()=>({initial:t,animate:n}),[kJ(t),kJ(n)])}function kJ(e){return Array.isArray(e)?e.join(` `):e}var AJ=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function jJ(e,t,n){for(let r in t)!NH(t[r])&&!bK(r,n)&&(e[r]=t[r])}function MJ({transformTemplate:e},t){return(0,v.useMemo)(()=>{let n=AJ();return xU(n,t,e),Object.assign({},n.vars,n.style)},[t])}function NJ(e,t){let n=e.style||{},r={};return jJ(r,n,e),Object.assign(r,MJ(e,t)),r}function PJ(e,t){let n={},r=NJ(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout=`none`,r.touchAction=e.drag===!0?`none`:`pan-${e.drag===`x`?`y`:`x`}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}var FJ=()=>({...AJ(),attrs:{}});function IJ(e,t,n,r){let i=(0,v.useMemo)(()=>{let n=FJ();return EU(n,t,Xq(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};return jJ(t,e.style,e),{...i,style:{...t,...i.style}}}return i}var LJ=new Set(`animate.exit.variants.initial.style.values.transition.transformTemplate.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.tap.propagate.ignoreStrict.viewport.pinch`.split(`.`));function RJ(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||LJ.has(e)}function zJ(e,t){return e.startsWith(`on`)?!RJ(e):t?.(e)??!RJ(e)}function BJ(e,t,n,r){let i={};for(let a in e)(a!==`values`||typeof e.values!=`object`)&&(NH(e[a])||(a===`fx`?e.fx&&(i.fx=``):(zJ(a,r)||n===!0&&RJ(a)||!t&&!RJ(a)||e.draggable&&a.startsWith(`onDrag`))&&(i[a]=e[a])));return i}var VJ=[`animate`,`circle`,`defs`,`desc`,`ellipse`,`g`,`image`,`line`,`filter`,`marker`,`mask`,`metadata`,`path`,`pattern`,`polygon`,`polyline`,`rect`,`stop`,`switch`,`symbol`,`svg`,`text`,`tspan`,`use`,`view`];function HJ(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(VJ.indexOf(e)>-1||/[A-Z]/u.test(e))}function UJ(e,t,n,{latestValues:r},i,a=!1,o,s){let c=(o??HJ(e)?IJ:PJ)(t,r,i,e),l=BJ(t,typeof e==`string`,a,s),u=e===v.Fragment?{}:{...l,...c,ref:n},{children:d}=t,f=(0,v.useMemo)(()=>NH(d)?d.get():d,[d]);return(0,v.createElement)(e,{...u,children:f})}function WJ({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:GJ(n,r,i,e),renderState:t()}}function GJ(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=hW(a[e]);let{initial:o,animate:s}=e,c=oK(e),l=sK(e);t&&l&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),s===void 0&&(s=t.animate));let u=n?n.initial===!1:!1;u||=o===!1;let d=u?s:o;if(d&&typeof d!=`boolean`&&!nK(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=TH(e,t[n]);if(r){let{transitionEnd:e,transition:t,...n}=r;for(let e in n){let t=n[e];if(Array.isArray(t)){let e=u?t.length-1:0;t=t[e]}t!==null&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}var KJ=e=>(t,n)=>{let r=(0,v.useContext)(EJ),i=(0,v.useContext)(KI),a=()=>WJ(e,t,r,i);return n?a():WI(a)},qJ=KJ({scrapeMotionValuesFromProps:xK,createRenderState:AJ}),JJ=KJ({scrapeMotionValuesFromProps:Qq,createRenderState:FJ}),YJ=Symbol.for(`motionComponentSymbol`);function XJ(e,t,n){let r=(0,v.useRef)(n);(0,v.useInsertionEffect)(()=>{r.current=n});let i=(0,v.useRef)(null);return(0,v.useCallback)(n=>{n&&e.onMount?.(n),t&&(n?t.mount(n):t.unmount());let a=r.current;if(typeof a==`function`){if(n){let e=a(n);typeof e==`function`&&(i.current=e)}else i.current?(i.current(),i.current=null):a(n)}else a&&(a.current=n)},[t])}var ZJ=(0,v.createContext)({});function QJ(e,t,n,r,i,a){let{visualElement:o}=(0,v.useContext)(EJ),s=(0,v.useContext)(bJ),c=(0,v.useContext)(KI),l=(0,v.useContext)(oJ),u=l.reducedMotion,d=l.skipAnimations,f=(0,v.useRef)(null),p=(0,v.useRef)(!1);r||=s.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u,skipAnimations:d,isSVG:a}),p.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));let m=f.current,h=(0,v.useContext)(ZJ);m&&!m.projection&&i&&(m.type===`html`||m.type===`svg`)&&i.create(m,n,h),(0,v.useInsertionEffect)(()=>{m&&m.props!==n&&m.update(n,c)});let g=n[IH],_=(0,v.useRef)(!!g&&typeof window<`u`&&!window.MotionHandoffIsComplete?.(g)&&window.MotionHasOptimisedAnimation?.(g));return GI(()=>{p.current&&m&&(m.animationState?.animateChanges(),m.enteringChildren=void 0)},[]),GI(()=>{p.current=!0,m&&(window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),_.current&&m.animationState&&m.animationState.animateChanges())}),(0,v.useEffect)(()=>{m&&(!_.current&&m.animationState&&m.animationState.animateChanges(),_.current&&=(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(g)}),!1),m.enteringChildren=void 0)}),m}function $J(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&TJ(r);let a=n?n===`svg`:HJ(e),o=a?JJ:qJ;function s(n,s){let c,l=eY(n);WI(()=>!!$G.current?.sharedNodes.get(l)?.lead&&n.initial)&&(n={...n,initial:!1});let u={...(0,v.useContext)(oJ),...n,layoutId:l},{isStatic:d,isValidProp:f}=u,p=OJ(n),m=o(n,d);if(!d&&typeof window<`u`){tY(u,r);let t=nY(u);p.visualElement=QJ(e,m,u,i,t.ProjectionNode,a),(t.isEnabled||p.visualElement?.projection?.options.layoutId)&&(c=t.MeasureLayout)}return(0,S.jsxs)(EJ.Provider,{value:p,children:[c&&p.visualElement?(0,S.jsx)(c,{visualElement:p.visualElement,...u}):null,UJ(e,n,XJ(m,p.visualElement,s),m,d,t,a,f)]})}s.displayName=`motion.${typeof e==`string`?e:`create(${e.displayName??e.name??``})`}`;let c=(0,v.forwardRef)(s);return c[YJ]=e,c}function eY({layoutId:e}){let t=(0,v.useContext)(UI).id;return t&&e!==void 0?t+`-`+e:e}function tY(e,t){(0,v.useContext)(bJ).strict}function nY(e){let{drag:t,layout:n}=wJ();if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:r.MeasureLayout,isEnabled:t?.isEnabled(e)||n?.isEnabled(e),ProjectionNode:r.ProjectionNode}}function rY(e,t){if(typeof Proxy>`u`)return $J;let n=new Map,r=(n,r)=>$J(n,r,e,t);return new Proxy((e,t)=>r(e,t),{get:(i,a)=>a===`create`?r:(n.has(a)||n.set(a,$J(a,void 0,e,t)),n.get(a))})}var iY=(e,t)=>t.isSVG??HJ(e)?new $q(t):new CK(t,{allowProjection:e!==v.Fragment}),aY=class extends Jq{constructor(e){super(e),e.animationState||=rJ(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();nK(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){this.node.getProps().animate!==this.node.prevProps?.animate&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}},oY=0,sY={animation:{Feature:aY},exit:{Feature:class extends Jq{constructor(){super(...arguments),this.id=oY++}update(){let{presenceContext:e,animationState:t}=this.node;if(!e||!t)return;let{isPresent:n,onExitComplete:r}=e;if(n===!this.exit)return;if(n){if(this.exit===!0){let{initial:e}=this.node.getProps();if(e&&!Array.isArray(e)){let{transition:t,transitionEnd:n,...r}=EH(this.node,e)||{};for(let e in r)this.node.getValue(e)?.jump(r[e])}this.node.blockInitialAnimation=!1,t.reset(),t.animateChanges()}else t.setActive(`exit`,!1);this.exit=void 0;return}let i=this.exit=t.setActive(`exit`,!0);r&&i.then(()=>{this.exit===i&&(this.exit=!0,r(this.id))})}mount(){let{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id,this.node)),this.update()}unmount(){}}}},cY=class extends Jq{constructor(e){super(e),this.removeGroupControls=tL,this.removeListeners=tL,this.controls=new yq(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||tL}update(){let{dragControls:e,drag:t}=this.node.getProps(),{dragControls:n,drag:r}=this.node.prevProps||{};e!==n&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls))),r&&!t&&this.controls.stop(void 0,void 0,r)}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},lY=e=>(t,n)=>{e&&QR.update(()=>e(t,n),!1,!0)},uY=class extends Jq{constructor(){super(...arguments),this.removePointerDownListener=tL}onPointerDown(e){this.session=new GK(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:this.node.current?.ownerDocument.defaultView})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:lY(e),onStart:lY(t),onMove:lY(n),onEnd:(e,t)=>{delete this.session,r&&QR.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=DK(this.node.current,`pointerdown`,e=>this.onPointerDown(e))}update(){this.session?.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session?.end()}},dY=!1,fY=({layout:e,layoutDependency:t,layoutAnchor:n})=>({layout:e,layoutDependency:t,layoutAnchor:n,animationType:typeof e==`string`?e:`both`}),pY=(e,t)=>{let{snapshot:n}=e,r=e.getStack();r?.remove(e);let i=r?.lead;if(r?.prevLead===e&&i.resumeFrom===e&&(i.resumeFrom=i.currentAnimation=e.resumingFrom=void 0),e.options.layoutId=t,!t)e.needsShow=!0;else return e.root.registerSharedNode(t,e),()=>{let{resumeFrom:t}=e;t?.isPresent!==!1&&e.getStack().members.includes(t)&&(t.hide(),e.resumeFrom=void 0,e.snapshot=n)}},mY=class extends v.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;i&&(t.group?.add(i),r&&n?.register?.(i),dY&&i.root.didUpdate(),i.options.layoutId!==r&&pY(i,r)?.(),i.addEventListener(`animationComplete`,()=>this.safeToRemove()),i.setOptions({...i.options,...fY(this.props),onExitComplete:()=>this.safeToRemove()})),_G.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,layoutId:n,visualElement:r,drag:i,isPresent:a}=this.props,{projection:o}=r;return o&&(o.isPresent=a,this.takeOver=e.layoutId===n?void 0:(o.willUpdate(),pY(o,n)),o.setOptions({...o.options,...fY(this.props)}),dY=!0,i||e.layoutDependency!==t||t===void 0||e.isPresent!==a?o.willUpdate():this.safeToRemove(),e.isPresent!==a&&(a?o.promote():o.relegate()||QR.postRender(()=>{o.getStack()?.members.length||this.safeToRemove()}))),null}componentDidUpdate(){let{projection:e}=this.props.visualElement;e&&(this.takeOver?.(),e.root.didUpdate(),sW.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;dY=!0,r&&(r.scheduleCheckAfterUnmount(),t.group?.remove(r),n?.deregister?.(r))}safeToRemove(){this.props.safeToRemove?.()}render(){return null}};function hY(e){let[t,n]=gJ(),r=(0,v.useContext)(UI);return(0,S.jsx)(mY,{...e,layoutGroup:r,switchLayoutGroup:(0,v.useContext)(ZJ),isPresent:t,safeToRemove:n})}var gY={pan:{Feature:uY},drag:{Feature:cY,ProjectionNode:eK,MeasureLayout:hY}};function _Y(e,t,n,r,i){let{props:a}=e,o=`while`+n;!i&&e.animationState&&a[o]&&e.animationState.setActive(o,r===`Start`);let s=a[`on`+n+r];s&&QR.postRender(()=>s(t,TK(t)))}var vY=class extends Jq{mount(){let{current:e}=this.node;e&&(this.unmount=Oq(e,(e,t)=>(_Y(this.node,t,`Hover`,`Start`),e=>_Y(this.node,e,`Hover`,`End`))))}unmount(){}},yY=class extends Jq{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(`:focus-visible`)}catch{e=!0}e&&this.node.animationState&&(this.node.animationState.setActive(`whileFocus`,!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive(`whileFocus`,!1),this.isActive=!1)}mount(){this.unmount=nL(ZG(this.node.current,`focus`,()=>this.onFocus()),ZG(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}};function bY(e,t,n,r){e.current instanceof HTMLButtonElement&&e.current.disabled||_Y(e,t,`Tap`,n,r)}var xY=class extends Jq{constructor(){super(...arguments),this.options={}}mount(){let{current:e}=this.node;e&&(this.update(),this.unmount=Bq(e,(e,t)=>(bY(this.node,t,`Start`),{onComplete:(e,{success:t})=>bY(this.node,e,t?``:`Cancel`),onRepeat:()=>bY(this.node,t,``,!0)}),this.options))}update(){let{options:e,node:t}=this,{globalTapTarget:n,propagate:r,tap:i}=t.props;for(let t in e)delete e[t];Object.assign(e,i,{useGlobalTarget:n,stopPropagation:r?.tap===!1})}unmount(){}},SY=new WeakMap,CY=new WeakMap,wY=e=>{let t=SY.get(e.target);t&&t(e)},TY=e=>{e.forEach(wY)};function EY({root:e,...t}){let n=e||document;CY.has(n)||CY.set(n,{});let r=CY.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(TY,{root:e,...t})),r[i]}function DY(e,t,n){let r=EY(t);return SY.set(e,n),r.observe(e),()=>{SY.delete(e),r.unobserve(e)}}var OY={some:0,all:1},kY=class extends Jq{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();let{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r=`some`,once:i}=e,a={root:t?t.current:void 0,rootMargin:n,threshold:typeof r==`number`?r:OY[r]},o=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(`whileInView`,t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),a=t?n:r;a&&a(e)};this.stopObserver=DY(this.node.current,a,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>`u`)return;let{props:e,prevProps:t}=this.node;[`amount`,`margin`,`root`].some(AY(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}};function AY({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var jY=rY(Object.assign({},sY,{inView:{Feature:kY},tap:{Feature:xY},focus:{Feature:yY},hover:{Feature:vY}},gY,{layout:{ProjectionNode:eK,MeasureLayout:hY}}),iY);function MY(e,t,n){(0,v.useInsertionEffect)(()=>e.on(t,n),[e,t,n])}function NY(e){let t=WI(()=>uH(e)),{isStatic:n}=(0,v.useContext)(oJ);if(n){let[,n]=(0,v.useState)(e);(0,v.useEffect)(()=>t.on(`change`,n),[])}return t}function PY(e,t){let n=NY(t()),r=()=>n.set(t());return r(),GI(()=>{let t=()=>QR.preRender(r,!1,!0),n=e.map(e=>e.on(`change`,t));return r(),()=>{n.forEach(e=>e()),$R(r)}}),n}function FY(e){cH.current=[],e();let t=PY(cH.current,e);return cH.current=void 0,t}function IY(e,t,n){let{isStatic:r}=(0,v.useContext)(oJ),i=()=>NH(e)?e.get():e;if(r)return FY(i);let a=NY(i());return(0,v.useInsertionEffect)(()=>n(a,e,t),[a,JSON.stringify(t)]),a}function LY(e,t={}){return IY(e,t,qq)}function RY(e,t,n,r){if(typeof e==`function`)return FY(e);if(n!==void 0&&!Array.isArray(n)&&typeof t!=`function`)return BY(e,t,n,r);let i=typeof t==`function`?t:Vq(t,n,r),a=Array.isArray(e)?zY(e,i):zY([e],([e])=>i(e)),o=Array.isArray(e)?void 0:e.accelerate;if(o&&!o.isTransformed&&typeof t!=`function`&&Array.isArray(n)&&r?.clamp!==!1&&!r?.mixer){let e=r?.ease;a.accelerate={...o,times:[0,...t,1],keyframes:[n[0],...n,n[n.length-1]],isTransformed:!0,...e?{ease:Array.isArray(e)?[e[0],...e]:e}:{}}}return a}function zY(e,t){let n=WI(()=>[]);return PY(e,()=>{n.length=0;let r=e.length;for(let t=0;t<r;t++)n[t]=e[t].get();return t(n)})}function BY(e,t,n,r){let i=WI(()=>Object.keys(n)),a=WI(()=>({}));for(let o of i)a[o]=RY(e,t,n[o],r);return a}function VY(){!uK.current&&fK();let[e]=(0,v.useState)(lK.current);return e}function HY(e){return typeof e==`object`&&!Array.isArray(e)}function UY(e,t,n,r){return e==null?[]:typeof e==`string`&&HY(t)?uU(e,n,r):e instanceof NodeList?Array.from(e):Array.isArray(e)?e.filter(e=>e!=null):[e]}function WY(e,t,n){return e*(t+1)+n*t}function GY(e,t){if(t.has(e))return t.get(e);let[,n,r]=e.match(/^(.+?)([+-][\d.]+)$/)||[];return t.has(n)?Math.max(0,t.get(n)+parseFloat(r)):void 0}function KY(e,t,n,r){return typeof t==`number`?t:t.startsWith(`-`)||t.startsWith(`+`)?Math.max(0,e+parseFloat(t)):t===`<`?n:t.startsWith(`<`)?Math.max(0,n+parseFloat(t.slice(1))):GY(t,r)??e}function qY(e,t,n){for(let r=0;r<e.length;r++){let i=e[r];i.at>t&&i.at<n&&(JI(e,i),r--)}}function JY(e,t,n,r,i,a){qY(e,i,a);for(let o=0;o<t.length;o++)e.push({value:t[o],at:jR(i,a,r[o]),easing:wL(n,o)})}function YY(e,t,n=0){let r=t+1+t*n;for(let t=0;t<e.length;t++)e[t]=e[t]/r}function XY(e,t){return e.at===t.at?e.value===null?1:t.value===null?-1:0:e.at-t.at}var ZY=`easeInOut`,QY=20;function $Y(e,{defaultTransition:t={},...n}={},r,i,a){let o=t.duration||.3,s=new Map,c=new Map,l={},u=new Map,d=0,f=0,p=0,m=(e,n)=>{let a=n,s=e=>typeof e==`number`?n+e:KY(f,e,d,u);for(let n=0;n<e.length;n++){let h=e[n];if(typeof h==`string`){u.set(h,f);continue}if(!Array.isArray(h)){let e=h.at===void 0?f:s(h.at);`sequence`in h?(d=f=e,f=m(h.sequence,e),d=e,a=Math.max(a,f)):u.set(h.name,e);continue}let[g,_,v={}]=h;v.at!==void 0&&(f=s(v.at));let y=0,b=(e,n,r,a=0,s=0)=>{let c=nX(e),{delay:l=0,times:u=Fz(c),type:d=t.type||`keyframes`,repeat:m,repeatType:h,repeatDelay:g=0,..._}=n,{ease:v=t.ease||`easeOut`,duration:b}=n;r.mixer||=n.mixer;let x=typeof l==`function`?l(a,s):l,S=c.length,C=rV(d)?d:i?.[d||`keyframes`];if(S<=2&&C){let e=100;if(S===2&&aX(c)){let t=c[1]-c[0];e=Math.abs(t)}let n={...t,..._};b!==void 0&&(n.duration=aL(b));let r=az(n,e,C);v=r.ease,b=r.duration}b??=o;let w=f+x;u.length===1&&u[0]===0&&(u[1]=1);let T=u.length-c.length;if(T>0&&Pz(u,T),c.length===1&&c.unshift(null),m&&m<QY){let e=b>0?g/b:0;b=WY(b,m,g);let t=[...c],n=[...u];v=Array.isArray(v)?[...v]:[v];let r=[...v],i=h===`reverse`||h===`mirror`,a=t,o=r;i&&(a=[...t].reverse(),h===`reverse`&&(o=[...r].reverse().map(e=>typeof e==`function`?fL(e):e)));for(let s=0;s<m;s++){let l=i&&s%2==0,d=l?a:t,f=l?o:r,p=(s+1)*(1+e);e>0&&(c.push(c[c.length-1]),u.push(p),v.push(`linear`)),c.push(...d);for(let e=0;e<d.length;e++)u.push(n[e]+p),v.push(e===0?`linear`:wL(f,e-1))}YY(u,m,e)}let E=w+b;JY(r,c,v,u,w,E),y=Math.max(x+b,y),p=Math.max(E,p)};if(NH(g)){let e=eX(g,c);b(_,v,tX(`default`,e))}else{let e=UY(g,_,r,l),t=e.length;for(let n=0;n<t;n++){_=_,v=v;let r=e[n],i=eX(r,c);for(let e in _)b(_[e],rX(v,e),tX(e,i),n,t)}}d=f,f+=y,a=Math.max(a,f)}return a};m(e,0),a&&(a.duration=p,a.labels=u);let{type:h,...g}=t;return c.forEach((e,r)=>{for(let i in e){let a=e[i];a.sort(XY);let o=[],c=[],l=[];for(let e=0;e<a.length;e++){let{at:t,value:n,easing:r}=a[e];o.push(n),c.push(rL(0,p,t)),l.push(r||`easeOut`)}c[0]!==0&&(c.unshift(0),o.unshift(o[0]),l.unshift(ZY)),c[c.length-1]!==1&&(c.push(1),o.push(null)),s.has(r)||s.set(r,{keyframes:{},transition:{}});let u=s.get(r);u.keyframes[i]=o,u.transition[i]={...g,duration:p,ease:l,times:c,mixer:a.mixer||t.mixer,...n}}}),s}function eX(e,t){return!t.has(e)&&t.set(e,{}),t.get(e)}function tX(e,t){return t[e]||(t[e]=[]),t[e]}function nX(e){return Array.isArray(e)?e:[e]}function rX(e,t){return e&&e[t]?{...e,...e[t]}:{...e}}var iX=e=>typeof e==`number`,aX=e=>e.every(iX);function oX(e,t){return NH(e)||typeof e==`number`||typeof e==`string`&&!HY(t)}function sX(e,t,n,r){let i=[];if(oX(e,t))i.push(lW(e,HY(t)&&t.default||t,n&&(n.default||n)));else{if(e==null)return i;let a=UY(e,t,r),o=a.length;for(let e=0;e<o;e++){let r=a[e],s={...n};`delay`in s&&typeof s.delay==`function`&&(s.delay=s.delay(e,o)),r instanceof Element?i.push(...aW(r,t,s,tK.get(r))):i.push(...rU(tU(r)??oW,r,t,s))}}return i}function cX(e,t,n,r){let i=[],a=$Y(e.map(e=>{if(Array.isArray(e)&&typeof e[0]==`function`){let t=e[0],n=uH(0);return n.on(`change`,t),e.length===1?[n,[0,1]]:e.length===2?[n,[0,1],e[1]]:[n,e[1],e[2]]}return e}),t,n,{spring:Az},r),o=t?.reduceMotion??t?.defaultTransition?.reduceMotion;return a.forEach(({keyframes:e,transition:t},n)=>{i.push(...sX(n,e,{...t,reduceMotion:o}))}),i}var lX=0;function uX({repeat:e=0,repeatDelay:t=0,repeatType:n=`loop`,delay:r=0},i,a,o){let s=i+t,c=o===void 0;if(c){let t=Math.max(0,a-r);o=s&&t>0?Math.min(e,Math.ceil(t/s-1e-9)-1):0,a=Math.min(t-o*s,i)}return n!==`loop`&&o%2&&(a=i-a),[o,c?a:r+o*s+a]}function dX(e,t){let n=[...e],r=typeof n[0]==`function`?Math.max(1,n.length-1):2;return n[r]={...n[r],at:t},n}var fX=(e,t)=>t===void 0?e:{name:e,at:t};function pX(e){e.pause(),e.time=0,e.stop()}var mX=class e{constructor(e=[],t={},n){this.options=t,this.entries=[],this.repeatIndex=0,this.prevTime=0,this.markers=[],this.labels=new Map,this.totalDuration=0,this.isDirty=!1,this.isDone=!1,this.isRebuilding=!1,this.playbackSpeed=1,this.motionScope=sU.current,this.isKilled=!1,this.isWrapped=!1,this.stop=()=>{this.flush(),this.group?.stop()},this.isPaused=t.autoplay===!1,this.newFinished(),e.forEach(e=>this.add(e)),n?(this.isDirty=!1,this.isWrapped=!0,this.group=new iH(n),this.watch()):(this.invalidate(),this.flush())}add(t,n){return t instanceof e&&t.adopt(this),this.push({item:t,at:n})}call(e,t){return this.push({item:e,at:t,marker:{name:`_m`+lX++,time:0,callback:e}})}addPause(e,t){return this.push({item:t||{},at:e,marker:{name:`_m`+lX++,time:0,callback:t,pause:!0}})}move(e,t){return this.entries.forEach(n=>{n.item===e&&(n.at=t)}),this.invalidate()}remove(t){return t instanceof e&&(t.parent=void 0),this.entries=this.entries.filter(e=>e.item!==t),this.invalidate()}clear(){return this.entries=[],this.invalidate()}getLabelTime(e){return this.flush(),this.labels.get(e)}seek(e){return this.time=this.resolve(e),this}playTo(e){let t=this.resolve(e),n=this.iterationDuration,r=this.time,[i]=uX(this.options,n,r),a=uX(this.options,n,t,i)[1],o=Math.abs(this.speed);return this.speed=a<r?-o:o,this.stopAt=t,this.clock||this.invalidate(),this.play(),this}reverse(){return this.speed=-this.speed,this.play(),this}get progress(){return this.duration?this.time/this.duration:0}set progress(e){this.time=e*this.duration}get time(){return this.active()?.time??0}set time(e){this.flush(),this.prevTime=e,this.group&&(this.group.time=e),this.repeatIndex=this.currentRepeat()}get speed(){return this.playbackSpeed}set speed(e){this.playbackSpeed=e,this.group&&(this.group.speed=e)}get duration(){return this.flush(),this.isWrapped?this.group.duration:this.totalDuration}get iterationDuration(){return this.flush(),this.isWrapped?this.group.iterationDuration:this.totalDuration}get state(){return this.active()?.state??`idle`}get startTime(){return this.active()?.startTime??null}play(){this.flush(),this.isPaused=!1,this.group?.play(),this.isDone&&(this.newFinished(),this.watch())}pause(){this.flush(),this.isPaused=!0,this.group?.pause()}cancel(){this.flush(),this.group?.cancel()}complete(){this.flush(),this.group?.complete()}attachTimeline(e){return this.flush(),this.scrollTimeline=e,this.detachScroll=this.group?.attachTimeline(e),()=>{this.scrollTimeline=void 0,this.detachScroll?.()}}then(e,t){return this.finished.then(e,t)}active(){return this.flush(),this.group?.animations.length?this.group:void 0}push(e){return this.entries.push(e),this.invalidate()}invalidate(){return this.parent?this.parent.invalidate():this.isDirty||(this.isDirty=!0,queueMicrotask(()=>this.flush())),this}flush(){this.isDirty&&!this.parent&&!this.isKilled&&this.build()}adopt(e){this.group&&=(pX(this.group),void 0),this.isDirty=!1,this.parent=e}build(){let e=this.isWrapped?this.group.iterationDuration:this.totalDuration;this.isDirty=!1,this.isWrapped=!1;let t=this.group,n=0;t&&(this.isRebuilding=!0,this.scrollTimeline?(this.detachScroll?.(),t.cancel()):(n=t.animations.length?t.time:0,pX(t)),this.isRebuilding=!1);let{defaultTransition:r,onComplete:i,onUpdate:a,onRepeat:o,onReverseComplete:s,autoplay:c,scope:l,...u}=this.options,d={};l?.reduceMotion!==void 0&&(d.reduceMotion=l.reduceMotion),l?.skipAnimations!==void 0&&(d.skipAnimations=l.skipAnimations),Object.assign(d,u);let f=new Map,p={},m=sU.current;sU.current=this.motionScope;let h;try{h=cX(this.toSequence(f),{defaultTransition:r,...d},l,p)}finally{sU.current=m}let g=p.labels,_=d.duration??p.duration,v=p.duration?_/p.duration:1;if(g.forEach((e,t)=>g.set(t,e*v)),this.markers=[],f.forEach((e,t)=>{e.time=g.get(t),g.delete(t),_=Math.max(_,e.time),this.markers.push(e)}),this.markers.sort((e,t)=>e.time-t.time),this.labels=g,this.totalDuration=_,this.clock=this.clockAnimation=void 0,this.markers.length||this.stopAt!==void 0||a||o){let e=this.clock=uH(0);e.on(`change`,t=>e===this.clock&&this.onClock(t)),h.unshift(this.clockAnimation=lW(e,[0,_],{...d,duration:_,ease:`linear`}))}let y=this.group=new iH(h),{delay:b=0,repeat:x=0,repeatDelay:S=0}=this.options,[C,w]=uX(this.options,e,n);n>b&&(n=uX(this.options,_,Math.min(w,_),C)[1]),this.isDone&&n<b+(x+1)*(_+S)-S&&this.newFinished(),this.scrollTimeline?this.detachScroll=y.attachTimeline(this.scrollTimeline):(y.speed=this.playbackSpeed,this.isPaused&&y.pause(),n&&(y.time=n)),this.repeatIndex=this.currentRepeat(),this.prevTime=n||-1,this.watch()}toSequence(t){return this.entries.map(({item:n,at:r,marker:i})=>i?(t.set(i.name,i),fX(i.name,r)):n instanceof e?{sequence:n.toSequence(t),at:r}:typeof n==`string`?fX(n,r):r===void 0?n:Array.isArray(n)?dX(n,r):{...n,at:r})}resolve(e){return this.flush(),typeof e==`number`?e:GY(e,this.labels)??this.time}currentRepeat(){return uX(this.options,this.totalDuration,this.clockAnimation?.time??0)[0]}onClock(e){let t=this.prevTime;if(this.prevTime=e,this.isRebuilding)return;let{onUpdate:n,onRepeat:r,repeatType:i=`loop`}=this.options;n?.(e);let a=this.currentRepeat(),o=a>this.repeatIndex?1:-1;for(;a!==this.repeatIndex;){let e=this.speed>0==(i===`loop`||!(this.repeatIndex%2)),n=e?this.totalDuration:0;if(this.cross(t,n))return;this.repeatIndex+=o,r?.(),t=i===`loop`?e?-1:1/0:n}this.cross(t,e)}cross(e,t){if(e===t)return;let n=t>e,r=r=>n?r>e&&r<=t:r<e&&r>=t,i=n?this.markers:[...this.markers].reverse();for(let e of i)if(r(e.time)&&(e.callback?.(n?1:-1),e.pause))return this.pauseAt(e.time);if(this.stopAt!==void 0&&r(this.stopAt))return this.pauseAt(this.stopAt),this.stopAt=void 0,!0}pauseAt(e){return this.pause(),this.time=uX(this.options,this.totalDuration,e,this.repeatIndex)[1],!0}watch(){let e=this.group;e.finished.then(()=>{if(e!==this.group||this.isDone)return;this.isDone=!0;let{onComplete:t,onReverseComplete:n}=this.options,r=this.speed<0&&n||t,i=this.resolveFinished;r?.(),i()})}newFinished(){this.isDone=!1,this.finished=new Promise(e=>{this.resolveFinished=e});let{scope:e}=this.options,t=this.motionScope?.add(()=>{this.isKilled=!0,this.stop()});e?.animations.push(this),this.finished.then(()=>{t?.(),e&&JI(e.animations,this)})}};function hX(e){return Array.isArray(e)&&e.some(e=>Array.isArray(e)||e?.sequence)}function gX(e={}){let{scope:t,reduceMotion:n,skipAnimations:r}=e;function i(e,i,a){let o=sU.current?.transition,s={};n!==void 0&&(s.reduceMotion=n),r!==void 0&&(s.skipAnimations=r);let c;if(hX(e)){let r={...s,...i,scope:t};o&&(r.defaultTransition={...o,...r.defaultTransition}),r.reduceMotion=i?.reduceMotion??r.defaultTransition?.reduceMotion??n,c=new mX(e,r)}else{let{onComplete:n,...r}=a||{},l={...s,...o,...r},{onUpdate:u}=r;c=new mX([typeof e==`number`||typeof e==`string`&&(typeof i==`string`||Array.isArray(i))?[u||(()=>{}),Array.isArray(i)?i:[e,i],{...l,onUpdate:void 0}]:[e,i,l]],{...s,onComplete:n,scope:t},sX(e,i,l,t))}return c}return i}var _X=Object.assign(gX(),{addEffect:$H,removeEffect:eU}),vX=jY;function yX({className:e,...t}){return(0,S.jsx)(`kbd`,{"data-slot":`kbd`,className:X(`pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3`,e),...t})}var bX={maskImage:`linear-gradient(#000 0 0), linear-gradient(#000 0 0)`,maskClip:`content-box, border-box`,maskComposite:`exclude`};function xX({glareX:e,glareY:t,rimAngle:n,shine:r,rimOpacity:i,glare:a,rim:o,rimWidth:s}){return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(vX.div,{"aria-hidden":!0,className:`pointer-events-none absolute inset-0 overflow-hidden rounded-3xl mix-blend-soft-light`,style:{opacity:r},children:(0,S.jsx)(vX.div,{className:`absolute -inset-1/2`,style:{x:e,y:t,background:`radial-gradient(circle closest-side, rgb(255 255 255 / ${a*.55}) 0%, rgb(255 255 255 / ${a*.12}) 35%, transparent 85%)`}})}),(0,S.jsx)(vX.div,{"aria-hidden":!0,className:`pointer-events-none absolute inset-0 overflow-hidden rounded-3xl`,style:{opacity:i,padding:s,...bX},children:(0,S.jsx)(vX.div,{className:`absolute top-1/2 left-1/2 aspect-square w-[200%]`,style:{x:`-50%`,y:`-50%`,rotate:n,background:`linear-gradient(0deg, rgb(255 255 255 / ${o}) 16%, rgb(255 255 255 / 0) 45%)`}})})]})}var SX=()=>window.matchMedia(`(prefers-color-scheme: dark)`),CX=e=>{let t=SX();return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)};function wX(e){let t=(0,v.useSyncExternalStore)(CX,()=>SX().matches,()=>!1);return e===`system`?t:e===`dark`}var TX=3,EX=2,DX={text:`Small tools and games,`,highlight:`built with care`};function OX({theme:e,tagline:t=DX,depth:n=0,grain:r=!0,className:i,style:a,selectable:o=!1,pressed:s=!1,children:c}){let l=wX(e.mode),u=n>0,d=e=>u?{transform:`translateZ(${e*n}px)`}:void 0;return(0,S.jsxs)(`div`,{"data-theme":e.name,className:X(`relative flex flex-col rounded-3xl border border-black/[0.07] bg-background p-2 text-foreground select-none`,`shadow-rim`,l&&`dark border-white/10`,u&&`transform-3d`,i),style:{colorScheme:l?`dark`:`light`,...a},children:[u&&Array.from({length:TX},(e,t)=>(0,S.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute -inset-px rounded-3xl`,style:{transform:`translateZ(${-(t+1)*EX}px)`,background:`color-mix(in oklab, var(--background), black ${30+t*13}%)`}},t)),r&&(0,S.jsx)(`div`,{"aria-hidden":!0,className:X(`pointer-events-none absolute inset-0 rounded-3xl`,l?`opacity-12 mix-blend-screen`:`opacity-7 mix-blend-multiply`),style:{backgroundImage:`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E")`}}),(0,S.jsxs)(`div`,{className:X(`relative flex flex-1 flex-col justify-center rounded-inner bg-card p-3.5 text-card-foreground`,`shadow-surface`,u&&`transform-3d`),style:d(10),children:[(0,S.jsxs)(`div`,{className:`text-center`,style:d(6),children:[(0,S.jsx)(`div`,{className:`truncate text-lg leading-tight font-semibold tracking-tight`,children:e.label}),(0,S.jsxs)(`p`,{className:`mt-1.5 line-clamp-2 text-xs leading-relaxed text-muted-foreground`,children:[t.text,` `,(0,S.jsx)(`span`,{className:`rounded-xs bg-(--selection) px-0.5 whitespace-nowrap text-(--selection-foreground)`,children:t.highlight}),`.`]})]}),(0,S.jsxs)(`div`,{className:`mt-3 flex items-center justify-center gap-1.5 text-3xs font-medium`,style:d(8),children:[(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-success/15 px-2 py-0.5 text-success`,children:[(0,S.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`}),`Live`]}),(0,S.jsx)(`span`,{className:`rounded-full bg-secondary px-2 py-0.5 text-secondary-foreground`,children:`v1.2`})]}),(0,S.jsx)(`div`,{className:`mt-5 flex items-center justify-center`,style:d(14),children:(0,S.jsx)(`span`,{"data-select":!0,className:X(`inline-flex items-center rounded-full bg-primary px-3 py-1 text-xs font-medium text-primary-foreground`,`shadow-glow transition duration-150 ease-out`,o&&!s&&`hover:shadow-glow-lifted hover:brightness-110`,s&&`scale-[0.985] shadow-glow-pressed brightness-95 duration-75`),children:`Select`})})]}),(0,S.jsx)(`div`,{className:`flex items-center justify-between gap-1 px-1.5 pt-2 pb-0.5`,style:d(4),children:[1,2,3,4,5,6,7,8].map(e=>(0,S.jsx)(`span`,{className:`h-1.5 flex-1 rounded-full shadow-swatch`,style:{background:`var(--tint-${e})`}},e))}),c&&(0,S.jsx)(`div`,{className:`pointer-events-none absolute inset-0`,style:d(30),children:c})]})}var kX=236,AX=252,jX=168,MX=50,NX=.07,PX=1100,FX=10,IX=24,LX=140,RX=(e,t)=>({type:`spring`,stiffness:e,damping:t}),zX=RX(260,30),BX=RX(380,26),VX=.45,HX=60,UX=100,WX=2,GX=[1.5,3.5,1/0],KX=new Set([`ArrowUp`,`ArrowDown`,`PageUp`,`PageDown`,`Home`,`End`,` `]),qX=e=>{if(typeof requestIdleCallback>`u`){let t=window.setTimeout(e,1e3);return()=>clearTimeout(t)}let t=requestIdleCallback(e,{timeout:3e3});return()=>cancelIdleCallback(t)},JX=()=>Math.min(1,window.innerWidth/(kX*2.6)),YX=(e,t)=>`${e.label} ${e.mode}`.toLowerCase().includes(t.trim().toLowerCase()),XX=e=>MX/(360/Math.max(e,IX)),ZX=e=>(e-1)/2>=XX(e),QX=(e,t)=>(e%t+t)%t,$X=(e,t)=>Math.min(t-1,Math.max(0,e)),eZ=(e,t,n)=>{let r=e-t;return ZX(n)?r-n*Math.round(r/n):r},tZ=(e,t)=>ZX(t)?Math.round(e):$X(Math.round(e),t),nZ=(e,t)=>QX(tZ(e,t),t),rZ=.3,iZ=(e,t)=>{if(ZX(t))return e;let n=$X(e,t);return n+(e-n)*rZ};function aZ({tagline:e,open:t,onOpenChange:n,trigger:r,shortcut:i=!0,finalFocus:a,favoriteKey:o=`!`,favoritesOnlyKey:s=`@`}={}){let{theme:c,themes:l,setTheme:u,favorites:d,toggleFavorite:f}=I(),p=l.filter(e=>!e.hidden||e.name===c),m=VY()??!1,[h,g]=(0,v.useState)(!1),_=t??h,[y,b]=(0,v.useState)(0),[x,C]=(0,v.useState)(1),[w,T]=(0,v.useState)(!1),[E,D]=(0,v.useState)(!1),[O,k]=(0,v.useState)(!1),[A,j]=(0,v.useState)(!1),M=NY(1),N=NY(1/0),P=NY(0),F=(0,v.useRef)(0),R=(0,v.useRef)(null),[z,V]=(0,v.useState)(``),[H,U]=(0,v.useState)(!1),ee=(e,t,n)=>p.filter(r=>YX(r,e)&&(!t||n.includes(r.name))),te=ee(z,H,d),ne=te.length,W=te[y];MY(P,`change`,e=>ne&&b(nZ(e,ne)));let re=(0,v.useRef)(!1),ie=e=>{re.current=!1,F.current=tZ(e,ne),_X(P,F.current,m?{duration:0}:zX)},ae=e=>ie(Math.round(F.current)+e),G=e=>{let t=Math.max(-60,Math.min(HX,e));if(m)return ie(P.get());re.current=!0,F.current=tZ(P.get()+t*VX,ne),_X(P,F.current,{type:`inertia`,velocity:t,power:VX,timeConstant:VX*1e3,modifyTarget:e=>tZ(e,ne),restDelta:.001})},K=(0,v.useEffectEvent)(e=>{!i||_||e.defaultPrevented||e.repeat||e.metaKey||e.ctrlKey||e.altKey||e.key.toLowerCase()!==`t`||L(e.target)||(e.preventDefault(),q(!0))});(0,v.useEffect)(()=>(window.addEventListener(`keydown`,K),()=>window.removeEventListener(`keydown`,K)),[]),(0,v.useEffect)(()=>qX(()=>j(!0)),[]),(0,v.useEffect)(()=>{if(A)return qX(()=>{let e=R.current?.closest(`[hidden]`);e&&(e.style.visibility=`hidden`,e.hidden=!1,e.offsetWidth,e.hidden=!0,e.style.visibility=``)})},[A]),(0,v.useEffect)(()=>{if(!_)return;let e=e=>e.preventDefault();return window.addEventListener(`wheel`,e,{passive:!1}),()=>window.removeEventListener(`wheel`,e)},[_]),(0,v.useEffect)(()=>{if(!_)return;let e=()=>C(JX());return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[_]);let q=(e,r)=>{if(!e&&r?.reason===`escape-key`&&z)return ce(``);t===void 0&&g(e),n?.(e)},oe=(0,v.useEffectEvent)(()=>{V(``),U(!1),T(!1),C(JX());let e=Math.max(0,p.findIndex(e=>e.name===c));P.jump(e),b(e),F.current=e,N.jump(GX[0]);let t=e=>requestAnimationFrame(()=>requestAnimationFrame(()=>{N.jump(GX[e]),e<GX.length-1&&t(e+1)}));t(1),m||(M.jump(.4),_X(M,1,BX))});(0,v.useEffect)(()=>{_&&oe()},[_]);let J=e=>{if(!e||e.name===c)return q(!1);let t=document.getElementById(`theme-card-${e.name}`)?.getBoundingClientRect();B(()=>{u(e.name),T(!0),q(!1)},t&&{x:t.left+t.width/2,y:t.top+t.height/2},m)},se=e=>{let t=W?e.indexOf(W):-1,n=Math.max(0,t);P.stop(),P.jump(n),F.current=n,b(n)},ce=e=>{se(ee(e,H,d)),V(e)},le=e=>{se(ee(z,e,d)),U(e)},ue=e=>{H&&se(te.filter(t=>t!==e)),f(e.name)},de=e=>{if(e.metaKey||e.ctrlKey||e.altKey)return;if(KX.has(e.key)&&e.target===R.current&&e.preventDefault(),e.key===o||e.key===s){if(e.preventDefault(),e.repeat)return;e.key===s?le(!H):W&&ue(W);return}if(e.key.length===1&&(e.key!==` `||z!==``)&&(e.key!==` `||e.target===R.current))return e.preventDefault(),ce(z+e.key);if(e.key===`Backspace`&&z)return e.preventDefault(),ce(z.slice(0,-1));if(!ne)return;let t={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1}[e.key];if(t)e.preventDefault(),ae(t);else if((e.key===`Enter`||e.key===` `)&&e.target===R.current){if(e.preventDefault(),e.repeat||E)return;if(m)return J(W);D(!0),window.setTimeout(()=>{D(!1),J(W)},LX)}else if(e.key===`Home`||e.key===`End`){e.preventDefault();let t=Math.round(F.current),n=ZX(ne)?t-QX(t,ne):0;ie(e.key===`Home`?n:ZX(ne)?n-1:ne-1)}},fe=(0,v.useRef)({last:0,settle:0}),pe=e=>{let t=Math.abs(e.deltaX)>Math.abs(e.deltaY)?e.deltaX:e.deltaY;if(e.deltaMode!==0||Number.isInteger(t)&&Math.abs(t)>=50){if(e.timeStamp-fe.current.last<60)return;fe.current.last=e.timeStamp,ae(Math.sign(t))}else P.stop(),P.set(iZ(P.get()+t/(jX*x),ne)),clearTimeout(fe.current.settle),fe.current.settle=window.setTimeout(()=>ie(P.get()),120)},me=(0,v.useRef)({x:0,y:0,start:0,moved:!1,caught:!1,gesture:`ring`,samples:[]}),he=(0,v.useRef)(null),[ge,_e]=(0,v.useState)(!1);return(0,S.jsxs)(Ty,{open:_,onOpenChange:q,modal:`trap-focus`,onOpenChangeComplete:e=>!e&&T(!1),children:[r===void 0&&(0,S.jsxs)(Xl,{children:[(0,S.jsx)(Gl,{render:(0,S.jsx)(Ay,{render:(0,S.jsxs)(vf,{variant:`ghost`,size:`icon`,"aria-label":`Choose a theme`,"aria-keyshortcuts":i?`t`:void 0,className:`relative outline-none focus-visible:border-transparent focus-visible:bg-muted focus-visible:ring-0`,children:[(0,S.jsx)(pd,{}),(0,S.jsx)(`span`,{className:`absolute right-1.5 bottom-1.5 size-2 rounded-full bg-primary ring-2 ring-background`})]})})}),(0,S.jsxs)(Kl,{children:[`Theme `,i&&(0,S.jsx)(yX,{children:`T`})]})]}),r&&(0,S.jsx)(Ay,{render:r}),(0,S.jsxs)(sy,{keepMounted:A,children:[(0,S.jsx)(Bv,{className:X(`fixed inset-0 z-50 bg-background/55 duration-200 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,w&&`invisible`)}),(0,S.jsxs)(ay,{initialFocus:R,finalFocus:a,onKeyDown:de,onPointerDown:e=>{if(e.button!==0||e.target.closest(`button`))return;let t=e.pointerType===`touch`,n=e.target.closest(`[data-theme-index]`),r=n!==null&&Math.round(eZ(Number(n.dataset.themeIndex),F.current,ne))===0;if(r&&e.target.closest(`[data-select]`)){k(!0);let e=()=>{k(!1),window.removeEventListener(`pointerup`,e),window.removeEventListener(`pointercancel`,e)};window.addEventListener(`pointerup`,e),window.addEventListener(`pointercancel`,e)}if(me.current.moved=me.current.caught=!1,me.current.gesture=`ring`,ne<2&&!(t&&r))return;let i=re.current&&Math.abs(P.getVelocity())>WX;i&&P.stop(),me.current={x:e.clientX,y:e.clientY,start:P.get(),moved:!1,caught:i,gesture:t?`pending`:`ring`,samples:[{t:e.timeStamp,x:e.clientX}]};let a=e=>{let{current:t}=me,n=e.clientX-t.x;if(t.gesture===`pending`){let i=e.clientY-t.y;if(Math.hypot(n,i)<6)return;t.gesture=Math.abs(i)>Math.abs(n)?r&&!m?`tilt`:`none`:ne<2?`none`:`ring`,k(!1)}if(t.gesture===`tilt`)return he.current?.aim(e.clientX,e.clientY);if(t.gesture===`ring`){for(t.samples.push({t:e.timeStamp,x:e.clientX});t.samples.length>2&&e.timeStamp-t.samples[0].t>UX;)t.samples.shift();!t.moved&&Math.abs(n)<4||(t.moved||(k(!1),P.stop(),t.start=P.get()+n/(jX*x),_e(!0)),t.moved=!0,P.set(iZ(t.start-n/(jX*x),ne)))}},o=e=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),window.removeEventListener(`pointercancel`,o),_e(!1),me.current.gesture===`tilt`&&he.current?.release();let{samples:t}=me.current,n=t[0],r=t[t.length-1],i=e.timeStamp-r.t>50||r.t===n.t?0:(r.x-n.x)/(r.t-n.t)*1e3;me.current.moved?G(-i/(jX*x)):me.current.caught&&ie(P.get())};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o),window.addEventListener(`pointercancel`,o)},onWheel:pe,onClick:e=>{let{moved:t,caught:n,gesture:r}=me.current;if(t||n||r===`tilt`||r===`none`)return;let i=e.target;if(i.closest(`button`))return;let a=i.closest(`[data-theme-index]`);if(!a)return q(!1);let o=Number(a.dataset.themeIndex);if(i.closest(`[data-favorite]`))return ue(te[o]);let s=Math.round(eZ(o,F.current,ne));s===0?J(te[o]):ae(s)},className:X(`fixed inset-0 z-50 flex touch-none flex-col items-center justify-center overflow-hidden text-foreground outline-none select-none duration-200 data-open:duration-75 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,w&&`invisible`),children:[(0,S.jsx)(Vv,{render:(0,S.jsx)(vf,{variant:`ghost`,size:`icon`,"aria-label":`Close`,className:`absolute top-4 right-4`,children:(0,S.jsx)(Fd,{})})}),(0,S.jsxs)(Xl,{children:[(0,S.jsx)(Gl,{render:(0,S.jsx)(vf,{variant:`ghost`,size:`icon`,"aria-label":`Favorites only`,"aria-pressed":H,"aria-keyshortcuts":s,className:`absolute top-4 right-14`,onMouseDown:e=>e.preventDefault(),onClick:()=>le(!H)}),children:(0,S.jsx)(Dd,{className:X(H&&`fill-current`)})}),(0,S.jsxs)(Kl,{children:[`Favorites only `,(0,S.jsx)(yX,{children:s})]})]}),(0,S.jsxs)(vX.div,{className:`flex w-full flex-col items-center will-change-transform`,style:{scale:M},children:[(0,S.jsxs)(`div`,{className:`text-center`,children:[(0,S.jsx)(Ey,{className:`text-xs font-medium tracking-wider text-muted-foreground uppercase`,children:`Theme`}),(0,S.jsx)(`div`,{"aria-live":`polite`,className:`mt-1 h-9 overflow-hidden`,children:z?(0,S.jsxs)(`div`,{className:`text-3xl font-semibold tracking-tight whitespace-pre`,children:[z,(0,S.jsx)(`span`,{className:`ml-0.5 inline-block h-[0.9em] w-[2px] translate-y-[0.1em] animate-pulse bg-primary`})]}):(0,S.jsx)(vX.div,{initial:!m&&{y:14,opacity:0},animate:{y:0,opacity:1},transition:RX(420,32),className:`text-3xl font-semibold tracking-tight`,children:W?.label},W?.name)}),(0,S.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground tabular-nums`,children:[ne===0?H&&!z?`No favorites yet`:`No theme matches`:z?`${W?.label} · ${y+1} of ${ne}`:`${String(y+1).padStart(2,`0`)} / ${String(ne).padStart(2,`0`)}`,H&&` · favorites`,W?.name===c&&` · current`]})]}),(0,S.jsx)(`div`,{ref:R,tabIndex:0,role:`listbox`,"aria-label":`Themes`,"aria-activedescendant":W?`theme-card-${W.name}`:void 0,className:`relative my-6 w-full outline-none`,style:{height:332*x},children:(0,S.jsx)(`div`,{className:`absolute top-1/2 left-1/2`,style:{transform:`scale(${x})`},children:!w&&te.map((t,n)=>(0,S.jsx)(sZ,{theme:t,index:n,count:ne,position:P,reach:N,isFront:n===y,tilt:n===y&&!ge&&!m,aimRef:he,pressed:n===y&&(E||O),favorite:d.includes(t.name),taglineText:e?.text,taglineHighlight:e?.highlight},t.name))})}),(0,S.jsxs)(`div`,{className:`hidden items-center gap-1.5 text-xs text-muted-foreground sm:flex`,children:[(0,S.jsx)(`span`,{children:`Drag or`}),(0,S.jsx)(yX,{children:`←`}),(0,S.jsx)(yX,{children:`→`}),(0,S.jsx)(`span`,{className:`mr-2`,children:`to browse`}),(0,S.jsx)(yX,{children:`Enter`}),(0,S.jsx)(`span`,{className:`mr-2`,children:`select`}),(0,S.jsx)(`span`,{className:`mr-2`,children:`type to filter`}),(0,S.jsx)(yX,{children:o}),(0,S.jsx)(`span`,{className:`mr-2`,children:`favorite`}),(0,S.jsx)(yX,{children:s}),(0,S.jsx)(`span`,{className:`mr-2`,children:`favorites only`}),(0,S.jsx)(yX,{children:`Esc`}),(0,S.jsx)(`span`,{children:z?`clear`:`close`})]})]})]})]})]})}var oZ=e=>Math.min(1,Math.max(-1,e*2-1)),sZ=(0,v.memo)(function({theme:e,index:t,count:n,position:r,reach:i,isFront:a,tilt:o,aimRef:s,pressed:c,favorite:l,taglineText:u,taglineHighlight:d}){let f=Math.max(n,IX),p=2*Math.PI/f,m=jX*f/(2*Math.PI),h=XX(n),g=RY(r,e=>eZ(t,e,n)),_=RY(g,e=>{let t=e*p,n=1+NX*Math.max(0,1-Math.abs(e));return`translate(-50%, -50%) perspective(${PX}px) translate3d(${m*Math.sin(t)}px, 0, ${m*(Math.cos(t)-1)}px) rotateY(${t*180/Math.PI}deg) scale(${n})`}),y=RY(g,e=>Math.min(1,Math.max(0,h+.5-Math.abs(e)))),b=RY([y,g,i],([e,t,n])=>e<=0||Math.abs(t)>n?`hidden`:`visible`),x=RY(g,e=>100-Math.round(Math.abs(e)*4)),C=RY(g,e=>Math.min(.45,Math.abs(e)*.09)),w=LY(0,{stiffness:320,damping:26}),T=LY(0,{stiffness:320,damping:26}),E=LY(0,{stiffness:200,damping:30}),D=RY(T,e=>-e*FX),O=RY(w,e=>e*FX),k=RY(w,e=>`${e*25}%`),A=RY(T,e=>`${e*25}%`),j=RY([w,T,g],([e,t,n])=>Math.atan2(t,e+n)*180/Math.PI+90),M=RY(E,[0,1],[.25,1]),N=RY(O,e=>-e*1.6),P=RY(D,e=>18+e*.8),F=RY(g,e=>Math.max(0,1-Math.abs(e))),I=RY(F,e=>e<=0?`hidden`:`visible`),L=RY(F,e=>e*.5);(0,v.useEffect)(()=>{o||(w.set(0),T.set(0),E.set(0))},[o,w,T,E]);let R=(0,v.useRef)(null);return(0,v.useEffect)(()=>{if(!o)return;let e={aim(e,t){let n=R.current?.getBoundingClientRect();n&&(w.set(oZ((e-n.left)/n.width)),T.set(oZ((t-n.top)/n.height)),E.set(1))},release(){w.set(0),T.set(0),E.set(0)}};return s.current=e,()=>{s.current===e&&(s.current=null)}},[o,s,w,T,E]),(0,S.jsxs)(vX.div,{"data-theme-index":t,className:`absolute top-0 left-0 cursor-pointer transform-3d`,style:{width:kX,height:AX,transform:_,opacity:y,visibility:b,zIndex:x},ref:R,onPointerMove:e=>{o&&e.pointerType!==`touch`&&s.current?.aim(e.clientX,e.clientY)},onPointerLeave:e=>{e.pointerType!==`touch`&&(w.set(0),T.set(0),E.set(0))},children:[(0,S.jsx)(vX.div,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-[8%] top-[12%] bottom-0 rounded-4xl bg-black blur-2xl`,style:{x:N,y:P,z:-40,opacity:L,visibility:I}}),(0,S.jsx)(vX.div,{id:`theme-card-${e.name}`,role:`option`,"aria-selected":a,"aria-label":l?`${e.label}, favorite`:e.label,className:`relative size-full transform-3d`,style:{rotateX:D,rotateY:O},children:(0,S.jsxs)(OX,{theme:e,tagline:u&&d?{text:u,highlight:d}:void 0,depth:1,grain:a,selectable:a,pressed:c,className:`size-full`,children:[(0,S.jsx)(`span`,{"data-favorite":!0,"aria-hidden":!0,className:X(`pointer-events-auto absolute top-1 right-1 flex size-11 items-center justify-center rounded-full transition duration-150 ease-out hover:scale-115`,l?`text-primary`:`text-muted-foreground/60 hover:text-foreground`),children:(0,S.jsx)(Dd,{className:X(`size-4`,l&&`fill-current`)})}),(0,S.jsx)(vX.div,{"aria-hidden":!0,className:`absolute inset-0 rounded-3xl bg-black`,style:{opacity:C}}),(0,S.jsx)(vX.div,{className:`absolute inset-0`,style:{opacity:F,visibility:I},children:(0,S.jsx)(xX,{glareX:k,glareY:A,rimAngle:j,shine:E,rimOpacity:M,glare:.55,rim:.7,rimWidth:.5})})]})})]})}),cZ=Bd(`flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1`,{variants:{orientation:{horizontal:`*:data-slot:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-lg! [&>[data-slot]~[data-slot]]:rounded-l-none [&>[data-slot]~[data-slot]]:border-l-0`,vertical:`flex-col *:data-slot:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-lg! [&>[data-slot]~[data-slot]]:rounded-t-none [&>[data-slot]~[data-slot]]:border-t-0`}},defaultVariants:{orientation:`horizontal`}});function lZ({className:e,orientation:t,...n}){return(0,S.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":t,className:X(cZ({orientation:t}),e),...n})}function uZ({...e}){return(0,S.jsx)(Xw,{"data-slot":`dropdown-menu`,...e})}function dZ({...e}){return(0,S.jsx)(eT,{"data-slot":`dropdown-menu-trigger`,...e})}function fZ({align:e=`start`,alignOffset:t=0,side:n=`bottom`,sideOffset:r=4,className:i,...a}){return(0,S.jsx)(Rw,{children:(0,S.jsx)(zw,{className:`isolate z-50 outline-none`,align:e,alignOffset:t,side:n,sideOffset:r,children:(0,S.jsx)(Fw,{"data-slot":`dropdown-menu-content`,className:X(`z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95`,i),...a})})})}function pZ({...e}){return(0,S.jsx)(Cw,{"data-slot":`dropdown-menu-group`,...e})}function mZ({className:e,inset:t,...n}){return(0,S.jsx)(ww,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:X(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,e),...n})}function hZ({className:e,inset:t,variant:n=`default`,...r}){return(0,S.jsx)(Ew,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:X(`group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function gZ({className:e,...t}){return(0,S.jsx)(Px,{"data-slot":`dropdown-menu-separator`,className:X(`-mx-1 my-1 h-px bg-border`,e),...t})}function _Z({act:e,open:t,onOpenChange:n,onCloned:r,finalFocus:i}){return(0,S.jsx)(jy,{open:t,onOpenChange:n,children:(0,S.jsxs)(Fy,{className:`sm:max-w-xl`,finalFocus:i,children:[(0,S.jsxs)(Iy,{children:[(0,S.jsx)(Ry,{children:`Clone a repo`}),(0,S.jsx)(zy,{children:`Your GitHub repos that aren't cloned yet, newest first. Once cloned, workwork looks for work in it.`})]}),(0,S.jsx)(vZ,{act:e,onCloned:r})]})})}function vZ({act:e,onCloned:t}){let[n,r]=(0,v.useState)(),[i,a]=(0,v.useState)(),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)();if((0,v.useEffect)(()=>{rf.repos().then(r,e=>a(e.message))},[]),i)return(0,S.jsx)(`p`,{className:`text-sm text-destructive`,children:i});if(!n)return(0,S.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,S.jsx)(By,{}),` Asking GitHub`]});let u=o.toLowerCase(),d=n.repos.filter(e=>e.name.toLowerCase().includes(u)||e.description.toLowerCase().includes(u)),f=i=>e(async()=>{l(i.name);try{await rf.clone(i.name),t(),r({...n,repos:n.repos.filter(e=>e!==i)})}finally{l(void 0)}});return(0,S.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-3`,children:[(0,S.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Clones into `,n.root,`/`]}),(0,S.jsx)(Uf,{placeholder:`Search ${n.repos.length} repos`,value:o,onChange:e=>s(e.target.value)}),(0,S.jsxs)(Fx,{className:`max-h-[50svh] overflow-y-auto`,children:[d.map(e=>(0,S.jsx)(Wx,{title:e.name,meta:[e.description,`created ${e.createdAt.slice(0,10)}`].filter(Boolean).join(` · `),children:(0,S.jsxs)(vf,{variant:`outline`,size:`sm`,disabled:c!==void 0,onClick:()=>f(e),children:[c===e.name&&(0,S.jsx)(By,{}),` Clone`]})},e.name)),d.length===0&&(0,S.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n.repos.length?`No repo matches.`:`Every repo of yours is cloned.`})]})]})}var yZ=Bd(`group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-transparent`,outline:`border border-input bg-transparent hover:bg-muted`},size:{default:`h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,sm:`h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`}},defaultVariants:{variant:`default`,size:`default`}}),bZ=v.createContext({size:`default`,variant:`default`,spacing:2,orientation:`horizontal`});function xZ({className:e,variant:t,size:n,spacing:r=2,orientation:i=`horizontal`,children:a,...o}){return(0,S.jsx)(nE,{"data-slot":`toggle-group`,"data-variant":t,"data-size":n,"data-spacing":r,"data-orientation":i,style:{"--gap":r},className:X(`group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch`,e),...o,children:(0,S.jsx)(bZ.Provider,{value:{variant:t,size:n,spacing:r,orientation:i},children:a})})}function SZ({className:e,children:t,variant:n=`default`,size:r=`default`,...i}){let a=v.useContext(bZ);return(0,S.jsx)($T,{"data-slot":`toggle-group-item`,"data-variant":a.variant||n,"data-size":a.size||r,"data-spacing":a.spacing,className:X(`shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t`,yZ({variant:a.variant||n,size:a.size||r}),e),...i,children:t})}var CZ=``,wZ={value:`clone-project`,label:`Clone project...`},TZ=100,EZ=e=>`${e.repo} ${e.id}`;function DZ({snapshot:e,act:t}){let[n,r]=(0,v.useState)(!1),[i,a]=(0,v.useState)(0),o=(0,v.useRef)(null),[s,c]=(0,v.useState)([]),[l,u]=(0,v.useState)([]),[d,f]=(0,v.useState)(CZ),[p,m]=(0,v.useState)(CZ),[h,g]=(0,v.useState)([`auto`,`skim`,`decide`]),[_,y]=(0,v.useState)(``),[b,x]=(0,v.useState)(TZ),[C,w]=(0,v.useState)(new Map),[T,E]=(0,v.useState)(0),{at:D,count:O,refreshing:k}=e.candidates;(0,v.useEffect)(()=>{let e=!1;return rf.candidates().then(({items:t,repos:n})=>{e||(c(t),u(n))}),()=>{e=!0}},[D,i]),(0,v.useEffect)(()=>{rf.plays().then(e=>w(new Map(e.map(e=>[e.name,e.description]))))},[D]);let A=(0,v.useMemo)(()=>{let t=new Map;for(let n of e.jobs)n.state!==`removed`&&t.set(EZ(n.item),n);return t},[e.jobs]),j={value:CZ,label:`All repos (${s.length})`},M=(0,v.useMemo)(()=>{let e=new Map;for(let t of s)e.set(t.repo,(e.get(t.repo)??0)+1);return l.map(t=>({value:t,label:`${Yd(t)} (${e.get(t)??0})`})).sort((e,t)=>e.label.localeCompare(t.label))},[s,l]),N=d===CZ?s:s.filter(e=>e.repo===d),P=new Map;for(let e of N)P.set(e.play,(P.get(e.play)??0)+1);let F=[...P].sort((e,t)=>e[1]-t[1]),I=_.toLowerCase().split(/\s+/).filter(Boolean),L=N.filter(e=>(p===CZ||e.play===p)&&h.includes(e.level)&&I.every(t=>`${Xd(e)} ${e.id} ${e.label}`.toLowerCase().includes(t))),R=(e,n)=>t(()=>rf.queue(e,n)),z=L.filter(e=>!A.has(EZ(e))),B=(0,S.jsxs)(Vd,{children:[(0,S.jsxs)(Hd,{children:[(0,S.jsx)(Ud,{children:k?`Asking workwork`:`No candidates yet`}),(0,S.jsx)(Wd,{children:k?`workwork is looking through every repo under $SRC. That takes a few minutes.`:d===CZ?`Ask workwork for candidates across your repos. It takes a few minutes.`:`There are no candidates for ${Yd(d)}.`})]}),(0,S.jsx)(Gd,{children:(0,S.jsxs)(vf,{variant:`outline`,disabled:k,onClick:()=>t(rf.refreshCandidates),children:[k&&(0,S.jsx)(By,{}),` Ask workwork`]})})]});return(0,S.jsxs)(`div`,{className:`flex flex-col gap-4 pt-2`,children:[(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsx)(Uf,{className:`max-w-xs`,placeholder:`Search titles, ids, repos`,value:_,onChange:e=>y(e.target.value)}),(0,S.jsx)(xZ,{multiple:!0,variant:`outline`,value:h,onValueChange:g,children:[`auto`,`skim`,`decide`].map(e=>(0,S.jsx)(SZ,{value:e,children:e},e))}),(0,S.jsxs)(jE,{items:[j,...M,wZ],value:d,onValueChange:e=>{if(e===wZ.value){r(!0);return}let t=e??CZ;f(t),x(TZ),s.some(e=>e.play===p&&(t===CZ||e.repo===t))||m(CZ)},children:[(0,S.jsx)(PE,{"aria-label":`Repo`,ref:o,children:(0,S.jsx)(NE,{})}),(0,S.jsxs)(FE,{alignItemWithTrigger:!1,children:[(0,S.jsxs)(ME,{children:[(0,S.jsx)(IE,{value:j.value,children:j.label}),M.map(e=>(0,S.jsx)(IE,{value:e.value,children:e.label},e.value))]}),(0,S.jsx)(LE,{}),(0,S.jsx)(ME,{children:(0,S.jsx)(IE,{value:wZ.value,children:wZ.label})})]})]}),(0,S.jsx)(_Z,{act:t,open:n,onOpenChange:r,onCloned:()=>a(e=>e+1),finalFocus:o}),(0,S.jsxs)(`span`,{className:`flex flex-1 items-center justify-end gap-2 text-sm text-muted-foreground`,children:[k?`Asking workwork…`:`${O} candidates${D?`, ${qd(D)}`:``}`,(0,S.jsxs)(Xl,{children:[(0,S.jsx)(Gl,{render:(0,S.jsx)(vf,{variant:`ghost`,size:`icon-sm`,"aria-label":`Refresh candidates`,disabled:k,onClick:()=>{E(T+1),t(rf.refreshCandidates)}}),children:(0,S.jsx)(yd,{className:T?`refresh-turn`:void 0},T)}),(0,S.jsx)(Kl,{children:k?`Asking workwork, takes a few minutes`:`Ask workwork again`})]})]})]}),N.length===0?B:(0,S.jsxs)(`div`,{className:`flex flex-col gap-6 md:flex-row`,children:[(0,S.jsx)(`nav`,{className:`flex flex-wrap gap-1 md:w-48 md:flex-none md:flex-col`,children:[[CZ,N.length],...F].map(([e,t])=>(0,S.jsxs)(Xl,{disabled:!C.has(e),children:[(0,S.jsxs)(Gl,{render:(0,S.jsx)(vf,{variant:p===e?`secondary`:`ghost`,size:`sm`,onClick:()=>{m(e),x(TZ)}}),children:[(0,S.jsx)(`span`,{className:`flex-1 text-left`,children:e||`All plays`}),(0,S.jsx)(`span`,{className:`text-muted-foreground`,children:t})]}),(0,S.jsx)(Kl,{side:`right`,children:C.get(e)})]},e))}),(0,S.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,S.jsxs)(Gx,{title:(0,S.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,S.jsxs)(`span`,{className:`flex-1`,children:[L.length,` matching, `,z.length,` not queued yet`]}),z.length>0&&z.length<=20&&(0,S.jsx)(OZ,{label:`Queue all ${z.length}`,presets:e.settings.presets,onQueue:e=>R(z,e)})]}),children:[(0,S.jsx)(Fx,{children:L.slice(0,b).map(n=>{let r=A.get(EZ(n)),i=(0,S.jsx)(OZ,{label:`Queue`,presets:e.settings.presets,onQueue:e=>R([n],e)});return(0,S.jsx)(Wx,{leading:(0,S.jsx)(lD,{state:dD(r,e.prs)}),title:(0,S.jsx)(pD,{item:n,job:r,play:C.get(n.play),snapshot:e,act:t,actions:!r&&i}),meta:(0,S.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,S.jsx)(uD,{state:dD(r,e.prs)}),[n.play,n.level,n.id].join(` · `)]}),children:!r&&i},EZ(n))})}),L.length>b&&(0,S.jsxs)(vf,{variant:`ghost`,onClick:()=>x(b+TZ),children:[`Show `,Math.min(TZ,L.length-b),` more`]})]})})]})]})}function OZ({label:e,presets:t,onQueue:n}){return(0,S.jsxs)(lZ,{children:[(0,S.jsx)(vf,{variant:`outline`,size:`sm`,onClick:()=>n(),children:e}),(0,S.jsxs)(uZ,{children:[(0,S.jsxs)(Xl,{children:[(0,S.jsx)(Gl,{render:(0,S.jsx)(dZ,{render:(0,S.jsx)(vf,{variant:`outline`,size:`icon-sm`,"aria-label":`${e} with`})}),children:(0,S.jsx)(Tu,{})}),(0,S.jsxs)(Kl,{children:[e,` for a specific agent or preset`]})]}),(0,S.jsxs)(fZ,{align:`end`,className:`w-auto`,children:[(0,S.jsxs)(pZ,{children:[(0,S.jsx)(mZ,{children:`Agent`}),Kx.map(e=>(0,S.jsx)(hZ,{onClick:()=>n({agent:e}),children:e},e))]}),(0,S.jsx)(gZ,{}),(0,S.jsxs)(pZ,{children:[(0,S.jsx)(mZ,{children:`Preset`}),t.length===0&&(0,S.jsx)(hZ,{disabled:!0,children:`Add presets in Settings`}),t.map((e,t)=>(0,S.jsx)(hZ,{onClick:()=>n(e),children:ef(e)},t))]})]})]})]})}function kZ({snapshot:e,act:t}){let{settings:n,on:r}=e,[i,a]=(0,v.useState)();return(0,S.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,S.jsxs)(Xl,{children:[(0,S.jsxs)(Gl,{render:(0,S.jsx)(DE,{orientation:`horizontal`}),children:[(0,S.jsx)(Mx,{id:`auto`,checked:n.auto.on,onCheckedChange:e=>t(()=>rf.saveSettings({...n,auto:{...n.auto,on:e}}))}),(0,S.jsx)(kE,{htmlFor:`auto`,children:`Auto`})]}),(0,S.jsx)(Kl,{children:`Keep the queue topped up from candidates while the factory is on`})]}),(0,S.jsxs)(Xl,{disabled:r,children:[(0,S.jsx)(Gl,{render:(0,S.jsx)(vf,{variant:`outline`,onClick:e=>{let i={agents:n.agents,limit:n.limit,until:n.until};r?t(rf.turnOff):e.shiftKey?t(()=>rf.turnOn(i)):a(i)}}),children:r?`Turn off`:`Turn on`}),(0,S.jsx)(Kl,{children:`Shift-click to turn on with your defaults`})]}),(0,S.jsx)(jy,{open:i!==void 0,onOpenChange:e=>!e&&a(void 0),children:(0,S.jsxs)(Fy,{children:[(0,S.jsxs)(Iy,{children:[(0,S.jsx)(Ry,{children:`Turn the factory on`}),(0,S.jsx)(zy,{children:`For this run only; the defaults are under Settings. Your picks go first, then what auto mode queues.`})]}),i&&(0,S.jsx)(HE,{value:i,onChange:a}),(0,S.jsx)(Ly,{children:(0,S.jsx)(vf,{disabled:!i||Object.keys(i.agents).length===0,onClick:()=>t(async()=>{await rf.turnOn(i),a(void 0)}),children:`Turn on`})})]})})]})}var AZ={value:`new-project`,label:`New project...`};function jZ({act:e,open:t,onOpenChange:n,onCreated:r}){return(0,S.jsx)(jy,{open:t,onOpenChange:n,children:(0,S.jsxs)(Fy,{className:`sm:max-w-2xl`,children:[(0,S.jsxs)(Iy,{children:[(0,S.jsx)(Ry,{children:`New goal`}),(0,S.jsx)(zy,{children:`A goal is one large task, planned into a graph of jobs. Nothing runs until you approve the plan.`})]}),(0,S.jsxs)(lx,{defaultValue:`brief`,children:[(0,S.jsxs)(dx,{children:[(0,S.jsx)(fx,{value:`brief`,children:`From a brief`}),(0,S.jsx)(fx,{value:`plan`,children:`Import a plan`})]}),(0,S.jsx)(px,{value:`brief`,children:(0,S.jsx)(MZ,{act:e,onCreated:r})}),(0,S.jsx)(px,{value:`plan`,children:(0,S.jsx)(NZ,{act:e,onCreated:r})})]})]})})}function MZ({act:e,onCreated:t}){let[n,r]=(0,v.useState)(),[i,a]=(0,v.useState)(``),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(``),[f,p]=(0,v.useState)(!1);(0,v.useEffect)(()=>{rf.candidates().then(r)},[]);let m=o===AZ.value,h=(n?.repos??[]).map(e=>({value:e,label:Yd(e)})),g=i.trim()&&(m?c.trim():o),_=()=>e(async()=>{p(!0);try{t((await rf.newGoal({title:i,brief:u,...m?{project:c.trim()}:{repo:o}})).id)}finally{p(!1)}});return(0,S.jsxs)(TE,{className:`mt-2`,children:[(0,S.jsxs)(DE,{children:[(0,S.jsx)(kE,{htmlFor:`goal-title`,children:`Title`}),(0,S.jsx)(Uf,{id:`goal-title`,autoFocus:!0,placeholder:`GPUI client for Tasks`,value:i,onChange:e=>a(e.target.value)})]}),(0,S.jsxs)(DE,{children:[(0,S.jsx)(kE,{children:`Repo`}),(0,S.jsxs)(jE,{items:[...h,AZ],value:o,onValueChange:e=>s(e??``),children:[(0,S.jsx)(PE,{"aria-label":`Repo`,children:(0,S.jsx)(NE,{placeholder:`Pick a repo`})}),(0,S.jsxs)(FE,{alignItemWithTrigger:!1,children:[(0,S.jsx)(ME,{children:h.map(e=>(0,S.jsx)(IE,{value:e.value,children:e.label},e.value))}),(0,S.jsx)(LE,{}),(0,S.jsx)(ME,{children:(0,S.jsx)(IE,{value:AZ.value,children:AZ.label})})]})]}),m&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Uf,{"aria-label":`Project name`,placeholder:`units`,value:c,onChange:e=>l(e.target.value)}),(0,S.jsxs)(AE,{children:[`Creates `,n?.root,`/`,c.trim()||`<name>`,` and a private GitHub repo of the same name.`]})]})]}),(0,S.jsxs)(DE,{children:[(0,S.jsx)(kE,{htmlFor:`goal-brief`,children:`Brief`}),(0,S.jsx)(rE,{id:`goal-brief`,className:`min-h-48`,placeholder:`What done looks like, constraints, links to specs, and the commands that prove it works.`,value:u,onChange:e=>d(e.target.value)}),(0,S.jsx)(AE,{children:`Markdown. A communicator plans it into a graph, which waits for your approval here.`})]}),(0,S.jsx)(Ly,{children:(0,S.jsx)(vf,{disabled:!g||f,onClick:_,children:`Plan it`})})]})}function NZ({act:e,onCreated:t}){let[n,r]=(0,v.useState)(``),[i,a]=(0,v.useState)(!1);return(0,S.jsxs)(TE,{className:`mt-2`,children:[(0,S.jsxs)(DE,{children:[(0,S.jsx)(kE,{htmlFor:`goal-plan`,children:`Plan`}),(0,S.jsx)(rE,{id:`goal-plan`,className:`min-h-64`,placeholder:`{ "format": "factory-plan/1", "goal": { ... }, "nodes": [ ... ] }`,value:n,onChange:e=>r(e.target.value)}),(0,S.jsx)(AE,{children:`JSON or YAML in factory-plan/1, as in spec/plan-format.md. It's validated before anything changes.`})]}),(0,S.jsx)(Ly,{children:(0,S.jsx)(vf,{disabled:!n.trim()||i,onClick:()=>e(async()=>{a(!0);try{t((await rf.importPlan(n)).id)}finally{a(!1)}}),children:`Import`})})]})}var PZ={communicator:`comm`,builder:`build`,grunt:`grunt`},FZ=e=>e.blocked?IZ[e.blocked]:e.state===`queued`?`working`:void 0,IZ={checkpoint:`waiting for your approval`,paused:`paused`,red:`integration branch red`,asked:`waiting for you`,held:`held by a failure`,review:`merging`},LZ=(e,t)=>e.filter(e=>e.of===t.id&&e.state!==`removed`);function RZ(e,t){return[t,...e].flatMap(e=>[e.added,...e.notes.map(e=>e.at),...e.attempts.map(e=>e.end)]).sort().at(-1)}function zZ({snapshot:e,act:t}){let[n,r]=bx(`goal`,``),[i,a]=(0,v.useState)(!1),o=e.jobs.filter(e=>e.goal&&e.state!==`removed`),s=o.find(e=>e.id===n);if(s)return(0,S.jsx)(BZ,{goal:s,snapshot:e,act:t,onBack:()=>r(``)});let c=(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(vf,{variant:`outline`,onClick:()=>a(!0),children:[(0,S.jsx)(_d,{}),` New goal`]}),(0,S.jsx)(jZ,{act:t,open:i,onOpenChange:a,onCreated:e=>{a(!1),r(e)}})]});return o.length===0?(0,S.jsxs)(Vd,{children:[(0,S.jsxs)(Hd,{children:[(0,S.jsx)(Ud,{children:`No goals yet`}),(0,S.jsx)(Wd,{children:`A goal is one large task, planned into a graph of jobs that run on their own branch.`})]}),(0,S.jsx)(Gd,{children:c})]}):(0,S.jsxs)(`div`,{className:`flex flex-col gap-4 pt-2`,children:[(0,S.jsx)(`div`,{className:`flex justify-end`,children:c}),(0,S.jsx)(Fx,{children:o.map(t=>{let n=LZ(e.jobs,t),i=n.filter(e=>e.state===`done`).length,a=n.reduce((e,t)=>e+t.attempts.length,0),o=t.goal.budget?.attempts;return(0,S.jsx)(Wx,{leading:(0,S.jsx)(lD,{state:t.state}),progress:n.length?i/n.length:0,title:(0,S.jsx)(`button`,{type:`button`,className:`text-left hover:underline`,onClick:()=>r(t.id),children:t.item.title}),meta:(0,S.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,S.jsx)(uD,{state:t.state,label:FZ(t)}),(0,S.jsxs)(`span`,{children:[i,`/`,n.length,` done`]}),Ov.map(e=>{let t=n.filter(t=>t.tier===e);return t.length?(0,S.jsxs)(`span`,{children:[PZ[e],` `,t.filter(e=>e.state===`done`).length,`/`,t.length]},e):null}),(0,S.jsxs)(`span`,{children:[a,o?`/${o}`:``,` attempts`]}),(0,S.jsx)(`span`,{children:qd(RZ(n,t))})]}),children:(0,S.jsx)(vf,{variant:`ghost`,size:`icon-sm`,"aria-label":`Open goal`,onClick:()=>r(t.id),children:(0,S.jsx)(Du,{})})},t.id)})})]})}function BZ({goal:e,snapshot:t,act:n,onBack:r}){let{jobs:i,status:a}=t,o=LZ(i,e),s=e.goal,c=o.filter(e=>e.state===`done`).length,l=o.reduce((e,t)=>e+t.attempts.length,0),u=e.blocked===`red`,d=e.notes.findLast(e=>e.kind===`factory`),f=Mv(e),p=o.flatMap(e=>e.unverified.map(t=>({node:e,need:t}))),m=o.flatMap(e=>e.notes.flatMap((t,n)=>t.kind===`assume`&&!e.notes.some(e=>e.kind===`answer`&&e.re===n)?[{node:e,note:t}]:[]));return(0,S.jsxs)(`div`,{className:`flex flex-col gap-6 pt-2`,children:[(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsx)(vf,{variant:`ghost`,size:`icon-sm`,"aria-label":`All goals`,onClick:r,children:(0,S.jsx)(_u,{})}),(0,S.jsx)(`h2`,{className:`font-heading text-lg font-semibold`,children:e.item.title}),(0,S.jsx)(uD,{state:e.state,label:FZ(e)}),(0,S.jsxs)(`span`,{className:`ml-auto flex gap-1`,children:[e.blocked===`paused`?(0,S.jsx)(vf,{variant:`outline`,size:`sm`,onClick:()=>n(()=>rf.goal(e.id,`resume`)),children:`Resume`}):e.state!==`done`&&(0,S.jsx)(vf,{variant:`outline`,size:`sm`,onClick:()=>n(()=>rf.goal(e.id,`pause`)),children:`Pause`}),e.state!==`done`&&(0,S.jsx)(GZ,{goal:e,act:n}),e.state!==`done`&&(0,S.jsx)(vf,{variant:`ghost`,size:`sm`,onClick:()=>n(()=>rf.goal(e.id,`cancel`)),children:`Cancel goal`})]})]}),(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 text-sm text-muted-foreground`,children:[(0,S.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,S.jsx)(Gu,{className:`size-4`}),` goal/`,s.slug]}),(0,S.jsx)(`span`,{className:u?`text-destructive`:``,children:s.gates.length===0?`no goal gates`:`${u?`red`:`green`}: ${s.gates.map(e=>`\`${e}\``).join(`, `)}`}),(0,S.jsxs)(`span`,{children:[c,`/`,o.length,` done`]}),(0,S.jsxs)(`span`,{children:[l,s.budget?` of ${s.budget.attempts}`:``,` attempts`]}),f&&(0,S.jsx)(`a`,{className:`text-primary hover:underline`,href:f,target:`_blank`,rel:`noreferrer`,children:`final PR`})]}),e.blocked===`checkpoint`&&(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 rounded-md border border-warning/50 bg-warning/10 p-3 text-sm`,children:[(0,S.jsx)(`span`,{className:`flex-1`,children:d?.text??`Waiting for your approval.`}),(0,S.jsx)(vf,{size:`sm`,onClick:()=>n(()=>rf.goal(e.id,`approve`)),children:`Approve`})]}),u&&d&&(0,S.jsxs)(`p`,{className:`rounded-md border border-destructive/40 p-3 text-sm text-destructive`,children:[d.text,`; a fix is queued at the front.`]}),(p.length>0||m.length>0)&&(0,S.jsx)(Gx,{title:`For you to check`,children:(0,S.jsxs)(`ul`,{className:`flex flex-col gap-2 text-sm`,children:[p.map(({node:e,need:t})=>(0,S.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsx)(cf,{variant:`outline`,children:`unverified`}),(0,S.jsxs)(`span`,{className:`flex-1`,children:[e.item.title,`: `,t]}),(0,S.jsx)(vf,{size:`sm`,variant:`outline`,onClick:()=>n(()=>rf.verify(e.id,t)),children:`Checked`})]},`${e.id} ${t}`)),m.map(({node:e,note:t})=>(0,S.jsx)(WZ,{node:e,question:t.text,assumed:t.assumed??``,act:n},`${e.id} ${t.at}`))]})}),(0,S.jsx)(Gx,{title:`Graph`,children:(0,S.jsx)(VZ,{nodes:o.filter(e=>!e.parent),all:o,snapshot:t,act:n,status:a})})]})}function VZ({nodes:e,all:t,snapshot:n,act:r,status:i}){let[a,o]=(0,v.useState)(),s=Iv(e.filter(e=>!e.branchOf));for(let t of e.filter(e=>e.branchOf))s.set(t.id,s.get(t.branchOf)??0);let c=Lv(t),l=new Set(t.find(e=>e.id===a)?.after??[]),u=[...new Set(s.values())].sort((e,t)=>e-t);return(0,S.jsx)(`div`,{className:`flex gap-3 overflow-x-auto pb-2`,children:u.map(a=>(0,S.jsx)(`div`,{className:`flex w-60 shrink-0 flex-col gap-2`,children:e.filter(e=>s.get(e.id)===a).map(e=>{let a=t.filter(t=>t.parent===e.id),s={node:e,snapshot:n,act:r,status:i,onPath:c.has(e.id),dependency:l.has(e.id),onHover:o};return a.length>0?(0,S.jsx)(HZ,{...s,members:a,all:t},e.id):(0,S.jsx)(UZ,{...s},e.id)})},a))})}function HZ({members:e,all:t,...n}){let{node:r,snapshot:i,act:a,status:o}=n,s=e.filter(e=>e.state===`done`).length;return(0,S.jsx)(`div`,{className:`rounded-md border border-dashed p-2`,children:(0,S.jsxs)(JF,{defaultOpen:r.state!==`done`,children:[(0,S.jsxs)(YF,{render:(0,S.jsx)(`button`,{type:`button`,className:`flex w-full items-center gap-2 text-left text-sm font-medium`}),children:[(0,S.jsx)(lD,{state:r.state}),(0,S.jsx)(`span`,{className:`flex-1`,children:r.item.title}),(0,S.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[s,`/`,e.length]})]}),(0,S.jsx)(XF,{className:`mt-2`,children:(0,S.jsx)(VZ,{nodes:e,all:t,snapshot:i,act:a,status:o})})]})})}function UZ({node:e,snapshot:t,act:n,status:r,onPath:i,dependency:a,onHover:o}){let s=r?.workers.find(t=>t.job===e.id),c=e.notes.findLast(t=>t.kind===`step`&&t.attempt===e.attempts.length+1),l=e.attempts.some(e=>(e.compactions??0)>2);return(0,S.jsxs)(`div`,{className:`flex flex-col gap-1 rounded-md border bg-card p-2 text-sm ${a?`ring-2 ring-accent`:i?`border-primary/60`:``}`,onMouseEnter:()=>o(e.id),onMouseLeave:()=>o(void 0),children:[(0,S.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,S.jsx)(lD,{state:e.state}),(0,S.jsx)(`span`,{className:`min-w-0 flex-1 wrap-anywhere`,children:(0,S.jsx)(pD,{item:e.item,job:e,snapshot:t,act:n,bare:!0})})]}),(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[e.tier&&(0,S.jsx)(cf,{variant:`secondary`,children:e.tier}),e.front&&(0,S.jsx)(cf,{variant:`outline`,children:`factory`}),e.blocked&&(0,S.jsx)(`span`,{children:IZ[e.blocked]}),e.attempts.length>0&&(0,S.jsxs)(`span`,{children:[e.attempts.length,` attempt`,e.attempts.length===1?``:`s`]}),l&&(0,S.jsxs)(Xl,{children:[(0,S.jsxs)(Gl,{render:(0,S.jsx)(`span`,{className:`flex items-center text-warning`}),children:[(0,S.jsx)(Uu,{className:`size-3.5`}),` heavy`]}),(0,S.jsx)(Kl,{children:`Compacted more than twice; replans split work like this smaller.`})]}),i&&(0,S.jsx)(`span`,{className:`text-primary`,children:`critical path`})]}),s&&(0,S.jsxs)(`div`,{className:`text-xs`,children:[(0,S.jsx)(`span`,{className:`text-primary`,children:s.id}),`, `,Jd(s.since),` min`,s.context?`, ${Math.round(s.context/1e3)}k context`:``,(0,S.jsx)(`div`,{className:`truncate text-muted-foreground`,children:c?`${c.text}${c.of?` (${c.done??0}/${c.of})`:``}`:s.activity??`starting`})]})]})}function WZ({node:e,question:t,assumed:n,act:r}){let[i,a]=(0,v.useState)(``);return(0,S.jsxs)(`li`,{className:`flex flex-col gap-1`,children:[(0,S.jsxs)(`span`,{children:[(0,S.jsx)(cf,{variant:`outline`,children:`assumed`}),` `,e.item.title,`: assumed`,` `,(0,S.jsx)(`strong`,{children:n}),`, asked `,t]}),(0,S.jsxs)(`form`,{className:`flex gap-2`,onSubmit:t=>{t.preventDefault(),r(()=>rf.answer(e.id,i))},children:[(0,S.jsx)(Uf,{value:i,onChange:e=>a(e.target.value),placeholder:`A different answer queues a change`}),(0,S.jsx)(vf,{type:`submit`,variant:`outline`,size:`sm`,disabled:!i.trim(),children:`Answer`}),(0,S.jsx)(vf,{type:`button`,size:`sm`,onClick:()=>r(()=>rf.answer(e.id,`fine`)),children:`Fine`})]})]})}function GZ({goal:e,act:t}){let[n,r]=(0,v.useState)();return n===void 0?(0,S.jsx)(vf,{variant:`outline`,size:`sm`,onClick:()=>r(``),children:`Replan`}):(0,S.jsxs)(`form`,{className:`flex gap-1`,onSubmit:i=>{i.preventDefault(),t(()=>rf.replan(e.id,n)).then(()=>r(void 0))},children:[(0,S.jsx)(Uf,{autoFocus:!0,value:n,onChange:e=>r(e.target.value),placeholder:`Why replan?`,className:`h-8 w-48`}),(0,S.jsx)(vf,{type:`submit`,size:`sm`,disabled:!n.trim(),children:`Queue`})]})}var KZ={y:14.2,width:3,height:3.4,rx:.6};function qZ({working:e}){return(0,S.jsxs)(`svg`,{viewBox:`0 0 48 48`,width:32,height:32,"aria-hidden":!0,className:e?`logo-working`:void 0,children:[(0,S.jsx)(`rect`,{width:`48`,height:`48`,rx:`10.5`,className:`logo-tile`}),(0,S.jsxs)(`g`,{transform:`translate(6 6) scale(1.5)`,children:[(0,S.jsx)(`g`,{fill:`none`,className:`logo-ink`,strokeWidth:`2.25`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,S.jsx)(`path`,{d:`M3 19a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8.5a.5.5 0 0 0-.769-.422l-4.462 2.844A.5.5 0 0 1 15 10.5v-2a.5.5 0 0 0-.769-.422L9.77 10.922A.5.5 0 0 1 9 10.5V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2z`})}),(0,S.jsx)(`g`,{className:`logo-ink-fill`,children:[6.5,10.5,14.5].map(e=>(0,S.jsx)(`rect`,{className:`logo-window`,x:e,...KZ},e))})]})]})}function JZ({dialog:e,onAnswer:t}){let[n,r]=(0,v.useState)(e.method===`editor`?e.prefill??``:``),i=e.method===`input`||e.method===`editor`;return(0,S.jsx)(jy,{open:!0,onOpenChange:e=>!e&&t({cancelled:!0}),children:(0,S.jsxs)(Fy,{children:[(0,S.jsxs)(Iy,{children:[(0,S.jsx)(Ry,{children:e.title}),e.method===`confirm`&&e.message&&(0,S.jsx)(zy,{children:e.message})]}),e.method===`input`&&(0,S.jsx)(Uf,{autoFocus:!0,value:n,placeholder:e.placeholder,onChange:e=>r(e.target.value),onKeyDown:e=>e.key===`Enter`&&t({value:n})}),e.method===`editor`&&(0,S.jsx)(rE,{autoFocus:!0,value:n,onChange:e=>r(e.target.value)}),(0,S.jsxs)(Ly,{children:[e.method===`select`&&e.options.map(e=>(0,S.jsx)(vf,{variant:`outline`,onClick:()=>t({value:e}),children:e},e)),e.method===`confirm`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(vf,{variant:`outline`,onClick:()=>t({confirmed:!1}),children:`No`}),(0,S.jsx)(vf,{autoFocus:!0,onClick:()=>t({confirmed:!0}),children:`Yes`})]}),i&&(0,S.jsx)(vf,{onClick:()=>t({value:n}),children:`Send`})]})]})})}var YZ=[`select`,`confirm`,`input`,`editor`],XZ={messages:[],busy:!1,dialogs:[]};function ZZ(e,t){let{messages:n}=e;switch(t.type){case`agent_start`:return{...e,busy:!0,error:void 0};case`agent_settled`:return{...e,busy:!1,dialogs:[]};case`exit`:return{...e,busy:!1,dialogs:[],error:t.error};case`extension_ui_request`:return YZ.includes(t.method)?{...e,dialogs:[...e.dialogs,t]}:e;case`extension_ui_answered`:return{...e,dialogs:e.dialogs.filter(e=>e.id!==t.id)};case`reset`:return XZ;case`message_start`:return{...e,messages:[...n,t.message]};case`message_end`:return{...e,messages:[...n.slice(0,-1),t.message]};case`message_update`:{let r=n.at(-1);if(r?.role!==`assistant`)return e;let i=QZ(r.content,t.assistantMessageEvent);return{...e,messages:[...n.slice(0,-1),{...r,content:i}]}}case`response`:if(!t.success)return{...e,error:t.error};if(t.command===`get_messages`)return{...e,messages:t.data.messages};if(t.command===`get_state`){let n=t.data;return n.model?{...e,model:{name:n.model.name,thinking:n.thinkingLevel}}:e}return e;default:return e}}function QZ(e,t){if(!(`contentIndex`in t))return e;let n=[...e],r=t.contentIndex;if(t.type===`text_start`)n[r]={type:`text`,text:``};else if(t.type===`thinking_start`)n[r]={type:`thinking`};else if(t.type===`text_delta`&&`delta`in t){let e=n[r];n[r]={type:`text`,text:(e?.type===`text`?e.text:``)+t.delta}}else t.type===`toolcall_start`&&`toolName`in t?n[r]={type:`toolCall`,id:t.id,name:t.toolName,arguments:{}}:t.type===`toolcall_end`&&`toolCall`in t&&(n[r]=t.toolCall);return n}function $Z({messages:e,busy:t}){let n=new Map;for(let t of e)t.role===`toolResult`&&n.set(t.toolCallId,t);return e.flatMap((e,r)=>{let i=String(r);if(e.role===`user`)return[{id:i,role:`user`,text:eQ(e.content)}];if(e.role!==`assistant`)return[];let a=e.content.flatMap(e=>e.type===`toolCall`?[tQ(e,n.get(e.id),t)]:[]),o=e.stopReason===`error`?[e.errorMessage,e.model&&`(${e.provider}/${e.model})`].filter(Boolean).join(` `):void 0;return[{id:i,role:`assistant`,text:[eQ(e.content),o&&`**Error:** ${o}`].filter(Boolean).join(`
74
+ `}),n}function RN(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function zN(e,t){let n=NN(e,t),r=n.one(e,void 0),i=gN(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
75
+ `},i)),a}function BN(e,t){return e&&`run`in e?async function(n,r){let i=zN(n,{file:r,...t});await e.run(i,r)}:function(n,r){return zN(n,{file:r,...e||t})}}function VN(e){if(e)throw e}var HN=o(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function UN(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function WN(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a)r(a);else{for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?GN(s,i)(...o):r(null,...o)}}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function GN(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var KN={basename:qN,dirname:JN,extname:YN,join:XN,sep:`/`};function qN(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);$N(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function JN(e){if($N(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function YN(e){$N(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}}else n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function XN(...e){let t=-1,n;for(;++t<e.length;)$N(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:ZN(n)}function ZN(e){$N(e);let t=e.codePointAt(0)===47,n=QN(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function QN(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(i!==o-1&&a!==1){if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1}i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function $N(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var eP={cwd:tP};function tP(){return`/`}function nP(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function rP(e){if(typeof e==`string`)e=new URL(e);else if(!nP(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return iP(e)}function iP(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var aP=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],oP=class{constructor(e){let t;t=e?nP(e)?{path:e}:typeof e==`string`||uP(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:eP.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<aP.length;){let e=aP[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)aP.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?KN.basename(this.path):void 0}set basename(e){cP(e,`basename`),sP(e,`basename`),this.path=KN.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?KN.dirname(this.path):void 0}set dirname(e){lP(this.basename,`dirname`),this.path=KN.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?KN.extname(this.path):void 0}set extname(e){if(sP(e,`extname`),lP(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=KN.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){nP(e)&&(e=rP(e)),cP(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?KN.basename(this.path,this.extname):void 0}set stem(e){cP(e,`stem`),sP(e,`stem`),this.path=KN.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new VO(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function sP(e,t){if(e&&e.includes(KN.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+KN.sep+"`")}function cP(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function lP(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function uP(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var dP=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),fP=l(HN(),1),pP={}.hasOwnProperty,mP=new class e extends dP{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=WN()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,fP.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(_P(`data`,this.frozen),this.namespace[e]=t,this):pP.call(this.namespace,e)&&this.namespace[e]||void 0:e?(_P(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=bP(e),n=this.parser||this.Parser;return hP(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),hP(`process`,this.parser||this.Parser),gP(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=bP(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);SP(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),hP(`processSync`,this.parser||this.Parser),gP(`processSync`,this.compiler||this.Compiler),this.process(e,r),yP(`processSync`,`process`,t),n;function r(e,r){t=!0,VN(e),n=r}}run(e,t,n){vP(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=bP(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),yP(`runSync`,`run`,n),r;function i(e,t){VN(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=bP(t),r=this.compiler||this.Compiler;return gP(`stringify`,r),vP(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(_P(`use`,this.frozen),e!=null){if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`")}return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`){if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e)}else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,fP.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null){if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];UN(o)&&UN(r)&&(r=(0,fP.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function hP(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function gP(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function _P(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function vP(e){if(!UN(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function yP(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function bP(e){return xP(e)?e:new oP(e)}function xP(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function SP(e){return typeof e==`string`||CP(e)}function CP(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var wP=[],TP={allowDangerousHtml:!0},EP=/^(https?|ircs?|mailto|xmpp)$/i,DP=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function OP(e){let t=kP(e),n=AP(e);return jP(t.runSync(t.parse(n),n),e)}function kP(e){let t=e.rehypePlugins||wP,n=e.remarkPlugins||wP,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...TP}:TP;return mP().use(xM).use(n).use(BN,r).use(t)}function AP(e){let t=e.children||``,n=new oP;return typeof t==`string`?n.value=t:``+t,n}function jP(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||MP;for(let e of DP)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return ON(e,l),YO(e,{Fragment:S.Fragment,components:i,ignoreInvalidStyle:!0,jsx:S.jsx,jsxs:S.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in vk)if(Object.hasOwn(vk,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=vk[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function MP(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||EP.test(e.slice(0,t))?e:``}var NP=Bd(`group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-card text-card-foreground`,destructive:`bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current`}},defaultVariants:{variant:`default`}});function PP({className:e,variant:t,...n}){return(0,S.jsx)(`div`,{"data-slot":`alert`,role:`alert`,className:X(NP({variant:t}),e),...n})}function FP({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`alert-title`,className:X(`font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground`,e),...t})}function IP({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`alert-description`,className:X(`text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4`,e),...t})}var LP=Bd(`group/bubble relative flex w-fit max-w-[80%] min-w-0 flex-col gap-1 group-data-[align=end]/message:self-end data-[align=end]:self-end data-[variant=ghost]:max-w-full`,{variants:{variant:{default:`*:data-[slot=bubble-content]:bg-primary *:data-[slot=bubble-content]:text-primary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-primary/80`,secondary:`*:data-[slot=bubble-content]:bg-secondary *:data-[slot=bubble-content]:text-secondary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]`,muted:`*:data-[slot=bubble-content]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--muted),var(--foreground)_5%)]`,tinted:`*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.93_calc(c*0.4)_h)] *:data-[slot=bubble-content]:text-foreground dark:*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.3_calc(c*0.4)_h)] [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.88_calc(c*0.5)_h)] dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.35_calc(c*0.5)_h)]`,outline:`*:data-[slot=bubble-content]:border-border *:data-[slot=bubble-content]:bg-background [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-input/30`,ghost:`border-none *:data-[slot=bubble-content]:rounded-none *:data-[slot=bubble-content]:bg-transparent *:data-[slot=bubble-content]:p-0 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted/50`,destructive:`*:data-[slot=bubble-content]:bg-destructive/10 *:data-[slot=bubble-content]:text-destructive dark:*:data-[slot=bubble-content]:bg-destructive/20 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/20 dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/30`}},defaultVariants:{variant:`default`}});function RP({variant:e=`default`,align:t=`start`,className:n,...r}){return(0,S.jsx)(`div`,{"data-slot":`bubble`,"data-variant":e,"data-align":t,className:X(LP({variant:e}),n),...r})}function zP({className:e,render:t,...n}){return of({defaultTagName:`div`,props:ki({className:X(`w-fit max-w-full min-w-0 overflow-hidden rounded-xl border border-transparent px-3 py-2 text-sm leading-relaxed wrap-break-word group-data-[align=end]/bubble:self-end [button]:text-left [button,a]:transition-colors [button,a]:outline-none [button,a]:focus-visible:border-ring [button,a]:focus-visible:ring-3 [button,a]:focus-visible:ring-ring/50`,e)},n),render:t,state:{slot:`bubble-content`}})}function BP({className:e,align:t=`start`,...n}){return(0,S.jsx)(`div`,{"data-slot":`message`,"data-align":t,className:X(`group/message relative flex w-full min-w-0 gap-2 text-sm data-[align=end]:flex-row-reverse`,e),...n})}function VP({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`message-content`,className:X(`flex w-full min-w-0 flex-col gap-2.5 wrap-break-word group-data-[align=end]/message:*:data-slot:self-end`,e),...t})}function HP({defaultTagName:e,props:t,render:n,state:r={},stateAttributesMapping:i}){let a=UP(WP(r,i),t);if(!n)return v.createElement(e,a);if(typeof n==`function`)return n(a,r);if(!v.isValidElement(n))return null;let o=n.props,s={...UP(a,o),ref:qP(a.ref,o.ref)};return v.cloneElement(n,s)}function UP(...e){let t={};for(let n of e){if(!n)continue;let e=n;for(let n of Object.keys(e)){let r=e[n];if(r===void 0)continue;let i=t[n];t[n]=n===`className`?[i,r].filter(Boolean).join(` `):n===`style`?{...i,...r}:n===`ref`?qP(i,r):KP(n)&&typeof i==`function`&&typeof r==`function`?GP(r,i):r}}return t}function WP(e,t){let n={};for(let r of Object.keys(e)){let i=e[r],a=t?.[r]?.(i);if(a){Object.assign(n,a);continue}if(r===`slot`){n[`data-slot`]=i;continue}let o=`data-${String(r).replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}`;typeof i==`boolean`?n[o]=i?``:void 0:i!=null&&(n[o]=String(i))}return n}function GP(e,t){return function(n){e(n),n.defaultPrevented||t(n)}}function KP(e){return/^on[A-Z]/.test(e)}function qP(...e){let t=e.filter(Boolean);if(t.length!==0)return e=>{for(let n of t)typeof n==`function`?n(e):n&&(n.current=e)}}var JP=8,YP=64,XP=0,ZP=.5,QP=180,$P=new Set([`ArrowDown`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`,` `]),eF={start:!1,end:!1},tF={currentAnchorId:null,visibleMessageIds:[]};function nF({content:e,scrollEdgeThreshold:t,spacer:n,viewport:r}){if(!r||!e)return eF;let i=mF({content:e,spacer:n,viewport:r});return{start:r.scrollTop>t,end:i-r.scrollTop-r.clientHeight>t}}function rF({content:e,scrollMargin:t,scrollPreviousItemPeek:n,spacer:r,viewport:i,visibleMessageIds:a}){if(!e||!i)return tF;let o=i.getBoundingClientRect(),s=o.top+t+n,c=typeof IntersectionObserver>`u`,l=[],u=null;for(let t of iF(e,r)){let e=t.dataset.messageId;if(!e)continue;let n=t.dataset.scrollAnchor===`true`,r=n||c?t.getBoundingClientRect():null;(c&&r?r.bottom>s&&r.top<o.bottom:a.has(e))&&l.push(e),n&&r&&r.top<=s+ZP&&(u=e)}return l.length===0&&u===null?tF:{currentAnchorId:u,visibleMessageIds:l}}function iF(e,t){return Array.from(e.children).filter(e=>e instanceof HTMLElement&&e!==t)}function aF(e,t){for(let n=t;n<e.length;n++){let t=e[n];if(t?.dataset.scrollAnchor===`true`)return t}return null}function oF(e,t){for(let n of e)if(n.dataset.scrollAnchor===`true`&&!t.has(n))return n;return null}function sF(e,t){let n=0;for(let r=t;r<e.length;r++)if(e[r]?.dataset.scrollAnchor===`true`&&(n+=1,n>1))return!0;return!1}function cF(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.dataset.scrollAnchor===`true`)return n}return null}function lF({content:e,spacer:t,viewport:n}){let r=n.getBoundingClientRect();for(let n of iF(e,t)){if(!n.dataset.messageId)continue;let e=n.getBoundingClientRect();if(e.bottom>r.top&&e.top<r.bottom)return n}return null}function uF({align:e,element:t,scrollMargin:n,spacer:r,viewport:i}){let a=dF(t,i),o=t.getBoundingClientRect().height,s=_F(r);if(e===`center`){let e=Math.max(0,i.clientHeight-s.start-s.end);return a-s.start-(e-o)/2-n}if(e===`end`)return a-i.clientHeight+o+s.end+n;if(e===`nearest`){let e=a+o,t=i.scrollTop+s.start,r=i.scrollTop+i.clientHeight-s.end;return a>=t&&e<=r?i.scrollTop:a<t?a-s.start-n:e-i.clientHeight+s.end+n}return a-s.start-n}function dF(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.top-r.top+t.scrollTop}function fF(e,t){return e.getBoundingClientRect().top-t.getBoundingClientRect().top}function pF({content:e,scrollTop:t,spacer:n,viewport:r}){let i=mF({content:e,spacer:n,viewport:r});return t+r.clientHeight-i}function mF({content:e,spacer:t,viewport:n}){let r=iF(e,t),i=gF(e),a=n.getBoundingClientRect(),o=n.scrollTop,s=i.start+i.end;for(let e of r){let t=e.getBoundingClientRect();s=Math.max(s,t.bottom-a.top+o+i.end)}return s}function hF(e){return Math.max(0,e.scrollHeight-e.clientHeight)}function gF(e){let t=window.getComputedStyle(e);return{end:yF(t.paddingBlockEnd||t.paddingBottom),start:yF(t.paddingBlockStart||t.paddingTop)}}function _F(e){let t=e?.parentElement;return t?gF(t):{end:0,start:0}}function vF(e){if(!e)return 0;let t=window.getComputedStyle(e);return yF(t.rowGap===`normal`?t.gap:t.rowGap)}function yF(e){if(!e)return 0;let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function bF(e,t){let n=e,r=new Set;return{getSnapshot:()=>n,hasListeners:()=>r.size>0,setSnapshot:e=>{t(n,e)||(n=e,r.forEach(e=>e()))},subscribe:(e,t,n)=>{let i=r.size===0;return r.add(e),i&&t?.(),()=>{r.delete(e),r.size===0&&n?.()}}}}function xF(e,t){return bF(e,t)}function SF(){return bF(tF,wF)}function CF(e,t){return e.start===t.start&&e.end===t.end}function wF(e,t){return e.currentAnchorId!==t.currentAnchorId||e.visibleMessageIds.length!==t.visibleMessageIds.length?!1:e.visibleMessageIds.every((e,n)=>e===t.visibleMessageIds[n])}function TF({autoScroll:e,defaultScrollPosition:t,scrollEdgeThreshold:n,scrollMargin:r,scrollPreviousItemPeek:i}){let a=v.useRef(e),o=v.useRef(!1),s=v.useRef(null),c=v.useRef(!1),l=v.useRef(n),u=v.useRef(0),d=v.useRef(null),f=v.useRef(0),p=v.useRef(e?`following-bottom`:`free-scrolling`),m=v.useRef(new Map),h=v.useRef(null),g=v.useRef(null),_=v.useRef(null),y=v.useRef(i),b=v.useRef(!0),x=v.useRef(null),S=v.useRef(r),C=v.useRef(null),w=v.useRef(0),T=v.useRef(0),E=v.useRef(null),D=v.useRef(null),O=v.useRef(null),k=v.useRef(null),A=v.useRef(null),j=v.useRef(null),M=v.useRef(null),N=v.useRef(null),P=v.useRef(null),F=v.useRef(new Set),I=v.useRef(new WeakSet);return O.current===null&&(O.current=xF(t===`end`||t===`last-anchor`,(e,t)=>e===t)),k.current===null&&(k.current=xF(eF,CF)),P.current===null&&(P.current=SF()),a.current=e,l.current=n,S.current=r,y.current=i,{autoScrollRef:a,autoscrollingRef:o,autoscrollingTimeoutRef:A,streamingTurnRef:_,contentRef:s,defaultScrollPositionAppliedRef:c,firstItemRef:d,itemCountRef:u,lastScrollTopRef:f,messageElementsRef:m,modeRef:p,pendingScrollFrameRef:C,pendingScrollToMessageRef:h,prependRestoreRef:g,preserveScrollOnPrependRef:b,pendingDefaultScrollStore:O.current,rootRef:x,scrollEdgeThresholdRef:l,scrollMarginRef:S,scrollPreviousItemPeekRef:y,spacerGapRef:w,spacerHeightRef:T,spacerRef:E,stateFrameRef:D,stateStore:k.current,viewportRef:j,visibilityFrameRef:M,visibilityObserverRef:N,visibilityStore:P.current,visibleMessageIdsRef:F,handledScrollAnchorsRef:I}}function EF(e){e.pendingDefaultScrollStore.setSnapshot(!1)}function DF(e){e.defaultScrollPositionAppliedRef.current=!0,EF(e)}function OF({refs:e,commitScrollState:t,scheduleStateCommit:n,scheduleVisibilitySync:r}){let{streamingTurnRef:i,autoScrollRef:a,autoscrollingRef:o,autoscrollingTimeoutRef:s,contentRef:c,itemCountRef:l,messageElementsRef:u,modeRef:d,pendingScrollToMessageRef:f,prependRestoreRef:p,scrollMarginRef:m,scrollPreviousItemPeekRef:h,spacerGapRef:g,spacerHeightRef:_,spacerRef:y,viewportRef:b}=e,x=v.useCallback(e=>{s.current!==null&&(window.clearTimeout(s.current),s.current=null),o.current!==e&&(o.current=e,t()),e&&(s.current=window.setTimeout(()=>{s.current=null,o.current=!1,t()},QP))},[t]),S=v.useCallback(e=>{let t=y.current;if(!t)return;let n=Math.max(0,Math.ceil(e));_.current!==n&&(_.current=n,t.hidden=n===0,t.style.height=`${n}px`,t.style.marginTop=n>0?`${-g.current}px`:``)},[]),C=v.useCallback((e,{behavior:r=`auto`,autoscrolling:i=!1}={})=>{let a=b.current;if(!a)return;let o=Math.max(0,e);Math.abs(a.scrollTop-o)<=ZP?(a.scrollTop=o,t()):(i&&x(!0),a.scrollTo({top:o,behavior:r}),n())},[t,n,x]),w=v.useCallback(({behavior:e=`auto`}={})=>b.current?(S(0),i.current=null,d.current=`free-scrolling`,C(0,{behavior:e}),r(),!0):!1,[r,C,S]),T=v.useCallback(({behavior:e=`auto`}={})=>{let t=b.current;return t?(S(0),i.current=null,d.current=a.current?`following-bottom`:`free-scrolling`,C(hF(t),{autoscrolling:!0,behavior:e}),r(),!0):!1},[r,C,S]),E=v.useCallback((e,{align:t=`start`,behavior:n=`auto`,scrollMargin:a=m.current}={},{keepPreviousPeek:o=!1}={})=>{let s=c.current,l=b.current;if(!s||!l||!s.contains(e))return!1;let u=uF({align:t,element:e,scrollMargin:o?a+h.current:a,spacer:y.current,viewport:l}),f=pF({content:s,scrollTop:u,spacer:y.current,viewport:l});return S(f),p.current={element:e,viewportTop:fF(e,l)},d.current=o?`anchored-to-message`:`settling-jump`,i.current=o?e:null,C(u,{behavior:n}),r(),!0},[r,C,S]),D=v.useCallback(()=>{let e=i.current;return!e||!e.isConnected||d.current!==`anchored-to-message`?!1:E(e,{align:`start`},{keepPreviousPeek:!0})},[E]),O=v.useCallback((t,n)=>{let r=u.current.get(t);return r?(DF(e),E(r,n)?(f.current=null,!0):(f.current={messageId:t,options:n},!0)):l.current===0&&(f.current={messageId:t,options:n},DF(e),!0)},[E]);return{flushPendingScrollToMessage:v.useCallback(()=>{let t=f.current;if(!t)return!1;let n=u.current.get(t.messageId);return!n||!E(n,t.options)?!1:(f.current=null,DF(e),!0)},[E]),reanchorToAnchoredMessage:D,scrollToElement:E,scrollToEnd:T,scrollToMessage:O,scrollToStart:w}}function kF(e,t){return v.useCallback(n=>{e.current=n,n&&t()},[e,t])}function AF({autoScroll:e=!1,defaultScrollPosition:t=`end`,scrollEdgeThreshold:n=JP,scrollPreviousItemPeek:r=YP,scrollMargin:i=XP}){let a=TF({autoScroll:e,defaultScrollPosition:t,scrollEdgeThreshold:n,scrollMargin:i,scrollPreviousItemPeek:r}),{streamingTurnRef:o,autoScrollRef:s,autoscrollingRef:c,autoscrollingTimeoutRef:l,contentRef:u,defaultScrollPositionAppliedRef:d,firstItemRef:f,itemCountRef:p,lastScrollTopRef:m,messageElementsRef:h,modeRef:g,pendingScrollFrameRef:_,pendingScrollToMessageRef:y,prependRestoreRef:b,preserveScrollOnPrependRef:x,pendingDefaultScrollStore:S,rootRef:C,scrollEdgeThresholdRef:w,scrollMarginRef:T,scrollPreviousItemPeekRef:E,spacerGapRef:D,spacerHeightRef:O,spacerRef:k,stateFrameRef:A,stateStore:j,viewportRef:M,visibilityFrameRef:N,visibilityObserverRef:P,visibilityStore:F,visibleMessageIdsRef:I,handledScrollAnchorsRef:L}=a,R=v.useRef(t);R.current!==t&&(R.current=t,d.current=!1);let z=v.useCallback(e=>{let t=C.current,n=M.current,r=[e.start&&`start`,e.end&&`end`].filter(Boolean).join(` `),i=c.current;for(let e of[t,n])e&&(r?e.setAttribute(`data-scrollable`,r):e.removeAttribute(`data-scrollable`),e.toggleAttribute(`data-autoscrolling`,i))},[]),B=v.useCallback(e=>{let t=M.current?.scrollTop??0,n=t<m.current-ZP;m.current=t,s.current&&!e.end&&g.current!==`settling-jump`&&g.current!==`anchored-to-message`?g.current=`following-bottom`:g.current===`following-bottom`&&e.end&&n&&!c.current&&(g.current=`free-scrolling`)},[]),V=v.useCallback(()=>{let e=nF({content:u.current,scrollEdgeThreshold:w.current,spacer:k.current,viewport:M.current});B(e);let t=g.current===`following-bottom`?{...e,end:!1}:e;z(t),j.setSnapshot(t)},[B,j,z]),H=v.useCallback(()=>{A.current===null&&(A.current=window.requestAnimationFrame(()=>{A.current=null,V()}))},[V]),U=v.useCallback(()=>{F.hasListeners()&&N.current===null&&(N.current=window.requestAnimationFrame(()=>{N.current=null,F.hasListeners()&&F.setSnapshot(rF({content:u.current,scrollMargin:T.current,scrollPreviousItemPeek:E.current,spacer:k.current,viewport:M.current,visibleMessageIds:I.current}))}))},[F]),{flushPendingScrollToMessage:ee,reanchorToAnchoredMessage:te,scrollToElement:ne,scrollToEnd:W,scrollToMessage:re,scrollToStart:ie}=OF({refs:a,commitScrollState:V,scheduleStateCommit:H,scheduleVisibilitySync:U}),ae=v.useCallback(()=>{let e=b.current,t=M.current;if(!e||!t||!e.element.isConnected)return!1;let n=fF(e.element,t)-e.viewportTop;return Math.abs(n)<=ZP?!1:(t.scrollTop+=n,e.viewportTop=fF(e.element,t),H(),U(),!0)},[H,U]),G=v.useCallback(()=>{let e=u.current,t=M.current;if(!e||!t){b.current=null;return}let n=lF({content:e,spacer:k.current,viewport:t});b.current=n?{element:n,viewportTop:fF(n,t)}:null},[]),K=v.useCallback(()=>{_.current===null&&(_.current=window.requestAnimationFrame(()=>{_.current=null,ee()&&G()}))},[G,ee]),q=v.useCallback(()=>{if(!t||d.current||p.current===0)return!1;let e=!1;if(t===`last-anchor`){let t=u.current,n=M.current,r=t&&n?cF(iF(t,k.current)):null;if(!t||!n||!r)e=W({behavior:`auto`});else{let i=dF(r,n);e=mF({content:t,spacer:k.current,viewport:n})-i<=n.clientHeight?W({behavior:`auto`}):ne(r,{align:`start`},{keepPreviousPeek:!0})}}else e=t===`end`?W({behavior:`auto`}):ie({behavior:`auto`});return e?(DF(a),!0):!1},[t,ne,W,ie]),oe=v.useCallback(()=>{let e=u.current;if(!e)return;let t=iF(e,k.current),n=p.current,r=f.current;p.current=t.length,f.current=t[0]??null,(()=>{if(ee())return;if(n===0){if(q()||t.length>0&&s.current&&W({behavior:`auto`}))return;V(),U();return}let e=r?t.indexOf(r):-1;if(x.current&&e>0)ae();else{if(t.length>n){let e=aF(t,n);if(e){if(s.current&&g.current===`following-bottom`&&sF(t,n)){W({behavior:`auto`});return}ne(e,{align:`start`},{keepPreviousPeek:!0}),L.current.add(e);return}}if(t.length===n){let e=oF(t,L.current);if(e){ne(e,{align:`start`},{keepPreviousPeek:!0}),L.current.add(e);return}}g.current===`following-bottom`&&s.current?W({behavior:`auto`}):(V(),U())}})(),G()},[q,G,V,ee,ae,U,ne,W]),J=v.useCallback(()=>{if(g.current===`following-bottom`&&s.current){W({behavior:`auto`});return}let e=O.current;te()?s.current&&e>0&&O.current===0&&W({behavior:`auto`}):(H(),U())},[te,H,U,W]),se=v.useCallback(()=>{let e=M.current;if(e&&F.hasListeners()){if(typeof IntersectionObserver>`u`){U();return}P.current||=new IntersectionObserver(e=>{for(let t of e){let e=t.target.dataset.messageId;e&&(t.isIntersecting?I.current.add(e):I.current.delete(e))}U()},{root:e,rootMargin:`${-(T.current+E.current)}px 0px 0px 0px`,threshold:[0,.01,.5,1]}),h.current.forEach(e=>{P.current?.observe(e)}),U()}},[U,F]),ce=v.useCallback(()=>{N.current!==null&&(window.cancelAnimationFrame(N.current),N.current=null),P.current?.disconnect(),P.current=null,I.current.clear(),F.setSnapshot(tF)},[F]),le=v.useCallback((e,t,n)=>{t?(h.current.set(e,t),P.current?.observe(t),U(),y.current?.messageId===e&&K()):n&&h.current.get(e)===n&&(h.current.delete(e),I.current.delete(e),P.current?.unobserve(n),U())},[K,U]),ue=v.useCallback(()=>{(g.current===`following-bottom`||g.current===`anchored-to-message`||g.current===`settling-jump`)&&(o.current=null,g.current=`free-scrolling`)},[]),de=v.useCallback(()=>z(j.getSnapshot()),[j,z]),fe=kF(C,de),pe=kF(M,de),me=v.useCallback(e=>{u.current=e},[]),he=v.useCallback(e=>{k.current=e,D.current=vF(e?.parentElement??null)},[]),ge=v.useCallback(()=>{V(),U(),G()},[G,V,U]),_e=v.useMemo(()=>({handleContentChange:oe,handleResize:J,observeVisibility:se,pendingDefaultScrollStore:S,preserveScrollOnPrependRef:x,scrollToEnd:W,scrollToMessage:re,scrollToStart:ie,setContentElement:me,setRootElement:fe,setSpacerElement:he,setViewportElement:pe,stateStore:j,syncAfterScroll:ge,unobserveVisibility:ce,userScrollIntent:ue,viewportRef:M,visibilityStore:F}),[oe,J,se,S,W,re,ie,me,fe,he,pe,j,ge,ce,ue,F]);return v.useLayoutEffect(()=>{q()||p.current===0&&EF(a)},[q]),v.useEffect(()=>()=>{A.current!==null&&(window.cancelAnimationFrame(A.current),A.current=null),N.current!==null&&(window.cancelAnimationFrame(N.current),N.current=null),l.current!==null&&(window.clearTimeout(l.current),l.current=null),_.current!==null&&(window.cancelAnimationFrame(_.current),_.current=null),P.current?.disconnect(),P.current=null},[]),v.useLayoutEffect(()=>{e&&g.current===`following-bottom`&&p.current>0?W({behavior:`auto`}):V()},[e,V,W]),{context:_e,registerMessage:le}}function jF(e){let t=v.useRef(e);return t.current=e,t}var MF=v.createContext(null),NF=v.createContext(null);function PF(){let e=v.useContext(MF);if(!e)throw Error(`useMessageScroller must be used within a MessageScroller.`);return e}function FF(){let e=v.useContext(NF);if(!e)throw Error(`MessageScrollerItem must be used within a MessageScroller.`);return e}function IF({autoScroll:e=!1,children:t,defaultScrollPosition:n=`end`,scrollEdgeThreshold:r,scrollPreviousItemPeek:i,scrollMargin:a}){let{context:o,registerMessage:s}=AF({autoScroll:e,defaultScrollPosition:n,scrollEdgeThreshold:r,scrollPreviousItemPeek:i,scrollMargin:a});return(0,S.jsx)(MF.Provider,{value:o,children:(0,S.jsx)(NF.Provider,{value:s,children:t})})}function LF(){let{pendingDefaultScrollStore:e}=PF();return v.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function RF({children:e,...t}){let{setRootElement:n}=PF(),r=LF();return(0,S.jsx)(`div`,{ref:n,...t,...r?{"data-pending-scroll":``}:null,children:e})}function zF({"aria-label":e,children:t,onKeyDown:n,onScroll:r,onTouchMove:i,onWheel:a,preserveScrollOnPrepend:o=!0,ref:s,role:c,tabIndex:l,...u}){let{handleResize:d,preserveScrollOnPrependRef:f,setViewportElement:p,syncAfterScroll:m,userScrollIntent:h,viewportRef:g}=PF(),_=LF();f.current=o;let y=v.useCallback(e=>{p(e),qP(s)?.(e)},[s,p]);function b(e){m(),r?.(e)}function x(e){h(),a?.(e)}function C(e){h(),i?.(e)}function w(e){$P.has(e.key)&&h(),n?.(e)}return v.useEffect(()=>{let e=g.current;if(!e||typeof ResizeObserver>`u`)return;let t=0,n=new ResizeObserver(()=>{window.cancelAnimationFrame(t),t=window.requestAnimationFrame(d)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.disconnect()}},[d,g]),(0,S.jsx)(`div`,{ref:y,role:c??`region`,"aria-label":e??`Messages`,tabIndex:l??0,onKeyDown:w,onScroll:b,onTouchMove:C,onWheel:x,...u,..._?{"data-pending-scroll":``}:null,children:t})}function BF({"aria-relevant":e,children:t,ref:n,role:r,spacerClassName:i,...a}){let{handleContentChange:o,handleResize:s,setContentElement:c,setSpacerElement:l}=PF(),u=v.useRef(null),d=v.useCallback(e=>{u.current=e,c(e),qP(n)?.(e)},[n,c]);return v.useLayoutEffect(()=>{let e=u.current;if(!e||(o(),typeof MutationObserver>`u`))return;let t=new MutationObserver(()=>{o()});return t.observe(e,{childList:!0}),()=>t.disconnect()},[o]),v.useEffect(()=>{let e=u.current;if(!e||typeof ResizeObserver>`u`)return;let t=0,n=new ResizeObserver(()=>{window.cancelAnimationFrame(t),t=window.requestAnimationFrame(s)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.disconnect()}},[s]),(0,S.jsxs)(`div`,{ref:d,role:r??`log`,"aria-relevant":e??`additions`,...a,children:[t,(0,S.jsx)(`div`,{ref:l,"aria-hidden":`true`,"data-message-scroller-spacer":``,hidden:!0,className:i})]})}function VF({messageId:e,ref:t,scrollAnchor:n=!1,...r}){let i=FF(),a=v.useRef(null),o=v.useCallback(n=>{let r=a.current;a.current=n,e&&i(e,n,r),qP(t)?.(n)},[e,t,i]);return(0,S.jsx)(`div`,{ref:o,"data-message-id":e,"data-scroll-anchor":n?`true`:`false`,...r})}function HF({behavior:e=`smooth`,children:t,direction:n=`end`,onClick:r,render:i,tabIndex:a,type:o=`button`,...s}){let{scrollToEnd:c,scrollToStart:l,stateStore:u}=PF(),d=jF(r),f=v.useCallback(e=>u.subscribe(e),[u]),p=v.useCallback(()=>{let e=u.getSnapshot();return n===`start`?e.start:e.end},[n,u]),m=v.useSyncExternalStore(f,p,p),h=v.useCallback(t=>{m&&(d.current?.(t),t.defaultPrevented||(t.currentTarget.blur(),n===`start`?l({behavior:e}):c({behavior:e})))},[e,n,m,d,c,l]);return HP({defaultTagName:`button`,props:UP({type:o,inert:!m,tabIndex:m?a:-1,children:t??(0,S.jsxs)(`span`,{children:[`Scroll to `,n]}),onClick:h},s),render:i,state:{active:m,direction:n},stateAttributesMapping:{active:e=>({"data-active":e?`true`:`false`})}})}var UF={Provider:IF,Root:RF,Viewport:zF,Content:BF,Item:VF,Button:HF};function WF(e){return(0,S.jsx)(UF.Provider,{...e})}function GF({className:e,...t}){return(0,S.jsx)(UF.Root,{"data-slot":`message-scroller`,className:X(`group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden`,e),...t})}function KF({className:e,...t}){return(0,S.jsx)(UF.Viewport,{"data-slot":`message-scroller-viewport`,className:X(`size-full min-h-0 min-w-0 scroll-fade-b scrollbar-thin scrollbar-gutter-stable overflow-y-auto overscroll-contain contain-content data-autoscrolling:scrollbar-thumb-transparent data-autoscrolling:scrollbar-track-transparent data-pending-scroll:invisible`,e),...t})}function qF({className:e,...t}){return(0,S.jsx)(UF.Content,{"data-slot":`message-scroller-content`,className:X(`flex h-max min-h-full flex-col gap-6`,e),...t})}function JF({className:e,scrollAnchor:t=!1,...n}){return(0,S.jsx)(UF.Item,{"data-slot":`message-scroller-item`,scrollAnchor:t,className:X(`min-w-0 shrink-0 [contain-intrinsic-size:auto_10rem] [content-visibility:auto]`,e),...n})}function YF({direction:e=`end`,className:t,children:n,render:r,variant:i=`secondary`,size:a=`icon-sm`,...o}){return(0,S.jsx)(UF.Button,{"data-slot":`message-scroller-button`,"data-direction":e,"data-variant":i,"data-size":a,direction:e,className:X(`absolute inset-s-1/2 -translate-x-1/2 border-border bg-background text-foreground transition-[translate,scale,opacity] duration-200 hover:bg-muted hover:text-foreground data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[active=false]:duration-400 data-[active=false]:ease-[cubic-bezier(0.7,0,0.84,0)] data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100 data-[active=true]:ease-[cubic-bezier(0.23,1,0.32,1)] data-[direction=end]:bottom-4 data-[direction=end]:data-[active=false]:translate-y-full data-[direction=start]:top-4 data-[direction=start]:data-[active=false]:-translate-y-full rtl:translate-x-1/2 data-[direction=start]:[&_svg]:rotate-180`,t),render:r??(0,S.jsx)(vf,{variant:i,size:a}),...o,children:n??(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(hu,{}),(0,S.jsx)(`span`,{className:`sr-only`,children:e===`end`?`Scroll to end`:`Scroll to start`})]})})}function XF({...e}){return(0,S.jsx)(ZC,{"data-slot":`collapsible`,...e})}function ZF({...e}){return(0,S.jsx)($C,{"data-slot":`collapsible-trigger`,...e})}function QF({...e}){return(0,S.jsx)(nw,{"data-slot":`collapsible-content`,...e})}function $F({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`trace`,className:X(`flex w-full min-w-0 flex-col gap-2 *:has-[>[data-slot=trace-line]]:flex *:has-[>[data-slot=trace-line]]:w-fit *:has-[>[data-slot=trace-line]]:max-w-full *:has-[>[data-slot=trace-line]]:min-w-0 *:has-[>[data-slot=trace-line]]:rounded-md *:has-[>[data-slot=trace-line]]:text-left *:has-[>[data-slot=trace-line]]:outline-none *:has-[>[data-slot=trace-line]]:focus-visible:ring-3 *:has-[>[data-slot=trace-line]]:focus-visible:ring-ring/50`,e),...t})}function eI({className:e,status:t,...n}){return(0,S.jsx)(`span`,{"data-slot":`trace-line`,"data-status":t,className:X(`flex w-fit max-w-full min-w-0 items-center gap-2 text-sm text-muted-foreground transition-colors in-[a,button]:cursor-pointer in-[a:hover,button:hover]:text-foreground data-[status=error]:text-destructive data-[status=error]:in-[a:hover,button:hover]:text-destructive data-[status=pending]:opacity-60 data-[status=running]:*:data-[slot=trace-title]:shimmer`,e),...n})}function tI({className:e,...t}){return(0,S.jsx)(`span`,{"data-slot":`trace-icon`,"aria-hidden":`true`,className:X(`flex size-4 shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [[data-slot=trace-title]~&]:-ml-1`,e),...t})}function nI({className:e,...t}){return(0,S.jsx)(`span`,{"data-slot":`trace-title`,className:X(`min-w-0 truncate motion-reduce:shimmer-none`,e),...t})}function rI({className:e,...t}){return(0,S.jsx)(XF,{"data-slot":`trace-collapsible`,className:X(`flex w-full min-w-0 flex-col`,e),...t})}function iI({className:e,children:t,...n}){return(0,S.jsxs)(ZF,{"data-slot":`trace-collapsible-trigger`,className:X(`group/trace-collapsible-trigger flex w-fit max-w-full min-w-0 cursor-pointer items-center gap-1 rounded-md text-left text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50 has-[[data-status=error]]:text-destructive`,e),...n,children:[t,(0,S.jsx)(tI,{className:`transition-transform group-aria-expanded/trace-collapsible-trigger:rotate-90`,children:(0,S.jsx)(Du,{})})]})}function aI({className:e,children:t,...n}){return(0,S.jsx)(QF,{"data-slot":`trace-collapsible-content`,className:`h-(--collapsible-panel-height) min-w-0 overflow-hidden transition-[height] duration-200 data-ending-style:h-0 data-starting-style:h-0`,...n,children:(0,S.jsx)(`div`,{"data-slot":`trace-collapsible-content-inner`,className:X(`mt-2 mb-1 ml-[calc(--spacing(2)-1px)] min-w-0 border-l pr-1 pl-4 leading-relaxed wrap-break-word text-muted-foreground`,e),children:t})})}function oI(e){let t=[];for(let n of e){let e=t.at(-1);n.role===`assistant`&&e?.role===`assistant`?e.messages.push(n):t.push({id:n.id,role:n.role,messages:[n]})}return t}function sI(e,t){let n=[];for(let r of e){r.text&&n.push({type:`text`,text:r.text});for(let e of r.tools??[]){let r=t?.(e),i=n.at(-1);r==null?i?.type===`steps`?i.tools.push(e):n.push({type:`steps`,tools:[e]}):n.push({type:`result`,id:e.id,node:r})}}return n}function cI({host:e}){let[t,n]=(0,v.useState)(!1);return t?(0,S.jsx)($u,{}):(0,S.jsx)(`img`,{src:`https://icons.duckduckgo.com/ip3/${e}.ico`,alt:``,className:`size-3 shrink-0 rounded-sm`,onError:()=>n(!0)})}var lI=6;function uI({sources:e}){let t=new Map;for(let n of e){let e=new URL(n.url).hostname;t.has(e)||t.set(e,n)}let n=t.size-lI;return(0,S.jsxs)(`ul`,{"aria-label":`Sources`,className:`flex flex-wrap gap-1 pl-6`,children:[[...t].slice(0,lI).map(([e,t])=>(0,S.jsx)(`li`,{children:(0,S.jsxs)(Xl,{children:[(0,S.jsxs)(Gl,{render:(0,S.jsx)(cf,{variant:`outline`,render:(0,S.jsx)(`a`,{href:t.url,target:`_blank`,rel:`noopener noreferrer`})}),children:[(0,S.jsx)(cI,{host:e}),e.replace(/^www\./,``)]}),(0,S.jsx)(Kl,{className:`wrap-anywhere`,children:t.title??t.url})]})},e)),n>0&&(0,S.jsx)(`li`,{children:(0,S.jsxs)(cf,{variant:`secondary`,children:[`+`,n]})})]})}function dI({tool:e}){let t=(0,S.jsxs)(eI,{status:e.status===`complete`?void 0:e.status,children:[(0,S.jsx)(tI,{children:e.sources?(0,S.jsx)($u,{}):(0,S.jsx)(Nd,{})}),(0,S.jsx)(nI,{children:e.label})]}),n=e.output?(0,S.jsxs)(rI,{children:[(0,S.jsx)(iI,{children:t}),(0,S.jsx)(aI,{children:(0,S.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap text-xs`,children:e.output})})]}):t;return e.sources?.length?(0,S.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[n,(0,S.jsx)(uI,{sources:e.sources})]}):n}function fI({quote:e}){return(0,S.jsx)($F,{children:(0,S.jsxs)(rI,{defaultOpen:!0,children:[(0,S.jsx)(iI,{children:(0,S.jsxs)(eI,{children:[(0,S.jsx)(tI,{children:(0,S.jsx)(kd,{})}),(0,S.jsx)(nI,{children:e.source})]})}),(0,S.jsxs)(aI,{children:[(0,S.jsx)(`p`,{className:`max-h-48 overflow-auto whitespace-pre-wrap text-foreground`,children:e.text}),e.href&&(0,S.jsx)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,className:`block truncate text-xs underline underline-offset-4`,children:e.href})]})]})})}var pI=(0,v.memo)(function({text:e}){return(0,S.jsx)(`div`,{className:`flex min-w-0 flex-col gap-2 text-sm leading-relaxed wrap-break-word`,children:(0,S.jsx)(OP,{skipHtml:!0,allowedElements:[`p`,`strong`,`em`,`a`,`ul`,`ol`,`li`,`code`,`pre`,`br`,`blockquote`],components:{a:({children:e,href:t})=>(0,S.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,className:`underline underline-offset-4`,children:e}),ul:({children:e})=>(0,S.jsx)(`ul`,{className:`list-disc pl-5`,children:e}),ol:({children:e})=>(0,S.jsx)(`ol`,{className:`list-decimal pl-5`,children:e}),pre:({children:e})=>(0,S.jsx)(`pre`,{className:`overflow-auto whitespace-pre-wrap`,children:e})},children:e})})});function mI({messages:e,prompt:t,onPromptChange:n,busy:r,disabled:i=!1,error:a,onSend:o,onStop:s,renderTool:c,model:l,placeholder:u=`Ask the agent…`,emptyTitle:d=`What would you like to do?`,emptyDescription:f=`Ask a question or describe a change. You stay in control of what gets applied.`}){let[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(``),_=a||h,y=(0,v.useId)(),b=r||p;async function x(){let e=t.trim();if(!(!e||b||i)){m(!0),g(``);try{await o(e)&&n(t=>t.trim()===e?``:t)}catch(e){g(e instanceof Error?e.message:`Could not send. Please try again.`)}finally{m(!1)}}}return(0,S.jsxs)(`section`,{"aria-label":`Agent conversation`,className:`flex min-h-0 min-w-0 flex-1 flex-col gap-4`,children:[(0,S.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,S.jsx)(WF,{autoScroll:!0,children:(0,S.jsxs)(GF,{children:[(0,S.jsx)(KF,{children:(0,S.jsx)(qF,{children:e.length===0?(0,S.jsx)(JF,{messageId:`empty`,children:(0,S.jsx)(Vd,{children:(0,S.jsxs)(Hd,{children:[(0,S.jsx)(Ud,{children:d}),(0,S.jsx)(Wd,{children:f})]})})}):oI(e).map(e=>(0,S.jsx)(JF,{messageId:e.id,scrollAnchor:e.role===`user`,children:(0,S.jsx)(BP,{align:e.role===`user`?`end`:`start`,children:(0,S.jsx)(VP,{children:e.role===`user`?(0,S.jsxs)(`div`,{className:`flex min-w-0 flex-col items-end gap-2`,children:[e.messages[0].quote&&(0,S.jsx)(fI,{quote:e.messages[0].quote}),(0,S.jsx)(RP,{align:`end`,variant:`muted`,children:(0,S.jsx)(zP,{className:`whitespace-pre-wrap`,children:e.messages[0].text})})]}):(0,S.jsx)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:sI(e.messages,c).map((e,t)=>e.type===`text`?(0,S.jsx)(pI,{text:e.text},t):e.type===`steps`?(0,S.jsx)($F,{children:e.tools.map(e=>(0,S.jsx)(dI,{tool:e},e.id))},e.tools[0].id):(0,S.jsx)(`div`,{className:`min-w-0`,children:e.node},e.id))})})})},e.id))})}),(0,S.jsx)(YF,{})]})})}),_&&(0,S.jsxs)(PP,{variant:`destructive`,children:[(0,S.jsx)(FP,{children:`The agent could not continue`}),(0,S.jsx)(IP,{children:_})]}),(0,S.jsxs)(`form`,{className:`shrink-0`,onSubmit:e=>{e.preventDefault(),x()},children:[(0,S.jsx)(`label`,{htmlFor:y,className:`sr-only`,children:`Message the agent`}),(0,S.jsxs)(aE,{children:[(0,S.jsx)(dE,{id:y,value:t,onChange:e=>n(e.target.value),className:`max-h-40`,onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),x())},placeholder:u,disabled:i,maxLength:4e3,rows:2}),(0,S.jsx)(sE,{align:`block-end`,className:`justify-end`,children:b?(0,S.jsxs)(lE,{type:`button`,size:`sm`,variant:`outline`,onClick:s,disabled:p||i,children:[(0,S.jsx)(Td,{"data-icon":`inline-start`}),`Stop`]}):(0,S.jsxs)(lE,{type:`submit`,size:`sm`,variant:t.trim()?`default`:`secondary`,disabled:i,"aria-disabled":i||!t.trim(),children:[(0,S.jsx)(yu,{"data-icon":`inline-start`}),`Send`]})})]})]}),(0,S.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-2`,children:[(0,S.jsx)(`p`,{role:`status`,className:`truncate text-xs text-muted-foreground`,children:b?`Agent working. You can stop it at any time.`:`Enter to send. Shift+Enter for a new line.`}),l&&(0,S.jsxs)(Xl,{children:[(0,S.jsxs)(Gl,{render:(0,S.jsx)(cf,{variant:`secondary`}),children:[(0,S.jsx)(xu,{}),l.name,` · `,l.thinking]}),(0,S.jsxs)(Kl,{children:[`Model `,l.name,`, thinking `,l.thinking]})]})]})]})}var hI=768;function gI(){let[e,t]=v.useState(void 0);return v.useEffect(()=>{let e=window.matchMedia(`(max-width: 767px)`),n=()=>{t(window.innerWidth<hI)};return e.addEventListener(`change`,n),t(window.innerWidth<hI),()=>e.removeEventListener(`change`,n)},[]),!!e}function _I({...e}){return(0,S.jsx)(Ey,{"data-slot":`sheet`,...e})}function vI({...e}){return(0,S.jsx)(cy,{"data-slot":`sheet-portal`,...e})}function yI({className:e,...t}){return(0,S.jsx)(Vv,{"data-slot":`sheet-overlay`,className:X(`fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs`,e),...t})}function bI({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,S.jsxs)(vI,{children:[(0,S.jsx)(yI,{}),(0,S.jsxs)(oy,{"data-slot":`sheet-content`,"data-side":n,className:X(`fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm`,e),...i,children:[t,r&&(0,S.jsxs)(Hv,{"data-slot":`sheet-close`,render:(0,S.jsx)(vf,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`}),children:[(0,S.jsx)(Fd,{}),(0,S.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function xI({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`sheet-header`,className:X(`flex flex-col gap-0.5 p-4`,e),...t})}function SI({className:e,...t}){return(0,S.jsx)(Dy,{"data-slot":`sheet-title`,className:X(`font-heading text-base font-medium text-foreground`,e),...t})}function CI({className:e,...t}){return(0,S.jsx)(Uv,{"data-slot":`sheet-description`,className:X(`text-sm text-muted-foreground`,e),...t})}var wI=`sidebar_state`,TI=604800,EI=`16rem`,DI=`18rem`,OI=`3rem`,kI=`b`,AI=v.createContext(null);function jI(){let e=v.useContext(AI);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function MI({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:a,...o}){let s=gI(),[c,l]=v.useState(!1),[u,d]=v.useState(e),f=t??u,p=v.useCallback(e=>{let t=typeof e==`function`?e(f):e;n?n(t):d(t),document.cookie=`${wI}=${t}; path=/; max-age=${TI}`},[n,f]),m=v.useCallback(()=>s?l(e=>!e):p(e=>!e),[s,p,l]);v.useEffect(()=>{let e=e=>{e.key===kI&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),m())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[m]);let h=f?`expanded`:`collapsed`,g=v.useMemo(()=>({state:h,open:f,setOpen:p,isMobile:s,openMobile:c,setOpenMobile:l,toggleSidebar:m}),[h,f,p,s,c,l,m]);return(0,S.jsx)(AI.Provider,{value:g,children:(0,S.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:{"--sidebar-width":EI,"--sidebar-width-icon":OI,...i},className:X(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),...o,children:a})})}function NI({side:e=`left`,variant:t=`sidebar`,collapsible:n=`offcanvas`,className:r,children:i,dir:a,...o}){let{isMobile:s,state:c,openMobile:l,setOpenMobile:u}=jI();return n===`none`?(0,S.jsx)(`div`,{"data-slot":`sidebar`,className:X(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),...o,children:i}):s?(0,S.jsx)(_I,{open:l,onOpenChange:u,...o,children:(0,S.jsxs)(bI,{dir:a,"data-sidebar":`sidebar`,"data-slot":`sidebar`,"data-mobile":`true`,className:`w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden`,style:{"--sidebar-width":DI},side:e,children:[(0,S.jsxs)(xI,{className:`sr-only`,children:[(0,S.jsx)(SI,{children:`Sidebar`}),(0,S.jsx)(CI,{children:`Displays the mobile sidebar.`})]}),(0,S.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:i})]})}):(0,S.jsxs)(`div`,{className:`group peer hidden text-sidebar-foreground md:block`,"data-state":c,"data-collapsible":c===`collapsed`?n:``,"data-variant":t,"data-side":e,"data-slot":`sidebar`,children:[(0,S.jsx)(`div`,{"data-slot":`sidebar-gap`,className:X(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,t===`floating`||t===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`)}),(0,S.jsx)(`div`,{"data-slot":`sidebar-container`,"data-side":e,className:X(`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex`,t===`floating`||t===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,r),...o,children:(0,S.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:i})})]})}function PI({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:X(`flex flex-col gap-2 p-2`,e),...t})}function FI({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:X(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,e),...t})}function II({children:e,agent:t,title:n=`Agent`}){return(0,S.jsx)(MI,{defaultOpen:!1,style:{"--sidebar-width":`24rem`},children:(0,S.jsx)(LI,{agent:t,title:n,children:e})})}function LI({children:e,agent:t,title:n}){let{open:r,openMobile:i,isMobile:a,toggleSidebar:o}=jI(),s=a?i:r,[c,l]=(0,v.useState)(!1),u=(0,v.useRef)(null);return(0,v.useEffect)(()=>{s?l(!0):c&&u.current?.focus()},[s,c]),(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`min-w-0 flex-1`,children:e}),(0,S.jsx)(`div`,{hidden:s,className:`fixed right-6 bottom-6 z-20`,children:(0,S.jsxs)(vf,{ref:u,"aria-label":`Open agent`,"aria-expanded":s,onClick:o,children:[(0,S.jsx)(ld,{"data-icon":`inline-start`}),n]})}),(0,S.jsx)(NI,{side:`right`,collapsible:`offcanvas`,children:(0,S.jsxs)(`div`,{inert:!s,className:`flex h-full min-h-0 flex-col`,children:[(0,S.jsx)(PI,{children:(0,S.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,S.jsx)(`h2`,{className:`text-sm font-medium`,children:n}),(0,S.jsx)(vf,{variant:`ghost`,size:`icon-sm`,"aria-label":`Minimize agent`,onClick:o,children:(0,S.jsx)(hd,{})})]})}),(0,S.jsx)(FI,{className:`overflow-hidden`,children:(0,S.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 p-4`,children:c?t:null})})]})})]})}function RI(e){let t=e.match(/https?:\/\/[^\s"'<>()[\]]+/g)??[];return[...new Set(t.map(e=>e.replace(/[.,;:!?]+$/,``)))].filter(e=>URL.canParse(e)).map(e=>({url:e}))}var zI=e=>typeof e==`string`?e.split(`
76
+ `)[0]:void 0,BI=e=>e>1?` and ${e-1} more`:``,VI=({url:e,urls:t})=>[e,t].flat().filter(e=>typeof e==`string`&&URL.canParse(e)),HI={running:`Running`,complete:`Ran`,error:`Failed to run`},UI={bash:{verbs:HI,subject:({command:e})=>zI(e)},read:{verbs:{running:`Reading`,complete:`Read`,error:`Failed to read`},subject:({path:e})=>zI(e)},edit:{verbs:{running:`Editing`,complete:`Edited`,error:`Failed to edit`},subject:({path:e})=>zI(e)},write:{verbs:{running:`Writing`,complete:`Wrote`,error:`Failed to write`},subject:({path:e})=>zI(e)},grep:{verbs:{running:`Searching for`,complete:`Searched for`,error:`Failed to search for`},subject:({pattern:e})=>zI(e)},find:{verbs:{running:`Finding`,complete:`Found`,error:`Failed to find`},subject:({pattern:e})=>zI(e)},ls:{verbs:{running:`Listing`,complete:`Listed`,error:`Failed to list`},subject:({path:e})=>zI(e)},web_search:{verbs:{running:`Searching`,complete:`Searched`,error:`Failed to search`},subject:({query:e,queries:t})=>{let n=Array.isArray(t)?t:[e];return typeof n[0]==`string`?`for “${n[0]}”${BI(n.length)}`:`the web`},sources:(e,t)=>t?RI(t):void 0},fetch_content:{verbs:{running:`Reading`,complete:`Read`,error:`Failed to read`},subject:e=>{let t=VI(e);return t.length?`${new URL(t[0]).hostname}${BI(t.length)}`:`a page`},sources:e=>VI(e).map(e=>({url:e}))}};function WI(e,t,n,r=UI){let i=r[e.name];return i?{label:`${i.verbs[t]} ${i.subject(e.arguments)??``}`.trim(),sources:i.sources?.(e.arguments,n)}:{label:`${HI[t]} ${e.name}`}}var GI=(0,v.createContext)({});function KI(e){let t=(0,v.useRef)(null);return t.current===null&&(t.current=e()),t.current}var qI=typeof window<`u`?v.useLayoutEffect:v.useEffect,JI=(0,v.createContext)(null);function YI(e,t){e.indexOf(t)===-1&&e.push(t)}function XI(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var ZI=(e,t,n)=>n>t?t:n<e?e:n,QI={},$I=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),eL=e=>typeof e==`object`&&!!e,tL=e=>/^0[^.\s]+$/u.test(e);function nL(e){let t;return()=>(t===void 0&&(t=e()),t)}var rL=e=>e,iL=(...e)=>e.reduce((e,t)=>n=>t(e(n))),aL=(e,t,n)=>{let r=t-e;return r?(n-e)/r:1},oL=class{constructor(){this.subscriptions=[]}add(e){return YI(this.subscriptions,e),()=>this.remove(e)}remove(e){XI(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r){if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){let r=this.subscriptions[i];r&&r(e,t,n)}}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},sL=e=>e*1e3,cL=e=>e/1e3,lL=(e,t)=>t?1e3/t*e:0,uL=(e,t,n)=>{let r=t-e;return((n-e)%r+r)%r+e},dL=(e,t,n)=>e*(3*(1-e)*((1-e)*t+e*n)+e*e);function fL(e,t,n,r){return e===t&&n===r?rL:i=>{let a=0,o=1,s=i;for(let t=0;;t++){s>=a&&s<=o||(s=(a+o)/2);let r=dL(s,e,n)-i;if(r*r<1e-28||t===40)break;r>0?o=s:a=s,s-=r*1e-7/(dL(s+1e-7,e,n)-i-r)}return dL(s,t,r)}}var pL=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,mL=e=>t=>1-e(1-t),hL=fL(.33,1.53,.69,.99),gL=mL(hL),_L=pL(gL),vL=e=>e>=1?1:(e*=2)<1?.5*gL(e):.5*(2-2**(-10*(e-1))),yL=e=>1-Math.sin(Math.acos(e)),bL=mL(yL),xL=pL(yL),SL=fL(.42,0,1,1),CL=fL(0,0,.58,1),wL=fL(.42,0,.58,1),TL=e=>Array.isArray(e)&&typeof e[0]!=`number`;function EL(e,t){return TL(e)?e[uL(0,e.length,t)]:e}var DL=e=>Array.isArray(e)&&typeof e[0]==`number`,OL={linear:rL,easeIn:SL,easeInOut:wL,easeOut:CL,circIn:yL,circInOut:xL,circOut:bL,backIn:gL,backInOut:_L,backOut:hL,anticipate:vL},kL=e=>typeof e==`string`,AL=e=>{if(DL(e)){let[t,n,r,i]=e;return fL(t,n,r,i)}return kL(e)?OL[e]:e},jL={delta:0,timestamp:0,isProcessing:!1},ML;function NL(){ML=void 0}var PL={now:()=>(ML===void 0&&PL.set(jL.isProcessing||QI.useManualTiming?jL.timestamp:performance.now()),ML),set:e=>{ML=e,queueMicrotask(NL)}},FL=e=>Math.round(e*1e5)/1e5,IL=e=>t=>typeof t==`string`&&t.startsWith(e),LL=IL(`--`),RL=IL(`var(--`),zL=e=>RL(e)?BL.test(e.split(`/*`)[0].trim()):!1,BL=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function VL(e){return typeof e==`string`&&e.split(`/*`)[0].includes(`var(--`)}var HL={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},UL={...HL,transform:e=>ZI(0,1,e)},WL={...HL,default:1},GL=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function KL(e){return e==null}var qL=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,JL=(e,t)=>n=>!!(typeof n==`string`&&qL.test(n)&&n.startsWith(e)||t&&!KL(n)&&Object.prototype.hasOwnProperty.call(n,t)),YL=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(GL);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},XL=e=>ZI(0,255,e),ZL={...HL,transform:e=>Math.round(XL(e))},QL={test:JL(`rgb`,`red`),parse:YL(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+ZL.transform(e)+`, `+ZL.transform(t)+`, `+ZL.transform(n)+`, `+FL(UL.transform(r))+`)`},$L=(e,t,n)=>{let r=e.substring(1+t*n,1+(t+1)*n);return n>1?r:r+r};function eR(e){let t=e.length>5?2:1,n=$L(e,3,t);return{red:parseInt($L(e,0,t),16),green:parseInt($L(e,1,t),16),blue:parseInt($L(e,2,t),16),alpha:n?parseInt(n,16)/255:1}}var tR={test:JL(`#`),parse:eR,transform:QL.transform},nR=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),rR=nR(`deg`),iR=nR(`%`),aR=nR(`px`),oR=nR(`vh`),sR=nR(`vw`),cR={...iR,parse:e=>iR.parse(e)/100,transform:e=>iR.transform(e*100)},lR={test:JL(`hsl`,`hue`),parse:YL(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+iR.transform(FL(t))+`, `+iR.transform(FL(n))+`, `+FL(UL.transform(r))+`)`},uR={test:e=>QL.test(e)||tR.test(e)||lR.test(e),parse:e=>QL.test(e)?QL.parse(e):lR.test(e)?lR.parse(e):tR.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?QL.transform(e):lR.transform(e),getAnimatableNone:e=>{let t=uR.parse(e);return t.alpha=0,uR.transform(t)}},dR=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,fR=new RegExp(GL.source),pR=new RegExp(dR.source,`i`);function mR(e){return isNaN(e)&&typeof e==`string`&&(fR.test(e)||pR.test(e))}var hR=`number`,gR=`color`,_R=`var`,vR=`var(`,yR="${}",bR=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)(?![a-z]*\()/giu;function xR(e){let t=e.toString();return fR.test(t)||pR.test(t)}function SR(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(bR,e=>(uR.test(e)?(r.color.push(a),i.push(gR),n.push(uR.parse(e))):e.startsWith(vR)?(r.var.push(a),i.push(_R),n.push(e)):(r.number.push(a),i.push(hR),n.push(parseFloat(e))),++a,yR)).split(yR),indexes:r,types:i}}function CR(e){return SR(e).values}function wR({split:e,types:t}){let n=e.length;return r=>{let i=``;for(let a=0;a<n;a++)if(i+=e[a],r[a]!==void 0){let e=t[a];i+=e===hR?FL(r[a]):e===gR?uR.transform(r[a]):r[a]}return i}}function TR(e){return wR(SR(e))}var ER=e=>typeof e==`number`?0:uR.test(e)?uR.getAnimatableNone(e):e,DR=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:ER(e);function OR(e){let t=SR(e);return wR(t)(t.values.map((e,n)=>DR(e,t.split[n])))}var kR={test:mR,parse:CR,createTransformer:TR,getAnimatableNone:OR};function AR(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function jR({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=AR(s,r,e+1/3),a=AR(s,r,e),o=AR(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function MR(e,t){return n=>n>0?t:e}var NR=(e,t,n)=>e+(t-e)*n,PR=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},FR=[tR,QL,lR],IR=e=>FR.find(t=>t.test(e));function LR(e){let t=IR(e);if(!t)return!1;let n=t.parse(e);return t===lR&&(n=jR(n)),n}var RR=(e,t)=>{let n=LR(e),r=LR(t);if(!n||!r)return MR(e,t);let i={...n};return e=>(i.red=PR(n.red,r.red,e),i.green=PR(n.green,r.green,e),i.blue=PR(n.blue,r.blue,e),i.alpha=NR(n.alpha,r.alpha,e),QL.transform(i))},zR=new Set([`none`,`hidden`]);function BR(e,t){return zR.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function VR(e,t){return n=>NR(e,t,n)}function HR(e){return typeof e==`number`?VR:typeof e==`string`?zL(e)?MR:uR.test(e)?RR:KR:Array.isArray(e)?UR:typeof e==`object`?uR.test(e)?RR:WR:MR}function UR(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>HR(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function WR(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=HR(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function GR(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let a=t.types[i],o=e.indexes[a][r[a]],s=e.values[o]??0;n[i]=s,r[a]++}return n}var KR=(e,t)=>{let n=SR(e),r=SR(t);return n.indexes.var.length===r.indexes.var.length&&n.indexes.color.length===r.indexes.color.length&&n.indexes.number.length>=r.indexes.number.length?zR.has(e)&&!r.values.length||zR.has(t)&&!n.values.length?BR(e,t):iL(UR(GR(n,r),r.values),wR(r)):MR(e,t)},qR=/^(-?(?:\d+(?:\.\d*)?|\.\d+))([a-z%]*)$/iu;function JR(e,t){let n=qR.exec(e);if(!n)return;let r=qR.exec(t);if(!r||n[2]!==r[2])return;let i=n[2],a=parseFloat(n[1]),o=parseFloat(r[1]);return e=>FL(NR(a,o,e))+i}function YR(e,t,n){if(typeof e==`number`&&typeof t==`number`&&typeof n==`number`)return NR(e,t,n);if(typeof e==`string`&&typeof t==`string`){let n=JR(e,t);if(n)return n}return HR(e)(e,t)}var XR=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`];function ZR(e){let t=new Set,n=new Set,r=!1,i=!1,a,o=new Set,s={delta:0,timestamp:0,isProcessing:!1};function c(t){o.has(t)&&(n.add(t),e()),(a=t)(s)}let l={schedule:(e,i=!1,s=!1)=>{let c=s&&r,l=c?t:n;return i&&o.add(e),c&&e!==a&&l.delete(e),l.add(e),e},cancel:e=>{n.delete(e),o.delete(e)},process:e=>{if(s=e,r){i=!0;return}r=!0;let o=t;t=n,n=o,t.forEach(c),t.clear(),a=void 0,r=!1,i&&(i=!1,l.process(e))}};return l}var QR=40;function $R(e,t,n={delta:0,timestamp:0,isProcessing:!1}){let r=!1,i=!0,a=()=>r=!0,o=XR.reduce((e,t)=>(e[t]=ZR(a),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=QI.useManualTiming,o=a?n.timestamp:performance.now();r=!1,a||(n.delta=i?1e3/60:Math.max(Math.min(o-n.timestamp,QR),1)),n.timestamp=o,n.isProcessing=!0,s.process(n),c.process(n),l.process(n),u.process(n),d.process(n),f.process(n),p.process(n),m.process(n),n.isProcessing=!1,r&&t&&(i=!1,e(h))},g=()=>{r=!0,i=!0,n.isProcessing||e(h)};return{schedule:XR.reduce((e,t)=>{let n=o[t];return e[t]=(e,t=!1,i=!1)=>(r||g(),n.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t<XR.length;t++)o[XR[t]].cancel(e)},state:n,steps:o}}var{schedule:ez,cancel:tz,steps:nz}=$R(typeof requestAnimationFrame<`u`?requestAnimationFrame:rL,!0,jL),rz=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>ez.update(t,e),stop:()=>tz(t),now:()=>jL.isProcessing?jL.timestamp:PL.now()}},iz=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t<i;t++)r+=Math.round(e(t/(i-1))*1e4)/1e4+`, `;return`linear(${r.substring(0,r.length-2)})`},az=2e4;function oz(e,t=50,n=az,r){let i=0,a=e.next(i);for(r?.push(a.value);!a.done&&i<n;)i+=t,a=e.next(i),r?.push(a.value);return i>=n?1/0:i}function sz(e,t=100,n){let{keyframes:r,velocity:i}=e,a=r&&r[r.length-1]-r[0],o=n({...e,velocity:i&&a?i*t/a:i,keyframes:[0,t]}),s=Math.min(oz(o),az);return{type:`keyframes`,ease:e=>o.next(s*e).value/t,duration:cL(s)}}var cz=100,lz=10,uz=1,dz=800,fz=.3,pz=.3,mz=.01,hz=2,gz=.005,_z=.5,vz=.01,yz=10,bz=.05,xz=e=>e<0?1/Math.max(1+e,bz):Math.max(1-e,bz);function Sz(e,t){if(!(e>1))return 1;let n=Math.sqrt(e*e-1),r=e-n,i=e+n,a=2*n*Math.exp(-t)*(1+t);return Tz(e=>i*Math.exp(-r*e)-r*Math.exp(-i*e)-a,e=>Math.exp(-i*e)-Math.exp(-r*e),t)/t}function Cz(e,t){return e*Math.sqrt(1-t*t)}var wz=12;function Tz(e,t,n){let r=n;for(let n=1;n<wz;n++)r-=e(r)/t(r);return r}var Ez=.001;function Dz({duration:e=dz,bounce:t=fz}){let n,r,i=xz(t);e=ZI(vz,yz,cL(e)),i<1?(n=t=>{let n=t*i,r=n*e,a=Cz(t,i),o=Math.exp(-r);return Ez-n/a*o},r=t=>{let r=t*i*e,a=i*i*t*t*e,o=Math.exp(-r),s=Cz(t*t,i);return(-n(t)+Ez>0?-1:1)*-a*o/s}):(n=t=>-.001+Math.exp(-t*e)*(t*e+1),r=t=>Math.exp(-t*e)*(-t*(e*e)));let a=5/e,o=Tz(n,r,a),s=o*Sz(i,o*e),c=s*s;return{stiffness:c,damping:i*2*Math.sqrt(c),duration:sL(e)}}var Oz=(e,t)=>(t?e>=0:e>0)&&e<1/0;function kz(e,t){if(Oz(e,t))return e}function Az(e){let t=kz(e.stiffness),n=kz(e.damping,!0),r=kz(e.mass),i={...e,stiffness:t??cz,damping:n??lz,mass:r??uz,isResolvedFromDuration:!1,isTimeDefined:(t??n??r)===void 0&&(e.duration!==void 0||e.bounce!==void 0)};if(i.isTimeDefined){if(e.visualDuration){let t=xz(e.bounce||0),n=2*Math.PI/(e.visualDuration*1.2)*Sz(t,2*Math.PI/1.2);i.stiffness=n*n,i.damping=2*t*Math.sqrt(i.stiffness)}else Object.assign(i,Dz(i)),i.isResolvedFromDuration=!0;(!Oz(i.stiffness)||!Oz(i.damping,!0))&&(i.stiffness=cz,i.damping=lz)}return i}function jz(e=pz,t=fz){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},r=n.keyframes[0],i=n.keyframes[n.keyframes.length-1],a={done:!1,value:r},{stiffness:o,damping:s,mass:c,duration:l,isResolvedFromDuration:u,isTimeDefined:d}=Az({...n}),f=e=>u?0:-cL(e),p=s/(2*Math.sqrt(o*c)),m=cL(Math.sqrt(o/c)),h=p*m,g={target:i,delta:i-r,velocity:f(n.velocity)||0,restSpeed:0,restDelta:0},_=()=>{let e=Math.abs(g.delta)<5;g.restSpeed=n.restSpeed||(e?mz:hz),g.restDelta=n.restDelta||(e?gz:_z)};_();let v,y,b;if(p<1){let e=Cz(m,p),t={A:0,sinC:0,cosC:0,t:-1,env:0,sin:0,cos:0};b=()=>{t.A=(g.velocity+h*g.delta)/e,t.sinC=h*t.A+g.delta*e,t.cosC=h*g.delta-t.A*e};let n=n=>{n!==t.t&&(t.t=n,t.env=Math.exp(-h*n),t.sin=Math.sin(e*n),t.cos=Math.cos(e*n))};v=e=>(n(e),g.target-t.env*(t.A*t.sin+g.delta*t.cos)),y=e=>(n(e),t.env*(t.sinC*t.sin+t.cosC*t.cos))}else if(p===1){v=e=>g.target-Math.exp(-m*e)*(g.delta+(g.velocity+m*g.delta)*e);let e={C:0};b=()=>{e.C=g.velocity+m*g.delta},y=t=>Math.exp(-m*t)*(m*e.C*t-g.velocity)}else{let e=m*Math.sqrt(p*p-1),t=h-e,n=h+e,r=e<1||d?1/0:300/e,i=(e,t)=>Math.exp(t>r?(h-e)*r-h*t:-e*t),a={S:0,F:0};b=()=>{let t=(g.velocity+h*g.delta)/e;a.S=(g.delta+t)/2,a.F=(g.delta-t)/2},v=e=>g.target-a.S*i(t,e)-a.F*i(n,e),y=e=>t*a.S*i(t,e)+n*a.F*i(n,e)}b();let x=u&&l||null,S={calculatedDuration:x,retarget:(e,t)=>{g.target=e[e.length-1],g.delta=g.target-e[0],g.velocity=f(t),n.restSpeed&&n.restDelta||_(),S.calculatedDuration=x,a.done=!1,b()},velocity:e=>sL(y(e)),next:e=>{let t=v(e);if(u)a.done=e>=l;else{let n=sL(y(e));a.done=Math.abs(n)<=g.restSpeed&&Math.abs(g.target-t)<=g.restDelta}return a.value=a.done?g.target:t,a},toString:()=>{let e=Math.min(oz(S),az),t=iz(t=>S.next(e*t).value,e,30);return e+`ms `+t}};return S}var Mz=Object.assign(jz,{applyToOptions:e=>{let t=sz(e,100,jz);return e.ease=t.ease,e.duration=sL(t.duration),e.type=`keyframes`,e}});function Nz({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>e<s||e>c,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)<Math.abs(c-e)?s:c,h=n*t,g=d+h,_=o?o(g):g;_!==g&&(h=_-d);let v=e=>-h*Math.exp(-e/r),y=e=>{let t=v(e);f.done=Math.abs(t)<=l,f.value=f.done?_:e?_+t:d},b,x,S=e=>{p(f.value)&&(b=e,x=Mz({keyframes:[f.value,m(f.value)],velocity:-v(e)/r*1e3,damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return S(0),{calculatedDuration:null,next:e=>{let t=!1;return!x&&b===void 0&&(t=!0,y(e),S(e)),b!==void 0&&e>=b?x.next(e-b):(!t&&y(e),f)}}}function Pz(e,t,n){let r=[],i=QI.mix||YR,a=e.length-1;for(let o=0;o<a;o++){let a=n?.(e[o],e[o+1])||i(e[o],e[o+1]);t&&(a=iL(Array.isArray(t)?t[o]||rL:t,a)),r.push(a)}return r}function Fz(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let a=e.length;if(a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=Pz(t,r,i),c=s.length,l=n=>{if(o&&n<e[0])return t[0];let r=0;if(c>1)for(;r<e.length-2&&!(n<e[r+1]);r++);let i=aL(e[r],e[r+1],n);return s[r](i)};return n?t=>l(ZI(e[0],e[a-1],t)):l}function Iz(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=aL(0,t,r);e.push(NR(n,1,i))}}function Lz(e){let t=[0];return Iz(t,e.length-1),t}function Rz(e,t){return e.map(e=>e*t)}function zz(e,t){return e.map(()=>t||wL).splice(0,e.length-1)}function Bz({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`,mixer:i}){let a=typeof t[0]==`number`?void 0:i,o=TL(r)?r.map(AL):AL(r)||wL,s={done:!1,value:t[0]},c=-1;if(!a){for(let e=1;e<t.length;e++)if(t[e]!==t[e-1]){if(c>=0){c=-2;break}c=e-1}}if(c>=0){let r=n&&n.length===t.length?n:Lz(t),i=r[c]*e,a=r[c+1]*e,l=t[c],u=t[c+1],d=Array.isArray(o)?o[c]:o,f=(QI.mix||YR)(l,u),p=t.length-2;return{calculatedDuration:e,next:t=>(s.value=c&&t<i?f(0):c<p&&(t>=a||!e)?typeof u==`number`?u:f(1):f(d(t>=a||!e?1:t<=i?0:(t-i)/(a-i))),s.done=t>=e,s)}}let l=Fz(Rz(n&&n.length===t.length?n:Lz(t),e),t,{ease:Array.isArray(o)?o:zz(t,o),mixer:a});return{calculatedDuration:e,next:t=>(s.value=l(t),s.done=t>=e,s)}}var Vz=5;function Hz(e,t,n){let r=Math.max(t-Vz,0);return lL(n-e(r),t-r)}function Uz(e,t,n=0){return t<=0?n:e.velocity?e.velocity(t):Hz(t=>e.next(t).value,t,e.next(t).value)}function Wz(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a,o,s=0;for(let t=0;t<e.length;t++){let n=e[t];n!==null&&(s++||(a=n),o=n)}let c=i<0||t&&n!==`loop`&&t%2==1?0:s-1;return!c||r===void 0?c?o:a:r}var Gz={decay:Nz,inertia:Nz,tween:Bz,keyframes:Bz,spring:Mz};function Kz(e){typeof e.type==`string`&&(e.type=Gz[e.type])}var qz=40,Jz=(e,t)=>t-e>qz&&!QI.useManualTiming?t:e;function Yz(e,t){return{kind:e,animation:t,timestamp:PL.now(),frameTimestamp:jL.timestamp,frameIsProcessing:jL.isProcessing}}function Xz(e,t,n){let r=globalThis.__MOTION_INSPECT__;if(r)try{r({...Yz(`animation-start`,e),options:n?{...t,...n}:t})}catch{}}function Zz(e,t){let n=globalThis.__MOTION_INSPECT__;if(n)try{n({...Yz(`layout-animation-start`,e),node:t})}catch{}}var Qz=class{constructor(){this.isResolved=!1}get finished(){return this._finished||=this.isResolved?Promise.resolve():new Promise(e=>{this._resolve=e}),this._finished}updateFinished(){this._finished=this._resolve=void 0,this.isResolved=!1}notifyFinished(){this.isResolved=!0,this._resolve?.()}then(e,t){return this.finished.then(e,t)}},$z=e=>e/100,eB=e=>Math.round(e*1e4)/1e4,tB=class extends Qz{constructor(e){super(),this.state=`idle`,this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{let{motionValue:e}=this.options,t=PL.now();e&&e.updatedAt!==t&&this.tick(e.updatedAt=t),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause(),Xz(this,this.options)}initAnimation(){let{options:e}=this;Kz(e);let{type:t=Bz,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||Bz;this.mixKeyframes=void 0,s!==Bz&&typeof o[0]!=`number`&&(this.mixKeyframes=iL($z,e.mixer?.(o[0],o[1])||YR(o[0],o[1])),o=[0,100]);let c=s(o===e.keyframes?e:{...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=oz(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){this.currentTime=this.holdTime??Math.round(e-this.startTime)*this.playbackSpeed}tick(e,t=!1){let{generator:n,totalDuration:r,calculatedDuration:i}=this;if(this.startTime===null)return n.next(0);let{delay:a=0,keyframes:o,type:s,onUpdate:c,finalKeyframe:l}=this.options;this.startTime===this.pendingStartTime&&(this.startTime=Jz(this.startTime,e)),this.pendingStartTime=void 0,this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let u=this.currentTime-a*(this.playbackSpeed>=0?1:-1),d=this.playbackSpeed>=0?u<0:u>r;this.currentTime=Math.max(u,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let f=this.generate(this.currentTime,d),{done:p}=f;d||(p=this.playbackSpeed>=0?i<1/0?this.currentTime>=r:p:this.currentTime<=0);let m=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&p);return m&&s!==Nz&&(f.value=Wz(o,this.options,l,this.speed)),c&&c(f.value),m&&this.finish(),f}at(e){return this.holdTime??eB((e-this.startTime)*this.playbackSpeed)}sampleAt(e,t){let{options:n,totalDuration:r}=this,i=this.at(e)-(n.delay||0);return i>=r&&n.type!==Nz?Wz(n.keyframes,n,t?void 0:n.finalKeyframe):this.generate(Math.max(i,0),i<0).value}generate(e,t){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o}=this,{keyframes:s,repeat:c,repeatType:l,repeatDelay:u}=this.options,d=e,f=n;if(c){let t=Math.min(e,r)/o,n=Math.floor(t),i=t%1;!i&&t>=1&&(i=1),i===1&&n--,n=Math.min(n,c+1),n%2&&(l===`reverse`?(i=1-i,u&&(i-=u/o)):l===`mirror`&&(f=a)),d=ZI(0,1,i)*o}let p;return t?(this.delayState.value=s[0],p=this.delayState):p=f.next(d),i&&!t&&(p.value=i(p.value)),p}get duration(){return cL(this.calculatedDuration)}get iterationDuration(){return this.duration+cL(this.options.delay??0)}get time(){return cL(this.currentTime)}set time(e){this.state===`finished`&&this.updateFinished(),e=sL(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state=`paused`,this.holdTime=e,this.tick(e))}getGeneratorVelocity(){return Uz(this.generator,this.currentTime,this.options.velocity)}get speed(){return this.playbackSpeed}set speed(e){let t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(PL.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=cL(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=rz,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??(this.pendingStartTime=n):this.startTime=n-this.holdTime/(this.playbackSpeed||1),this.state===`finished`&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state=`running`,this.driver.start()}pause(){this.state=`paused`,this.updateTime(PL.now()),this.holdTime=this.currentTime}complete(){this.state!==`running`&&this.play(),this.state=`finished`,this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state=`finished`,this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state=`idle`,this.driver?.stop(),this.driver=void 0,this.startTime=this.holdTime=null}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}},nB=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function rB(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(GL)||[];if(!r)return e;let i=n.replace(r,``),a=+!!nB.has(t);return r!==n&&(a*=100),t+`(`+a+i+`)`}var iB=/\b([a-z-]*)\(.*?\)/gu,aB={...kR,getAnimatableNone:e=>{let t=e.match(iB);return t?t.map(rB).join(` `):e}},oB={...kR,getAnimatableNone:e=>{let t=kR.parse(e);return kR.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},sB={...HL,transform:Math.round},cB={rotate:rR,pathRotation:rR,rotateX:rR,rotateY:rR,rotateZ:rR,scale:WL,scaleX:WL,scaleY:WL,scaleZ:WL,skew:rR,skewX:rR,skewY:rR,distance:aR,translateX:aR,translateY:aR,translateZ:aR,x:aR,y:aR,z:aR,perspective:aR,transformPerspective:aR,opacity:UL,originX:cR,originY:cR,originZ:aR},lB={borderWidth:aR,borderTopWidth:aR,borderRightWidth:aR,borderBottomWidth:aR,borderLeftWidth:aR,borderRadius:aR,borderTopLeftRadius:aR,borderTopRightRadius:aR,borderBottomRightRadius:aR,borderBottomLeftRadius:aR,width:aR,maxWidth:aR,height:aR,maxHeight:aR,top:aR,right:aR,bottom:aR,left:aR,inset:aR,insetBlock:aR,insetBlockStart:aR,insetBlockEnd:aR,insetInline:aR,insetInlineStart:aR,insetInlineEnd:aR,padding:aR,paddingTop:aR,paddingRight:aR,paddingBottom:aR,paddingLeft:aR,paddingBlock:aR,paddingBlockStart:aR,paddingBlockEnd:aR,paddingInline:aR,paddingInlineStart:aR,paddingInlineEnd:aR,margin:aR,marginTop:aR,marginRight:aR,marginBottom:aR,marginLeft:aR,marginBlock:aR,marginBlockStart:aR,marginBlockEnd:aR,marginInline:aR,marginInlineStart:aR,marginInlineEnd:aR,fontSize:aR,backgroundPositionX:aR,backgroundPositionY:aR,...cB,zIndex:sB,fillOpacity:UL,strokeOpacity:UL,numOctaves:sB},uB={...lB,color:uR,backgroundColor:uR,outlineColor:uR,fill:uR,stroke:uR,borderColor:uR,borderTopColor:uR,borderRightColor:uR,borderBottomColor:uR,borderLeftColor:uR,filter:aB,WebkitFilter:aB,mask:oB,WebkitMask:oB},dB=e=>uB[e],fB=new Set([aB,oB]),pB,mB,hB;function gB(e,t){if(e===pB&&t===mB)return hB;let n=dB(e);return fB.has(n)||(n=kR),hB=n.getAnimatableNone?n.getAnimatableNone(t):void 0,pB=e,mB=t,hB}function _B(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var vB=e=>e*180/Math.PI,yB=e=>xB(vB(Math.atan2(e[1],e[0]))),bB={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scaleZ:()=>1,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:yB,rotateZ:yB,skewX:e=>vB(Math.atan(e[1])),skewY:e=>vB(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},xB=e=>(e%=360,e<0&&(e+=360),e),SB=yB,CB=e=>Math.hypot(e[0],e[1]),wB=e=>Math.hypot(e[4],e[5]),TB={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:CB,scaleY:wB,scaleZ:e=>Math.hypot(e[8],e[9],e[10]),scale:e=>(CB(e)+wB(e))/2,rotateX:e=>xB(vB(Math.atan2(e[6],e[5]))),rotateY:e=>xB(vB(Math.atan2(-e[2],e[0]))),rotateZ:SB,rotate:SB,skewX:e=>vB(Math.atan(e[4])),skewY:e=>vB(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function EB(e){return+!!e.includes(`scale`)}function DB(e,t){if(!e||e===`none`)return EB(t);let n=e.match(/^matrix(3d)?\(([-\d.e\s,]+)\)$/u);if(!n)return EB(t);let r=(n[1]?TB:bB)[t],i=n[2].split(`,`).map(e=>parseFloat(e));return typeof r==`function`?r(i):i[r]}var OB=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return DB(n,t)},kB=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`scaleZ`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],AB=new Set([...kB,`pathRotation`]),jB=e=>e===HL||e===aR,MB=new Set([`x`,`y`,`z`]),NB=kB.filter(e=>!MB.has(e));function PB(e){let t=[];return NB.forEach(n=>{let r=e.getValue(n);if(r!==void 0){let e=r.get(),i=+!!n.startsWith(`scale`);if(e===i)return;t.push([n,e]),r.set(i)}}),t}var FB=new Set([`bottom`,`right`]);function IB(e,t,n,r,i,a){let o=parseFloat(e);if(!isNaN(o))return o;let{min:s,max:c}=t()[n],l=c-s;return a===`border-box`?l:l-parseFloat(r)-parseFloat(i)}var LB=({transform:e})=>DB(e,`x`),RB=({transform:e})=>DB(e,`y`),zB={width:({width:e,paddingLeft:t=`0`,paddingRight:n=`0`,boxSizing:r},i)=>IB(e,i,`x`,t,n,r),height:({height:e,paddingTop:t=`0`,paddingBottom:n=`0`,boxSizing:r},i)=>IB(e,i,`y`,t,n,r),top:({top:e})=>parseFloat(e),left:({left:e})=>parseFloat(e),bottom:({top:e},t)=>{let{y:n}=t();return parseFloat(e)+(n.max-n.min)},right:({left:e},t)=>{let{x:n}=t();return parseFloat(e)+(n.max-n.min)},x:LB,y:RB,translateX:LB,translateY:RB},BB=new Set,VB=!1,HB=!1,UB=!1;function WB(){if(HB){let e=[],t=new Set,n=new Set;BB.forEach(r=>{r.needsMeasurement&&(e.push(r),t.add(r.element),FB.has(r.name)&&n.add(r.element))});let r=new Map;n.forEach(e=>{let t=PB(e);t.length&&(r.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=r.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}HB=!1,VB=!1,BB.forEach(e=>e.complete(UB)),BB.clear()}function GB(){BB.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(HB=!0)})}function KB(){UB=!0,GB(),WB(),UB=!1}function qB(e,t,n){if(typeof e==`string`){if($I(e)||tL(e))return parseFloat(e);if(!kR.test(e)&&kR.test(n))return gB(t,n)}return e??void 0}var JB=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(BB.add(this),VB||(VB=!0,ez.read(GB),ez.resolveKeyframes(WB))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=qB(n.readValue(t,a),t,a);r!==void 0&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}_B(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),BB.delete(this)}cancel(){this.state===`scheduled`&&(BB.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},YB=e=>e.startsWith(`--`);function XB(e,t,n){YB(t)?e.style.setProperty(t,n):e.style[t]=n}var ZB={};function QB(e,t){let n=nL(e);return()=>ZB[t]??n()}var $B=QB(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),eV=QB(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),tV=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,nV={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:tV([0,.65,.55,1]),circOut:tV([.55,0,1,.45]),backIn:tV([.31,.01,.66,-.59]),backOut:tV([.33,1.53,.69,.99])};function rV(e,t){if(e)return typeof e==`function`?eV()?iz(e,t):`ease-out`:DL(e)?tV(e):Array.isArray(e)?e.map(e=>rV(e,t)||nV.easeOut):nV[e]}function iV(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=rV(s,i);Array.isArray(d)&&(u.easing=d);let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};return l&&(f.pseudoElement=l),e.animate(u,f)}function aV(e){return typeof e==`function`&&`applyToOptions`in e}function oV({type:e,...t}){return aV(e)&&eV()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var sV=class extends Qz{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e;let c=oV(e);this.animation=iV(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=this.onFinish=()=>{if(this.animation.onfinish=null,this.finishedTime=this.time,!i){let e=Wz(r,this.options,o,this.speed);this.updateMotionValue?.(e),XB(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()},Xz(this,e,c)}play(){this.isStopped||(this.manualStartTime=null,this.animation.onfinish=this.onFinish,this.animation.play(),this.state===`finished`&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.isStopped||(this.animation.onfinish=this.onFinish),this.animation.finish?.()}cancel(){this.animation.onfinish=null;try{this.animation.cancel()}catch{}}stop(){this.isStopped||(this.isStopped=!0,this.state!==`idle`&&this.finishedTime===null&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel()))}commitStyles(){let e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return cL(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+cL(e)}get time(){return cL(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=sL(e),t&&(this.animation.pause(),this.updateFinished())}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,onAttach:t,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=this.onFinish=null,e&&$B()?(this.animation.timeline=e,t?.(this.animation),rL):n(this)}},cV={anticipate:vL,backInOut:_L,circInOut:xL};function lV(e){return e in cV}function uV(e){typeof e.ease==`string`&&lV(e.ease)&&(e.ease=cV[e.ease])}var dV=class extends sV{constructor(e){uV(e),Kz(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}elapsed(){return this.state===`running`?(PL.now()-this.startTime)*this.speed:this.time*1e3}sample(e){if(!this.sampler){let{motionValue:e,onUpdate:t,onComplete:n,onPlay:r,onStop:i,element:a,...o}=this.options;this.sampler=new tB({...o,autoplay:!1}),this.sampler.stop()}return this.sampler.sample(Math.max(0,e)).value}liveValue(){let{state:e}=this;if(e===`running`||e===`paused`)return this.sample(this.elapsed())}updateMotionValue(e){let{motionValue:t,element:n,name:r}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let{speed:i}=this,a=this.elapsed(),o=this.state===`running`&&i?ZI(0,10,a):0,s=this.sample(a);n&&r&&XB(n,r,s),t.setWithVelocity(this.sample(a-o*Math.sign(i)),s,o/Math.abs(i||1))}},fV=(e,t)=>t!==`zIndex`&&!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(kR.test(e)||e===`0`)&&!e.startsWith(`url(`));function pV(e){let t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function mV(e,t,n,r){let i=e[0];if(i===null)return!1;if(t===`display`||t===`visibility`)return!0;let a=e[e.length-1],o=fV(i,t),s=fV(a,t);return!o||!s?!1:pV(e)||(n===`spring`||aV(n))&&r}function hV(e){e.duration=0,e.type=`keyframes`}var gV=new Set([`opacity`,`clipPath`,`filter`,`transform`]),_V=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function vV(e){for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&_V.test(e[t]))return!0;return!1}var yV=({mixer:e,keyframes:t})=>e&&typeof t[0]!=`number`&&t.some((n,r)=>r&&e(t[r-1],n)),bV=new Set([`color`,`backgroundColor`,`outlineColor`,`fill`,`stroke`,`borderColor`,`borderTopColor`,`borderRightColor`,`borderBottomColor`,`borderLeftColor`]),xV=()=>!QI.useManualTiming&&Object.hasOwnProperty.call(Element.prototype,`animate`);function SV(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o,keyframes:s}=e;if(!n||!(gV.has(n)||bV.has(n)))return!1;let c=t?.owner?.current;if(!(c instanceof HTMLElement)&&!(c instanceof SVGElement))return!1;let{onUpdate:l,transformTemplate:u}=t.owner.getProps();return xV()&&(gV.has(n)||bV.has(n)&&vV(s))&&(n!==`transform`||!u)&&!l&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`&&!yV(e)}var CV=(e,t)=>t&&typeof e==`number`?t.transform(e):e,wV={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},TV=kB.length,EV={},DV=(e,t,n=CV(t,cB[e]))=>(EV[e]||(EV[e]=(wV[e]||e)+`(`))+n+`)`,OV=(e,t)=>(typeof t==`number`?t:parseFloat(t))===+!!e.startsWith(`scale`);function kV(e,t,n){let r=``;for(let i=0;i<TV;i++){let a=kB[i],o=e[a];if(o===void 0)continue;let s=n&&(t[a]=CV(o,lB[a]));OV(a,o)||(r+=DV(a,o,s||void 0)+` `)}let i=e.pathRotation;return i&&(r+=DV(`rotate`,i)),r=r.trim(),n?n(t,r):r||`none`}var AV=new WeakMap,jV=200,MV=.001,NV=.1,PV=.001,FV=100,IV=100,LV=new Set([`linear`,`easeIn`,`easeOut`,`easeInOut`]),RV=e=>LV.has(e),zV=new WeakMap,BV=(e,t)=>{let n=zV.get(e);return n?.[0]!==t&&(n=[t,`linear(`+Lz(Array(t+1)).map(t=>eB(e(t))+` `+eB(t*100)+`%`)+`)`],zV.set(e,n)),n[1]},VV=(e,t)=>Math.min(jV,Math.max(2,Math.ceil((t-e)/10))),HV=(e,t)=>Math.abs(e-t)<=MV,UV=(e,t)=>e-t,WV=(e,t,n)=>Lz(Array(n+1)).map(n=>NR(e,t,n)),GV=e=>e.motionValue.owner,KV=e=>AV.get(e),qV=({state:e})=>e===`idle`||e===`finished`,JV=(e,t)=>e.latestValues?e.latestValues[t]:e.getValue(t)?.get(),YV=({name:e,motionValue:t})=>e&&kB.includes(e)&&t?.owner?.current instanceof HTMLElement&&xV()&&eV();function XV(e){let t=GV(e),{onUpdate:n,transformTemplate:r}=t.getProps();return!e.isHandoff&&!n&&!e.hasOnUpdate&&!r&&e.type!==`inertia`&&(JV(t,`transform`)||`none`)===`none`&&!JV(t,`pathRotation`)&&!t.projection?.isProjecting()&&!yV(e)}var ZV=class{constructor(e,t,n,r){this.element=e,this.update=t,this.makeDriver=n,this.animation=r}get js(){return this.driver||=this.makeDriver(this.update)}now(){return this.driver||this.makeDriver!==rz?this.js.now():jL.isProcessing?jL.timestamp:PL.now()}start(e=!0){let t=KV(this.element);!t||t.isJS?this.js.start(e):t.schedule(!1,!e)}stopJS(){this.driver?.stop()}stop(){this.stopJS();let e=KV(this.element);e&&!e.isFinishing&&e.release(this.animation)}},QV,$V=class extends tB{constructor(e){let t=GV(e).current,{driver:n=rz}=e,r,i=XV(e);e.driver=e=>new ZV(t,e,n,r),super(e),r=this;let a=this.driver;a&&(a.animation=this),this.canAccelerate=i;let{stop:o}=this;this.stop=()=>{this.isAccelerated()&&this.sync(),o()}}offsets(){let{keyframes:e,times:t}=this.options;return t||(this.offsetsOf!==e&&(this.offsetsOf=e,this.cachedOffsets=Lz(e)),this.cachedOffsets)}get group(){return KV(GV(this.options).current)}get js(){return this.driver?.js}stopJS(){this.driver?.stopJS()}get name(){return this.options.name}timing(){let{startTime:e,speed:t,totalDuration:n}=this,{delay:r=0,repeatType:i}=this.options;return this.holdTime===null?n===1/0?[e+r/t,this.resolvedDuration*(i===`loop`?1:2)/t||1]:[e+(r+n)/t,0]:[1/0,0]}isAccelerated(){let{group:e,state:t}=this;return e?.tracks.has(this)&&!e.isJS&&this.canAccelerate&&(t===`running`||t===`paused`)}liveValue(){return this.isAccelerated()?this.sampleAt(PL.now()):void 0}tween(){let{keyframes:e,type:t,repeat:n,delay:r=0}=this.options,i=-1;if(n||t!==Bz||this.holdTime!==null)return;for(let t=1;t<e.length;t++)if(e[t]!==e[t-1]){if(i>=0)return;i=t-1}let{ease:a}=this.options;TL(a)&&(a=a[i]);let o=this.offsets(),s=e=>this.startTime+(r+o[e]*this.totalDuration)/this.speed;if(i>=0){let e=DL(a)?tV(a):RV(a)?nV[a]:AL(a);return[s(i),s(i+1),typeof e==`string`||HV(e(0),0)&&HV(e(1),1)?e:void 0]}}boundaries(e,t){let{startTime:n,speed:r,resolvedDuration:i,options:a}=this,{delay:o=0,repeat:s=0,repeatDelay:c=0,repeatType:l,type:u}=a,d=(u||Bz)===Bz?this.offsets():[0,1],f=n+o/r,p=[];if(this.holdTime!==null||!(i>0))return p;for(let n=Math.max(0,Math.floor((e-f)*r/i));n<=s;n++){let a=f+n*i/r;if(a>t)break;for(let o of d){let s=a+(n%2&&l&&l!==`loop`?1-o:o)*(i-c)/r;s>e&&s<t&&p.push(s)}}return p}numberAt(e){return parseFloat(this.sampleAt(e,!0))}sync(){let e=PL.now(),t=this.sampleAt(e,!0);this.options.motionValue.setWithVelocity(this.holdTime===null?this.sampleAt(e-10,!0):t,t,10)}play(){this.isStopped||((this.group||nH(GV(this.options))).tracks.add(this),super.play())}pause(){super.pause(),this.isAccelerated()&&this.group.schedule(!1)}complete(){super.complete();let{group:e}=this;e&&!e.isJS&&this.tick(PL.now())}get time(){return this.isAccelerated()?cL(ZI(0,this.totalDuration,this.at(PL.now())-(this.options.delay||0))):super.time}set time(e){(QV??=Object.getOwnPropertyDescriptor(tB.prototype,`time`).set).call(this,e)}attachTimeline(e){return this.canAccelerate=!1,this.group?.demote(!0),super.attachTimeline(e)}},eH,tH=e=>{eH||queueMicrotask(()=>{let e=eH;eH=void 0,e.forEach(e=>e())}),(eH||=[]).push(e)};function nH(e){let t=e.current,n=new Set,r=new Map,i={},a=[],o=new Map,s=[],c=!1,l=!1,u=!1,d=!1,f=-1/0,p,m=1/0,h,g=e=>{for(let t of n)if(t.name===e)return!0},_=(t,n)=>{let o={};for(let s of t===void 0?kB:a){let a=r.get(s),c=t===void 0?JV(e,s):a?a.sampleAt(n>t&&!a.timing()[1]?n:t):i[s];c!==void 0&&(o[s]=c)}return o},v=(e,t)=>{let n=``;for(let r in e){let i=e[r];(!t||!OV(r,i))&&(n+=DV(r,i)+` `)}return(t?n.trim():n)||`none`},y=(e,t)=>v(_(e,t)),b=(e=_())=>{t.style.transform=v(e,!0)},x=e=>{e.onfinish=e.oncancel=null,e.cancel()},S=(e=!0)=>{clearTimeout(p),m=1/0,h=void 0,e&&b(),s.forEach(({animation:e})=>x(e)),s=[]},C=(e,n)=>new Animation(new KeyframeEffect(t,e,n)),w=(e,t,n=1/0)=>{let r={animation:e,offset:t,end:n};e.startTime=PL.now()+t,n<1/0&&(e.onfinish=()=>{r.isDone=!0,s.some(e=>e.end===1/0)&&(x(e),s=s.filter(e=>e!==r)),F.schedule(!1)}),e.oncancel=()=>s.includes(r)&&F.demote(),s.push(r)},T=(e,t,n)=>{let r=(t,n)=>Math.abs(e(n)-e(t)),i=r(t,n);for(;n-t>.01;){let e=(t+n)/2;r(t,e)>r(e,n)?n=e:t=e}return r(t,n)>i/2?[t,n]:[]},E=(e,t,n,r)=>{let i=VV(t,n);if(r.length*4>i)return;let a;for(let r of e){let e=r.numberAt(t),i=(r.numberAt((t+n)/2)-e)/(r.numberAt(n)-e);if(i===i){if(a===void 0)a=i;else if(!HV(i,a))return}}let o=WV(t,n,i).concat(r).sort(UV),s=e=>aL(t,n,e),c,l;for(let n of e){let e=n.numberAt(t),r=o.map(t=>n.numberAt(t)-e),i=r[r.length-1],a=r.some(e=>Math.abs(e)*MV>Math.abs(i))?0:i,s=r.map(e=>a?e/a:e);if(a&&!c)c=s,l=t=>(n.numberAt(t)-e)/a;else if(s.some((e,t)=>!HV(e,a&&c[t])))return}if(!c||c.every((e,t)=>HV(e,s(o[t]))))return`linear`;let u=[],d=(e,t=l(e))=>u.push(eB(t)+` `+eB(s(e)*100)+`%`);return c.forEach((e,t)=>{t&&Math.abs(e-c[t-1])>.2&&T(l,o[t-1],o[t]).forEach(e=>d(e)),d(o[t],e)}),`linear(`+u+`)`},D=(e,t,n,r)=>{let i=[t],a=[],o=n,s=t;for(let r of e){let e=r.tween();if(e?.[2]!==`linear`){let[i,c]=r.timing(),[l,u]=e||[t,c?n:i];o=Math.min(o,l),s=Math.max(s,u),a.push(r)}}o=Math.max(t,o),s=Math.min(n,s);let c=(e,t)=>a.every(n=>!(Math.abs(n.numberAt((e+t)/2)-(n.numberAt(e)+n.numberAt(t))/2)>(n.name.startsWith(`scale`)?PV:NV))),l=(t,n,r)=>{if(n-t<1||c(t,n))i.push(n);else if(r<4)l(t,(t+n)/2,r+1),l((t+n)/2,n,r+1);else{for(let r of e)i.push(...T(e=>r.numberAt(e),t,n));i.push(n)}},u=s>o?WV(o,s,Math.ceil((s-o)/100)):[];u.push(n);for(let e of r)u.push(e,Math.min(e+.01,n));let d=t;for(let e of u.sort(UV))e>d&&l(d,e,0),d=e;return i.sort(UV)},O=e=>{let t;for(let n of e){let e=n.tween();if(!e||t&&(Math.abs(e[0]-t[0])>1||Math.abs(e[1]-t[1])>1))return;t=[e[0],e[1],!t||e[2]===t[2]?e[2]:void 0]}return t},k=(e,t,n,r,i={fill:`both`},a)=>{let o=r?[]:e.flatMap(e=>e.boundaries(t,n)),s=r||E(e,t,n,o),c=s?[t,n]:D(e,t,n,o),l=c.map(e=>y(e,a)),u={transform:l};return s||(u.offset=c.map(e=>aL(t,n,e))),l.every(e=>e===l[0])&&(b(_(t,a)),u=null),C(u,{...i,duration:n-t,easing:s||`linear`})},A=e=>{let t=PL.now()+e;t<m&&(clearTimeout(p),m=t,p=setTimeout(()=>{m=1/0,F.schedule(!1)},e))},j=t=>{let c=t,l=0,u=0,d=[],f=[],p=new Set;r.clear(),o=new Map;for(let e of n){r.set(e.name,e);let[n,i]=e.timing(),a=n===1/0;if(o.set(e,[e.at(t),e.speed,a]),!a){if(e.speed<0)return;if(i){if(l){let e=(n-u)/i;if(Math.abs(i-l)>1||Math.abs(e-Math.round(e))*l>1)return}else l=i,u=n;f.push(e)}else p.add(n);d.push(e),c=Math.max(c,n)}}i={},a=kB.filter(t=>{if(r.has(t))return!0;let n=i[t]=JV(e,t);return n!==void 0&&!OV(t,n)}),S(!1);let m=!l&&O(d);try{if(c>t){let e;if(m&&m[1]>t){let[n,r,i]=m;if(n-t>IV)return d.forEach(e=>e.sync()),A(h=n-t-IV),!0;e=typeof i==`string`?i:i?BV(i,VV(n,r)):E(d,n,r,[]),e&&w(k(d,n,r,e,{fill:`both`,endDelay:c-r}),n-t,c-n)}e||w(k(d,t,c),0,c-t),p.forEach(e=>e<c-1&&w(C(null,{duration:e-t}),0,e-t))}if(l){let e=u+Math.floor((c-u)/l)*l;w(k(f,e,e+l,void 0,{iterations:1/0,iterationStart:(c-e)/l,fill:`forwards`},c),c-t)}}catch{return}return s.length||S(),!0},M=(e,t)=>{let r,i=0;for(let t of n){let n=o.get(t);if(!n)return!1;let[a,c,l]=n,u=t.at(e),d=t.timing()[0]===1/0;if(l){if(d&&(u===a||!s.length))continue;return!1}let f=(u-a)/c,p=d?0:t.speed/c;if(r===void 0)r=f,i=p;else if(Math.abs(f-r)>1||p!==i)return!1}if(r===void 0)return!0;if(!s.length){if(h===void 0||t&&i)return!1;if(i){let e=(h-r)/i;if(e<1)return!1;A(e)}return!0}for(let{offset:e,end:n,isDone:i}of s){let a=r-e;if(n<1/0&&(i?a<n-1:a<0&&(t||e<=0)||a>=n))return!1}for(let{animation:t,offset:n,isDone:a}of s){if(a)continue;let o=r-n;i&&t.updatePlaybackRate&&t.playState===`running`&&Math.abs(Number(t.currentTime)-o)<20?t.playbackRate!==i&&t.updatePlaybackRate(i):i?(t.playbackRate!==i&&(t.playbackRate=i),t.startTime=e-o/i):(t.startTime=null,t.currentTime=o)}return!0},N=()=>!n.size&&(u=!0,KV(t)===F&&AV.delete(t),F.isJS||S(),!0),P=()=>{let t=PL.now();if(F.isJS||(F.isFinishing=!0,n.forEach(n=>{let[r,a]=n.timing();n.state===`running`&&n.speed>0&&!a&&r<=t+1&&(n.complete(),i[n.name]=JV(e,n.name),o.has(n)||(c=!0))}),F.isFinishing=!1),l=!1,u||(n.forEach(e=>qV(e)&&n.delete(e)),N()))return;for(let e of n)if(!e.canAccelerate)return F.demote(!0);F.isJS&&(F.isJS=!1,c=!0,n.forEach(e=>e.stopJS()));let r=c,a=d;if(c=d=!1,r||!M(t,a)){if(a){if(t-f<FV)return F.demote();f=t}if(!j(t))return F.demote()}else if(h!==void 0&&!a)return;n.forEach(e=>e.timing()[0]===1/0&&e.sync())},F={tracks:n,isJS:!1,isFinishing:!1,schedule(e,t){u||(c||=e,d||=!!t,l||(l=!0,jL.isProcessing?ez.render(P,!1,!0):tH(P)))},release(e){qV(e)&&n.delete(e),N()||F.schedule(!0)},check(){if(!F.isJS){for(let t in i)if(JV(e,t)!==i[t]&&!g(t))return F.schedule(!0,!0)}},demote(e){if(!(F.isJS||u))return n.forEach(t=>{t.isAccelerated()&&t.sync(),e||(t.canAccelerate=!1)}),F.isJS=!0,o=new Map,S(),n.forEach(e=>e.state===`running`&&e.js?.start()),!0}};return AV.set(t,F),F}var rH=class extends Qz{constructor(e){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=PL.now();let{keyframes:t,name:n,motionValue:r,element:i}=e,a=e;a.autoplay??=!0,a.delay??=0,a.type??=`keyframes`,a.repeat??=0,a.repeatDelay??=0,a.repeatType??=`loop`;let o=i?.KeyframeResolver||JB;this.keyframeResolver=new o(t,(e,t,n)=>this.onKeyframesResolved(e,t,a,!n),n,r,i),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=PL.now();let u=mV(e,i,a,o);u||((QI.instantAnimations||!s)&&l?.(Wz(e,n,t)),e[0]=e[e.length-1],hV(n),n.repeat=0);let{onComplete:d}=n;n.finalKeyframe=t,n.keyframes=e,n.onComplete=()=>{d?.(),this.notifyFinished()};let f=u&&!c&&SV(n),p=!f&&YV(n);r&&(f||p||this.resolvedAt!==this.createdAt)&&(n.startTime??=Jz(this.createdAt,this.resolvedAt));let m;if(f){n.element=n.motionValue?.owner?.current;try{m=new dV(n)}catch{m=new tB(n)}}else m=p?new $V(n):new tB(n);this.pendingTimeline&&=(this.stopTimeline=m.attachTimeline(this.pendingTimeline),void 0),this._animation=m}get finished(){return this._animation?this._animation.finished:super.finished}then(e,t){return this.finished.finally(e).then(()=>{})}liveValue(){return this._animation?.liveValue?.()}get animation(){return this._animation||(this.keyframeResolver?.resume(),KB()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation?.cancel(),this.keyframeResolver?.cancel()}},iH=class{constructor(e){this.stop=()=>{for(let e of this.animations)e.stop()},this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map(e=>e.finished))}getAll(e){return this.animations[0][e]}attachTimeline(e){let t=this.animations.map(t=>t.attachTimeline(e));return()=>{t.forEach((e,t)=>{e&&e(),this.animations[t].stop()})}}get time(){return this.getAll(`time`)}set time(e){for(let t of this.animations)t.time=e}get speed(){return this.getAll(`speed`)}set speed(e){for(let t of this.animations)t.speed=e}get state(){return this.getAll(`state`)}get startTime(){return this.getAll(`startTime`)}get duration(){return aH(this.animations,`duration`)}get iterationDuration(){return aH(this.animations,`iterationDuration`)}play(){for(let e of this.animations)e.play()}pause(){for(let e of this.animations)e.pause()}cancel(){for(let e of this.animations)e.cancel()}complete(){for(let e of this.animations)e.complete()}};function aH(e,t){let n=0;for(let r=0;r<e.length;r++){let i=e[r][t];i!==null&&i>n&&(n=i)}return n}var oH=class extends iH{then(e,t){return this.finished.finally(e).then(()=>{})}};function sH(e,t,n,r=0,i=1){let a=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),o=e.size,s=(o-1)*r;return typeof n==`function`?n(a,o):i===1?a*r:s-a*r}var cH=30,lH=e=>!isNaN(parseFloat(e)),uH={current:void 0},dH=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=PL.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.dirty(),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=PL.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=lH(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){var n;return e===`change`?this.onChangeSubscribe(t):((n=this.events)[e]||(n[e]=new oL)).add(t)}onChangeSubscribe(e){let{events:t}=this;return!t.change&&!this.changeSubscriber?this.changeSubscriber=e:(t.change||(t.change=new oL,t.change.add(this.changeSubscriber),this.changeSubscriber=void 0),t.change.add(e)),()=>{this.changeSubscriber===e?this.changeSubscriber=void 0:t.change?.remove(e),this.stopIfUnobserved()}}stopIfUnobserved(){ez.read(()=>{!this.changeSubscriber&&!this.events.change?.getSize()&&this.stop()})}clearListeners(){this.changeSubscriber=void 0;for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){t&&(this.updatedAt=PL.now(),this.stop()),this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,this.stopPassiveEffect?.()}dirty(){let{current:e,changeSubscriber:t}=this;t?t(e):this.events.change?.notify(e)}addDependent(e){(this.dependents||=new Set).add(e)}removeDependent(e){this.dependents?.delete(e)}get(){uH.current?.push(this);let e=this.animation?.liveValue?.();return e===void 0?this.current:e}getCurrent(){return this.current}getPrevious(){return this.prev}getVelocity(){let e=PL.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>cH)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,cH);return lL(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return new Promise(t=>this.run(e,t))}run(e,t){this.stop(),this.hasAnimated=!0;let n=!1,r;r=e(()=>{n=!0,this.events.animationComplete?.notify(),this.animation===r&&(this.animation=void 0),t?.()}),n||(this.animation=r),this.events.animationStart?.notify()}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel?.notify()),this.animation=void 0}isAnimating(){return!!this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect?.()}};function fH(e,t){return new dH(e,t)}function pH(e,t){if(e?.inherit&&t){let{inherit:n,...r}=e;return{...t,...r}}return e}function mH(e,t){let n=e?.[t]??e?.default??e;return n===e?n:pH(n,e)}var hH={type:`spring`,stiffness:500,damping:25,restSpeed:10},gH=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),_H={type:`keyframes`,duration:.8},vH={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},yH=(e,{keyframes:t})=>t.length>2?_H:AB.has(e)?e.startsWith(`scale`)?gH(t[1]):hH:vH,bH=new Set([`when`,`delay`,`delayChildren`,`staggerChildren`,`staggerDirection`,`repeat`,`repeatType`,`repeatDelay`,`from`,`elapsed`,`out`,`mixer`]);function xH(e){for(let t in e)if(!bH.has(t))return!0;return!1}var SH=(e,t,n,r={},i,a)=>o=>{let s=mH(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=sL(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:`easeOut`,velocity:t.getVelocity(),...s,delay:-l,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:a?void 0:i,hasOnUpdate:!!s.onUpdate};xH(s)||Object.assign(u,yH(e,u)),u.duration&&=sL(u.duration),u.repeatDelay&&=sL(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(hV(u),u.delay===0&&(d=!0)),(QI.instantAnimations||QI.skipAnimations||i?.shouldSkipAnimations||s.skipAnimations)&&(d=!0,hV(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=Wz(u.keyframes,s);if(e!==void 0){ez.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new tB(u):new rH(u)},CH=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function wH(e){let t=CH.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function TH(e,t,n=1){let[r,i]=wH(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return $I(e)?parseFloat(e):e}return zL(i)?TH(i,t,n+1):i}function EH(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function DH(e,t,n,r){let i=t=>typeof t==`function`?t(n===void 0?e.custom:n,...EH(r)):t;return t=i(t),typeof t==`string`&&(t=e.variants&&e.variants[t]),i(t)}function OH(e,t,n){return DH(e.getProps(),t,n,e)}var kH=(e,t)=>t===`exit`?e.presenceContext?.custom:void 0,AH=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...kB]),jH=e=>Array.isArray(e);function MH(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,fH(n))}function NH(e){return jH(e)?e[e.length-1]||0:e}function PH(e,t){let{transitionEnd:n={},transition:r={},...i}=OH(e,t)||{};i={...i,...n};for(let t in i)MH(e,t,NH(i[t]))}var FH=e=>!!(e&&e.getVelocity);function IH(e){return!!(FH(e)&&e.add)}function LH(e,t){let n=e.getValue(`willChange`);if(IH(n))return n.add(t);if(!n&&QI.WillChange){let n=new QI.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}var RH=`data-framer-appear-id`;function zH(e){return e.props[RH]}var BH=typeof window<`u`;function VH({protectedKeys:e,needsAnimating:t},n){let r=n in e&&!t[n];return t[n]=!1,r}function HH(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:o,...s}=t,c=e.getDefaultTransition();a=a?pH(a,c):c;let l=a?.reduceMotion,u=a?.skipAnimations;r&&(a=r);let d=[],f=i&&e.animationState?.getState()[i],p=a?.path;p&&(p.animateValues?p.animateValues(t=>e.getValue(t,e.latestValues[t]??0),s,a,n,d):p.animateVisualElement?.(e,s,a,n,d));for(let t in s){let r=e.getValue(t,e.latestValues[t]??null),i=s[t];if(i===void 0||f&&VH(f,t))continue;let o={delay:n,...mH(f?.out[t]||a||{},t)};u&&(o.skipAnimations=!0);let c=r.get();if(c!==void 0&&!r.isAnimating()&&!Array.isArray(i)&&i===c&&!o.velocity){ez.update(()=>r.set(i));continue}let p=!1;if(BH&&window.MotionHandoffAnimation){let n=zH(e);if(n){let e=window.MotionHandoffAnimation(n,t,ez);e!==null&&(o.startTime=e,p=!0)}}LH(e,t);let m=l??e.shouldReduceMotion;r.run(SH(t,r,i,m&&AH.has(t)?{type:!1}:o,e,p));let h=r.animation;h&&d.push(h)}if(o){let t=()=>ez.update(()=>{o&&PH(e,o)});d.length?Promise.all(d).then(t):t()}return d}function UH(e,t,n={}){let r=OH(e,t,kH(e,n.type)),i=n.transitionOverride||(r?.transition??(e.getDefaultTransition()||{})),a=()=>Promise.all(r?HH(e,r,n):[]),o=(r=0)=>{let{variantChildren:a}=e,{delayChildren:o=0,staggerChildren:s,staggerDirection:c}=i,l=[];return a?.forEach(e=>{e.notify(`AnimationStart`,t),l.push(UH(e,t,{...n,delay:r+(typeof o==`function`?0:o)+sH(a,e,o,s,c)}).then(()=>e.notify(`AnimationComplete`,t)))}),Promise.all(l)},{when:s}=i;return s?s===`beforeChildren`?a().then(()=>o()):o().then(a):Promise.all([a(),o(n.delay)])}function WH(e,t,n={}){return e.notify(`AnimationStart`,t),(Array.isArray(t)?Promise.all(t.map(t=>UH(e,t,n))):typeof t==`string`?UH(e,t,n):Promise.all(HH(e,OH(e,t,n.custom),n))).then(()=>{e.notify(`AnimationComplete`,t)})}var GH={test:e=>e===`auto`,parse:e=>e},KH=e=>t=>t.test(e),qH=[HL,aR,iR,rR,sR,oR,GH],JH=e=>qH.find(KH(e));function YH(e){return typeof e==`number`?e===0:e===null||e===`none`||e===`0`||tL(e)}var XH=new Set([`auto`,`none`,`0`]);function ZH(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!XH.has(t)&&xR(t)&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]!==i&&(e[r]=gB(n,i))}var QH=class extends JB{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}scheduleResolve(){if(this.canReadNow()&&(this.readKeyframes(),!this.needsMeasurement))return this.complete();super.scheduleResolve()}canReadNow(){let{unresolvedKeyframes:e,element:t,motionValue:n}=this,r=e[0]??n?.get();if(!t?.current||r===void 0)return!1;for(let t=0;t<e.length;t++)if(VL(t?e[t]:r))return!1;return!0}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:n}=this;if(!t?.current)return;super.readKeyframes();for(let n=0;n<e.length;n++){let r=e[n];if(typeof r==`string`&&(r=r.trim(),zL(r))){let i=TH(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!AH.has(n)||e.length!==2)return;let[r,i]=e;if(typeof r==`number`&&typeof i==`number`)return;let a=JH(r),o=JH(i);if(VL(r)!==VL(i)&&zB[n])this.needsMeasurement=!0;else if(a!==o){if(jB(a)&&jB(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else zB[n]&&(this.needsMeasurement=!0)}}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||YH(e[t]))&&n.push(t);n.length&&ZH(e,n,t)}measure(){let{element:e,name:t}=this;return zB[t](window.getComputedStyle(e.current),()=>e.measureViewportBox())}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e?.current)return;n===`height`&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=this.measure(),t[0]=this.measuredOrigin;let r=t[t.length-1];r!==void 0&&this.motionValue?.jump(r,!1)}measureEndState(){let{element:e,unresolvedKeyframes:t}=this;if(!e?.current)return;this.motionValue?.jump(this.measuredOrigin,!1);let n=t.length-1,r=t[n];t[n]=this.measure(),r!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=r),this.resolveNoneKeyframes()}},$H=[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomRightRadius`,`borderBottomLeftRadius`],eU=[];function tU(e){nU(e),eU.unshift(e)}function nU(e){XI(eU,e)}function rU(e){return eU.find(t=>t.test(e))}function iU(e,t,n={},r){let i=[],{velocity:a,path:o}=n,s=n.reduceMotion??r?.shouldReduceMotion;o?.animateValues&&r&&(t={...t},o.animateValues(e,t,n,0,i));for(let o in t){if(o===`transition`||o===`transitionEnd`)continue;let c=t[o];if(c===void 0)continue;let l=e(o),u=l.get();u!==void 0&&!l.isAnimating()&&!Array.isArray(c)&&c===u&&!a?ez.update(()=>l.set(c)):(l.run(SH(o,l,c,s&&AH.has(o)?{type:!1}:n,r)),l.animation&&i.push(l.animation))}let{transitionEnd:c}=t;if(c){let t=()=>ez.update(()=>{for(let t in c)e(t).set(c[t])});i.length?Promise.all(i).then(t):t()}return i}function aU(e,t,n,r,i){let a,o=!1,s=iU(r=>{let s=a?.[r]??e.get(t,r);if(!s){let c;if(!i){let i=n[r];c=oU(i)??e.read(t,r,i)}s=fH(c,{owner:i}),o?e(t,{[r]:s}):(a||={})[r]=s}return s},n,r,i);return o=!0,a&&e(t,a),s}function oU(e){let t=Array.isArray(e)?e[0]:void 0;return t===null?void 0:t}function sU(e){return eL(e)&&`offsetHeight`in e&&!(`ownerSVGElement`in e)}function cU(e){return eL(e)&&`ownerSVGElement`in e}var lU={};function uU(e){return lU.current?.add(e),e}var dU=e=>lU.current?lU.current.bind(e):e;function fU(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=t?t.current:lU.current?.root||document,i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(e=>e!=null)}var pU=class{constructor(e=ez.render){this.step=e,this.values=new Map,this.pending=[],this.numPending=0,this.flush=()=>{let{pending:e,numPending:t}=this;this.numPending=0;for(let n=0;n<t;n++)e[n]()}}set(e,t,n,r){if(this.values.get(e)?.onRemove(),r)for(let e of this.values.values())e.value===r&&(n=e.render);let i=()=>n&&this.schedule(n);t.get()!==void 0&&i();let a=t.on(`change`,i),o=()=>{a(),n&&!r&&this.cancel(n),this.values.get(e)?.onRemove===o&&this.values.delete(e)};return this.values.set(e,{value:t,render:r?void 0:n,onRemove:o}),o}get(e){return this.values.get(e)?.value}release(){let e=new Map;return this.values.forEach((t,n)=>{e.set(n,t.value),t.onRemove()}),this.transformKeys=this.transformValues=void 0,e}schedule(e){let{pending:t,numPending:n}=this;for(let r=0;r<n;r++)if(t[r]===e)return;n||this.step(this.flush),t[this.numPending++]=e}cancel(e){let{pending:t}=this;for(let n=0;n<this.numPending;n++)if(t[n]===e){t[n]=t[--this.numPending];return}}};function mU(e,{step:t,...n}={}){let r=new WeakMap;return Object.assign((n,i)=>{let a=r.get(n)??new pU(t);r.set(n,a);let o=[];for(let t in i){let r=i[t],s=e(n,a,t,r);o.push(s)}return()=>{for(let e of o)e()}},n,{get:(e,t)=>r.get(e)?.get(t),flush:e=>r.get(e)?.flush(),state:e=>r.get(e)})}function hU(e){let t=``,{transformKeys:n=[],transformValues:r={}}=e;for(let e=0;e<n.length;e++){let i=n[e],a=r[i].getCurrent();a!==void 0&&(OV(i,a)||(t+=(t&&` `)+DV(i,a)))}let i=e.get(`pathRotation`)?.get();return i&&(t+=(t&&` `)+DV(`rotate`,i)),t||`none`}var gU=new Set([`originX`,`originY`,`originZ`]),_U=(e,t)=>CV(e.get(t)?.get(),lB[t]),vU=(e,t,n,r)=>{let i,a;if(AB.has(n)){if(n!==`pathRotation`){let e=t.transformKeys??=[];(t.transformValues??={})[n]=r,e.includes(n)||(e.push(n),e.sort((e,t)=>kB.indexOf(e)-kB.indexOf(t)))}t.get(`transform`)||(!sU(e)&&!t.get(`transformBox`)&&vU(e,t,`transformBox`,new dH(`fill-box`)),t.set(`transform`,new dH(`none`),()=>{AV.get(e)?.check(),e.style.transform=hU(t)})),a=t.get(`transform`)}else gU.has(n)?(t.get(`transformOrigin`)||t.set(`transformOrigin`,new dH(``),()=>{let n=_U(t,`originX`)??`50%`,r=_U(t,`originY`)??`50%`,i=_U(t,`originZ`)??0;e.style.transformOrigin=`${n} ${r} ${i}`}),a=t.get(`transformOrigin`)):i=YB(n)?()=>{e.style.setProperty(n,r.getCurrent())}:()=>{e.style[n]=CV(r.getCurrent(),lB[n])};return t.set(n,r,i,a)},yU=e=>sU(e)||cU(e),bU=(e,t)=>{if(AB.has(t))return OB(e,t);let n=getComputedStyle(e),r=YB(t)?n.getPropertyValue(t):n[t];return typeof r==`string`&&r.trim()||0},xU=mU(vU,{test:yU,read:bU});function SU(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}function CU(e,t,n){let{style:r,vars:i,transformOrigin:a}=e,o=!1,s=!1;for(let e in t){let n=t[e];if(AB.has(e))o=!0;else if(LL(e))i[e]=n;else{let t=CV(n,lB[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=kV(t,e.transform,n):r.transform&&=`none`),s){let{originX:e=`50%`,originY:t=`50%`,originZ:n=0}=a;r.transformOrigin=`${e} ${t} ${n}`}}var wU={offset:`stroke-dashoffset`,array:`stroke-dasharray`},TU={offset:`strokeDashoffset`,array:`strokeDasharray`};function EU(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?wU:TU;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}var DU=[`transform`,`opacity`,`clipPath`,`filter`,`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function OU(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(CU(e,s,l),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:f}=e;for(let e of DU)d[e]!==void 0&&(f[e]=d[e],delete d[e]);(f.transform||d.transformOrigin)&&(f.transformOrigin=d.transformOrigin??`50% 50%`,delete d.transformOrigin),f.transform&&(f.transformBox=u?.transformBox??`fill-box`,delete d.transformBox),t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),i!==void 0&&EU(d,i,a,o,!1)}function kU(e,t){if(!(t in e))return!1;let n=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),t)||Object.getOwnPropertyDescriptor(e,t);return n&&typeof n.set==`function`}var AU=(e,t,n,r,i=n)=>{let a=kU(e,i);!a&&(i.startsWith(`data`)||i.startsWith(`aria`))&&(i=SU(i));let o=lB[n]||lB[i],s=a?()=>{e[i]=CV(r.get(),lB[n])}:()=>{let t=CV(r.get(),o);t==null?e.removeAttribute(i):e.setAttribute(i,String(t))};return t.set(n,r,s)};function jU(e,t,n,r){return ez.render(()=>e.setAttribute(`pathLength`,`1`)),n===`pathOffset`?t.set(n,r,()=>{let t=r.get();e.setAttribute(`stroke-dashoffset`,`${-t}`)}):(t.get(`stroke-dasharray`)||t.set(`stroke-dasharray`,new dH(`1 1`),()=>{let n=t.get(`pathLength`)?.get()??1,r=t.get(`pathSpacing`)?.get();e.setAttribute(`stroke-dasharray`,`${n} ${r??1-Number(n)}`)}),t.set(n,r,void 0,t.get(`stroke-dasharray`)))}var MU=mU((e,t,n,r)=>n.startsWith(`path`)&&!AB.has(n)?jU(e,t,n,r):n.startsWith(`attr`)?AU(e,t,n,r,NU(n)):n===`d`?t.set(n,r,()=>{let t=r.get()?.replace(/path\(|["')]/g,``);t===void 0?e.removeAttribute(n):e.setAttribute(n,t)}):(AB.has(n)||gU.has(n)||YB(n)||n in e.style?vU:AU)(e,t,n,r),{test:cU,read:(e,t)=>AB.has(t)?lB[t]?.default||0:YB(t)||DU.includes(t)?bU(e,t)||e.getAttribute(SU(t))||0:(t=NU(t),e.getAttribute(SU(t))??e.getAttribute(t)??void 0)});function NU(e){return e.replace(/^attr([A-Z])/,(e,t)=>t.toLowerCase())}function PU({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function FU({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function IU(e,t){if(!t)return e;let n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function LU(e){return e===void 0||e===1}function RU({scale:e,scaleX:t,scaleY:n}){return!LU(e)||!LU(t)||!LU(n)}var zU=[`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skewX`,`skewY`];function BU(e){return RU(e)||HU(e)||VU(e)}function VU(e){return e.z||e.rotate||e.rotateX||e.rotateY||e.rotateZ||e.skewX||e.skewY}function HU(e){return UU(e.x)||UU(e.y)}function UU(e){return e&&e!==`0%`}function WU(e,t,n){return n+t*(e-n)}function GU(e,t,n,r,i){return i!==void 0&&(e=WU(e,i,r)),WU(e,n,r)+t}function KU(e,t=0,n=1,r,i){e.min=GU(e.min,t,n,r,i),e.max=GU(e.max,t,n,r,i)}function qU(e,{x:t,y:n}){KU(e.x,t.translate,t.scale,t.originPoint),KU(e.y,n.translate,n.scale,n.originPoint)}var JU=.999999999999,YU=1.0000000000001;function XU(e,t,n,r=!1){let i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let s=0;s<i;s++)a=n[s],o=a.projectionDelta,a.options.visualElement?.props.style?.display!==`contents`&&(r===!0&&a.options.layoutScroll&&a.scroll&&a!==a.root&&(ZU(e.x,-a.scroll.offset.x),ZU(e.y,-a.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,qU(e,o)),r&&(r.path?.[s]||r)!==a&&BU(a.latestValues)&&eW(e,a.latestValues,a.layout?.layoutBox));t.x<YU&&t.x>JU&&(t.x=1),t.y<YU&&t.y>JU&&(t.y=1)}function ZU(e,t){e.min+=t,e.max+=t}function QU(e,t,n,r,i=.5){KU(e,t,n,NR(e.min,e.max,i),r)}function $U(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function eW(e,t,n){let r=n??e;QU(e.x,$U(t.x,r.x),t.scaleX,t.scale,t.originX),QU(e.y,$U(t.y,r.y),t.scaleY,t.scale,t.originY)}function tW(e,t){return PU(IU(e.getBoundingClientRect(),t))}function nW(e,t,n){let r=tW(e,n),{scroll:i}=t;return i&&(ZU(r.x,i.offset.x),ZU(r.y,i.offset.y)),r}var rW=()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),iW={},aW=e=>cU(e)?MU:xU,oW=class{constructor(e,t){this.effect=e,this.current=t,this.KeyframeResolver=QH}getValue(e){return this.effect.get(this.current,e)}readValue(e,t){return this.effect.read(this.current,e,t)}render(){this.effect.flush(this.current)}measureViewportBox(){return tW(this.current)}getProps(){return iW}};function sW(e,t,n,r){if(lU.current?.track(e),r)return iU(e=>r.getValue(e,null),t,n,r);let i=aW(e);return aU(i,e,t,n,new oW(i,e))}var cW=mU((e,t,n,r)=>t.set(n,r,()=>{e[n]=r.get()}),{test:e=>eL(e),read:(e,t)=>{let n=e[t];return typeof n==`string`||typeof n==`number`?n:void 0}}),{schedule:lW,cancel:uW}=$R(queueMicrotask,!1);function dW(e,t,n){let r=FH(e)?e:fH(e);return r.run(SH(``,r,t,n)),r.animation}var fW={},pW={value:null,addProjectionMetrics:null,countProjection:void 0};function mW(e,t){let n=PL.now();e=dU(e);let r=({timestamp:i})=>{let a=i-n;a>=t&&(tz(r),e(a-t))};return ez.setup(r,!0),uU(()=>tz(r))}function hW(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function gW(e){return cU(e)&&e.tagName===`svg`}function _W(e){return FH(e)?e.get():e}var vW=e=>typeof e==`number`?e:parseFloat(e),yW=$H.length,bW=e=>typeof e==`number`||aR.test(e);function xW(e,t,n,r,i,a){i?(e.opacity=NR(0,n.opacity??1,CW(r)),e.opacityExit=NR(t.opacity??1,0,wW(r))):a&&(e.opacity=NR(t.opacity??1,n.opacity??1,r));for(let i=0;i<yW;i++){let a=$H[i],o=SW(t,a),s=SW(n,a);(o!==void 0||s!==void 0)&&(o||=0,s||=0,o===0||s===0||bW(o)===bW(s)?(e[a]=Math.max(NR(vW(o),vW(s),r),0),(iR.test(s)||iR.test(o))&&(e[a]+=`%`)):e[a]=s)}for(let i=0;i<zU.length;i++){let a=zU[i];(t[a]||n[a])&&(e[a]=NR(t[a]||0,n[a]||0,r))}}function SW(e,t){return e[t]===void 0?e.borderRadius:e[t]}var CW=TW(0,.5,bL),wW=TW(.5,.95,rL);function TW(e,t,n){return r=>r<e?0:r>t?1:n(aL(e,t,r))}var EW=(e,t,{x:n,y:r})=>{let i=e*e+t*t;return i<1?0:-1e3*(n*e+r*t)/i},DW=(e,t=300)=>{let n=ZI(.25,2,t/300),{stiffness:r,damping:i}=Az({...e,duration:e.duration&&sL(e.duration)});return{...e,stiffness:r,damping:i*Math.sqrt(n),mass:n}};function OW(e,t){e.min=t.min,e.max=t.max}function kW(e,t){OW(e.x,t.x),OW(e.y,t.y)}function AW(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var jW=.9999,MW=1.0001,NW=-.01,PW=.01;function FW(e){return e.max-e.min}function IW(e,t,n){return Math.abs(e-t)<=n}function LW(e,t,n,r=.5){e.origin=r,e.originPoint=NR(t.min,t.max,e.origin),e.scale=FW(n)/FW(t),e.translate=NR(n.min,n.max,e.origin)-e.originPoint,(e.scale>=jW&&e.scale<=MW||isNaN(e.scale))&&(e.scale=1),(e.translate>=NW&&e.translate<=PW||isNaN(e.translate))&&(e.translate=0)}function RW(e,t,n,r){LW(e.x,t.x,n.x,r?.originX),LW(e.y,t.y,n.y,r?.originY)}function zW(e,t,n,r=0){e.min=(r?NR(n.min,n.max,r):n.min)+t.min,e.max=e.min+FW(t)}function BW(e,t,n,r){zW(e.x,t.x,n.x,r?.x),zW(e.y,t.y,n.y,r?.y)}function VW(e,t,n,r=0){let i=r?NR(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+FW(t)}function HW(e,t,n,r){VW(e.x,t.x,n.x,r?.x),VW(e.y,t.y,n.y,r?.y)}function UW(e,t,n,r,i){return e-=t,e=WU(e,1/n,r),i!==void 0&&(e=WU(e,1/i,r)),e}function WW(e,t=0,n=1,r=.5,i,a=e,o=e){if(iR.test(t)&&(t=parseFloat(t),t=NR(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=NR(a.min,a.max,r);e===a&&(s-=t),e.min=UW(e.min,t,n,s,i),e.max=UW(e.max,t,n,s,i)}function GW(e,t,[n,r,i],a,o){WW(e,t[n],t[r],t[i],t.scale,a,o)}var KW=[`x`,`scaleX`,`originX`],qW=[`y`,`scaleY`,`originY`];function JW(e,t,n,r){GW(e.x,t,KW,n?.x,r?.x),GW(e.y,t,qW,n?.y,r?.y)}var YW=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),XW=YW(`applewebkit/`)&&!YW(`chrome/`)?Math.round:rL;function ZW(e){e.min=XW(e.min),e.max=XW(e.max)}function QW(e){ZW(e.x),ZW(e.y)}var $W=()=>({translate:0,scale:1,origin:0,originPoint:0}),eG=()=>({x:$W(),y:$W()}),tG=()=>({min:0,max:0}),nG=()=>({x:tG(),y:tG()});function rG(e){return e.translate===0&&e.scale===1}function iG(e){return rG(e.x)&&rG(e.y)}function aG(e,t){return e.min===t.min&&e.max===t.max}function oG(e,t){return aG(e.x,t.x)&&aG(e.y,t.y)}function sG(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function cG(e,t){return sG(e.x,t.x)&&sG(e.y,t.y)}function lG(e){return FW(e.x)/FW(e.y)}function uG(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}var dG=class{constructor(){this.members=[]}add(e){YI(this.members,e);for(let t=this.members.length-1;t>=0;t--){let n=this.members[t];if(n===e||n===this.lead||n===this.prevLead)continue;let r=n.instance;(!r||r.isConnected===!1)&&!n.snapshot&&(XI(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(XI(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){let e=this.members[t];if(e.isPresent!==!1&&e.instance?.isConnected!==!1)return this.promote(e),!0}return!1}promote(e,t){let n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.updateSnapshot(),e.scheduleRender();let{layoutDependency:r}=n.options,{layoutDependency:i}=e.options;(r===void 0||r!==i)&&(e.resumeFrom=n,t&&(n.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}};function fG(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var pG={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`){if(aR.test(e))e=parseFloat(e);else return e}return`${fG(e,t.target.x)}% ${fG(e,t.target.y)}%`}},mG={borderRadius:Object.assign({},pG,{applyTo:$H.slice()}),borderTopLeftRadius:pG,borderTopRightRadius:pG,borderBottomLeftRadius:pG,borderBottomRightRadius:pG,boxShadow:{correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=kR.parse(e);if(i.length>5)return r;let a=kR.createTransformer(e),o=typeof i[0]==`number`?0:1,s=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=s,i[1+o]/=c;let l=NR(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}}};function hG(e,t,n){let r=``,i=e.x.translate/t.x,a=e.y.translate/t.y,o=n?.z||0;(i||a||o)&&(r=`translate3d(${i}px, ${a}px, ${o}px) `);let s=``;if(n){let{transformPerspective:e}=n;e&&(r=`perspective(${e}px) ${r}`);for(let e=0;e<zU.length;e++){let t=zU[e],r=n[t];r&&(s+=`${t}(${r}deg) `),!e&&n.pathRotation&&(s+=`rotate(${n.pathRotation}deg) `)}}if(s){(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),r+=s;let n=e.x.scale*t.x,i=e.y.scale*t.y;(n!==1||i!==1)&&(r+=`scale(${n}, ${i})`)}else e.x.scale!==1||e.y.scale!==1?r+=`scale(${e.x.scale}, ${e.y.scale})`:!r&&(t.x!==1||t.y!==1)&&(r=`scale(1, 1)`);return r||`none`}function gG(e){return[e(`x`),e(`y`)]}var _G=(e,t)=>e.depth-t.depth,vG=class{constructor(){this.children=[],this.isDirty=!1}add(e){YI(this.children,e),this.isDirty=!0}remove(e){XI(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(_G),this.isDirty=!1,this.children.forEach(e)}},yG={hasAnimatedSinceResize:!0,hasEverUpdated:!1},bG=[`z`,`skew`,`skewZ`],xG=1e3,SG=0;function CG(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}var wG=e=>e.instance&&AV.get(e.instance)?.demote()&&e.resetSkewAndRotation();function TG(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=zH(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,ez,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&TG(r)}function EG(e){if(e)return e.options.allowProjection===!1?EG(e.parent):e.projection}function DG({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return Object.assign(fW,{...mG,...fW}),class{static create(e,t,n){let{layoutId:r,layout:i,drag:a,dragConstraints:o,layoutScroll:s,layoutRoot:c,layoutAnchor:l,layoutCrossfade:u}=t,d=e.projection=new this(e.latestValues,t[`data-framer-portal-id`]?void 0:EG(e.parent));d.setOptions({layoutId:r,layout:i,alwaysMeasureLayout:!!a||o&&hW(o),visualElement:e,animationType:typeof i==`string`?i:`both`,initialPromotionConfig:n,crossfade:u,layoutScroll:s,layoutRoot:c,layoutAnchor:l});let f=d.getStack()?.lead;f&&!d.root.isUpdateBlocked()&&(f.willUpdate(),f.scheduleCheckAfterUnmount())}constructor(e={},n=t?.()){this.id=SG++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(AG),this.nodes.forEach(VG),this.nodes.forEach(HG),this.nodes.forEach(jG),pW.countProjection?.()},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new vG)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new oL),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){this.eventHandlers.get(e)?.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=cU(t)&&!gW(t),this.instance=t;let{layoutId:n,layout:r,visualElement:i}=this.options;if(i&&!i.current&&i.mount(t),this.root.nodes.add(this),this.parent?.children.add(this),this.root.hasTreeAnimated&&(r||n)&&(this.isLayoutDirty=!0),e){let n,r=0,i=()=>this.root.updateBlockedByResize=!1;ez.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n?.(),n=mW(i,250),yG.hasAnimatedSinceResize&&(yG.hasAnimatedSinceResize=!1,this.nodes.forEach(BG)))})}n&&this.root.registerSharedNode(n,this),this.addLayoutListener()}addLayoutListener(){let{layoutId:e,layout:t,visualElement:n,animate:r}=this.options;this.instance&&!this.hasLayoutListener&&r!==!1&&n&&(e||t)&&(this.hasLayoutListener=!0,this.addEventListener(`didUpdate`,({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:r,layout:i})=>{if(this.isAnimationBlocked){this.target=void 0,this.relativeTarget=void 0;return}let a=this.options.transition||n.getDefaultTransition()||YG,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=n.getProps(),c=!this.targetLayout||!cG(this.targetLayout,i),l=!t&&r;if(this.options.layoutRoot||this.resumeFrom||l||t&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...mH(a,`layout`),onPlay:o,onComplete:s};(n.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,l,t.path)}else t||BG(this),this.isLead()&&this.options.onExitComplete?.();this.targetLayout=i}))}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this),this.getStack()?.remove(this),this.parent?.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),this.hasLayoutListener=!1,tz(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes?.forEach(UG),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete?.();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&TG(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;wG(this),this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,wG(t),(typeof t.latestValues.x==`string`||typeof t.latestValues.y==`string`)&&(t.isLayoutDirty=!0),t.updateScroll(`snapshot`),t.options.layoutRoot&&t.willUpdate(!1),t.isAnimationBlocked&&(t.dragSnapshot||=t.measure(),this.dragAncestor=t)}let{layoutId:t,layout:n}=this.options;if(t===void 0&&!n)return;let r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,``):void 0,this.updateSnapshot(),e&&this.notifyListeners(`willUpdate`)}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){let e=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),e&&this.nodes.forEach(PG),this.nodes.forEach(NG);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(FG);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(LG),this.nodes.forEach(RG),this.nodes.forEach(zG),this.nodes.forEach(OG),this.nodes.forEach(kG)):this.nodes.forEach(FG),this.clearAllSnapshots();let e=PL.now();jL.delta=ZI(0,1e3/60,e-jL.timestamp),jL.timestamp=e,jL.isProcessing=!0,nz.update.process(jL),nz.preRender.process(jL),nz.render.process(jL),jL.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,lW.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(MG),this.sharedNodes.forEach((e,t)=>e.members.length?e.removeLeadSnapshot():this.sharedNodes.delete(t))}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,ez.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){ez.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){if(!this.snapshot&&this.instance&&(this.snapshot=this.measure(),this.snapshot&&!FW(this.snapshot.measuredBox.x)&&!FW(this.snapshot.measuredBox.y)&&(this.snapshot=void 0),this.snapshot)){let{visualElement:e}=this.options,t=this.currentAnimation?.state===`running`,n=t&&this.animationEdges;t&&this.relativeTarget&&(this.snapshot.relativeVelocity=this.relativeVelocity?.slice()||[]);let r=n&&this.motionValue?.getVelocity()||0,i=[0,1,2,3,4,5].map(t=>(t<4?n&&(this.edgeValues?this.edgeVelocity(t):-n[t]*r/1e3):e?.getValue(t<5?`x`:`y`)?.getVelocity())||0);i.some(Boolean)&&(this.snapshot.velocity=i)}}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutCorrected||=nG(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners(`measure`,this.layout.layoutBox);let{visualElement:t}=this.options;t?.notify(`LayoutMeasure`,this.layout.layoutBox,e?.layoutBox)}updateScroll(e=`measure`){let{scroll:t,instance:i}=this,{animationId:a}=this.root;if(this.options.layoutScroll&&i&&!(t&&t.animationId===a&&t.phase===e)){let o=r(i);this.scroll={animationId:a,phase:e,isRoot:o,offset:n(i),wasRoot:t?t.isRoot:o}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout;e&&wG(this);let t=this.projectionDelta&&!iG(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||BU(this.latestValues)||a)&&(i(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){let t=this.measurePageBox(),n=this.removeElementScroll(t);return e&&(n=this.removeTransform(n)),QW(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return nG();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(QG))){let{scroll:e}=this.root;e&&(ZU(t.x,e.offset.x),ZU(t.y,e.offset.y))}return t}removeElementScroll(e){let t=nG();if(kW(t,e),this.scroll?.wasRoot)return t;for(let n=0;n<this.path.length;n++){let r=this.path[n],{scroll:i,options:a}=r;r!==this.root&&i&&a.layoutScroll&&(i.wasRoot&&kW(t,e),ZU(t.x,i.offset.x),ZU(t.y,i.offset.y))}return t}applyTransform(e,t=!1,n,r,i=0){let a=n||nG();kW(a,e);for(let e=i;e<this.path.length;e++){let n=this.path[e];!t&&n.options.layoutScroll&&n.scroll&&n!==n.root&&(ZU(a.x,-n.scroll.offset.x),ZU(a.y,-n.scroll.offset.y)),BU(n.latestValues)&&eW(a,n.latestValues,n.layout?.layoutBox)}return!r&&BU(this.latestValues)&&eW(a,this.latestValues,this.layout?.layoutBox),a}removeTransform(e){let t=nG();kW(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!BU(n.latestValues))continue;let r;n.instance&&(RU(n.latestValues)&&n.updateSnapshot(),r=nG(),kW(r,n.measurePageBox())),JW(t,n.latestValues,n.snapshot?.layoutBox,r)}return BU(this.latestValues)&&JW(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:e.crossfade===void 0||e.crossfade},this.addLayoutListener()}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==jL.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||=t.isProjectionDirty,this.isTransformDirty||=t.isTransformDirty,this.isSharedProjectionDirty||=t.isSharedProjectionDirty;let n=!!this.resumingFrom||this!==t;if(!(e||n&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:r,layoutId:i}=this.options;if(!this.layout||!(r||i))return;this.resolvedRelativeTargetAt=jL.timestamp;let a=this.getClosestProjectingParent();!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&a&&a.layout?this.createRelativeTarget(a,this.layout.layoutBox,a.layout.layoutBox):this.removeRelativeTarget()),(this.relativeTarget||this.targetDelta)&&(this.target||(this.target=nG(),this.targetWithTransforms=nG()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),BW(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target,!0):kW(this.target,this.layout.layoutBox),qU(this.target,this.targetDelta)):kW(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&a&&(!a.resumingFrom==!this.resumingFrom||a.options.layoutRoot&&!a.resumingFrom)&&!a.options.layoutScroll&&a.target&&this.animationProgress!==1?this.createRelativeTarget(a,this.target,a.target):this.relativeParent=this.relativeTarget=void 0),pW.countProjection?.(1))}getClosestProjectingParent(){if(!(!this.parent||RU(this.parent.latestValues)||HU(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,n){this.relativeParent=e,this.forceRelativeParentToResolveTarget(),this.relativeTarget=nG(),this.relativeTargetOrigin=nG(),HW(this.relativeTargetOrigin,t,n,this.options.layoutAnchor||void 0),kW(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,n=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(n=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(n=!1),this.resolvedRelativeTargetAt===jL.timestamp&&(n=!1),n)return;let{layout:r,layoutId:i}=this.options;if(this.isTreeAnimating=!!(this.parent?.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(r||i))return;kW(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;XU(this.layoutCorrected,this.treeScale,this.path,t&&(e.relativeTarget&&!e.relativeParent.resumingFrom?e.relativeParent:!0)),e.layout&&!e.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=nG());let{target:s}=e;s?(!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(AW(this.prevProjectionDelta.x,this.projectionDelta.x),AW(this.prevProjectionDelta.y,this.projectionDelta.y)),RW(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!uG(this.projectionDelta.x,this.prevProjectionDelta.x)||!uG(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),pW.countProjection?.(2)):this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender())}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){this.options.visualElement?.scheduleRender(),e&&this.getStack()?.scheduleRender(),this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=eG(),this.projectionDelta=eG(),this.projectionDeltaWithTransform=eG()}setAnimationOrigin(e,t=!1,n){let r=this.snapshot,i=r?r.latestValues:{},a={...this.latestValues},o=eG();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let s=nG(),c=r?.source!==this.layout?.source,l=this.getStack(),u=!l||l.members.length<=1,d=!(!c||u||this.options.crossfade!==!0||this.path.some(JG));this.animationProgress=0;let f,p=n?.interpolateProjection(e),m=this.layout?.layoutBox,h=m&&[m.x.min,m.x.max,m.y.min,m.y.max].map((t,n)=>{let{translate:r,scale:i,originPoint:a}=e[n<2?`x`:`y`];return(t-a)*(i-1)+r});h?.every(isFinite)||(h=void 0),this.animationEdges=h,this.edgeValues=this.startVelocity=this.impulse=this.relativeVelocity=this.relativeStart=void 0;let g=r?.velocity,_=r?.relativeVelocity||g;if(_?.slice(0,4).some(Boolean)&&this.getClosestProjectingParent()&&(this.relativeStart=_),g&&h){let t=g.slice(0,4).map((e,t)=>e+(c?g[4+(t>>1)]:0));t.some(Boolean)&&(this.startVelocity=p?EW(e.x.translate,e.y.translate,{x:(t[0]+t[1])/2,y:(t[2]+t[3])/2}):t)}this.mixTargetDelta=t=>{let n=t/1e3,r=p?.(n),l=this.edgeValues;for(let t=0;t<2;t++){let r=t?`y`:`x`;l?WG(o[r],e[r],this.layout.layoutBox[r],l[t*2],l[t*2+1]):GG(o[r],e[r],n)}if(r&&(o.x.translate=r.x,o.y.translate=r.y),this.setTargetDelta(o),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout){HW(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0);let e=this.relativeTargetOrigin,t=s;if(qG(this.relativeTarget,e,t,n),this.isSpringLayout){let e=this.relativeTarget,t=this.impulse||0,n=this.relativeStart,r=PL.now(),i=(r-this.relativeTime)/1e3;this.relativeTime=r;let a=this.relativeVelocity||=[0,0,0,0];for(let r=0;r<4;r++){let o=r<2?`x`:`y`,s=r&1?`max`:`min`;n&&(e[o][s]+=n[r]*t),f&&i>0&&(a[r]=(e[o][s]-f[o][s])/i)}}f&&oG(this.relativeTarget,f)&&(this.isProjectionDirty=!1),f||=nG(),kW(f,this.relativeTarget)}c&&(this.animationValues=a,xW(a,i,this.latestValues,n,d,u)),r?.rotate!==void 0&&(this.animationValues||=a,this.animationValues.pathRotation=r.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners(`animationStart`);let t=this.isSpringLayout=e.type===`spring`;this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.resumingFrom&&(this.resumingFrom.edgeValues=void 0),this.pendingAnimation&&=(tz(this.pendingAnimation),void 0),this.pendingAnimation=ez.update(()=>{yG.hasAnimatedSinceResize=!0,this.motionValue||=fH(0),this.motionValue.jump(0,!1);let n=this.startVelocity;this.startVelocity=void 0;let r=e,i=0;if(t){if(e.mass===`auto`){let t=this.layout?.layoutBox;r=DW(e,t&&Math.sqrt(FW(t.x)*FW(t.y)))}let t=this.relativeStart;if((n||t)&&!e.repeat){if(typeof n==`number`)i=n;else{let e=n&&this.animationEdges;r={...r,type:r=>{let i=[r.velocity,...n||[]].map((t,n)=>Mz({...r,keyframes:n?[e[n-1],0]:r.keyframes,velocity:t})),a=i.length;t&&i.push(Mz({...r,keyframes:[0,0],velocity:1e3,restDelta:.5,restSpeed:5}));let o=0,s=[],c={calculatedDuration:null,next:t=>{o=t;let n=i[0].next(t),r=n.done;for(let e=1;e<i.length;e++){let{value:n,done:o}=i[e].next(t);e<a?s[e-1]=n:this.impulse=n/1e3,r&&=o}return e&&(this.edgeValues=s),n.done=r,n}};return c.calculatedDuration=oz(c),c.next(0),this.edgeVelocity=e=>i[e+1].velocity(o),c}}}}}let a=dW(this.motionValue,[0,1e3],{...r,velocity:i,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}});this.currentAnimation=a,Zz(this.currentAnimation,this),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=this.edgeValues=this.edgeVelocity=this.impulse=void 0,this.notifyListeners(`animationComplete`)}finishAnimation(){this.currentAnimation&&(this.edgeValues=this.impulse=void 0,this.mixTargetDelta?.(xG),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,layout:n,latestValues:r}=e,{target:i}=e;if(t&&i&&n){if(this!==e&&this.layout&&n&&ZG(this.options.animationType,this.layout.layoutBox,n.layoutBox)){let{layoutBox:e}=this.layout,t=i;i=this.target||nG(),XG(i.x,t.x,e.x),XG(i.y,t.y,e.y)}kW(t,i),eW(t,r),RW(this.projectionDeltaWithTransform,this.layoutCorrected,t,r)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new dG),this.sharedNodes.get(e).add(t);let n=t.options.initialPromotionConfig;t.promote({transition:n?.transition,preserveFollowOpacity:n?.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return!e||e.lead===this}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){this.getStack()?.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){return this.getStack()?.relegate(this)||!1}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let{latestValues:t}=e;if(!VU(t))return;let n={};for(let t=0;t<bG.length;t++)CG(bG[t],e,n,this.animationValues);for(let t=0;t<zU.length;t++)CG(zU[t],e,n,this.animationValues);e.render();for(let t in n)e.setStaticValue(t,n[t]),this.animationValues&&(this.animationValues[t]=n[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;let n=this.getLead();if(!this.isVisible&&n!==this){e.visibility=`hidden`;return}let r=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility=``,e.opacity=``,e.pointerEvents=_W(t?.pointerEvents)||``,e.transform=r?r(this.latestValues,``):`none`;return}if(!this.projectionDelta||!this.layout||!n.target){(this.options.layoutId||this.needsShow)&&(this.needsShow=!1,e.visibility=``,e.opacity=this.latestValues.opacity===void 0?1:this.latestValues.opacity,e.pointerEvents=_W(t?.pointerEvents)||``),this.hasProjected&&!BU(this.latestValues)&&(e.transform=r?r({},``):`none`,this.hasProjected=!1);return}e.visibility=``;let i=n.animationValues||n.latestValues;this.applyTransformsToTarget();let a=hG(this.projectionDeltaWithTransform,this.treeScale,i);r&&(a=r(i,a)),e.transform=a;let{x:o,y:s}=this.projectionDelta;e.transformOrigin=`${o.origin*100}% ${s.origin*100}% 0`,e.opacity=n.animationValues?n===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:n===this?i.opacity===void 0?``:i.opacity:i.opacityExit===void 0?0:i.opacityExit;for(let t in fW){if(i[t]===void 0)continue;let{correct:r,applyTo:o,isCSSVariable:s}=fW[t],c=a===`none`?i[t]:r(i[t],n);if(o){let t=o.length;for(let n=0;n<t;n++)e[o[n]]=c}else s?this.options.visualElement.renderState.vars[t]=c:e[t]=c}this.options.layoutId&&(e.pointerEvents=n===this?_W(t?.pointerEvents)||``:`none`)}clearSnapshot(){this.resumeFrom=this.snapshot=this.dragSnapshot=this.dragAncestor=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(NG),this.root.sharedNodes.clear()}}}function OG(e){e.updateLayout(),IG(e)}function kG(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners(`didUpdate`)){let{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,a=t.source!==e.layout.source,o=(r,a)=>{if(i===`size`)gG(e=>{let t=FW(r[e]);r[e].min=a[e].min,r[e].max=r[e].min+t});else if(i===`x`||i===`y`){let e=i===`x`?`y`:`x`;OW(r[e],a[e])}else ZG(i,t.layoutBox,n)&&gG(t=>{let n=FW(a[t]);r[t].max=r[t].min+n,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[t].max=e.relativeTarget[t].min+n)})},s=a?t.measuredBox:t.layoutBox;o(s,n);let c=eG();RW(c,n,t.layoutBox);let l=eG();RW(l,a?e.applyTransform(r,!0):n,s);let u=!iG(c),d=!1,f=e.getClosestProjectingParent();if((!a||f?.options.layoutRoot&&e.resumeFrom?.path.includes(f))&&f&&!f.resumeFrom){let{snapshot:r,layout:i}=f;if(r&&i){let s=e.options.layoutAnchor||void 0,c=nG();HW(c,a?e.resumeFrom.applyTransform(t.layoutBox,!0,void 0,!0,f.depth+1):t.layoutBox,r.layoutBox,s);let l=nG();HW(l,n,i.layoutBox,s),a&&o(c,l),cG(c,l)||(d=!0),f.options.layoutRoot&&(e.relativeTarget=l,e.relativeTargetOrigin=c,e.relativeParent=f)}}e.notifyListeners(`didUpdate`,{layout:n,snapshot:t,delta:l,layoutDelta:c,hasLayoutChanged:u,hasRelativeLayoutChanged:d})}else e.isLead()&&e.options.onExitComplete?.();e.options.transition=void 0}function AG(e){pW.countProjection?.(0),e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty),e.isTransformDirty||=e.parent.isTransformDirty)}function jG(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function MG(e){e.clearSnapshot()}function NG(e){e.clearMeasurements()}function PG(e){e.isLayoutDirty=!0,e.updateLayout()}function FG(e){e.isLayoutDirty=!1}function IG(e){let{snapshot:t,dragAncestor:n}=e,r=n?.isAnimationBlocked&&n.layout;if(!t||!r||e.resumeFrom||e.isAnimationBlocked)return;let i=n.dragSnapshot;gG(e=>ZU(t.layoutBox[e],r.layoutBox[e].min-i.layoutBox[e].min))}function LG(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.dragSnapshot||e.layout,e.isLayoutDirty=!0)}function RG(e){e.relativeTarget&&e.relativeParent?.isLayoutDirty&&(e.currentAnimation?e.isLayoutDirty=!0:(e.targetDelta=void 0,e.removeRelativeTarget()))}function zG(e){let{visualElement:t}=e.options;t?.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function BG(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function VG(e){e.resolveTargetDelta()}function HG(e){e.calcProjection()}function UG(e){e.resetSkewAndRotation()}function WG(e,t,n,r,i){let a=n.max-n.min,o=a?Math.max(0,(a+i-r)/a):1,s=e.originPoint=t.originPoint;e.origin=t.origin,e.scale=o,e.translate=n.min+r-(s+(n.min-s)*o)}function GG(e,t,n){e.translate=NR(t.translate,0,n),e.scale=NR(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function KG(e,t,n,r){e.min=NR(t.min,n.min,r),e.max=NR(t.max,n.max,r)}function qG(e,t,n,r){KG(e.x,t.x,n.x,r),KG(e.y,t.y,n.y,r)}function JG(e){return e.animationValues?.opacityExit!==void 0}var YG={duration:.45,ease:[.4,0,.1,1]};function XG(e,t,n){e.max=FW(n)+(e.min=t.min)}function ZG(e,t,n){return e===`position`||e===`preserve-aspect`&&!IW(lG(t),lG(n),.2)}function QG(e){return e!==e.root&&e.scroll?.wasRoot}function $G(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}var eK=DG({attachResizeListener:(e,t)=>$G(e,`resize`,t),measureScroll:rW,checkIsScrollRoot:()=>!0}),tK={current:void 0},nK=DG({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!tK.current){let e=new eK({});e.mount(window),e.setOptions({layoutScroll:!0}),tK.current=e}return tK.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),rK=new WeakMap;function iK(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function aK(e){return typeof e==`string`||Array.isArray(e)}var oK=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`whilePinch`,`exit`],sK=[`initial`].concat(oK);function cK(e){if(iK(e.animate))return!0;for(let t=0;t<sK.length;t++)if(aK(e[sK[t]]))return!0;return!1}function lK(e){return!!(cK(e)||e.variants)}function uK(e,t,n){for(let r in t){let i=t[r],a=n[r];if(FH(i))e.addValue(r,i);else if(FH(a))e.addValue(r,fH(i,{owner:e}));else if(a!==i){if(e.hasValue(r)){let t=e.getValue(r);t.liveStyle===!0?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(r);e.addValue(r,fH(t===void 0?i:t,{owner:e}))}}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var dK={current:null},fK={current:!1},pK=typeof window<`u`;function mK(){if(fK.current=!0,pK){if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>dK.current=e.matches;e.addEventListener(`change`,t),t()}else dK.current=!1}}var hK=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],gK={};function _K(e){gK=e}function vK(){return gK}var yK=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,skipAnimations:i,blockInitialAnimation:a,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=JB,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify(`Update`,this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=PL.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,ez.render(this.render,!1,!0))};let{latestValues:c,renderState:l}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=t.initial?{...c}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=i,this.options=s,this.blockInitialAnimation=!!a,this.isControllingVariants=cK(t),this.isVariantNode=lK(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);let{willChange:u,...d}=this.scrapeMotionValuesFromProps(t,{},this);for(let e in d){let t=d[e];c[e]!==void 0&&FH(t)&&t.set(c[e])}}mount(e){let t=this.presenceContext;if(this.hasBeenMounted&&t?.isPresent!==!1&&!t?.keepValuesOnRemount)for(let e in this.initialValues)this.values.get(e)?.jump(this.initialValues[e]),this.latestValues[e]=this.initialValues[e];if(this.current=e,rK.set(e,this),this.projection?.instance||this.projection?.mount(e),this.isVariantNode&&!this.isControllingVariants){let e=this;do e=e.props.inherit!==!1&&e.parent;while(e&&!e.isVariantNode);if(e){let{variantChildren:t}=e;t.add(this),this.removeFromVariantTree=()=>t.delete(this)}}this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),this.reducedMotionConfig===`never`?this.shouldReduceMotion=!1:this.reducedMotionConfig===`always`?this.shouldReduceMotion=!0:(fK.current||mK(),this.shouldReduceMotion=dK.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection?.unmount(),tz(this.notifyUpdate),tz(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree?.(),this.parent?.removeChild(this);for(let e in this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),(this.enteringChildren||=new Set).add(e)}removeChild(e){this.children.delete(e),this.enteringChildren?.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.get(e)?.(),t.accelerate&&gV.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new sV({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:sL(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=AB.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&ez.preRender(this.notifyUpdate),n&&(this.projection&&(this.projection.isTransformDirty=!0),AV.get(this.current)?.check()),this.scheduleRender()}),i;typeof window<`u`&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),i?.()})}sortNodePosition(e){return!this.current||!e.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e=`animation`;for(e in gK){let t=gK[e];if(!t)continue;let{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):nG()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){let{transformTemplate:n,onUpdate:r}=this.props;(e.transformTemplate||n)&&this.scheduleRender(),(e.transformTemplate&&!n||e.onUpdate&&!r)&&AV.get(this.current)?.demote(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<hK.length;t++){let n=hK[t];this.propEventSubscriptions[n]?.(),delete this.propEventSubscriptions[n];let r=e[`on`+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=uK(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue?.()}getProps(){return this.props}getVariant(e){return this.props.variants?.[e]}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}addValue(e,t){let n=this.values.get(e);if(t!==n){n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t);let r=t.get();r!==void 0&&(this.latestValues[e]=r)}}removeValue(e){this.values.delete(e),this.valueSubscriptions.get(e)?.(),this.valueSubscriptions.delete(e),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){let n=this.props.values?.[e];return n||(n=this.values.get(e),n===void 0&&t!==void 0&&(n=fH(t??this.getDefaultValue?.(e),{owner:this}),this.addValue(e,n)),n)}readValue(e,t){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n==`string`&&($I(n)||tL(n))?n=parseFloat(n):typeof n!=`number`&&!kR.test(n)&&kR.test(t)&&(n=gB(e,t)),this.setBaseTarget(e,FH(n)?n.get():n)),FH(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}on(e,t){return(this.events[e]||(this.events[e]=new oL)).add(t)}notify(e,...t){this.events[e]?.notify(...t)}scheduleRenderMicrotask(){lW.render(this.render)}},bK=class extends yK{constructor(){super(...arguments),this.KeyframeResolver=QH}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){let n=e.style;return n?n[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;FH(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}};function xK(e,{style:t,vars:n},r,i){let a=e.style,o;for(o in t)a[o]=t[o];for(o in i?.applyProjectionStyles(a,r),n)a.setProperty(o,n[o])}function SK(e,{layout:t,layoutId:n}){return AB.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!fW[e]||e===`opacity`)}function CK(e,t,n){let r=e.style,i=t?.style,a={};if(!r)return a;for(let t in r)(FH(r[t])||i&&FH(i[t])||SK(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(a[t]=r[t]);return a}function wK(e){return window.getComputedStyle(e)}var TK=class extends bK{constructor(){super(...arguments),this.type=`html`,this.renderInstance=xK}mount(e){super.mount(e)}readValueFromInstance(e,t){if(AB.has(t))return this.projection?.isProjecting?EB(t):OB(e,t);{let n=wK(e),r=(LL(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return tW(e,t)}build(e,t,n){CU(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return CK(e,t,n)}},EK=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1;function DK(e){return{point:{x:e.pageX,y:e.pageY}}}var OK=e=>t=>EK(t)&&e(t,DK(t));function kK(e,t,n,r){return $G(e,t,OK(n),r)}var AK=new WeakMap,jK,MK=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:cU(r)&&`getBBox`in r?r.getBBox()[t]:r[n],NK=MK(`inline`,`width`,`offsetWidth`),PK=MK(`block`,`height`,`offsetHeight`);function FK({target:e,borderBoxSize:t}){AK.get(e)?.forEach(n=>{n(e,{get width(){return NK(e,t)},get height(){return PK(e,t)}})})}function IK(e){e.forEach(FK)}function LK(){typeof ResizeObserver<`u`&&(jK=new ResizeObserver(IK))}function RK(e,t){jK||LK();let n=fU(e);return n.forEach(e=>{let n=AK.get(e);n||(n=new Set,AK.set(e,n)),n.add(t),jK?.observe(e)}),()=>{n.forEach(e=>{let n=AK.get(e);n?.delete(t),n?.size||jK?.unobserve(e)})}}var zK=new Set,BK;function VK(){BK=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};zK.forEach(t=>t(e))},window.addEventListener(`resize`,BK)}function HK(e){return zK.add(e),BK||VK(),()=>{zK.delete(e),!zK.size&&typeof BK==`function`&&(window.removeEventListener(`resize`,BK),BK=void 0)}}function UK(e,t){return uU(typeof e==`function`?HK(e):RK(e,t))}var WK=(e,t)=>Math.abs(e-t);function GK(e,t){let n=WK(e.x,t.x),r=WK(e.y,t.y);return Math.sqrt(n**2+r**2)}var KK=new Set([`auto`,`scroll`]),qK=class{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:a=3,element:o,immediate:s}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.hasPendingMove=!1,this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=YK(this.lastRawMoveEventInfo,this.transformPagePoint));let e=ZK(this.lastMoveEventInfo,this.history),t=this.startEvent!==null,n=GK(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!n)return;let{point:r}=e;this.history.push({...r,timestamp:PL.now()});let{onStart:i,onMove:a}=this.handlers;t||(i?.(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),a?.(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.handleScroll(window),this.lastMoveEvent=e,this.lastRawMoveEventInfo=t,this.lastMoveEventInfo=YK(t,this.transformPagePoint),this.hasPendingMove=!0,ez.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.hasPendingMove&&this.updatePoint(),this.end();let{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&i?.(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let a=ZK(e.type===`pointercancel`?this.lastMoveEventInfo:YK(t,this.transformPagePoint),this.history);this.startEvent&&n?.(e,a),r?.(e,a)},!EK(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=s?0:a,this.contextWindow=r||window;let c=DK(e),l=YK(c,this.transformPagePoint),{point:u}=l;this.history=[{...u,timestamp:PL.now()}];let{onSessionStart:d}=t;d&&d(e,ZK(l,this.history));let f={passive:!0,capture:!0};this.removeListeners=iL(kK(this.contextWindow,`pointermove`,this.handlePointerMove,f),kK(this.contextWindow,`pointerup`,this.handlePointerUp,f),kK(this.contextWindow,`pointercancel`,this.handlePointerUp,f)),o&&this.startScrollTracking(o),s&&(this.handlePointerMove(e,c),this.updatePoint())}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(KK.has(e.overflowX)||KK.has(e.overflowY))&&this.scrollPositions.set(t,JK(t)),t=t.parentElement}this.scrollPositions.set(window,JK(window)),this.removeScrollListeners=iL($G(window,`scroll`,this.onElementScroll,{capture:!0}),$G(window,`scroll`,this.onWindowScroll,{}))}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let n=e===window,r=JK(e),i={x:r.x-t.x,y:r.y-t.y};(i.x!==0||i.y!==0)&&(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,r),ez.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners?.(),this.removeScrollListeners?.(),this.scrollPositions.clear(),tz(this.updatePoint)}},JK=e=>e===window?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop};function YK(e,t){return t?{point:t(e.point)}:e}function XK(e,t){return{x:e.x-t.x,y:e.y-t.y}}function ZK({point:e},t){return{point:e,delta:XK(e,$K(t)),offset:XK(e,QK(t)),velocity:eq(t,.1)}}function QK(e){return e[0]}function $K(e){return e[e.length-1]}function eq(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null,i=$K(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>sL(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&i.timestamp-r.timestamp>sL(t)*2&&(r=e[1]);let a=cL(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};let o={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}var tq=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function nq(e){return tq.has(e.tagName)||e.isContentEditable===!0}var rq=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function iq(e){return rq.has(e.tagName)||e.isContentEditable===!0}var aq={x:!1,y:!1};function oq(){return aq.x||aq.y}function sq(e){return e===`x`||e===`y`?aq[e]?null:(aq[e]=!0,()=>{aq[e]=!1}):aq.x||aq.y?null:(aq.x=aq.y=!0,()=>{aq.x=aq.y=!1})}function cq(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?NR(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?NR(n,e,r.max):Math.min(e,n)),e}function lq(e,t,n){return{min:t===void 0?void 0:e.min+t,max:n===void 0?void 0:e.max+n-(e.max-e.min)}}function uq(e,{top:t,left:n,bottom:r,right:i}){return{x:lq(e.x,n,i),y:lq(e.y,t,r)}}function dq(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function fq(e,t){return{x:dq(e.x,t.x),y:dq(e.y,t.y)}}function pq(e,t){let n=.5,r=FW(e),i=FW(t);return i>r?n=aL(t.min,t.max-r,e.min):r>i&&(n=aL(e.min,e.max-i,t.min)),ZI(0,1,n)}function mq(e,t){let n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}var hq=.35;function gq(e=hq){return e===!1?e=0:e===!0&&(e=hq),{x:_q(e,`left`,`right`),y:_q(e,`top`,`bottom`)}}function _q(e,t,n){return{min:vq(e,t),max:vq(e,n)}}function vq(e,t){return typeof e==`number`?e:e[t]||0}function yq(e){let t=``;for(let n of e.path){n.scroll=void 0,n.updateScroll();let{scroll:r}=n;n!==e.root&&r&&(t+=r.offset.x+`,`+r.offset.y+`,`)}return t}var bq=new WeakMap,xq=class{constructor(e,t=()=>e.getProps()){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=nG(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e,this.readProps=t}start(e,t={}){if(this.visualElement.presenceContext?.isPresent===!1)return;let n=e=>{t.snapToCursor&&this.snapToCursor(e),this.stopAnimation()},r=(e,t)=>{let{drag:n,dragConstraints:r,dragPropagation:i,onDragStart:a}=this.getProps();if(n&&!i&&(this.openDragLock?.(),this.openDragLock=sq(n),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints();let{projection:o}=this.visualElement;o&&(o.isAnimationBlocked=!0,o.target=void 0),gG(e=>{let t=this.getAxisMotionValue(e).get()||0;if(zL(t)&&(t=TH(t,this.visualElement.current)||0),aR.test(t))t=parseFloat(t);else if(iR.test(t)){let n=o?.layout?.layoutBox[e];n&&(t=FW(n)*(parseFloat(t)/100))}this.originPoint[e]=t}),this.point=typeof r==`function`&&r(this),a&&ez.update(()=>a(e,t),!1,!0),LH(this.visualElement,`transform`),this.visualElement.animationState?.setActive(`whileDrag`,!0)},i=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:a}=this.getProps();if(!n&&!this.openDragLock)return;let{offset:o}=t;if(r&&this.currentDirection===null){if(this.currentDirection=Dq(o),this.currentDirection===null)return;i&&i(this.currentDirection)}this.updateAxis(`x`,o),this.updateAxis(`y`,o),this.point&&this.point.move(),this.visualElement.render(),a&&ez.update(()=>a(e,t),!1,!0)},a=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},o=()=>{let{dragSnapToOrigin:e}=this.getProps();(e||this.constraints||this.point)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:s}=this.getProps();this.panSession=new qK(e,{onSessionStart:n,onStart:r,onMove:i,onSessionEnd:a,resumeAnimation:o},{...t,transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:s,contextWindow:this.visualElement.current?.ownerDocument.defaultView,element:this.visualElement.current})}stop(e,t,n){let r=e||this.latestPointerEvent,i=t||this.latestPanInfo,a=this.isDragging;if(this.cancel(),!a||!i||!r)return;let{velocity:o}=i;this.startAnimation(o,n);let{onDragEnd:s}=this.getProps();s&&ez.postRender(()=>s(r,i))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession(),!this.getProps().dragPropagation&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t?.setActive(`whileDrag`,!1)}endPanSession(){this.panSession?.end(),this.panSession=void 0}updateAxis(e,t){let{drag:n}=this.readProps();if(!t||!Eq(e,n,this.currentDirection))return;let r=this.getAxisMotionValue(e),i=this.originPoint[e]+t[e],a=this.constraints&&this.constraints[e];a&&(i=cq(i,a,this.elastic[e])),this.point?this.point[e]=i:r.set(i)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),{projection:n}=this.visualElement,r=n&&(n.layout||n.measure(!1)),i=this.constraints;Sq(e)?(!this.constraints||this.scroll!==yq(n))&&(this.constraints=this.resolveRefConstraints()):this.constraints=e&&r&&typeof e==`object`?uq(r.layoutBox,e):!1,this.elastic=gq(t),i!==this.constraints&&!Sq(e)&&r&&this.constraints&&!this.hasMutatedConstraints&&gG(e=>{this.constraints!==!1&&this.getAxisMotionValue(e)&&(this.constraints[e]=mq(r.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!Sq(e))return!1;let n=Cq(e),{projection:r}=this.visualElement;if(!r||!r.layout)return!1;this.scroll=yq(r);let i=nW(n,r.root,this.visualElement.getTransformPagePoint()),a=fq(r.layout.layoutBox,r.removeElementScroll(i));if(t){let e=t(FU(a));this.hasMutatedConstraints=!!e,e&&(a=PU(e))}return a}startAnimation(e,t){let{drag:n,dragMomentum:r,dragElastic:i,dragTransition:a,dragSnapToOrigin:o,onDragTransitionEnd:s}=this.getProps(),c={bounceStiffness:i?200:1e6,bounceDamping:i?40:1e7,timeConstant:750,restDelta:1,restSpeed:10,...a},l=i=>r&&!(this.point&&o)&&Eq(i,t||n,this.currentDirection)?e[i]:0;if(this.point&&!o)return this.point.release({x:l(`x`),y:l(`y`)},c).then(s);let u=this.constraints||{},d=gG(e=>{if(!Eq(e,t||n,this.currentDirection))return;let r=u[e]||{};(o===!0||o===e)&&(r={min:0,max:0});let i={type:`inertia`,velocity:l(e),...c,...r};return this.startAxisValueAnimation(e,i)});return Promise.all(d).then(s)}startAxisValueAnimation(e,t){let n=this.getAxisMotionValue(e);return LH(this.visualElement,e),n.start(SH(e,n,0,t,this.visualElement,!1))}stopAnimation(){gG(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`;return this.readProps()[t]||this.visualElement.getValue(e,this.visualElement.latestValues[e]??0)}snapToCursor({clientX:e,clientY:t}){let{drag:n}=this.getProps(),r={x:e,y:t},i=this.visualElement.getTransformPagePoint()?.(r)||r,a=this.visualElement.measureViewportBox();gG(e=>{if(!Eq(e,n,this.currentDirection))return;let t=this.getAxisMotionValue(e),{min:r,max:o}=a[e];t.set((t.get()||0)+i[e]-NR(r,o,.5))})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!Sq(t)||!n||!this.constraints)return;this.stopAnimation();let r=this.constraints,i={x:0,y:0};gG(e=>{let t=this.getAxisMotionValue(e).get();i[e]=pq({min:t,max:t},r[e])});let{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},``):`none`,n.root?.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),gG(t=>{let n=this.getAxisMotionValue(t);if(!Eq(t,e,null)||!n.get())return;let{min:r,max:a}=this.constraints[t];n.set(NR(r,a,i[t]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;bq.set(this.visualElement,this);let e=this.visualElement.current,t=kK(e,`pointerdown`,t=>{let{drag:n,dragListener:r=!0}=this.getProps(),i=t.target,a=i!==e&&iq(i);n&&r&&!a&&this.start(t)}),n,r=()=>{let{dragConstraints:t}=this.getProps(),r=Sq(t)&&Cq(t);r&&(this.constraints=this.resolveRefConstraints(),n||=Tq(e,r,()=>this.scalePositionWithinConstraints()))},{projection:i}=this.visualElement,a=i.addEventListener(`measure`,r);i.layout||(i.root?.updateScroll(),i.updateLayout()),ez.read(r);let o=$G(window,`resize`,()=>this.scalePositionWithinConstraints()),s=i.addEventListener(`didUpdate`,(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(gG(t=>{if(!Eq(t,this.getProps().drag,this.currentDirection))return;let n=this.getAxisMotionValue(t);this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate)}),this.visualElement.render())}));return()=>{o(),t(),a(),s(),n?.()}}getProps(){let e=this.readProps(),{dragElastic:t=hq,dragMomentum:n=!0}=e;return{...e,dragElastic:t,dragMomentum:n}}};function Sq(e){return!!e&&typeof e==`object`&&(`current`in e||`nodeType`in e)}var Cq=e=>`current`in e?e.current:e;function wq(e){let t=!0;return()=>{t?t=!1:e()}}function Tq(e,t,n){let r=UK(e,wq(n)),i=UK(t,wq(n));return()=>{r(),i()}}function Eq(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function Dq(e,t=10){let n=null;return Math.abs(e.y)>t?n=`y`:Math.abs(e.x)>t&&(n=`x`),n}function Oq(e,t){let n=fU(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},uU(()=>r.abort())]}function kq(e){return!(e.pointerType===`touch`||oq())}function Aq(e,t,n={}){t=dU(t);let[r,i,a]=Oq(e,n);return r.forEach(e=>{let n=!1,r=!1,a,o=()=>{e.removeEventListener(`pointerleave`,u)},s=e=>{a&&=(a(e),void 0),o()},c=e=>{n=!1,window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),r&&(r=!1,s(e))},l=()=>{n=!0,window.addEventListener(`pointerup`,c,i),window.addEventListener(`pointercancel`,c,i)},u=e=>{e.pointerType!==`touch`&&(n?r=!0:s(e))};e.addEventListener(`pointerenter`,n=>{if(!kq(n))return;r=!1;let o=t(e,n);typeof o==`function`&&(a=o,e.addEventListener(`pointerleave`,u,i))},i),e.addEventListener(`pointerdown`,l,i)}),a}var jq=(e,t)=>t?e===t||jq(e,t.parentElement):!1,Mq=new WeakSet;function Nq(e){return t=>{t.key===`Enter`&&e(t)}}function Pq(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var Fq=(e,t)=>{let n=!1,r=Nq(()=>{n||Mq.has(e)||(n=!0,Pq(e,`down`))}),i=Nq(()=>{n&&(n=!1,Pq(e,`up`))});e.addEventListener(`keydown`,r,t),e.addEventListener(`keyup`,i,t),e.addEventListener(`blur`,()=>{e.removeEventListener(`keydown`,r),e.removeEventListener(`keyup`,i),n&&Pq(e,`cancel`)},{...t,once:!0})};function Iq(e){return EK(e)&&!oq()}var Lq=new WeakSet,Rq=100,zq=8,Bq=(e,t,n)=>Math.hypot(e.clientX-t.clientX,e.clientY-t.clientY)>n,Vq=e=>e.preventDefault();function Hq(e,t,n={}){t=dU(t);let[r,i,a]=Oq(e,n),o=new WeakMap,s=e=>{let r=e.currentTarget;if(!Iq(e)||Lq.has(e))return;n.stopPropagation&&Lq.add(e);let{count:a=1,countTimeout:s=.3,hold:c=0,repeat:l}=n,u=PL.now(),d=sL(c),f=sL(s),p=o.get(r);p?.expire(Bq(p.event,e,Rq))?p=void 0:p&&(tz(p.expire),o.delete(r));let m=p?p.count+1:1,h=m>=a,g=h&&(c||l),_=!c,v=0,y;if(Mq.add(r),p)y=p.handlers;else{let n=t(r,e);y=typeof n==`function`?{onComplete:n}:n||{}}h&&_&&y.onActive?.();let b=sL(l),x=d||b,S=u+x,C=!0,w=()=>{if(i.signal.aborted)return tz(w);let e=Math.min(1-(S-PL.now())/x,1);C&&e<1&&(e=0),C=!1,y.onHold?.(e),!(e<1)&&(_?y.onRepeat?.(++v):(_=!0,y.onActive?.()),l?(C=!0,S+=x=b):tz(w))},T={...i,capture:!0},E=(t,n)=>{if(EK(t)){if(window.removeEventListener(`pointerup`,D,T),window.removeEventListener(`pointercancel`,O,T),window.removeEventListener(`pointermove`,k,T),r.removeEventListener(`contextmenu`,Vq),tz(w),Mq.delete(r),oq()&&(n=!1),n&&!h){let n=PL.now(),a=e=>{let s=i.signal.aborted;if(s||e===!0||PL.now()-n>f)return tz(a),o.delete(r),s||y.onComplete?.(t,{success:!1}),!0};o.set(r,{count:m,event:e,handlers:y,expire:a}),ez.update(a,!0)}else y.onComplete?.(t,{success:n&&_})}},D=e=>{E(e,r===window||r===document||n.useGlobalTarget||jq(r,e.target))},O=e=>{E(e,!1)},k=t=>{EK(t)&&((l||!_)&&Bq(e,t,zq)||a>1&&oq())&&O(t)};window.addEventListener(`pointerup`,D,T),window.addEventListener(`pointercancel`,O,T),(g||a>1)&&window.addEventListener(`pointermove`,k,T),g&&(ez.update(w,!0),r.addEventListener(`contextmenu`,Vq,{...i,passive:!1}))};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,s,i),sU(e)&&(e.addEventListener(`focus`,()=>Fq(e,i),i),!nq(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function Uq(...e){let t=!Array.isArray(e[0]),n=t?0:-1,r=e[0+n],i=e[1+n],a=e[2+n],o=e[3+n],s=Fz(i,a,o);return t?s(r):s}var Wq=new Set,Gq=({timestamp:e})=>{Wq.forEach(t=>t.tick(e))},Kq=class extends Qz{constructor(e){super(),this.state=`idle`,this.startTime=0,this.currentTime=0,this.started=!1,this.hasNextTarget=!1,this.nextTarget=0,this.stop=()=>{this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},this.options=e,this.factory=e.type,this.generator=this.factory(e);let{driver:t}=e;t&&(this.driver=t(e=>this.tick(e))),this.startTime=this.now(),this.state=`running`,this.driver?this.driver.start():(Wq.size||ez.update(Gq,!0),Wq.add(this))}setTarget(e,t){this.nextTarget=e,this.nextVelocity=t,this.hasNextTarget=!0}retarget(e,t){let{options:n,generator:r}=this;n.keyframes=e,n.velocity=t,this.startTime=this.now(),this.currentTime=0,r.retarget?r.retarget(e,t):this.generator=this.factory(n)}tick(e){let{options:t,hasNextTarget:n}=this,{delay:r=0,onUpdate:i,onPlay:a}=t;this.started||(this.startTime=Jz(this.startTime,e));let o=Math.round(e-this.startTime)-r,s=this.currentTime=Math.max(0,o),c=this.generator.next(s),l=o<0?t.keyframes[0]:c.value;if(n){this.hasNextTarget=!1;let{keyframes:e}=t;e[0]=l,e[1]=this.nextTarget,this.retarget(e,this.nextVelocity??this.getGeneratorVelocity())}(n||!this.started)&&(this.started=!0,a?.()),this.state===`running`&&(i?.(l),c.done&&o>=0&&!n&&!this.hasNextTarget&&this.state===`running`&&(this.notifyFinished(),this.teardown(),this.state=`finished`,t.onComplete?.()))}getGeneratorVelocity(){return Uz(this.generator,this.currentTime,this.options.velocity)}now(){return this.driver?this.driver.now():PL.now()}teardown(){this.state=`idle`,this.driver?this.driver.stop():(Wq.delete(this),Wq.size||tz(Gq))}};function qq(e,t,n){let r=e.get(),i=null,a,o=typeof r==`string`?r.replace(/[\d.-]/g,``):void 0,s=e=>a(o?e+o:e),c=()=>e.events.animationStart?.notify(),l=()=>{i&&=(i.stop(),null),e.animation=void 0};if(e.attach((t,r)=>{a=r;let o=vW(t);if(i?.state===`running`){i.setTarget(o,n.velocity);return}let u=vW(e.get()),d=i?i.getGeneratorVelocity():e.getVelocity();if(l(),u===o)return;let f=i=new Kq({keyframes:[u,o],velocity:d,restDelta:.001,restSpeed:.01,...n,onUpdate:s,onPlay:c});e.animation=f,f.then(()=>{i===f&&(i=null,e.animation=void 0,e.events.animationComplete?.notify())})},l),FH(t)){let r=n.skipInitialAnimation===!0,i=t=>{r?(r=!1,e.jump(Jq(t,o),!1)):e.set(Jq(t,o))},a=t.on(`change`,i),s=t.get();vW(s)-vW(e.get())&&i(s);let c=e.on(`destroy`,a);return()=>{a(),c(),l()}}return l}function Jq(e,t){return t?e+t:e}function Yq(e,t,n){return qq(e,t,{...n,type:Mz})}var Xq=class{constructor(e){this.isMounted=!1,this.node=e}update(){}},Zq=new Set([`baseFrequency`,`diffuseConstant`,`kernelMatrix`,`kernelUnitLength`,`keySplines`,`keyTimes`,`limitingConeAngle`,`markerHeight`,`markerWidth`,`numOctaves`,`targetX`,`targetY`,`surfaceScale`,`specularConstant`,`specularExponent`,`stdDeviation`,`tableValues`,`viewBox`,`gradientTransform`,`pathLength`,`startOffset`,`textLength`,`lengthAdjust`]),Qq=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function $q(e,t,n,r){xK(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(Zq.has(n)?n:SU(n),t.attrs[n])}function eJ(e,t,n){let r=CK(e,t,n);for(let n in e)if(n!==`children`&&(FH(e[n])||FH(t[n]))){let t=kB.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var tJ=class extends bK{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=nG}getBaseTargetFromProps(e,t){return AB.has(t)?super.getBaseTargetFromProps(e,t)??EB(t):e[t]}getDefaultValue(e){return AB.has(e)?this.latestValues[e]??EB(e):void 0}readValueFromInstance(e,t){if(AB.has(t)){let e=dB(t);return e&&e.default||0}if(DU.includes(t)){let n=getComputedStyle(e)[t];if(typeof n==`string`&&n)return n.trim()}return t=Zq.has(t)?t:SU(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return eJ(e,t,n)}build(e,t,n){OU(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){$q(e,t,n,r)}mount(e){this.isSVGTag=Qq(e.tagName),super.mount(e)}};function nJ(e,t){if(!Array.isArray(t))return!1;let n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}var rJ=[...oK].reverse(),iJ=e=>e?.out===!0?e:e?.out;function aJ(e){let t=t=>Promise.all(t.map(({animation:t,options:n})=>WH(e,t,n))),n=sJ(),r=!0,i=!1;function a(a){let{props:o,parent:s,manuallyAnimateOnMount:c}=e,{initial:l}=o,u=r||i,d=[],f=(t=l)=>typeof t!=`boolean`&&OH(e,Array.isArray(t)?t[0]:t,e.presenceContext?.custom)||void 0,p=new Map,m={},h=1/0,g=e;do g=g.props.inherit!==!1&&g.parent;while(g&&!g.isControllingVariants);let _=u&&iJ(f(l??(g&&g.props.initial))?.transition);if(rJ.forEach((t,r)=>{let i=n[t],l=o[t],f=g&&g.props[t],v=l===void 0?aK(f)||f===!1?f:void 0:l,y=aK(v),b=t===a?i.isActive:null,x=y&&l===void 0&&!(u&&c);if(i.protectedKeys={...m},!i.isActive&&b===null||!v&&!i.prevProp||iK(v)||typeof v==`boolean`)return;if(b===!1&&(h=r),t===`exit`&&i.isActive&&b!==!0){m={...m,...i.prevResolvedValues};return}let S=oJ(i.prevProp,v),C=S||y&&(b&&!x||r>h),w=!1,T=Array.isArray(v)?v:[v],E={},D;if(b!==!1)for(let n of T){let{transition:r,transitionEnd:i,...a}=OH(e,n,kH(e,t))||{};E={...E,...a,...i},D=iJ(r)||D}let{prevResolvedValues:O}=i;for(let t in{...O,...E}){if(t in m)continue;let n=E[t],r=O[t],a=Array.isArray(n)&&Array.isArray(r)?!nJ(n,r)||S:n!==r,o;if(a&&n==null)p.has(t)||p.set(t,i.prevOut);else if(a||n!==void 0&&p.has(t)){C=!0,o=p.get(t)||_,p.delete(t)&&(w=!0),i.needsAnimating[t]=!0;let n=e.getValue(t);n&&(n.liveStyle=!1)}else i.protectedKeys[t]=!0;i.out[t]=o}if(i.prevProp=v,i.prevResolvedValues=E,i.prevOut=D,i.isActive&&(m={...m,...E}),C&&(!(x&&S)||w))for(let n of T){let r={type:t};if(typeof n==`string`&&u&&c&&s?.enteringChildren){let t=OH(s,n)?.transition?.delayChildren;r.delay=sH(s.enteringChildren,e,t)}d.push({animation:n,options:r})}}),p.size){let t={},n=f(),r=n?.transition;p.forEach((i,a)=>{i&&(r={...r||e.getDefaultTransition(),[a]:i});let s=e.getValue(a);s&&(s.liveStyle=!0);let c=n&&!Array.isArray(l)?n[a]:void 0,u=e.getBaseTargetFromProps(o,a);t[a]=(c===void 0?u!==void 0&&!FH(u)?u:e.initialValues[a]===void 0?e.baseTarget[a]:void 0:c)??null}),r&&(t.transition=r),d.push({animation:t})}let v=u&&e.blockInitialAnimation||r&&!c&&(o.initial===!1||o.initial===o.animate);return r=i=!1,!v&&d.length?t(d):Promise.resolve()}function o(t,r){if(n[t].isActive===r)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,r)),n[t].isActive=r;let i=a(t);for(let e in n)n[e].protectedKeys={};return i}return{animateChanges:a,setActive:o,setAnimateFunction:n=>{t=n(e)},getState:()=>n,reset:()=>{n=sJ(),i=!0}}}function oJ(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!nJ(t,e):!1}function sJ(){let e={};for(let t of oK)e[t]={isActive:t===`animate`,protectedKeys:{},needsAnimating:{},prevResolvedValues:{},out:{}};return e}var cJ=(0,v.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function lJ(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function uJ(...e){return t=>{let n=!1,r=e.map(e=>{let r=lJ(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():lJ(e[t],null)}}}}function dJ(...e){return v.useCallback(uJ(...e),e)}var fJ=e=>{let{width:t,height:n}=e?.getBoundingClientRect()||{};return[t/e?.offsetWidth||1,n/e?.offsetHeight||1]},pJ=e=>{let{left:t,top:n}=e.getBoundingClientRect(),r=e;for(;r=r.parentElement||r.parentNode?.host;){let{scrollLeft:e,scrollTop:i}=r;if(e||i){let[a,o]=fJ(r);t+=e*a,n+=i*o}if(getComputedStyle(r).position===`fixed`)break}let[i,a]=fJ(e.offsetParent);return[t/i,n/a]},mJ=class extends v.Component{getSnapshotBeforeUpdate(e){let t=this.props.getElement();if(sU(t)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){let e=t.offsetParent,n=sU(e)&&e.offsetWidth||0,r=sU(e)&&e.offsetHeight||0,i=getComputedStyle(t),a=this.props.sizeRef.current;a.height=parseFloat(i.height),a.width=parseFloat(i.width),a.top=t.offsetTop,a.left=t.offsetLeft,a.right=n-a.width-a.left,a.bottom=r-a.height-a.top,a.direction=i.direction,a.point=pJ(t)}return null}componentDidUpdate(){}render(){return this.props.children}};function hJ({children:e,isPresent:t,anchorX:n,anchorY:r,root:i,pop:a,popNode:o}){let s=(0,v.useId)(),c=(0,v.useRef)(null),l=(0,v.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:`ltr`}),{nonce:u}=(0,v.useContext)(cJ),d=dJ(c,a===!1?void 0:e.props?.ref??e?.ref),f=()=>c.current||o?.current?.current,p=e=>{let{width:t,height:i,top:a,left:o,right:c,bottom:u,direction:d}=l.current,f=d===`rtl`,p=n===`left`?f?`right:${c}`:`left:${o}`:f?`left:${o}`:`right:${c}`,m=r===`bottom`?`bottom:${u}`:`top:${a}`;e?.insertRule(`[data-motion-pop-id="${s}"]{position:absolute!important;width:${t}px!important;height:${i}px!important;${p}px!important;${m}px!important}`)};return(0,v.useInsertionEffect)(()=>{let{width:e,height:n}=l.current,r=f();if(t||a===!1||!r||!e||!n)return;r.dataset.motionPopId=s;let o=r.ownerDocument,c=o.createElement(`style`);u&&(c.nonce=u);let d=i??o.head;d.appendChild(c),p(c.sheet);let m=0,h=0;return lW.setup(()=>{let[e,t]=pJ(r);m=l.current.point[0]-e,h=l.current.point[1]-t}),lW.read(()=>{let{sheet:e}=c;if(!e||!m&&!h)return;let t=l.current;t.left+=m,t.right-=m,t.top+=h,t.bottom-=h,e.deleteRule(0),p(e)}),()=>{r.removeAttribute(`data-motion-pop-id`),d.contains(c)&&d.removeChild(c)}},[t]),(0,S.jsx)(mJ,{isPresent:t,getElement:f,sizeRef:l,pop:a,children:a===!1?e:v.cloneElement(e,{ref:d})})}var gJ=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:a,mode:o,anchorX:s,anchorY:c,root:l})=>{let u=KI(_J),d=(0,v.useId)(),f=(0,v.useRef)(),p=(0,v.useRef)(n),m=(0,v.useRef)(r);qI(()=>{p.current=n,m.current=r});let h=!0,g=(0,v.useMemo)(()=>(h=!1,{id:d,initial:t,isPresent:n,custom:i,onExitComplete:e=>{u.set(e,!0);for(let e of u.values())if(!e)return;r&&r()},register:(e,t)=>(u.set(e,!1),t&&t.parent?.presenceContext?.id!==d&&(f.current=t),()=>{u.delete(e),!p.current&&!u.size&&m.current?.()})}),[n,u,r]);return a&&h&&(g={...g}),(0,v.useMemo)(()=>{u.forEach((e,t)=>u.set(t,!1))},[n]),v.useEffect(()=>{!n&&!u.size&&r&&r()},[n]),e=(0,S.jsx)(hJ,{pop:o===`popLayout`,isPresent:n,anchorX:s,anchorY:c,root:l,popNode:f,children:e}),(0,S.jsx)(JI.Provider,{value:g,children:e})};function _J(){return new Map}function vJ(e=!0){let t=(0,v.useContext)(JI);if(t===null)return[!0,null];let{isPresent:n,onExitComplete:r,register:i}=t,a=(0,v.useId)();(0,v.useEffect)(()=>{if(e)return i(a)},[e]);let o=(0,v.useCallback)(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,o]:[!0]}var yJ=e=>e.key||``;function bJ(e){let t=[];return v.Children.forEach(e,e=>{(0,v.isValidElement)(e)&&t.push(e)}),t}var xJ=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:a=`sync`,propagate:o=!1,anchorX:s=`left`,anchorY:c=`top`,root:l})=>{let[u,d]=vJ(o),f=(0,v.useMemo)(()=>bJ(e),[e]),p=o&&!u?[]:f.map(yJ),m=(0,v.useRef)(!0),h=KI(()=>new Map),g=(0,v.useRef)(new Set),[_,y]=(0,v.useState)(f),[b,x]=(0,v.useState)(f);qI(()=>{o&&!u&&!b.length&&d?.()},[u,o,b.length,d]);let C=(0,v.useRef)();(0,v.useEffect)(()=>()=>{let e=C.current;C.current=void 0,e?.()},[b]),qI(()=>{m.current=!1;for(let e=0;e<b.length;e++){let t=yJ(b[e]);p.includes(t)?(h.delete(t),g.current.delete(t)):h.get(t)!==!0&&h.set(t,!1)}},[b,p.length,p.join(`-`)]);let w=[];if(f!==_){let e=[...f],t=0;for(let n of b){let r=p.indexOf(yJ(n));r===-1?(e.splice(t++,0,n),w.push(n)):t=r+w.length+1}return w.every(e=>h.get(yJ(e)))?e=f:a===`wait`&&(e=w),x(bJ(e)),y(f),null}let{forceRender:T}=(0,v.useContext)(GI);return(0,S.jsx)(S.Fragment,{children:b.map(e=>{let _=yJ(e),v=o&&!u?!1:f===b||p.includes(_);return(0,S.jsx)(gJ,{isPresent:v,initial:!m.current||n?void 0:!1,custom:t,presenceAffectsLayout:i,mode:a,root:l,onExitComplete:v?void 0:()=>{if(g.current.has(_))return;if(h.has(_))g.current.add(_),h.set(_,!0);else return;let e=!0;h.forEach(t=>{t||(e=!1)}),e&&(T?.(),y([]),o&&d?.(),C.current=r)},anchorX:s,anchorY:c,children:e},_)})})},SJ=(0,v.createContext)({strict:!1}),CJ={animation:[`variants`,...oK],exit:[`exit`],drag:[`drag`,`dragControls`],focus:[`whileFocus`],hover:[`whileHover`,`onHoverStart`,`onHoverEnd`],tap:[`whileTap`,`onTap`,`onTapStart`,`onTapCancel`],pan:[`onPan`,`onPanStart`,`onPanSessionStart`,`onPanEnd`],inView:[`whileInView`,`onViewportEnter`,`onViewportLeave`],layout:[`layout`,`layoutId`]},wJ=!1;function TJ(){if(wJ)return;let e={};for(let t in CJ)e[t]={isEnabled:e=>CJ[t].some(t=>!!e[t])};_K(e),wJ=!0}function EJ(){return TJ(),vK()}function DJ(e){let t=EJ();for(let n in e)t[n]={...t[n],...e[n]};_K(t)}var OJ=(0,v.createContext)({});function kJ(e,t){if(cK(e)){let{initial:t,animate:n}=e;return{initial:t===!1||aK(t)?t:void 0,animate:aK(n)?n:void 0}}return e.inherit===!1?{}:t}function AJ(e){let{initial:t,animate:n}=kJ(e,(0,v.useContext)(OJ));return(0,v.useMemo)(()=>({initial:t,animate:n}),[jJ(t),jJ(n)])}function jJ(e){return Array.isArray(e)?e.join(` `):e}var MJ=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function NJ(e,t,n){for(let r in t)!FH(t[r])&&!SK(r,n)&&(e[r]=t[r])}function PJ({transformTemplate:e},t){return(0,v.useMemo)(()=>{let n=MJ();return CU(n,t,e),Object.assign({},n.vars,n.style)},[t])}function FJ(e,t){let n=e.style||{},r={};return NJ(r,n,e),Object.assign(r,PJ(e,t)),r}function IJ(e,t){let n={},r=FJ(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout=`none`,r.touchAction=e.drag===!0?`none`:`pan-${e.drag===`x`?`y`:`x`}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}var LJ=()=>({...MJ(),attrs:{}});function RJ(e,t,n,r){let i=(0,v.useMemo)(()=>{let n=LJ();return OU(n,t,Qq(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};return NJ(t,e.style,e),{...i,style:{...t,...i.style}}}return i}var zJ=new Set(`animate.exit.variants.initial.style.values.transition.transformTemplate.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.tap.propagate.ignoreStrict.viewport.pinch`.split(`.`));function BJ(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||zJ.has(e)}function VJ(e,t){return e.startsWith(`on`)?!BJ(e):t?.(e)??!BJ(e)}function HJ(e,t,n,r){let i={};for(let a in e)(a!==`values`||typeof e.values!=`object`)&&(FH(e[a])||(a===`fx`?e.fx&&(i.fx=``):(VJ(a,r)||n===!0&&BJ(a)||!t&&!BJ(a)||e.draggable&&a.startsWith(`onDrag`))&&(i[a]=e[a])));return i}var UJ=[`animate`,`circle`,`defs`,`desc`,`ellipse`,`g`,`image`,`line`,`filter`,`marker`,`mask`,`metadata`,`path`,`pattern`,`polygon`,`polyline`,`rect`,`stop`,`switch`,`symbol`,`svg`,`text`,`tspan`,`use`,`view`];function WJ(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(UJ.indexOf(e)>-1||/[A-Z]/u.test(e))}function GJ(e,t,n,{latestValues:r},i,a=!1,o,s){let c=(o??WJ(e)?RJ:IJ)(t,r,i,e),l=HJ(t,typeof e==`string`,a,s),u=e===v.Fragment?{}:{...l,...c,ref:n},{children:d}=t,f=(0,v.useMemo)(()=>FH(d)?d.get():d,[d]);return(0,v.createElement)(e,{...u,children:f})}function KJ({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:qJ(n,r,i,e),renderState:t()}}function qJ(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=_W(a[e]);let{initial:o,animate:s}=e,c=cK(e),l=lK(e);t&&l&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),s===void 0&&(s=t.animate));let u=n?n.initial===!1:!1;u||=o===!1;let d=u?s:o;if(d&&typeof d!=`boolean`&&!iK(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=DH(e,t[n]);if(r){let{transitionEnd:e,transition:t,...n}=r;for(let e in n){let t=n[e];if(Array.isArray(t)){let e=u?t.length-1:0;t=t[e]}t!==null&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}var JJ=e=>(t,n)=>{let r=(0,v.useContext)(OJ),i=(0,v.useContext)(JI),a=()=>KJ(e,t,r,i);return n?a():KI(a)},YJ=JJ({scrapeMotionValuesFromProps:CK,createRenderState:MJ}),XJ=JJ({scrapeMotionValuesFromProps:eJ,createRenderState:LJ}),ZJ=Symbol.for(`motionComponentSymbol`);function QJ(e,t,n){let r=(0,v.useRef)(n);(0,v.useInsertionEffect)(()=>{r.current=n});let i=(0,v.useRef)(null);return(0,v.useCallback)(n=>{n&&e.onMount?.(n),t&&(n?t.mount(n):t.unmount());let a=r.current;if(typeof a==`function`){if(n){let e=a(n);typeof e==`function`&&(i.current=e)}else i.current?(i.current(),i.current=null):a(n)}else a&&(a.current=n)},[t])}var $J=(0,v.createContext)({});function eY(e,t,n,r,i,a){let{visualElement:o}=(0,v.useContext)(OJ),s=(0,v.useContext)(SJ),c=(0,v.useContext)(JI),l=(0,v.useContext)(cJ),u=l.reducedMotion,d=l.skipAnimations,f=(0,v.useRef)(null),p=(0,v.useRef)(!1);r||=s.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u,skipAnimations:d,isSVG:a}),p.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));let m=f.current,h=(0,v.useContext)($J);m&&!m.projection&&i&&(m.type===`html`||m.type===`svg`)&&i.create(m,n,h),(0,v.useInsertionEffect)(()=>{m&&m.props!==n&&m.update(n,c)});let g=n[RH],_=(0,v.useRef)(!!g&&typeof window<`u`&&!window.MotionHandoffIsComplete?.(g)&&window.MotionHasOptimisedAnimation?.(g));return qI(()=>{p.current&&m&&(m.animationState?.animateChanges(),m.enteringChildren=void 0)},[]),qI(()=>{p.current=!0,m&&(window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),_.current&&m.animationState&&m.animationState.animateChanges())}),(0,v.useEffect)(()=>{m&&(!_.current&&m.animationState&&m.animationState.animateChanges(),_.current&&=(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(g)}),!1),m.enteringChildren=void 0)}),m}function tY(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&DJ(r);let a=n?n===`svg`:WJ(e),o=a?XJ:YJ;function s(n,s){let c,l=nY(n);KI(()=>!!tK.current?.sharedNodes.get(l)?.lead&&n.initial)&&(n={...n,initial:!1});let u={...(0,v.useContext)(cJ),...n,layoutId:l},{isStatic:d,isValidProp:f}=u,p=AJ(n),m=o(n,d);if(!d&&typeof window<`u`){rY(u,r);let t=iY(u);p.visualElement=eY(e,m,u,i,t.ProjectionNode,a),(t.isEnabled||p.visualElement?.projection?.options.layoutId)&&(c=t.MeasureLayout)}return(0,S.jsxs)(OJ.Provider,{value:p,children:[c&&p.visualElement?(0,S.jsx)(c,{visualElement:p.visualElement,...u}):null,GJ(e,n,QJ(m,p.visualElement,s),m,d,t,a,f)]})}s.displayName=`motion.${typeof e==`string`?e:`create(${e.displayName??e.name??``})`}`;let c=(0,v.forwardRef)(s);return c[ZJ]=e,c}function nY({layoutId:e}){let t=(0,v.useContext)(GI).id;return t&&e!==void 0?t+`-`+e:e}function rY(e,t){(0,v.useContext)(SJ).strict}function iY(e){let{drag:t,layout:n}=EJ();if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:r.MeasureLayout,isEnabled:t?.isEnabled(e)||n?.isEnabled(e),ProjectionNode:r.ProjectionNode}}function aY(e,t){if(typeof Proxy>`u`)return tY;let n=new Map,r=(n,r)=>tY(n,r,e,t);return new Proxy((e,t)=>r(e,t),{get:(i,a)=>a===`create`?r:(n.has(a)||n.set(a,tY(a,void 0,e,t)),n.get(a))})}var oY=(e,t)=>t.isSVG??WJ(e)?new tJ(t):new TK(t,{allowProjection:e!==v.Fragment}),sY=class extends Xq{constructor(e){super(e),e.animationState||=aJ(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();iK(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){this.node.getProps().animate!==this.node.prevProps?.animate&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}},cY=0,lY={animation:{Feature:sY},exit:{Feature:class extends Xq{constructor(){super(...arguments),this.id=cY++}update(){let{presenceContext:e,animationState:t}=this.node;if(!e||!t)return;let{isPresent:n,onExitComplete:r}=e;if(n===!this.exit)return;if(n){if(this.exit===!0){let{initial:e}=this.node.getProps();if(e&&!Array.isArray(e)){let{transition:t,transitionEnd:n,...r}=OH(this.node,e)||{};for(let e in r)this.node.getValue(e)?.jump(r[e])}this.node.blockInitialAnimation=!1,t.reset(),t.animateChanges()}else t.setActive(`exit`,!1);this.exit=void 0;return}let i=this.exit=t.setActive(`exit`,!0);r&&i.then(()=>{this.exit===i&&(this.exit=!0,r(this.id))})}mount(){let{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id,this.node)),this.update()}unmount(){}}}},uY=class extends Xq{constructor(e){super(e),this.removeGroupControls=rL,this.removeListeners=rL,this.controls=new xq(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||rL}update(){let{dragControls:e,drag:t}=this.node.getProps(),{dragControls:n,drag:r}=this.node.prevProps||{};e!==n&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls))),r&&!t&&this.controls.stop(void 0,void 0,r)}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},dY=e=>(t,n)=>{e&&ez.update(()=>e(t,n),!1,!0)},fY=class extends Xq{constructor(){super(...arguments),this.removePointerDownListener=rL}onPointerDown(e){this.session=new qK(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:this.node.current?.ownerDocument.defaultView})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:dY(e),onStart:dY(t),onMove:dY(n),onEnd:(e,t)=>{delete this.session,r&&ez.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=kK(this.node.current,`pointerdown`,e=>this.onPointerDown(e))}update(){this.session?.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session?.end()}},pY=!1,mY=({layout:e,layoutDependency:t,layoutAnchor:n})=>({layout:e,layoutDependency:t,layoutAnchor:n,animationType:typeof e==`string`?e:`both`}),hY=(e,t)=>{let{snapshot:n}=e,r=e.getStack();r?.remove(e);let i=r?.lead;if(r?.prevLead===e&&i.resumeFrom===e&&(i.resumeFrom=i.currentAnimation=e.resumingFrom=void 0),e.options.layoutId=t,!t)e.needsShow=!0;else return e.root.registerSharedNode(t,e),()=>{let{resumeFrom:t}=e;t?.isPresent!==!1&&e.getStack().members.includes(t)&&(t.hide(),e.resumeFrom=void 0,e.snapshot=n)}},gY=class extends v.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;i&&(t.group?.add(i),r&&n?.register?.(i),pY&&i.root.didUpdate(),i.options.layoutId!==r&&hY(i,r)?.(),i.addEventListener(`animationComplete`,()=>this.safeToRemove()),i.setOptions({...i.options,...mY(this.props),onExitComplete:()=>this.safeToRemove()})),yG.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,layoutId:n,visualElement:r,drag:i,isPresent:a}=this.props,{projection:o}=r;return o&&(o.isPresent=a,this.takeOver=e.layoutId===n?void 0:(o.willUpdate(),hY(o,n)),o.setOptions({...o.options,...mY(this.props)}),pY=!0,i||e.layoutDependency!==t||t===void 0||e.isPresent!==a?o.willUpdate():this.safeToRemove(),e.isPresent!==a&&(a?o.promote():o.relegate()||ez.postRender(()=>{o.getStack()?.members.length||this.safeToRemove()}))),null}componentDidUpdate(){let{projection:e}=this.props.visualElement;e&&(this.takeOver?.(),e.root.didUpdate(),lW.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;pY=!0,r&&(r.scheduleCheckAfterUnmount(),t.group?.remove(r),n?.deregister?.(r))}safeToRemove(){this.props.safeToRemove?.()}render(){return null}};function _Y(e){let[t,n]=vJ(),r=(0,v.useContext)(GI);return(0,S.jsx)(gY,{...e,layoutGroup:r,switchLayoutGroup:(0,v.useContext)($J),isPresent:t,safeToRemove:n})}var vY={pan:{Feature:fY},drag:{Feature:uY,ProjectionNode:nK,MeasureLayout:_Y}};function yY(e,t,n,r,i){let{props:a}=e,o=`while`+n;!i&&e.animationState&&a[o]&&e.animationState.setActive(o,r===`Start`);let s=a[`on`+n+r];s&&ez.postRender(()=>s(t,DK(t)))}var bY=class extends Xq{mount(){let{current:e}=this.node;e&&(this.unmount=Aq(e,(e,t)=>(yY(this.node,t,`Hover`,`Start`),e=>yY(this.node,e,`Hover`,`End`))))}unmount(){}},xY=class extends Xq{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(`:focus-visible`)}catch{e=!0}e&&this.node.animationState&&(this.node.animationState.setActive(`whileFocus`,!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive(`whileFocus`,!1),this.isActive=!1)}mount(){this.unmount=iL($G(this.node.current,`focus`,()=>this.onFocus()),$G(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}};function SY(e,t,n,r){e.current instanceof HTMLButtonElement&&e.current.disabled||yY(e,t,`Tap`,n,r)}var CY=class extends Xq{constructor(){super(...arguments),this.options={}}mount(){let{current:e}=this.node;e&&(this.update(),this.unmount=Hq(e,(e,t)=>(SY(this.node,t,`Start`),{onComplete:(e,{success:t})=>SY(this.node,e,t?``:`Cancel`),onRepeat:()=>SY(this.node,t,``,!0)}),this.options))}update(){let{options:e,node:t}=this,{globalTapTarget:n,propagate:r,tap:i}=t.props;for(let t in e)delete e[t];Object.assign(e,i,{useGlobalTarget:n,stopPropagation:r?.tap===!1})}unmount(){}},wY=new WeakMap,TY=new WeakMap,EY=e=>{let t=wY.get(e.target);t&&t(e)},DY=e=>{e.forEach(EY)};function OY({root:e,...t}){let n=e||document;TY.has(n)||TY.set(n,{});let r=TY.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(DY,{root:e,...t})),r[i]}function kY(e,t,n){let r=OY(t);return wY.set(e,n),r.observe(e),()=>{wY.delete(e),r.unobserve(e)}}var AY={some:0,all:1},jY=class extends Xq{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();let{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r=`some`,once:i}=e,a={root:t?t.current:void 0,rootMargin:n,threshold:typeof r==`number`?r:AY[r]},o=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(`whileInView`,t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),a=t?n:r;a&&a(e)};this.stopObserver=kY(this.node.current,a,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>`u`)return;let{props:e,prevProps:t}=this.node;[`amount`,`margin`,`root`].some(MY(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}};function MY({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var NY=aY(Object.assign({},lY,{inView:{Feature:jY},tap:{Feature:CY},focus:{Feature:xY},hover:{Feature:bY}},vY,{layout:{ProjectionNode:nK,MeasureLayout:_Y}}),oY);function PY(e,t,n){(0,v.useInsertionEffect)(()=>e.on(t,n),[e,t,n])}function FY(e){let t=KI(()=>fH(e)),{isStatic:n}=(0,v.useContext)(cJ);if(n){let[,n]=(0,v.useState)(e);(0,v.useEffect)(()=>t.on(`change`,n),[])}return t}function IY(e,t){let n=FY(t()),r=()=>n.set(t());return r(),qI(()=>{let t=()=>ez.preRender(r,!1,!0),n=e.map(e=>e.on(`change`,t));return r(),()=>{n.forEach(e=>e()),tz(r)}}),n}function LY(e){uH.current=[],e();let t=IY(uH.current,e);return uH.current=void 0,t}function RY(e,t,n){let{isStatic:r}=(0,v.useContext)(cJ),i=()=>FH(e)?e.get():e;if(r)return LY(i);let a=FY(i());return(0,v.useInsertionEffect)(()=>n(a,e,t),[a,JSON.stringify(t)]),a}function zY(e,t={}){return RY(e,t,Yq)}function BY(e,t,n,r){if(typeof e==`function`)return LY(e);if(n!==void 0&&!Array.isArray(n)&&typeof t!=`function`)return HY(e,t,n,r);let i=typeof t==`function`?t:Uq(t,n,r),a=Array.isArray(e)?VY(e,i):VY([e],([e])=>i(e)),o=Array.isArray(e)?void 0:e.accelerate;if(o&&!o.isTransformed&&typeof t!=`function`&&Array.isArray(n)&&r?.clamp!==!1&&!r?.mixer){let e=r?.ease;a.accelerate={...o,times:[0,...t,1],keyframes:[n[0],...n,n[n.length-1]],isTransformed:!0,...e?{ease:Array.isArray(e)?[e[0],...e]:e}:{}}}return a}function VY(e,t){let n=KI(()=>[]);return IY(e,()=>{n.length=0;let r=e.length;for(let t=0;t<r;t++)n[t]=e[t].get();return t(n)})}function HY(e,t,n,r){let i=KI(()=>Object.keys(n)),a=KI(()=>({}));for(let o of i)a[o]=BY(e,t,n[o],r);return a}function UY(){!fK.current&&mK();let[e]=(0,v.useState)(dK.current);return e}function WY(e){return typeof e==`object`&&!Array.isArray(e)}function GY(e,t,n,r){return e==null?[]:typeof e==`string`&&WY(t)?fU(e,n,r):e instanceof NodeList?Array.from(e):Array.isArray(e)?e.filter(e=>e!=null):[e]}function KY(e,t,n){return e*(t+1)+n*t}function qY(e,t){if(t.has(e))return t.get(e);let[,n,r]=e.match(/^(.+?)([+-][\d.]+)$/)||[];return t.has(n)?Math.max(0,t.get(n)+parseFloat(r)):void 0}function JY(e,t,n,r){return typeof t==`number`?t:t.startsWith(`-`)||t.startsWith(`+`)?Math.max(0,e+parseFloat(t)):t===`<`?n:t.startsWith(`<`)?Math.max(0,n+parseFloat(t.slice(1))):qY(t,r)??e}function YY(e,t,n){for(let r=0;r<e.length;r++){let i=e[r];i.at>t&&i.at<n&&(XI(e,i),r--)}}function XY(e,t,n,r,i,a){YY(e,i,a);for(let o=0;o<t.length;o++)e.push({value:t[o],at:NR(i,a,r[o]),easing:EL(n,o)})}function ZY(e,t,n=0){let r=t+1+t*n;for(let t=0;t<e.length;t++)e[t]=e[t]/r}function QY(e,t){return e.at===t.at?e.value===null?1:t.value===null?-1:0:e.at-t.at}var $Y=`easeInOut`,eX=20;function tX(e,{defaultTransition:t={},...n}={},r,i,a){let o=t.duration||.3,s=new Map,c=new Map,l={},u=new Map,d=0,f=0,p=0,m=(e,n)=>{let a=n,s=e=>typeof e==`number`?n+e:JY(f,e,d,u);for(let n=0;n<e.length;n++){let h=e[n];if(typeof h==`string`){u.set(h,f);continue}if(!Array.isArray(h)){let e=h.at===void 0?f:s(h.at);`sequence`in h?(d=f=e,f=m(h.sequence,e),d=e,a=Math.max(a,f)):u.set(h.name,e);continue}let[g,_,v={}]=h;v.at!==void 0&&(f=s(v.at));let y=0,b=(e,n,r,a=0,s=0)=>{let c=iX(e),{delay:l=0,times:u=Lz(c),type:d=t.type||`keyframes`,repeat:m,repeatType:h,repeatDelay:g=0,..._}=n,{ease:v=t.ease||`easeOut`,duration:b}=n;r.mixer||=n.mixer;let x=typeof l==`function`?l(a,s):l,S=c.length,C=aV(d)?d:i?.[d||`keyframes`];if(S<=2&&C){let e=100;if(S===2&&sX(c)){let t=c[1]-c[0];e=Math.abs(t)}let n={...t,..._};b!==void 0&&(n.duration=sL(b));let r=sz(n,e,C);v=r.ease,b=r.duration}b??=o;let w=f+x;u.length===1&&u[0]===0&&(u[1]=1);let T=u.length-c.length;if(T>0&&Iz(u,T),c.length===1&&c.unshift(null),m&&m<eX){let e=b>0?g/b:0;b=KY(b,m,g);let t=[...c],n=[...u];v=Array.isArray(v)?[...v]:[v];let r=[...v],i=h===`reverse`||h===`mirror`,a=t,o=r;i&&(a=[...t].reverse(),h===`reverse`&&(o=[...r].reverse().map(e=>typeof e==`function`?mL(e):e)));for(let s=0;s<m;s++){let l=i&&s%2==0,d=l?a:t,f=l?o:r,p=(s+1)*(1+e);e>0&&(c.push(c[c.length-1]),u.push(p),v.push(`linear`)),c.push(...d);for(let e=0;e<d.length;e++)u.push(n[e]+p),v.push(e===0?`linear`:EL(f,e-1))}ZY(u,m,e)}let E=w+b;XY(r,c,v,u,w,E),y=Math.max(x+b,y),p=Math.max(E,p)};if(FH(g)){let e=nX(g,c);b(_,v,rX(`default`,e))}else{let e=GY(g,_,r,l),t=e.length;for(let n=0;n<t;n++){_=_,v=v;let r=e[n],i=nX(r,c);for(let e in _)b(_[e],aX(v,e),rX(e,i),n,t)}}d=f,f+=y,a=Math.max(a,f)}return a};m(e,0),a&&(a.duration=p,a.labels=u);let{type:h,...g}=t;return c.forEach((e,r)=>{for(let i in e){let a=e[i];a.sort(QY);let o=[],c=[],l=[];for(let e=0;e<a.length;e++){let{at:t,value:n,easing:r}=a[e];o.push(n),c.push(aL(0,p,t)),l.push(r||`easeOut`)}c[0]!==0&&(c.unshift(0),o.unshift(o[0]),l.unshift($Y)),c[c.length-1]!==1&&(c.push(1),o.push(null)),s.has(r)||s.set(r,{keyframes:{},transition:{}});let u=s.get(r);u.keyframes[i]=o,u.transition[i]={...g,duration:p,ease:l,times:c,mixer:a.mixer||t.mixer,...n}}}),s}function nX(e,t){return!t.has(e)&&t.set(e,{}),t.get(e)}function rX(e,t){return t[e]||(t[e]=[]),t[e]}function iX(e){return Array.isArray(e)?e:[e]}function aX(e,t){return e&&e[t]?{...e,...e[t]}:{...e}}var oX=e=>typeof e==`number`,sX=e=>e.every(oX);function cX(e,t){return FH(e)||typeof e==`number`||typeof e==`string`&&!WY(t)}function lX(e,t,n,r){let i=[];if(cX(e,t))i.push(dW(e,WY(t)&&t.default||t,n&&(n.default||n)));else{if(e==null)return i;let a=GY(e,t,r),o=a.length;for(let e=0;e<o;e++){let r=a[e],s={...n};`delay`in s&&typeof s.delay==`function`&&(s.delay=s.delay(e,o)),r instanceof Element?i.push(...sW(r,t,s,rK.get(r))):i.push(...aU(rU(r)??cW,r,t,s))}}return i}function uX(e,t,n,r){let i=[],a=tX(e.map(e=>{if(Array.isArray(e)&&typeof e[0]==`function`){let t=e[0],n=fH(0);return n.on(`change`,t),e.length===1?[n,[0,1]]:e.length===2?[n,[0,1],e[1]]:[n,e[1],e[2]]}return e}),t,n,{spring:Mz},r),o=t?.reduceMotion??t?.defaultTransition?.reduceMotion;return a.forEach(({keyframes:e,transition:t},n)=>{i.push(...lX(n,e,{...t,reduceMotion:o}))}),i}var dX=0;function fX({repeat:e=0,repeatDelay:t=0,repeatType:n=`loop`,delay:r=0},i,a,o){let s=i+t,c=o===void 0;if(c){let t=Math.max(0,a-r);o=s&&t>0?Math.min(e,Math.ceil(t/s-1e-9)-1):0,a=Math.min(t-o*s,i)}return n!==`loop`&&o%2&&(a=i-a),[o,c?a:r+o*s+a]}function pX(e,t){let n=[...e],r=typeof n[0]==`function`?Math.max(1,n.length-1):2;return n[r]={...n[r],at:t},n}var mX=(e,t)=>t===void 0?e:{name:e,at:t};function hX(e){e.pause(),e.time=0,e.stop()}var gX=class e{constructor(e=[],t={},n){this.options=t,this.entries=[],this.repeatIndex=0,this.prevTime=0,this.markers=[],this.labels=new Map,this.totalDuration=0,this.isDirty=!1,this.isDone=!1,this.isRebuilding=!1,this.playbackSpeed=1,this.motionScope=lU.current,this.isKilled=!1,this.isWrapped=!1,this.stop=()=>{this.flush(),this.group?.stop()},this.isPaused=t.autoplay===!1,this.newFinished(),e.forEach(e=>this.add(e)),n?(this.isDirty=!1,this.isWrapped=!0,this.group=new oH(n),this.watch()):(this.invalidate(),this.flush())}add(t,n){return t instanceof e&&t.adopt(this),this.push({item:t,at:n})}call(e,t){return this.push({item:e,at:t,marker:{name:`_m`+dX++,time:0,callback:e}})}addPause(e,t){return this.push({item:t||{},at:e,marker:{name:`_m`+dX++,time:0,callback:t,pause:!0}})}move(e,t){return this.entries.forEach(n=>{n.item===e&&(n.at=t)}),this.invalidate()}remove(t){return t instanceof e&&(t.parent=void 0),this.entries=this.entries.filter(e=>e.item!==t),this.invalidate()}clear(){return this.entries=[],this.invalidate()}getLabelTime(e){return this.flush(),this.labels.get(e)}seek(e){return this.time=this.resolve(e),this}playTo(e){let t=this.resolve(e),n=this.iterationDuration,r=this.time,[i]=fX(this.options,n,r),a=fX(this.options,n,t,i)[1],o=Math.abs(this.speed);return this.speed=a<r?-o:o,this.stopAt=t,this.clock||this.invalidate(),this.play(),this}reverse(){return this.speed=-this.speed,this.play(),this}get progress(){return this.duration?this.time/this.duration:0}set progress(e){this.time=e*this.duration}get time(){return this.active()?.time??0}set time(e){this.flush(),this.prevTime=e,this.group&&(this.group.time=e),this.repeatIndex=this.currentRepeat()}get speed(){return this.playbackSpeed}set speed(e){this.playbackSpeed=e,this.group&&(this.group.speed=e)}get duration(){return this.flush(),this.isWrapped?this.group.duration:this.totalDuration}get iterationDuration(){return this.flush(),this.isWrapped?this.group.iterationDuration:this.totalDuration}get state(){return this.active()?.state??`idle`}get startTime(){return this.active()?.startTime??null}play(){this.flush(),this.isPaused=!1,this.group?.play(),this.isDone&&(this.newFinished(),this.watch())}pause(){this.flush(),this.isPaused=!0,this.group?.pause()}cancel(){this.flush(),this.group?.cancel()}complete(){this.flush(),this.group?.complete()}attachTimeline(e){return this.flush(),this.scrollTimeline=e,this.detachScroll=this.group?.attachTimeline(e),()=>{this.scrollTimeline=void 0,this.detachScroll?.()}}then(e,t){return this.finished.then(e,t)}active(){return this.flush(),this.group?.animations.length?this.group:void 0}push(e){return this.entries.push(e),this.invalidate()}invalidate(){return this.parent?this.parent.invalidate():this.isDirty||(this.isDirty=!0,queueMicrotask(()=>this.flush())),this}flush(){this.isDirty&&!this.parent&&!this.isKilled&&this.build()}adopt(e){this.group&&=(hX(this.group),void 0),this.isDirty=!1,this.parent=e}build(){let e=this.isWrapped?this.group.iterationDuration:this.totalDuration;this.isDirty=!1,this.isWrapped=!1;let t=this.group,n=0;t&&(this.isRebuilding=!0,this.scrollTimeline?(this.detachScroll?.(),t.cancel()):(n=t.animations.length?t.time:0,hX(t)),this.isRebuilding=!1);let{defaultTransition:r,onComplete:i,onUpdate:a,onRepeat:o,onReverseComplete:s,autoplay:c,scope:l,...u}=this.options,d={};l?.reduceMotion!==void 0&&(d.reduceMotion=l.reduceMotion),l?.skipAnimations!==void 0&&(d.skipAnimations=l.skipAnimations),Object.assign(d,u);let f=new Map,p={},m=lU.current;lU.current=this.motionScope;let h;try{h=uX(this.toSequence(f),{defaultTransition:r,...d},l,p)}finally{lU.current=m}let g=p.labels,_=d.duration??p.duration,v=p.duration?_/p.duration:1;if(g.forEach((e,t)=>g.set(t,e*v)),this.markers=[],f.forEach((e,t)=>{e.time=g.get(t),g.delete(t),_=Math.max(_,e.time),this.markers.push(e)}),this.markers.sort((e,t)=>e.time-t.time),this.labels=g,this.totalDuration=_,this.clock=this.clockAnimation=void 0,this.markers.length||this.stopAt!==void 0||a||o){let e=this.clock=fH(0);e.on(`change`,t=>e===this.clock&&this.onClock(t)),h.unshift(this.clockAnimation=dW(e,[0,_],{...d,duration:_,ease:`linear`}))}let y=this.group=new oH(h),{delay:b=0,repeat:x=0,repeatDelay:S=0}=this.options,[C,w]=fX(this.options,e,n);n>b&&(n=fX(this.options,_,Math.min(w,_),C)[1]),this.isDone&&n<b+(x+1)*(_+S)-S&&this.newFinished(),this.scrollTimeline?this.detachScroll=y.attachTimeline(this.scrollTimeline):(y.speed=this.playbackSpeed,this.isPaused&&y.pause(),n&&(y.time=n)),this.repeatIndex=this.currentRepeat(),this.prevTime=n||-1,this.watch()}toSequence(t){return this.entries.map(({item:n,at:r,marker:i})=>i?(t.set(i.name,i),mX(i.name,r)):n instanceof e?{sequence:n.toSequence(t),at:r}:typeof n==`string`?mX(n,r):r===void 0?n:Array.isArray(n)?pX(n,r):{...n,at:r})}resolve(e){return this.flush(),typeof e==`number`?e:qY(e,this.labels)??this.time}currentRepeat(){return fX(this.options,this.totalDuration,this.clockAnimation?.time??0)[0]}onClock(e){let t=this.prevTime;if(this.prevTime=e,this.isRebuilding)return;let{onUpdate:n,onRepeat:r,repeatType:i=`loop`}=this.options;n?.(e);let a=this.currentRepeat(),o=a>this.repeatIndex?1:-1;for(;a!==this.repeatIndex;){let e=this.speed>0==(i===`loop`||!(this.repeatIndex%2)),n=e?this.totalDuration:0;if(this.cross(t,n))return;this.repeatIndex+=o,r?.(),t=i===`loop`?e?-1:1/0:n}this.cross(t,e)}cross(e,t){if(e===t)return;let n=t>e,r=r=>n?r>e&&r<=t:r<e&&r>=t,i=n?this.markers:[...this.markers].reverse();for(let e of i)if(r(e.time)&&(e.callback?.(n?1:-1),e.pause))return this.pauseAt(e.time);if(this.stopAt!==void 0&&r(this.stopAt))return this.pauseAt(this.stopAt),this.stopAt=void 0,!0}pauseAt(e){return this.pause(),this.time=fX(this.options,this.totalDuration,e,this.repeatIndex)[1],!0}watch(){let e=this.group;e.finished.then(()=>{if(e!==this.group||this.isDone)return;this.isDone=!0;let{onComplete:t,onReverseComplete:n}=this.options,r=this.speed<0&&n||t,i=this.resolveFinished;r?.(),i()})}newFinished(){this.isDone=!1,this.finished=new Promise(e=>{this.resolveFinished=e});let{scope:e}=this.options,t=this.motionScope?.add(()=>{this.isKilled=!0,this.stop()});e?.animations.push(this),this.finished.then(()=>{t?.(),e&&XI(e.animations,this)})}};function _X(e){return Array.isArray(e)&&e.some(e=>Array.isArray(e)||e?.sequence)}function vX(e={}){let{scope:t,reduceMotion:n,skipAnimations:r}=e;function i(e,i,a){let o=lU.current?.transition,s={};n!==void 0&&(s.reduceMotion=n),r!==void 0&&(s.skipAnimations=r);let c;if(_X(e)){let r={...s,...i,scope:t};o&&(r.defaultTransition={...o,...r.defaultTransition}),r.reduceMotion=i?.reduceMotion??r.defaultTransition?.reduceMotion??n,c=new gX(e,r)}else{let{onComplete:n,...r}=a||{},l={...s,...o,...r},{onUpdate:u}=r;c=new gX([typeof e==`number`||typeof e==`string`&&(typeof i==`string`||Array.isArray(i))?[u||(()=>{}),Array.isArray(i)?i:[e,i],{...l,onUpdate:void 0}]:[e,i,l]],{...s,onComplete:n,scope:t},lX(e,i,l,t))}return c}return i}var yX=Object.assign(vX(),{addEffect:tU,removeEffect:nU}),bX=NY;function xX({className:e,...t}){return(0,S.jsx)(`kbd`,{"data-slot":`kbd`,className:X(`pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3`,e),...t})}var SX={maskImage:`linear-gradient(#000 0 0), linear-gradient(#000 0 0)`,maskClip:`content-box, border-box`,maskComposite:`exclude`};function CX({glareX:e,glareY:t,rimAngle:n,shine:r,rimOpacity:i,glare:a,rim:o,rimWidth:s}){return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(bX.div,{"aria-hidden":!0,className:`pointer-events-none absolute inset-0 overflow-hidden rounded-3xl mix-blend-soft-light`,style:{opacity:r},children:(0,S.jsx)(bX.div,{className:`absolute -inset-1/2`,style:{x:e,y:t,background:`radial-gradient(circle closest-side, rgb(255 255 255 / ${a*.55}) 0%, rgb(255 255 255 / ${a*.12}) 35%, transparent 85%)`}})}),(0,S.jsx)(bX.div,{"aria-hidden":!0,className:`pointer-events-none absolute inset-0 overflow-hidden rounded-3xl`,style:{opacity:i,padding:s,...SX},children:(0,S.jsx)(bX.div,{className:`absolute top-1/2 left-1/2 aspect-square w-[200%]`,style:{x:`-50%`,y:`-50%`,rotate:n,background:`linear-gradient(0deg, rgb(255 255 255 / ${o}) 16%, rgb(255 255 255 / 0) 45%)`}})})]})}var wX=()=>window.matchMedia(`(prefers-color-scheme: dark)`),TX=e=>{let t=wX();return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)};function EX(e){let t=(0,v.useSyncExternalStore)(TX,()=>wX().matches,()=>!1);return e===`system`?t:e===`dark`}var DX=3,OX=2,kX={text:`Small tools and games,`,highlight:`built with care`};function AX({theme:e,tagline:t=kX,depth:n=0,grain:r=!0,className:i,style:a,selectable:o=!1,pressed:s=!1,children:c}){let l=EX(e.mode),u=n>0,d=e=>u?{transform:`translateZ(${e*n}px)`}:void 0;return(0,S.jsxs)(`div`,{"data-theme":e.name,className:X(`relative flex flex-col rounded-3xl border border-black/[0.07] bg-background p-2 text-foreground select-none`,`shadow-rim`,l&&`dark border-white/10`,u&&`transform-3d`,i),style:{colorScheme:l?`dark`:`light`,...a},children:[u&&Array.from({length:DX},(e,t)=>(0,S.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute -inset-px rounded-3xl`,style:{transform:`translateZ(${-(t+1)*OX}px)`,background:`color-mix(in oklab, var(--background), black ${30+t*13}%)`}},t)),r&&(0,S.jsx)(`div`,{"aria-hidden":!0,className:X(`pointer-events-none absolute inset-0 rounded-3xl`,l?`opacity-12 mix-blend-screen`:`opacity-7 mix-blend-multiply`),style:{backgroundImage:`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E")`}}),(0,S.jsxs)(`div`,{className:X(`relative flex flex-1 flex-col justify-center rounded-inner bg-card p-3.5 text-card-foreground`,`shadow-surface`,u&&`transform-3d`),style:d(10),children:[(0,S.jsxs)(`div`,{className:`text-center`,style:d(6),children:[(0,S.jsx)(`div`,{className:`truncate text-lg leading-tight font-semibold tracking-tight`,children:e.label}),(0,S.jsxs)(`p`,{className:`mt-1.5 line-clamp-2 text-xs leading-relaxed text-muted-foreground`,children:[t.text,` `,(0,S.jsx)(`span`,{className:`rounded-xs bg-(--selection) px-0.5 whitespace-nowrap text-(--selection-foreground)`,children:t.highlight}),`.`]})]}),(0,S.jsxs)(`div`,{className:`mt-3 flex items-center justify-center gap-1.5 text-3xs font-medium`,style:d(8),children:[(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-success/15 px-2 py-0.5 text-success`,children:[(0,S.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`}),`Live`]}),(0,S.jsx)(`span`,{className:`rounded-full bg-secondary px-2 py-0.5 text-secondary-foreground`,children:`v1.2`})]}),(0,S.jsx)(`div`,{className:`mt-5 flex items-center justify-center`,style:d(14),children:(0,S.jsx)(`span`,{"data-select":!0,className:X(`inline-flex items-center rounded-full bg-primary px-3 py-1 text-xs font-medium text-primary-foreground`,`shadow-glow transition duration-150 ease-out`,o&&!s&&`hover:shadow-glow-lifted hover:brightness-110`,s&&`scale-[0.985] shadow-glow-pressed brightness-95 duration-75`),children:`Select`})})]}),(0,S.jsx)(`div`,{className:`flex items-center justify-between gap-1 px-1.5 pt-2 pb-0.5`,style:d(4),children:[1,2,3,4,5,6,7,8].map(e=>(0,S.jsx)(`span`,{className:`h-1.5 flex-1 rounded-full shadow-swatch`,style:{background:`var(--tint-${e})`}},e))}),c&&(0,S.jsx)(`div`,{className:`pointer-events-none absolute inset-0`,style:d(30),children:c})]})}var jX=236,MX=252,NX=168,PX=50,FX=.07,IX=1100,LX=10,RX=24,zX=140,BX=(e,t)=>({type:`spring`,stiffness:e,damping:t}),VX=BX(260,30),HX=BX(380,26),UX=.45,WX=60,GX=100,KX=2,qX=[1.5,3.5,1/0],JX=new Set([`ArrowUp`,`ArrowDown`,`PageUp`,`PageDown`,`Home`,`End`,` `]),YX=e=>{if(typeof requestIdleCallback>`u`){let t=window.setTimeout(e,1e3);return()=>clearTimeout(t)}let t=requestIdleCallback(e,{timeout:3e3});return()=>cancelIdleCallback(t)},XX=()=>Math.min(1,window.innerWidth/(jX*2.6)),ZX=(e,t)=>`${e.label} ${e.mode}`.toLowerCase().includes(t.trim().toLowerCase()),QX=e=>PX/(360/Math.max(e,RX)),$X=e=>(e-1)/2>=QX(e),eZ=(e,t)=>(e%t+t)%t,tZ=(e,t)=>Math.min(t-1,Math.max(0,e)),nZ=(e,t,n)=>{let r=e-t;return $X(n)?r-n*Math.round(r/n):r},rZ=(e,t)=>$X(t)?Math.round(e):tZ(Math.round(e),t),iZ=(e,t)=>eZ(rZ(e,t),t),aZ=.3,oZ=(e,t)=>{if($X(t))return e;let n=tZ(e,t);return n+(e-n)*aZ};function sZ({tagline:e,open:t,onOpenChange:n,trigger:r,shortcut:i=!0,finalFocus:a,favoriteKey:o=`!`,favoritesOnlyKey:s=`@`}={}){let{theme:c,themes:l,setTheme:u,favorites:d,toggleFavorite:f}=I(),p=l.filter(e=>!e.hidden||e.name===c),m=UY()??!1,[h,g]=(0,v.useState)(!1),_=t??h,[y,b]=(0,v.useState)(0),[x,C]=(0,v.useState)(1),[w,T]=(0,v.useState)(!1),[E,D]=(0,v.useState)(!1),[O,k]=(0,v.useState)(!1),[A,j]=(0,v.useState)(!1),M=FY(1),N=FY(1/0),P=FY(0),F=(0,v.useRef)(0),R=(0,v.useRef)(null),[z,V]=(0,v.useState)(``),[H,U]=(0,v.useState)(!1),ee=(e,t,n)=>p.filter(r=>ZX(r,e)&&(!t||n.includes(r.name))),te=ee(z,H,d),ne=te.length,W=te[y];PY(P,`change`,e=>ne&&b(iZ(e,ne)));let re=(0,v.useRef)(!1),ie=e=>{re.current=!1,F.current=rZ(e,ne),yX(P,F.current,m?{duration:0}:VX)},ae=e=>ie(Math.round(F.current)+e),G=e=>{let t=Math.max(-60,Math.min(WX,e));if(m)return ie(P.get());re.current=!0,F.current=rZ(P.get()+t*UX,ne),yX(P,F.current,{type:`inertia`,velocity:t,power:UX,timeConstant:UX*1e3,modifyTarget:e=>rZ(e,ne),restDelta:.001})},K=(0,v.useEffectEvent)(e=>{!i||_||e.defaultPrevented||e.repeat||e.metaKey||e.ctrlKey||e.altKey||e.key.toLowerCase()!==`t`||L(e.target)||(e.preventDefault(),q(!0))});(0,v.useEffect)(()=>(window.addEventListener(`keydown`,K),()=>window.removeEventListener(`keydown`,K)),[]),(0,v.useEffect)(()=>YX(()=>j(!0)),[]),(0,v.useEffect)(()=>{if(A)return YX(()=>{let e=R.current?.closest(`[hidden]`);e&&(e.style.visibility=`hidden`,e.hidden=!1,e.offsetWidth,e.hidden=!0,e.style.visibility=``)})},[A]),(0,v.useEffect)(()=>{if(!_)return;let e=e=>e.preventDefault();return window.addEventListener(`wheel`,e,{passive:!1}),()=>window.removeEventListener(`wheel`,e)},[_]),(0,v.useEffect)(()=>{if(!_)return;let e=()=>C(XX());return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[_]);let q=(e,r)=>{if(!e&&r?.reason===`escape-key`&&z)return ce(``);t===void 0&&g(e),n?.(e)},oe=(0,v.useEffectEvent)(()=>{V(``),U(!1),T(!1),C(XX());let e=Math.max(0,p.findIndex(e=>e.name===c));P.jump(e),b(e),F.current=e,N.jump(qX[0]);let t=e=>requestAnimationFrame(()=>requestAnimationFrame(()=>{N.jump(qX[e]),e<qX.length-1&&t(e+1)}));t(1),m||(M.jump(.4),yX(M,1,HX))});(0,v.useEffect)(()=>{_&&oe()},[_]);let J=e=>{if(!e||e.name===c)return q(!1);let t=document.getElementById(`theme-card-${e.name}`)?.getBoundingClientRect();B(()=>{u(e.name),T(!0),q(!1)},t&&{x:t.left+t.width/2,y:t.top+t.height/2},m)},se=e=>{let t=W?e.indexOf(W):-1,n=Math.max(0,t);P.stop(),P.jump(n),F.current=n,b(n)},ce=e=>{se(ee(e,H,d)),V(e)},le=e=>{se(ee(z,e,d)),U(e)},ue=e=>{H&&se(te.filter(t=>t!==e)),f(e.name)},de=e=>{if(e.metaKey||e.ctrlKey||e.altKey)return;if(JX.has(e.key)&&e.target===R.current&&e.preventDefault(),e.key===o||e.key===s){if(e.preventDefault(),e.repeat)return;e.key===s?le(!H):W&&ue(W);return}if(e.key.length===1&&(e.key!==` `||z!==``)&&(e.key!==` `||e.target===R.current))return e.preventDefault(),ce(z+e.key);if(e.key===`Backspace`&&z)return e.preventDefault(),ce(z.slice(0,-1));if(!ne)return;let t={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1}[e.key];if(t)e.preventDefault(),ae(t);else if((e.key===`Enter`||e.key===` `)&&e.target===R.current){if(e.preventDefault(),e.repeat||E)return;if(m)return J(W);D(!0),window.setTimeout(()=>{D(!1),J(W)},zX)}else if(e.key===`Home`||e.key===`End`){e.preventDefault();let t=Math.round(F.current),n=$X(ne)?t-eZ(t,ne):0;ie(e.key===`Home`?n:$X(ne)?n-1:ne-1)}},fe=(0,v.useRef)({last:0,settle:0}),pe=e=>{let t=Math.abs(e.deltaX)>Math.abs(e.deltaY)?e.deltaX:e.deltaY;if(e.deltaMode!==0||Number.isInteger(t)&&Math.abs(t)>=50){if(e.timeStamp-fe.current.last<60)return;fe.current.last=e.timeStamp,ae(Math.sign(t))}else P.stop(),P.set(oZ(P.get()+t/(NX*x),ne)),clearTimeout(fe.current.settle),fe.current.settle=window.setTimeout(()=>ie(P.get()),120)},me=(0,v.useRef)({x:0,y:0,start:0,moved:!1,caught:!1,gesture:`ring`,samples:[]}),he=(0,v.useRef)(null),[ge,_e]=(0,v.useState)(!1);return(0,S.jsxs)(Ey,{open:_,onOpenChange:q,modal:`trap-focus`,onOpenChangeComplete:e=>!e&&T(!1),children:[r===void 0&&(0,S.jsxs)(Xl,{children:[(0,S.jsx)(Gl,{render:(0,S.jsx)(jy,{render:(0,S.jsxs)(vf,{variant:`ghost`,size:`icon`,"aria-label":`Choose a theme`,"aria-keyshortcuts":i?`t`:void 0,className:`relative outline-none focus-visible:border-transparent focus-visible:bg-muted focus-visible:ring-0`,children:[(0,S.jsx)(pd,{}),(0,S.jsx)(`span`,{className:`absolute right-1.5 bottom-1.5 size-2 rounded-full bg-primary ring-2 ring-background`})]})})}),(0,S.jsxs)(Kl,{children:[`Theme `,i&&(0,S.jsx)(xX,{children:`T`})]})]}),r&&(0,S.jsx)(jy,{render:r}),(0,S.jsxs)(cy,{keepMounted:A,children:[(0,S.jsx)(Vv,{className:X(`fixed inset-0 z-50 bg-background/55 duration-200 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,w&&`invisible`)}),(0,S.jsxs)(oy,{initialFocus:R,finalFocus:a,onKeyDown:de,onPointerDown:e=>{if(e.button!==0||e.target.closest(`button`))return;let t=e.pointerType===`touch`,n=e.target.closest(`[data-theme-index]`),r=n!==null&&Math.round(nZ(Number(n.dataset.themeIndex),F.current,ne))===0;if(r&&e.target.closest(`[data-select]`)){k(!0);let e=()=>{k(!1),window.removeEventListener(`pointerup`,e),window.removeEventListener(`pointercancel`,e)};window.addEventListener(`pointerup`,e),window.addEventListener(`pointercancel`,e)}if(me.current.moved=me.current.caught=!1,me.current.gesture=`ring`,ne<2&&!(t&&r))return;let i=re.current&&Math.abs(P.getVelocity())>KX;i&&P.stop(),me.current={x:e.clientX,y:e.clientY,start:P.get(),moved:!1,caught:i,gesture:t?`pending`:`ring`,samples:[{t:e.timeStamp,x:e.clientX}]};let a=e=>{let{current:t}=me,n=e.clientX-t.x;if(t.gesture===`pending`){let i=e.clientY-t.y;if(Math.hypot(n,i)<6)return;t.gesture=Math.abs(i)>Math.abs(n)?r&&!m?`tilt`:`none`:ne<2?`none`:`ring`,k(!1)}if(t.gesture===`tilt`)return he.current?.aim(e.clientX,e.clientY);if(t.gesture===`ring`){for(t.samples.push({t:e.timeStamp,x:e.clientX});t.samples.length>2&&e.timeStamp-t.samples[0].t>GX;)t.samples.shift();!t.moved&&Math.abs(n)<4||(t.moved||(k(!1),P.stop(),t.start=P.get()+n/(NX*x),_e(!0)),t.moved=!0,P.set(oZ(t.start-n/(NX*x),ne)))}},o=e=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),window.removeEventListener(`pointercancel`,o),_e(!1),me.current.gesture===`tilt`&&he.current?.release();let{samples:t}=me.current,n=t[0],r=t[t.length-1],i=e.timeStamp-r.t>50||r.t===n.t?0:(r.x-n.x)/(r.t-n.t)*1e3;me.current.moved?G(-i/(NX*x)):me.current.caught&&ie(P.get())};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o),window.addEventListener(`pointercancel`,o)},onWheel:pe,onClick:e=>{let{moved:t,caught:n,gesture:r}=me.current;if(t||n||r===`tilt`||r===`none`)return;let i=e.target;if(i.closest(`button`))return;let a=i.closest(`[data-theme-index]`);if(!a)return q(!1);let o=Number(a.dataset.themeIndex);if(i.closest(`[data-favorite]`))return ue(te[o]);let s=Math.round(nZ(o,F.current,ne));s===0?J(te[o]):ae(s)},className:X(`fixed inset-0 z-50 flex touch-none flex-col items-center justify-center overflow-hidden text-foreground outline-none select-none duration-200 data-open:duration-75 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,w&&`invisible`),children:[(0,S.jsx)(Hv,{render:(0,S.jsx)(vf,{variant:`ghost`,size:`icon`,"aria-label":`Close`,className:`absolute top-4 right-4`,children:(0,S.jsx)(Fd,{})})}),(0,S.jsxs)(Xl,{children:[(0,S.jsx)(Gl,{render:(0,S.jsx)(vf,{variant:`ghost`,size:`icon`,"aria-label":`Favorites only`,"aria-pressed":H,"aria-keyshortcuts":s,className:`absolute top-4 right-14`,onMouseDown:e=>e.preventDefault(),onClick:()=>le(!H)}),children:(0,S.jsx)(Dd,{className:X(H&&`fill-current`)})}),(0,S.jsxs)(Kl,{children:[`Favorites only `,(0,S.jsx)(xX,{children:s})]})]}),(0,S.jsxs)(bX.div,{className:`flex w-full flex-col items-center will-change-transform`,style:{scale:M},children:[(0,S.jsxs)(`div`,{className:`text-center`,children:[(0,S.jsx)(Dy,{className:`text-xs font-medium tracking-wider text-muted-foreground uppercase`,children:`Theme`}),(0,S.jsx)(`div`,{"aria-live":`polite`,className:`mt-1 h-9 overflow-hidden`,children:z?(0,S.jsxs)(`div`,{className:`text-3xl font-semibold tracking-tight whitespace-pre`,children:[z,(0,S.jsx)(`span`,{className:`ml-0.5 inline-block h-[0.9em] w-[2px] translate-y-[0.1em] animate-pulse bg-primary`})]}):(0,S.jsx)(bX.div,{initial:!m&&{y:14,opacity:0},animate:{y:0,opacity:1},transition:BX(420,32),className:`text-3xl font-semibold tracking-tight`,children:W?.label},W?.name)}),(0,S.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground tabular-nums`,children:[ne===0?H&&!z?`No favorites yet`:`No theme matches`:z?`${W?.label} · ${y+1} of ${ne}`:`${String(y+1).padStart(2,`0`)} / ${String(ne).padStart(2,`0`)}`,H&&` · favorites`,W?.name===c&&` · current`]})]}),(0,S.jsx)(`div`,{ref:R,tabIndex:0,role:`listbox`,"aria-label":`Themes`,"aria-activedescendant":W?`theme-card-${W.name}`:void 0,className:`relative my-6 w-full outline-none`,style:{height:332*x},children:(0,S.jsx)(`div`,{className:`absolute top-1/2 left-1/2`,style:{transform:`scale(${x})`},children:!w&&te.map((t,n)=>(0,S.jsx)(lZ,{theme:t,index:n,count:ne,position:P,reach:N,isFront:n===y,tilt:n===y&&!ge&&!m,aimRef:he,pressed:n===y&&(E||O),favorite:d.includes(t.name),taglineText:e?.text,taglineHighlight:e?.highlight},t.name))})}),(0,S.jsxs)(`div`,{className:`hidden items-center gap-1.5 text-xs text-muted-foreground sm:flex`,children:[(0,S.jsx)(`span`,{children:`Drag or`}),(0,S.jsx)(xX,{children:`←`}),(0,S.jsx)(xX,{children:`→`}),(0,S.jsx)(`span`,{className:`mr-2`,children:`to browse`}),(0,S.jsx)(xX,{children:`Enter`}),(0,S.jsx)(`span`,{className:`mr-2`,children:`select`}),(0,S.jsx)(`span`,{className:`mr-2`,children:`type to filter`}),(0,S.jsx)(xX,{children:o}),(0,S.jsx)(`span`,{className:`mr-2`,children:`favorite`}),(0,S.jsx)(xX,{children:s}),(0,S.jsx)(`span`,{className:`mr-2`,children:`favorites only`}),(0,S.jsx)(xX,{children:`Esc`}),(0,S.jsx)(`span`,{children:z?`clear`:`close`})]})]})]})]})]})}var cZ=e=>Math.min(1,Math.max(-1,e*2-1)),lZ=(0,v.memo)(function({theme:e,index:t,count:n,position:r,reach:i,isFront:a,tilt:o,aimRef:s,pressed:c,favorite:l,taglineText:u,taglineHighlight:d}){let f=Math.max(n,RX),p=2*Math.PI/f,m=NX*f/(2*Math.PI),h=QX(n),g=BY(r,e=>nZ(t,e,n)),_=BY(g,e=>{let t=e*p,n=1+FX*Math.max(0,1-Math.abs(e));return`translate(-50%, -50%) perspective(${IX}px) translate3d(${m*Math.sin(t)}px, 0, ${m*(Math.cos(t)-1)}px) rotateY(${t*180/Math.PI}deg) scale(${n})`}),y=BY(g,e=>Math.min(1,Math.max(0,h+.5-Math.abs(e)))),b=BY([y,g,i],([e,t,n])=>e<=0||Math.abs(t)>n?`hidden`:`visible`),x=BY(g,e=>100-Math.round(Math.abs(e)*4)),C=BY(g,e=>Math.min(.45,Math.abs(e)*.09)),w=zY(0,{stiffness:320,damping:26}),T=zY(0,{stiffness:320,damping:26}),E=zY(0,{stiffness:200,damping:30}),D=BY(T,e=>-e*LX),O=BY(w,e=>e*LX),k=BY(w,e=>`${e*25}%`),A=BY(T,e=>`${e*25}%`),j=BY([w,T,g],([e,t,n])=>Math.atan2(t,e+n)*180/Math.PI+90),M=BY(E,[0,1],[.25,1]),N=BY(O,e=>-e*1.6),P=BY(D,e=>18+e*.8),F=BY(g,e=>Math.max(0,1-Math.abs(e))),I=BY(F,e=>e<=0?`hidden`:`visible`),L=BY(F,e=>e*.5);(0,v.useEffect)(()=>{o||(w.set(0),T.set(0),E.set(0))},[o,w,T,E]);let R=(0,v.useRef)(null);return(0,v.useEffect)(()=>{if(!o)return;let e={aim(e,t){let n=R.current?.getBoundingClientRect();n&&(w.set(cZ((e-n.left)/n.width)),T.set(cZ((t-n.top)/n.height)),E.set(1))},release(){w.set(0),T.set(0),E.set(0)}};return s.current=e,()=>{s.current===e&&(s.current=null)}},[o,s,w,T,E]),(0,S.jsxs)(bX.div,{"data-theme-index":t,className:`absolute top-0 left-0 cursor-pointer transform-3d`,style:{width:jX,height:MX,transform:_,opacity:y,visibility:b,zIndex:x},ref:R,onPointerMove:e=>{o&&e.pointerType!==`touch`&&s.current?.aim(e.clientX,e.clientY)},onPointerLeave:e=>{e.pointerType!==`touch`&&(w.set(0),T.set(0),E.set(0))},children:[(0,S.jsx)(bX.div,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-[8%] top-[12%] bottom-0 rounded-4xl bg-black blur-2xl`,style:{x:N,y:P,z:-40,opacity:L,visibility:I}}),(0,S.jsx)(bX.div,{id:`theme-card-${e.name}`,role:`option`,"aria-selected":a,"aria-label":l?`${e.label}, favorite`:e.label,className:`relative size-full transform-3d`,style:{rotateX:D,rotateY:O},children:(0,S.jsxs)(AX,{theme:e,tagline:u&&d?{text:u,highlight:d}:void 0,depth:1,grain:a,selectable:a,pressed:c,className:`size-full`,children:[(0,S.jsx)(`span`,{"data-favorite":!0,"aria-hidden":!0,className:X(`pointer-events-auto absolute top-1 right-1 flex size-11 items-center justify-center rounded-full transition duration-150 ease-out hover:scale-115`,l?`text-primary`:`text-muted-foreground/60 hover:text-foreground`),children:(0,S.jsx)(Dd,{className:X(`size-4`,l&&`fill-current`)})}),(0,S.jsx)(bX.div,{"aria-hidden":!0,className:`absolute inset-0 rounded-3xl bg-black`,style:{opacity:C}}),(0,S.jsx)(bX.div,{className:`absolute inset-0`,style:{opacity:F,visibility:I},children:(0,S.jsx)(CX,{glareX:k,glareY:A,rimAngle:j,shine:E,rimOpacity:M,glare:.55,rim:.7,rimWidth:.5})})]})})]})}),uZ=Bd(`flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1`,{variants:{orientation:{horizontal:`*:data-slot:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-lg! [&>[data-slot]~[data-slot]]:rounded-l-none [&>[data-slot]~[data-slot]]:border-l-0`,vertical:`flex-col *:data-slot:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-lg! [&>[data-slot]~[data-slot]]:rounded-t-none [&>[data-slot]~[data-slot]]:border-t-0`}},defaultVariants:{orientation:`horizontal`}});function dZ({className:e,orientation:t,...n}){return(0,S.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":t,className:X(uZ({orientation:t}),e),...n})}function fZ({...e}){return(0,S.jsx)(Zw,{"data-slot":`dropdown-menu`,...e})}function pZ({...e}){return(0,S.jsx)(tT,{"data-slot":`dropdown-menu-trigger`,...e})}function mZ({align:e=`start`,alignOffset:t=0,side:n=`bottom`,sideOffset:r=4,className:i,...a}){return(0,S.jsx)(zw,{children:(0,S.jsx)(Bw,{className:`isolate z-50 outline-none`,align:e,alignOffset:t,side:n,sideOffset:r,children:(0,S.jsx)(Iw,{"data-slot":`dropdown-menu-content`,className:X(`z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95`,i),...a})})})}function hZ({...e}){return(0,S.jsx)(ww,{"data-slot":`dropdown-menu-group`,...e})}function gZ({className:e,inset:t,...n}){return(0,S.jsx)(Tw,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:X(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,e),...n})}function _Z({className:e,inset:t,variant:n=`default`,...r}){return(0,S.jsx)(Dw,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:X(`group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function vZ({className:e,...t}){return(0,S.jsx)(Fx,{"data-slot":`dropdown-menu-separator`,className:X(`-mx-1 my-1 h-px bg-border`,e),...t})}function yZ({act:e,open:t,onOpenChange:n,onCloned:r,finalFocus:i}){return(0,S.jsx)(My,{open:t,onOpenChange:n,children:(0,S.jsxs)(Iy,{className:`sm:max-w-xl`,finalFocus:i,children:[(0,S.jsxs)(Ly,{children:[(0,S.jsx)(zy,{children:`Clone a repo`}),(0,S.jsx)(By,{children:`Your GitHub repos that aren't cloned yet, newest first. Once cloned, workwork looks for work in it.`})]}),(0,S.jsx)(bZ,{act:e,onCloned:r})]})})}function bZ({act:e,onCloned:t}){let[n,r]=(0,v.useState)(),[i,a]=(0,v.useState)(),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)();if((0,v.useEffect)(()=>{rf.repos().then(r,e=>a(e.message))},[]),i)return(0,S.jsx)(`p`,{className:`text-sm text-destructive`,children:i});if(!n)return(0,S.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,S.jsx)(Vy,{}),` Asking GitHub`]});let u=o.toLowerCase(),d=n.repos.filter(e=>e.name.toLowerCase().includes(u)||e.description.toLowerCase().includes(u)),f=i=>e(async()=>{l(i.name);try{await rf.clone(i.name),t(),r({...n,repos:n.repos.filter(e=>e!==i)})}finally{l(void 0)}});return(0,S.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-3`,children:[(0,S.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Clones into `,n.root,`/`]}),(0,S.jsx)(Uf,{placeholder:`Search ${n.repos.length} repos`,value:o,onChange:e=>s(e.target.value)}),(0,S.jsxs)(Ix,{className:`max-h-[50svh] overflow-y-auto`,children:[d.map(e=>(0,S.jsx)(Gx,{title:e.name,meta:[e.description,`created ${e.createdAt.slice(0,10)}`].filter(Boolean).join(` · `),children:(0,S.jsxs)(vf,{variant:`outline`,size:`sm`,disabled:c!==void 0,onClick:()=>f(e),children:[c===e.name&&(0,S.jsx)(Vy,{}),` Clone`]})},e.name)),d.length===0&&(0,S.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n.repos.length?`No repo matches.`:`Every repo of yours is cloned.`})]})]})}var xZ=Bd(`group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-transparent`,outline:`border border-input bg-transparent hover:bg-muted`},size:{default:`h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,sm:`h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`}},defaultVariants:{variant:`default`,size:`default`}}),SZ=v.createContext({size:`default`,variant:`default`,spacing:2,orientation:`horizontal`});function CZ({className:e,variant:t,size:n,spacing:r=2,orientation:i=`horizontal`,children:a,...o}){return(0,S.jsx)(rE,{"data-slot":`toggle-group`,"data-variant":t,"data-size":n,"data-spacing":r,"data-orientation":i,style:{"--gap":r},className:X(`group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch`,e),...o,children:(0,S.jsx)(SZ.Provider,{value:{variant:t,size:n,spacing:r,orientation:i},children:a})})}function wZ({className:e,children:t,variant:n=`default`,size:r=`default`,...i}){let a=v.useContext(SZ);return(0,S.jsx)(eE,{"data-slot":`toggle-group-item`,"data-variant":a.variant||n,"data-size":a.size||r,"data-spacing":a.spacing,className:X(`shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t`,xZ({variant:a.variant||n,size:a.size||r}),e),...i,children:t})}var TZ=``,EZ={value:`clone-project`,label:`Clone project...`},DZ=100,OZ=e=>`${e.repo} ${e.id}`;function kZ({snapshot:e,act:t}){let[n,r]=(0,v.useState)(!1),[i,a]=(0,v.useState)(0),o=(0,v.useRef)(null),[s,c]=(0,v.useState)([]),[l,u]=(0,v.useState)([]),[d,f]=(0,v.useState)(TZ),[p,m]=(0,v.useState)(TZ),[h,g]=(0,v.useState)([`auto`,`skim`,`decide`]),[_,y]=(0,v.useState)(``),[b,x]=(0,v.useState)(DZ),[C,w]=(0,v.useState)(new Map),[T,E]=(0,v.useState)(0),{at:D,count:O,refreshing:k}=e.candidates;(0,v.useEffect)(()=>{let e=!1;return rf.candidates().then(({items:t,repos:n})=>{e||(c(t),u(n))}),()=>{e=!0}},[D,i]),(0,v.useEffect)(()=>{rf.plays().then(e=>w(new Map(e.map(e=>[e.name,e.description]))))},[D]);let A=(0,v.useMemo)(()=>{let t=new Map;for(let n of e.jobs)n.state!==`removed`&&t.set(OZ(n.item),n);return t},[e.jobs]),j={value:TZ,label:`All repos (${s.length})`},M=(0,v.useMemo)(()=>{let e=new Map;for(let t of s)e.set(t.repo,(e.get(t.repo)??0)+1);return l.map(t=>({value:t,label:`${Yd(t)} (${e.get(t)??0})`})).sort((e,t)=>e.label.localeCompare(t.label))},[s,l]),N=d===TZ?s:s.filter(e=>e.repo===d),P=new Map;for(let e of N)P.set(e.play,(P.get(e.play)??0)+1);let F=[...P].sort((e,t)=>e[1]-t[1]),I=_.toLowerCase().split(/\s+/).filter(Boolean),L=N.filter(e=>(p===TZ||e.play===p)&&h.includes(e.level)&&I.every(t=>`${Xd(e)} ${e.id} ${e.label}`.toLowerCase().includes(t))),R=(e,n)=>t(()=>rf.queue(e,n)),z=L.filter(e=>!A.has(OZ(e))),B=(0,S.jsxs)(Vd,{children:[(0,S.jsxs)(Hd,{children:[(0,S.jsx)(Ud,{children:k?`Asking workwork`:`No candidates yet`}),(0,S.jsx)(Wd,{children:k?`workwork is looking through every repo under $SRC. That takes a few minutes.`:d===TZ?`Ask workwork for candidates across your repos. It takes a few minutes.`:`There are no candidates for ${Yd(d)}.`})]}),(0,S.jsx)(Gd,{children:(0,S.jsxs)(vf,{variant:`outline`,disabled:k,onClick:()=>t(rf.refreshCandidates),children:[k&&(0,S.jsx)(Vy,{}),` Ask workwork`]})})]});return(0,S.jsxs)(`div`,{className:`flex flex-col gap-4 pt-2`,children:[(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsx)(Uf,{className:`max-w-xs`,placeholder:`Search titles, ids, repos`,value:_,onChange:e=>y(e.target.value)}),(0,S.jsx)(CZ,{multiple:!0,variant:`outline`,value:h,onValueChange:g,children:[`auto`,`skim`,`decide`].map(e=>(0,S.jsx)(wZ,{value:e,children:e},e))}),(0,S.jsxs)(ME,{items:[j,...M,EZ],value:d,onValueChange:e=>{if(e===EZ.value){r(!0);return}let t=e??TZ;f(t),x(DZ),s.some(e=>e.play===p&&(t===TZ||e.repo===t))||m(TZ)},children:[(0,S.jsx)(FE,{"aria-label":`Repo`,ref:o,children:(0,S.jsx)(PE,{})}),(0,S.jsxs)(IE,{alignItemWithTrigger:!1,children:[(0,S.jsxs)(NE,{children:[(0,S.jsx)(LE,{value:j.value,children:j.label}),M.map(e=>(0,S.jsx)(LE,{value:e.value,children:e.label},e.value))]}),(0,S.jsx)(RE,{}),(0,S.jsx)(NE,{children:(0,S.jsx)(LE,{value:EZ.value,children:EZ.label})})]})]}),(0,S.jsx)(yZ,{act:t,open:n,onOpenChange:r,onCloned:()=>a(e=>e+1),finalFocus:o}),(0,S.jsxs)(`span`,{className:`flex flex-1 items-center justify-end gap-2 text-sm text-muted-foreground`,children:[k?`Asking workwork…`:`${O} candidates${D?`, ${qd(D)}`:``}`,(0,S.jsxs)(Xl,{children:[(0,S.jsx)(Gl,{render:(0,S.jsx)(vf,{variant:`ghost`,size:`icon-sm`,"aria-label":`Refresh candidates`,disabled:k,onClick:()=>{E(T+1),t(rf.refreshCandidates)}}),children:(0,S.jsx)(yd,{className:T?`refresh-turn`:void 0},T)}),(0,S.jsx)(Kl,{children:k?`Asking workwork, takes a few minutes`:`Ask workwork again`})]})]})]}),N.length===0?B:(0,S.jsxs)(`div`,{className:`flex flex-col gap-6 md:flex-row`,children:[(0,S.jsx)(`nav`,{className:`flex flex-wrap gap-1 md:w-48 md:flex-none md:flex-col`,children:[[TZ,N.length],...F].map(([e,t])=>(0,S.jsxs)(Xl,{disabled:!C.has(e),children:[(0,S.jsxs)(Gl,{render:(0,S.jsx)(vf,{variant:p===e?`secondary`:`ghost`,size:`sm`,onClick:()=>{m(e),x(DZ)}}),children:[(0,S.jsx)(`span`,{className:`flex-1 text-left`,children:e||`All plays`}),(0,S.jsx)(`span`,{className:`text-muted-foreground`,children:t})]}),(0,S.jsx)(Kl,{side:`right`,children:C.get(e)})]},e))}),(0,S.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,S.jsxs)(Kx,{title:(0,S.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,S.jsxs)(`span`,{className:`flex-1`,children:[L.length,` matching, `,z.length,` not queued yet`]}),z.length>0&&z.length<=20&&(0,S.jsx)(AZ,{label:`Queue all ${z.length}`,presets:e.settings.presets,onQueue:e=>R(z,e)})]}),children:[(0,S.jsx)(Ix,{children:L.slice(0,b).map(n=>{let r=A.get(OZ(n)),i=(0,S.jsx)(AZ,{label:`Queue`,presets:e.settings.presets,onQueue:e=>R([n],e)});return(0,S.jsx)(Gx,{leading:(0,S.jsx)(uD,{state:fD(r,e.prs)}),title:(0,S.jsx)(mD,{item:n,job:r,play:C.get(n.play),snapshot:e,act:t,actions:!r&&i}),meta:(0,S.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,S.jsx)(dD,{state:fD(r,e.prs)}),[n.play,n.level,n.id].join(` · `)]}),children:!r&&i},OZ(n))})}),L.length>b&&(0,S.jsxs)(vf,{variant:`ghost`,onClick:()=>x(b+DZ),children:[`Show `,Math.min(DZ,L.length-b),` more`]})]})})]})]})}function AZ({label:e,presets:t,onQueue:n}){return(0,S.jsxs)(dZ,{children:[(0,S.jsx)(vf,{variant:`outline`,size:`sm`,onClick:()=>n(),children:e}),(0,S.jsxs)(fZ,{children:[(0,S.jsxs)(Xl,{children:[(0,S.jsx)(Gl,{render:(0,S.jsx)(pZ,{render:(0,S.jsx)(vf,{variant:`outline`,size:`icon-sm`,"aria-label":`${e} with`})}),children:(0,S.jsx)(Tu,{})}),(0,S.jsxs)(Kl,{children:[e,` for a specific agent or preset`]})]}),(0,S.jsxs)(mZ,{align:`end`,className:`w-auto`,children:[(0,S.jsxs)(hZ,{children:[(0,S.jsx)(gZ,{children:`Agent`}),qx.map(e=>(0,S.jsx)(_Z,{onClick:()=>n({agent:e}),children:e},e))]}),(0,S.jsx)(vZ,{}),(0,S.jsxs)(hZ,{children:[(0,S.jsx)(gZ,{children:`Preset`}),t.length===0&&(0,S.jsx)(_Z,{disabled:!0,children:`Add presets in Settings`}),t.map((e,t)=>(0,S.jsx)(_Z,{onClick:()=>n(e),children:ef(e)},t))]})]})]})]})}function jZ({snapshot:e,act:t}){let{settings:n,on:r}=e,[i,a]=(0,v.useState)();return(0,S.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,S.jsxs)(Xl,{children:[(0,S.jsxs)(Gl,{render:(0,S.jsx)(OE,{orientation:`horizontal`}),children:[(0,S.jsx)(Nx,{id:`auto`,checked:n.auto.on,onCheckedChange:e=>t(()=>rf.saveSettings({...n,auto:{...n.auto,on:e}}))}),(0,S.jsx)(AE,{htmlFor:`auto`,children:`Auto`})]}),(0,S.jsx)(Kl,{children:`Keep the queue topped up from candidates while the factory is on`})]}),(0,S.jsxs)(Xl,{disabled:r,children:[(0,S.jsx)(Gl,{render:(0,S.jsx)(vf,{variant:`outline`,onClick:e=>{let i={agents:n.agents,limit:n.limit,until:n.until};r?t(rf.turnOff):e.shiftKey?t(()=>rf.turnOn(i)):a(i)}}),children:r?`Turn off`:`Turn on`}),(0,S.jsx)(Kl,{children:`Shift-click to turn on with your defaults`})]}),(0,S.jsx)(My,{open:i!==void 0,onOpenChange:e=>!e&&a(void 0),children:(0,S.jsxs)(Iy,{children:[(0,S.jsxs)(Ly,{children:[(0,S.jsx)(zy,{children:`Turn the factory on`}),(0,S.jsx)(By,{children:`For this run only; the defaults are under Settings. Your picks go first, then what auto mode queues.`})]}),i&&(0,S.jsx)(UE,{value:i,onChange:a}),(0,S.jsx)(Ry,{children:(0,S.jsx)(vf,{disabled:!i||Object.keys(i.agents).length===0,onClick:()=>t(async()=>{await rf.turnOn(i),a(void 0)}),children:`Turn on`})})]})})]})}var MZ={value:`new-project`,label:`New project...`};function NZ({act:e,open:t,onOpenChange:n,onCreated:r}){return(0,S.jsx)(My,{open:t,onOpenChange:n,children:(0,S.jsxs)(Iy,{className:`sm:max-w-2xl`,children:[(0,S.jsxs)(Ly,{children:[(0,S.jsx)(zy,{children:`New goal`}),(0,S.jsx)(By,{children:`A goal is one large task, planned into jobs. Nothing runs until you approve the plan.`})]}),(0,S.jsxs)(ux,{defaultValue:`brief`,children:[(0,S.jsxs)(fx,{children:[(0,S.jsx)(px,{value:`brief`,children:`From a brief`}),(0,S.jsx)(px,{value:`plan`,children:`Import a plan`})]}),(0,S.jsx)(mx,{value:`brief`,children:(0,S.jsx)(PZ,{act:e,onCreated:r})}),(0,S.jsx)(mx,{value:`plan`,children:(0,S.jsx)(FZ,{act:e,onCreated:r})})]})]})})}function PZ({act:e,onCreated:t}){let[n,r]=(0,v.useState)(),[i,a]=(0,v.useState)(``),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(``),[f,p]=(0,v.useState)(!1);(0,v.useEffect)(()=>{rf.candidates().then(r)},[]);let m=o===MZ.value,h=(n?.repos??[]).map(e=>({value:e,label:Yd(e)})),g=i.trim()&&(m?c.trim():o),_=()=>e(async()=>{p(!0);try{t((await rf.newGoal({title:i,brief:u,...m?{project:c.trim()}:{repo:o}})).id)}finally{p(!1)}});return(0,S.jsxs)(EE,{className:`mt-2`,children:[(0,S.jsxs)(OE,{children:[(0,S.jsx)(AE,{htmlFor:`goal-title`,children:`Title`}),(0,S.jsx)(Uf,{id:`goal-title`,autoFocus:!0,placeholder:`GPUI client for Tasks`,value:i,onChange:e=>a(e.target.value)})]}),(0,S.jsxs)(OE,{children:[(0,S.jsx)(AE,{children:`Repo`}),(0,S.jsxs)(ME,{items:[...h,MZ],value:o,onValueChange:e=>s(e??``),children:[(0,S.jsx)(FE,{"aria-label":`Repo`,children:(0,S.jsx)(PE,{placeholder:`Pick a repo`})}),(0,S.jsxs)(IE,{alignItemWithTrigger:!1,children:[(0,S.jsx)(NE,{children:h.map(e=>(0,S.jsx)(LE,{value:e.value,children:e.label},e.value))}),(0,S.jsx)(RE,{}),(0,S.jsx)(NE,{children:(0,S.jsx)(LE,{value:MZ.value,children:MZ.label})})]})]}),m&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Uf,{"aria-label":`Project name`,placeholder:`units`,value:c,onChange:e=>l(e.target.value)}),(0,S.jsxs)(jE,{children:[`Creates `,n?.root,`/`,c.trim()||`<name>`,` and a private GitHub repo of the same name.`]})]})]}),(0,S.jsxs)(OE,{children:[(0,S.jsx)(AE,{htmlFor:`goal-brief`,children:`Brief`}),(0,S.jsx)(iE,{id:`goal-brief`,className:`min-h-48`,placeholder:`What done looks like, constraints, links to specs, and the commands that prove it works.`,value:u,onChange:e=>d(e.target.value)}),(0,S.jsx)(jE,{children:`Markdown. A communicator plans it into jobs, which wait for your approval here.`})]}),(0,S.jsx)(Ry,{children:(0,S.jsx)(vf,{disabled:!g||f,onClick:_,children:f?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Vy,{}),` `,m?`Creating the repo…`:`Setting up the branch…`]}):`Plan it`})})]})}function FZ({act:e,onCreated:t}){let[n,r]=(0,v.useState)(``),[i,a]=(0,v.useState)(!1);return(0,S.jsxs)(EE,{className:`mt-2`,children:[(0,S.jsxs)(OE,{children:[(0,S.jsx)(AE,{htmlFor:`goal-plan`,children:`Plan`}),(0,S.jsx)(iE,{id:`goal-plan`,className:`min-h-64`,placeholder:`{ "format": "factory-plan/1", "goal": { ... }, "nodes": [ ... ] }`,value:n,onChange:e=>r(e.target.value)}),(0,S.jsx)(jE,{children:`JSON or YAML in factory-plan/1, as in spec/plan-format.md. It's validated before anything changes.`})]}),(0,S.jsx)(Ry,{children:(0,S.jsx)(vf,{disabled:!n.trim()||i,onClick:()=>e(async()=>{a(!0);try{t((await rf.importPlan(n)).id)}finally{a(!1)}}),children:i?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Vy,{}),` Importing…`]}):`Import`})})]})}var IZ={communicator:`comm`,builder:`build`,grunt:`grunt`};function LZ(e,t){if(e.blocked)return RZ[e.blocked];if(e.state===`queued`)return t.some(e=>e.item.play===`decompose`&&(e.state===`queued`||e.state===`running`))?`planning`:`working`}var RZ={checkpoint:`needs your approval`,paused:`paused`,red:`integration branch red`,asked:`waiting for you`,held:`held by a failure`,review:`merging`},zZ=e=>e.charAt(0).toUpperCase()+e.slice(1)+`.`,BZ=(e,t)=>e.filter(e=>e.of===t.id&&e.state!==`removed`);function VZ(e,t){return[t,...e].flatMap(e=>[e.added,...e.notes.map(e=>e.at),...e.attempts.map(e=>e.end)]).sort().at(-1)}function HZ({snapshot:e,act:t}){let[n,r]=xx(`goal`,``),[i,a]=(0,v.useState)(!1),o=e.jobs.filter(e=>e.goal&&e.state!==`removed`),s=o.find(e=>e.id===n);return s?(0,S.jsx)(WZ,{goal:s,snapshot:e,act:t,onBack:()=>r(``)}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(UZ,{goals:o,snapshot:e,act:t,onNew:()=>a(!0),onOpen:r}),(0,S.jsx)(NZ,{act:t,open:i,onOpenChange:a,onCreated:e=>{a(!1),r(e)}})]})}function UZ({goals:e,snapshot:t,act:n,onNew:r,onOpen:i}){let a=(0,S.jsxs)(vf,{variant:`outline`,onClick:r,children:[(0,S.jsx)(_d,{}),` New goal`]});return e.length===0?(0,S.jsxs)(Vd,{children:[(0,S.jsxs)(Hd,{children:[(0,S.jsx)(Ud,{children:`No goals yet`}),(0,S.jsx)(Wd,{children:`A goal is one large task, planned into jobs that run on their own branch.`})]}),(0,S.jsx)(Gd,{children:a})]}):(0,S.jsxs)(`div`,{className:`flex flex-col gap-4 pt-2`,children:[(0,S.jsx)(`div`,{className:`flex justify-end`,children:a}),(0,S.jsx)(Ix,{children:e.map(e=>{let r=BZ(t.jobs,e),a=r.filter(e=>e.state===`done`).length,o=r.reduce((e,t)=>e+t.attempts.length,0),s=e.goal.budget?.attempts;return(0,S.jsxs)(Gx,{leading:(0,S.jsx)(uD,{state:e.state}),progress:r.length?a/r.length:0,title:(0,S.jsx)(`button`,{type:`button`,className:`text-left hover:underline`,onClick:()=>i(e.id),children:e.item.title}),meta:(0,S.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,S.jsx)(dD,{state:e.state,label:LZ(e,r)}),(0,S.jsxs)(`span`,{children:[a,`/`,r.length,` done`]}),Ov.map(e=>{let t=r.filter(t=>t.tier===e);return t.length?(0,S.jsxs)(`span`,{children:[IZ[e],` `,t.filter(e=>e.state===`done`).length,`/`,t.length]},e):null}),(0,S.jsxs)(`span`,{children:[o,s?`/${s}`:``,` attempts`]}),(0,S.jsx)(`span`,{children:qd(VZ(r,e))})]}),children:[e.blocked===`checkpoint`&&(0,S.jsx)(YZ,{goal:e,act:n}),(0,S.jsx)(vf,{variant:`ghost`,size:`icon-sm`,"aria-label":`Open goal`,onClick:()=>i(e.id),children:(0,S.jsx)(Du,{})})]},e.id)})})]})}function WZ({goal:e,snapshot:t,act:n,onBack:r}){let{jobs:i,status:a}=t,o=BZ(i,e),s=e.goal,c=o.filter(e=>e.state===`done`).length,l=o.reduce((e,t)=>e+t.attempts.length,0),u=e.blocked===`red`,d=e.notes.findLast(e=>e.kind===`factory`),f=Nv(e),p=o.filter(e=>kv.includes(e.item.play)),m=o.flatMap(e=>e.unverified.map(t=>({node:e,need:t}))),h=o.flatMap(e=>e.notes.flatMap((t,n)=>t.kind===`assume`&&!e.notes.some(e=>e.kind===`answer`&&e.re===n)?[{node:e,note:t}]:[]));return(0,S.jsxs)(`div`,{className:`flex flex-col gap-6 pt-2`,children:[(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsx)(vf,{variant:`ghost`,size:`icon-sm`,"aria-label":`All goals`,onClick:r,children:(0,S.jsx)(_u,{})}),(0,S.jsx)(`h2`,{className:`font-heading text-lg font-semibold`,children:e.item.title}),(0,S.jsx)(dD,{state:e.state,label:LZ(e,o)}),(0,S.jsxs)(`span`,{className:`ml-auto flex gap-1`,children:[e.blocked===`checkpoint`&&(0,S.jsx)(YZ,{goal:e,act:n}),e.blocked===`paused`?(0,S.jsx)(vf,{variant:`outline`,size:`sm`,onClick:()=>n(()=>rf.goal(e.id,`resume`)),children:`Resume`}):e.state!==`done`&&(0,S.jsx)(vf,{variant:`outline`,size:`sm`,onClick:()=>n(()=>rf.goal(e.id,`pause`)),children:`Pause`}),e.state!==`done`&&(0,S.jsx)(XZ,{goal:e,act:n}),e.state!==`done`&&(0,S.jsx)(vf,{variant:`ghost`,size:`sm`,onClick:()=>n(()=>rf.goal(e.id,`cancel`)),children:`Cancel goal`})]})]}),(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 text-sm text-muted-foreground`,children:[(0,S.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,S.jsx)(Gu,{className:`size-4`}),` goal/`,s.slug]}),(0,S.jsx)(`span`,{className:u?`text-destructive`:``,children:s.gates.length===0?`no goal gates`:`${u?`red`:`green`}: ${s.gates.map(e=>`\`${e}\``).join(`, `)}`}),(0,S.jsxs)(`span`,{children:[c,`/`,o.length,` done`]}),(0,S.jsxs)(`span`,{children:[l,s.budget?` of ${s.budget.attempts}`:``,` attempts`]}),f&&(0,S.jsx)(`a`,{className:`text-primary hover:underline`,href:f,target:`_blank`,rel:`noreferrer`,children:`final PR`})]}),e.blocked===`checkpoint`&&(0,S.jsx)(`p`,{className:`rounded-md border border-warning/50 bg-warning/10 p-3 text-sm`,children:zZ(e.why??d?.text??`waiting for your approval`)}),u&&d&&(0,S.jsxs)(`p`,{className:`rounded-md border border-destructive/40 p-3 text-sm text-destructive`,children:[d.text,`; a fix is queued at the front.`]}),(m.length>0||h.length>0)&&(0,S.jsx)(Kx,{title:`For you to check`,children:(0,S.jsxs)(`ul`,{className:`flex flex-col gap-2 text-sm`,children:[m.map(({node:e,need:t})=>(0,S.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsx)(cf,{variant:`outline`,children:`unverified`}),(0,S.jsxs)(`span`,{className:`flex-1`,children:[e.item.title,`: `,t]}),(0,S.jsx)(vf,{size:`sm`,variant:`outline`,onClick:()=>n(()=>rf.verify(e.id,t)),children:`Checked`})]},`${e.id} ${t}`)),h.map(({node:e,note:t})=>(0,S.jsx)(JZ,{node:e,question:t.text,assumed:t.assumed??``,act:n},`${e.id} ${t.at}`))]})}),p.length>0&&(0,S.jsx)(Kx,{title:`Planning`,children:(0,S.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:p.map(e=>(0,S.jsx)(qZ,{node:e,snapshot:t,act:n,status:a,onPath:!1,dependency:!1,onHover:()=>{}},e.id))})}),(0,S.jsx)(Kx,{title:`Plan`,children:(0,S.jsx)(`div`,{className:`overflow-x-auto pb-2`,children:(0,S.jsx)(GZ,{nodes:o.filter(e=>!e.parent&&!p.includes(e)),all:o,snapshot:t,act:n,status:a})})})]})}function GZ({nodes:e,all:t,snapshot:n,act:r,status:i}){let[a,o]=(0,v.useState)(),s=Lv(e.filter(e=>!e.branchOf));for(let t of e.filter(e=>e.branchOf))s.set(t.id,s.get(t.branchOf)??0);let c=Rv(t),l=new Set(t.find(e=>e.id===a)?.after??[]),u=[...new Set(s.values())].sort((e,t)=>e-t);return(0,S.jsx)(`div`,{className:`flex w-max gap-3`,children:u.map(a=>(0,S.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.filter(e=>s.get(e.id)===a).map(e=>{let a=t.filter(t=>t.parent===e.id),s={node:e,snapshot:n,act:r,status:i,onPath:c.size>1&&c.has(e.id),dependency:l.has(e.id),onHover:o};return a.length>0?(0,S.jsx)(KZ,{...s,members:a,all:t},e.id):(0,S.jsx)(qZ,{...s},e.id)})},a))})}function KZ({members:e,all:t,...n}){let{node:r,snapshot:i,act:a,status:o}=n,s=e.filter(e=>e.state===`done`).length;return(0,S.jsx)(`div`,{className:`min-w-60 rounded-md border border-dashed p-2`,children:(0,S.jsxs)(XF,{defaultOpen:r.state!==`done`,children:[(0,S.jsxs)(ZF,{render:(0,S.jsx)(`button`,{type:`button`,className:`flex w-full items-center gap-2 text-left text-sm font-medium`}),children:[(0,S.jsx)(uD,{state:r.state}),(0,S.jsx)(`span`,{className:`flex-1`,children:r.item.title}),(0,S.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[s,`/`,e.length]})]}),(0,S.jsx)(QF,{className:`mt-2`,children:(0,S.jsx)(GZ,{nodes:e,all:t,snapshot:i,act:a,status:o})})]})})}function qZ({node:e,snapshot:t,act:n,status:r,onPath:i,dependency:a,onHover:o}){let s=r?.workers.find(t=>t.job===e.id),c=e.notes.findLast(t=>t.kind===`step`&&t.attempt===e.attempts.length+1),l=e.attempts.some(e=>(e.compactions??0)>2);return(0,S.jsxs)(`div`,{className:`flex w-60 flex-col gap-1 rounded-md border bg-card p-2 text-sm ${a?`ring-2 ring-accent`:i?`border-primary/60`:``}`,onMouseEnter:()=>o(e.id),onMouseLeave:()=>o(void 0),children:[(0,S.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,S.jsx)(uD,{state:e.state}),(0,S.jsx)(`span`,{className:`min-w-0 flex-1 wrap-anywhere [&_button]:whitespace-normal`,children:(0,S.jsx)(mD,{item:e.item,job:e,snapshot:t,act:n,bare:!0})})]}),(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[e.tier&&(0,S.jsx)(cf,{variant:`secondary`,children:e.tier}),e.front&&(0,S.jsx)(cf,{variant:`outline`,children:`factory`}),e.blocked&&(0,S.jsx)(`span`,{children:RZ[e.blocked]}),e.attempts.length>0&&(0,S.jsxs)(`span`,{children:[e.attempts.length,` attempt`,e.attempts.length===1?``:`s`]}),l&&(0,S.jsxs)(Xl,{children:[(0,S.jsxs)(Gl,{render:(0,S.jsx)(`span`,{className:`flex items-center text-warning`}),children:[(0,S.jsx)(Uu,{className:`size-3.5`}),` heavy`]}),(0,S.jsx)(Kl,{children:`Compacted more than twice; replans split work like this smaller.`})]}),i&&(0,S.jsx)(`span`,{className:`text-primary`,children:`critical path`})]}),s&&(0,S.jsxs)(`div`,{className:`text-xs`,children:[(0,S.jsx)(`span`,{className:`text-primary`,children:s.id}),`, `,Jd(s.since),` min`,s.context?`, ${Math.round(s.context/1e3)}k context`:``,(0,S.jsx)(`div`,{className:`truncate text-muted-foreground`,children:c?`${c.text}${c.of?` (${c.done??0}/${c.of})`:``}`:s.activity??`starting`})]})]})}function JZ({node:e,question:t,assumed:n,act:r}){let[i,a]=(0,v.useState)(``);return(0,S.jsxs)(`li`,{className:`flex flex-col gap-1`,children:[(0,S.jsxs)(`span`,{children:[(0,S.jsx)(cf,{variant:`outline`,children:`assumed`}),` `,e.item.title,`: assumed`,` `,(0,S.jsx)(`strong`,{children:n}),`, asked `,t]}),(0,S.jsxs)(`form`,{className:`flex gap-2`,onSubmit:t=>{t.preventDefault(),r(()=>rf.answer(e.id,i))},children:[(0,S.jsx)(Uf,{value:i,onChange:e=>a(e.target.value),placeholder:`A different answer queues a change`}),(0,S.jsx)(vf,{type:`submit`,variant:`outline`,size:`sm`,disabled:!i.trim(),children:`Answer`}),(0,S.jsx)(vf,{type:`button`,size:`sm`,onClick:()=>r(()=>rf.answer(e.id,`fine`)),children:`Fine`})]})]})}function YZ({goal:e,act:t}){return(0,S.jsx)(vf,{size:`sm`,onClick:()=>t(()=>rf.goal(e.id,`approve`)),children:`Approve`})}function XZ({goal:e,act:t}){let[n,r]=(0,v.useState)();return n===void 0?(0,S.jsx)(vf,{variant:`outline`,size:`sm`,onClick:()=>r(``),children:`Replan`}):(0,S.jsxs)(`form`,{className:`flex gap-1`,onSubmit:i=>{i.preventDefault(),t(()=>rf.replan(e.id,n)).then(()=>r(void 0))},children:[(0,S.jsx)(Uf,{autoFocus:!0,value:n,onChange:e=>r(e.target.value),placeholder:`Why replan?`,className:`h-8 w-48`}),(0,S.jsx)(vf,{type:`submit`,size:`sm`,disabled:!n.trim(),children:`Queue`})]})}var ZZ={y:14.2,width:3,height:3.4,rx:.6};function QZ({working:e}){return(0,S.jsxs)(`svg`,{viewBox:`0 0 48 48`,width:32,height:32,"aria-hidden":!0,className:e?`logo-working`:void 0,children:[(0,S.jsx)(`rect`,{width:`48`,height:`48`,rx:`10.5`,className:`logo-tile`}),(0,S.jsxs)(`g`,{transform:`translate(6 6) scale(1.5)`,children:[(0,S.jsx)(`g`,{fill:`none`,className:`logo-ink`,strokeWidth:`2.25`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,S.jsx)(`path`,{d:`M3 19a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8.5a.5.5 0 0 0-.769-.422l-4.462 2.844A.5.5 0 0 1 15 10.5v-2a.5.5 0 0 0-.769-.422L9.77 10.922A.5.5 0 0 1 9 10.5V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2z`})}),(0,S.jsx)(`g`,{className:`logo-ink-fill`,children:[6.5,10.5,14.5].map(e=>(0,S.jsx)(`rect`,{className:`logo-window`,x:e,...ZZ},e))})]})]})}function $Z({dialog:e,onAnswer:t}){let[n,r]=(0,v.useState)(e.method===`editor`?e.prefill??``:``),i=e.method===`input`||e.method===`editor`;return(0,S.jsx)(My,{open:!0,onOpenChange:e=>!e&&t({cancelled:!0}),children:(0,S.jsxs)(Iy,{children:[(0,S.jsxs)(Ly,{children:[(0,S.jsx)(zy,{children:e.title}),e.method===`confirm`&&e.message&&(0,S.jsx)(By,{children:e.message})]}),e.method===`input`&&(0,S.jsx)(Uf,{autoFocus:!0,value:n,placeholder:e.placeholder,onChange:e=>r(e.target.value),onKeyDown:e=>e.key===`Enter`&&t({value:n})}),e.method===`editor`&&(0,S.jsx)(iE,{autoFocus:!0,value:n,onChange:e=>r(e.target.value)}),(0,S.jsxs)(Ry,{children:[e.method===`select`&&e.options.map(e=>(0,S.jsx)(vf,{variant:`outline`,onClick:()=>t({value:e}),children:e},e)),e.method===`confirm`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(vf,{variant:`outline`,onClick:()=>t({confirmed:!1}),children:`No`}),(0,S.jsx)(vf,{autoFocus:!0,onClick:()=>t({confirmed:!0}),children:`Yes`})]}),i&&(0,S.jsx)(vf,{onClick:()=>t({value:n}),children:`Send`})]})]})})}var eQ=[`select`,`confirm`,`input`,`editor`],tQ={messages:[],busy:!1,dialogs:[]};function nQ(e,t){let{messages:n}=e;switch(t.type){case`agent_start`:return{...e,busy:!0,error:void 0};case`agent_settled`:return{...e,busy:!1,dialogs:[]};case`exit`:return{...e,busy:!1,dialogs:[],error:t.error};case`extension_ui_request`:return eQ.includes(t.method)?{...e,dialogs:[...e.dialogs,t]}:e;case`extension_ui_answered`:return{...e,dialogs:e.dialogs.filter(e=>e.id!==t.id)};case`reset`:return tQ;case`message_start`:return{...e,messages:[...n,t.message]};case`message_end`:return{...e,messages:[...n.slice(0,-1),t.message]};case`message_update`:{let r=n.at(-1);if(r?.role!==`assistant`)return e;let i=rQ(r.content,t.assistantMessageEvent);return{...e,messages:[...n.slice(0,-1),{...r,content:i}]}}case`response`:if(!t.success)return{...e,error:t.error};if(t.command===`get_messages`)return{...e,messages:t.data.messages};if(t.command===`get_state`){let n=t.data;return n.model?{...e,model:{name:n.model.name,thinking:n.thinkingLevel}}:e}return e;default:return e}}function rQ(e,t){if(!(`contentIndex`in t))return e;let n=[...e],r=t.contentIndex;if(t.type===`text_start`)n[r]={type:`text`,text:``};else if(t.type===`thinking_start`)n[r]={type:`thinking`};else if(t.type===`text_delta`&&`delta`in t){let e=n[r];n[r]={type:`text`,text:(e?.type===`text`?e.text:``)+t.delta}}else t.type===`toolcall_start`&&`toolName`in t?n[r]={type:`toolCall`,id:t.id,name:t.toolName,arguments:{}}:t.type===`toolcall_end`&&`toolCall`in t&&(n[r]=t.toolCall);return n}function iQ({messages:e,busy:t}){let n=new Map;for(let t of e)t.role===`toolResult`&&n.set(t.toolCallId,t);return e.flatMap((e,r)=>{let i=String(r);if(e.role===`user`)return[{id:i,role:`user`,text:aQ(e.content)}];if(e.role!==`assistant`)return[];let a=e.content.flatMap(e=>e.type===`toolCall`?[oQ(e,n.get(e.id),t)]:[]),o=e.stopReason===`error`?[e.errorMessage,e.model&&`(${e.provider}/${e.model})`].filter(Boolean).join(` `):void 0;return[{id:i,role:`assistant`,text:[aQ(e.content),o&&`**Error:** ${o}`].filter(Boolean).join(`
77
77
 
78
- `),tools:a}]})}function eQ(e){return typeof e==`string`?e:e.flatMap(e=>e?.type===`text`?[e.text]:[]).join(`
78
+ `),tools:a}]})}function aQ(e){return typeof e==`string`?e:e.flatMap(e=>e?.type===`text`?[e.text]:[]).join(`
79
79
 
80
- `)}function tQ(e,t,n){let r=t?t.isError?`error`:`complete`:n?`running`:`error`,i=t&&eQ(t.content);return{id:e.id,name:e.name,status:r,output:i,...HI(e,r,i)}}function nQ({agent:e,prompt:t,onPromptChange:n}){let[r,i]=(0,v.useState)(XZ),[a,o]=(0,v.useState)();(0,v.useEffect)(()=>{let e=new EventSource(`/api/chat`);return e.onopen=()=>i(XZ),e.onmessage=e=>i(t=>ZZ(t,JSON.parse(e.data))),()=>e.close()},[]);async function s(e){try{return await e(),o(void 0),!0}catch(e){return o(e.message),!1}}return(0,S.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,S.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[tf(e),` looks through the candidates and queues jobs once you agree. It never turns the factory on.`]}),(0,S.jsxs)(vf,{variant:`outline`,size:`sm`,disabled:r.messages.length===0,onClick:()=>void s(rf.resetChat),children:[(0,S.jsx)(xd,{}),`New chat`]})]}),r.dialogs[0]&&(0,S.jsx)(JZ,{dialog:r.dialogs[0],onAnswer:e=>void s(()=>rf.answerChat({id:r.dialogs[0].id,...e}))},r.dialogs[0].id),(0,S.jsx)(fI,{messages:$Z(r),prompt:t,onPromptChange:n,busy:r.busy,model:r.model,error:a??r.error,placeholder:`What should the factory work on next?`,emptyTitle:`Plan the queue`,emptyDescription:`For example: pick five auto jobs for tonight that won't conflict.`,onSend:e=>s(()=>rf.chat(e)),onStop:()=>void s(rf.abortChat)})]})}function rQ(e,t){let n=e.agent?ef({...e,agent:e.agent}):``,r=e.after.flatMap(e=>{let n=t.get(e);return n&&n.state!==`done`?[Xd(n.item)]:[]}),i=r.length>0&&`after ${r.join(`, `)}`;return[e.item.play,e.item.level,n,i].filter(Boolean).join(` · `)}function iQ({job:e,byId:t}){return(0,S.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,S.jsx)(uD,{state:e.state}),rQ(e,t)]})}function aQ({ref:e,children:t}){return(0,S.jsx)(vX.div,{ref:e,layout:`position`,exit:{opacity:0,x:64},transition:{duration:.2},children:t})}function oQ({snapshot:e,act:t,onCandidates:n}){let{jobs:r,status:i,on:a,settings:o}=e,s=new Map(r.map(e=>[e.id,e])),c=r.filter(e=>e.state===`queued`&&e.source===`pick`),l=r.filter(e=>e.state===`queued`&&e.source===`auto`),u=(n,r)=>(0,S.jsx)(pD,{item:n.item,job:n,snapshot:e,act:t,actions:r&&(0,S.jsx)(vf,{variant:`destructive`,size:`sm`,className:`sm:mr-auto`,onClick:()=>t(()=>rf.remove(n.id)),children:`Remove from queue`})}),d=e=>(0,S.jsxs)(Xl,{children:[(0,S.jsx)(Gl,{render:(0,S.jsx)(vf,{variant:`ghost`,size:`icon-sm`,"aria-label":`Remove from queue`,onClick:()=>t(()=>rf.remove(e.id))}),children:(0,S.jsx)(Fd,{})}),(0,S.jsx)(Kl,{children:`Remove from queue`})]});return(0,S.jsxs)(`div`,{className:`flex flex-col gap-8 pt-2`,children:[a&&i&&i.pools.map(e=>{let t=e.stopped??(e.until?`sleeps until ${Kd(e.until)}`:``);return(0,S.jsx)(Gx,{title:`${e.name}: limits hit ${e.limits} of ${i.limit??`∞`}${t?`, ${t}`:``}`,children:(0,S.jsx)(Fx,{children:i.workers.filter(t=>t.pool===e.name).map(e=>{let t=e.job?s.get(e.job):void 0,n=t?void 0:e.until?`until ${Kd(e.until)}`:e.reason??`waiting for work`,r=Ov.filter(t=>o.tiers[t].includes(e.preset)),i=t?.notes.findLast(e=>e.kind===`step`&&e.attempt===t.attempts.length+1),a=t?.notes.findLast(e=>e.kind!==`step`);return(0,S.jsx)(Wx,{title:(0,S.jsxs)(S.Fragment,{children:[e.id,` `,(0,S.jsx)(cf,{variant:Qd[e.state],children:e.state}),r.map(e=>(0,S.jsx)(cf,{variant:`secondary`,className:`ml-1`,children:e},e))]}),meta:(0,S.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[t&&(0,S.jsxs)(`span`,{className:`flex items-center gap-2 text-foreground`,children:[(0,S.jsx)(lD,{state:t.state}),u(t,!1)]}),(0,S.jsx)(`span`,{children:[n,$d(e),t?`${Jd(e.since)} min`:`since ${Kd(e.since)}`,e.context&&`${Math.round(e.context/1e3)}k context`].filter(Boolean).join(` · `)}),i&&(0,S.jsxs)(`span`,{className:`text-foreground`,children:[i.text,i.of?` (${i.done??0}/${i.of})`:``]}),e.activity&&(0,S.jsx)(`span`,{children:e.activity}),a&&(0,S.jsxs)(`span`,{children:[Kd(a.at),` `,a.kind,`: `,a.text]})]})},e.id)})})},e.name)}),(0,S.jsx)(Gx,{title:`Your picks (${c.length})`,children:c.length===0?(0,S.jsxs)(Vd,{children:[(0,S.jsxs)(Hd,{children:[(0,S.jsx)(Ud,{children:`Nothing picked`}),(0,S.jsx)(Wd,{children:`Picks go before anything auto mode queues. Find work under Candidates.`})]}),(0,S.jsx)(Gd,{children:(0,S.jsx)(vf,{variant:`outline`,onClick:n,children:`Browse candidates`})})]}):(0,S.jsx)(Fx,{children:(0,S.jsx)(yJ,{mode:`popLayout`,initial:!1,children:c.map((e,n)=>(0,S.jsx)(aQ,{children:(0,S.jsxs)(Wx,{leading:(0,S.jsx)(lD,{state:e.state}),title:u(e,!0),meta:(0,S.jsx)(iQ,{job:e,byId:s}),children:[(0,S.jsx)(vf,{variant:`ghost`,size:`icon-sm`,"aria-label":`Move up`,disabled:n===0,onClick:()=>t(()=>rf.move(e.id,n-1)),children:(0,S.jsx)(yu,{})}),(0,S.jsx)(vf,{variant:`ghost`,size:`icon-sm`,"aria-label":`Move down`,disabled:n===c.length-1,onClick:()=>t(()=>rf.move(e.id,n+1)),children:(0,S.jsx)(hu,{})}),d(e)]})},e.id))})})}),(0,S.jsx)(Gx,{title:`Auto (${l.length})`,children:l.length===0?(0,S.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o.auto.on?`Auto mode tops this up to 5 jobs per agent while the factory is on.`:`Auto mode is off. Turn it on to keep the queue topped up from workwork.`}):(0,S.jsx)(Fx,{children:(0,S.jsx)(yJ,{mode:`popLayout`,initial:!1,children:l.map(e=>(0,S.jsx)(aQ,{children:(0,S.jsx)(Wx,{leading:(0,S.jsx)(lD,{state:e.state}),title:u(e,!0),meta:(0,S.jsx)(iQ,{job:e,byId:s}),children:d(e)})},e.id))})})})]})}function sQ({snapshot:e,act:t}){let[n,r]=(0,v.useState)(!1);return(0,S.jsxs)(jy,{open:n,onOpenChange:r,children:[(0,S.jsx)(My,{render:(0,S.jsx)(vf,{variant:`ghost`,size:`icon`,"aria-label":`Settings`}),children:(0,S.jsx)(Cd,{})}),(0,S.jsxs)(Fy,{className:`sm:max-w-xl`,children:[(0,S.jsxs)(Iy,{children:[(0,S.jsx)(Ry,{children:`Settings`}),(0,S.jsx)(zy,{children:`Defaults for every run, and what auto mode may queue. Closing without saving discards changes.`})]}),(0,S.jsx)(cQ,{snapshot:e,act:t,onSaved:()=>r(!1)})]})]})}function cQ({snapshot:e,act:t,onSaved:n}){let[r,i]=(0,v.useState)(e.settings),[a,o]=(0,v.useState)([]),[s,c]=(0,v.useState)([]),l={...r,auto:{...r.auto,on:e.settings.auto.on}},u=JSON.stringify(l)===JSON.stringify(e.settings);(0,v.useEffect)(()=>{rf.candidates().then(e=>{o([...new Set(e.items.map(e=>e.play))].sort()),c([...new Set(e.items.map(e=>e.repo))].sort())})},[e.candidates.at]);let d=r.auto,f=e=>i({...r,auto:{...d,...e}});return(0,S.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),t(async()=>{await rf.saveSettings(l),n()})},children:[(0,S.jsxs)(lx,{defaultValue:`runs`,children:[(0,S.jsxs)(dx,{children:[(0,S.jsx)(fx,{value:`runs`,children:`Runs`}),(0,S.jsx)(fx,{value:`presets`,children:`Presets`}),(0,S.jsx)(fx,{value:`tiers`,children:`Tiers`}),(0,S.jsx)(fx,{value:`auto`,children:`Auto mode`}),(0,S.jsx)(fx,{value:`chat`,children:`Live Agent`})]}),(0,S.jsxs)(`div`,{className:`mt-2 grid`,children:[(0,S.jsx)(uQ,{value:`runs`,children:(0,S.jsxs)(TE,{children:[(0,S.jsx)(HE,{value:r,onChange:e=>i({...r,...e})}),(0,S.jsxs)(DE,{orientation:`horizontal`,children:[(0,S.jsx)(kE,{htmlFor:`idle`,children:`Minutes without a sign of life before an attempt times out`}),(0,S.jsx)(Uf,{id:`idle`,type:`number`,className:`w-20`,min:1,value:r.idle,onChange:e=>i({...r,idle:Number(e.target.value)})})]})]})}),(0,S.jsx)(uQ,{value:`presets`,children:(0,S.jsx)(lQ,{value:r.presets,onChange:e=>i({...r,presets:e})})}),(0,S.jsx)(uQ,{value:`tiers`,children:(0,S.jsx)(fQ,{presets:r.presets,value:r.tiers,onChange:e=>i({...r,tiers:e})})}),(0,S.jsx)(uQ,{value:`auto`,children:(0,S.jsxs)(TE,{children:[(0,S.jsx)(AE,{children:`While the factory is on, auto mode keeps up to 5 jobs per agent queued, cheapest attention first, and never queues a candidate that already had a job. An empty filter allows everything.`}),(0,S.jsxs)(DE,{children:[(0,S.jsx)(kE,{children:`Levels`}),(0,S.jsx)(xZ,{multiple:!0,variant:`outline`,value:d.levels,onValueChange:e=>f({levels:e}),children:[`auto`,`skim`,`decide`].map(e=>(0,S.jsx)(SZ,{value:e,children:e},e))})]}),(0,S.jsxs)(DE,{children:[(0,S.jsx)(kE,{children:`Plays`}),(0,S.jsx)(xZ,{multiple:!0,variant:`outline`,className:`flex-wrap`,value:d.plays,onValueChange:e=>f({plays:e}),children:a.map(e=>(0,S.jsx)(SZ,{value:e,children:e},e))})]}),(0,S.jsxs)(DE,{children:[(0,S.jsx)(kE,{children:`Repos`}),(0,S.jsx)(xZ,{multiple:!0,variant:`outline`,className:`flex-wrap`,value:d.repos,onValueChange:e=>f({repos:e}),children:s.map(e=>(0,S.jsx)(SZ,{value:e,children:Yd(e)},e))})]})]})}),(0,S.jsx)(uQ,{value:`chat`,children:(0,S.jsxs)(TE,{children:[(0,S.jsx)(AE,{children:`The agent you plan the queue with. Changing it starts a new chat.`}),(0,S.jsxs)(DE,{orientation:`horizontal`,children:[(0,S.jsx)(qE,{label:`Chat agent`,className:`w-24 flex-none`,items:Kx.map(e=>({value:e,label:tf(e)})),value:r.chat.agent,onChange:e=>e&&i({...r,chat:{agent:e}})}),(0,S.jsx)(GE,{agent:r.chat.agent,value:r.chat,onChange:e=>i({...r,chat:{...e,agent:r.chat.agent}})})]})]})})]})]}),(0,S.jsx)(Ly,{children:(0,S.jsx)(vf,{type:`submit`,disabled:u,children:`Save`})})]})}function lQ({value:e,onChange:t}){let n=(n,r)=>t(e.map((e,t)=>t===n?r:e));return(0,S.jsxs)(TE,{children:[(0,S.jsx)(AE,{children:`Queue a candidate with one of these from the arrow next to its Queue button. Tiers run on them too: workers is how many run at once (empty: one once a tier lists it), and k ctx the context size, in thousands of tokens, where the agent compacts (empty: 90 for Haiku, 200 otherwise).`}),e.map((r,i)=>(0,S.jsxs)(DE,{orientation:`horizontal`,children:[(0,S.jsx)(qE,{label:`Preset agent`,className:`w-24 flex-none`,items:Kx.map(e=>({value:e,label:tf(e)})),value:r.agent,onChange:e=>e&&n(i,{agent:e})}),(0,S.jsx)(GE,{agent:r.agent,value:r,onChange:e=>n(i,{...r,...e,agent:r.agent})}),(0,S.jsx)(Uf,{"aria-label":`Workers`,type:`number`,min:0,className:`w-16`,placeholder:`workers`,value:r.workers??``,onChange:e=>n(i,{...r,workers:e.target.value===``?void 0:Number(e.target.value)})}),(0,S.jsx)(Uf,{"aria-label":`Compact at, thousands of tokens`,type:`number`,min:10,className:`w-20`,placeholder:`k ctx`,value:r.compactAt?r.compactAt/1e3:``,onChange:e=>n(i,{...r,compactAt:e.target.value===``?void 0:Number(e.target.value)*1e3})}),(0,S.jsx)(vf,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Remove preset`,onClick:()=>t(e.filter((e,t)=>t!==i)),children:(0,S.jsx)(Fd,{})})]},i)),(0,S.jsxs)(vf,{type:`button`,variant:`outline`,className:`self-start`,onClick:()=>t([...e,{agent:Kx[0]}]),children:[(0,S.jsx)(_d,{}),` Add preset`]})]})}function uQ(e){return(0,S.jsx)(px,{keepMounted:!0,hidden:!1,className:`col-start-1 row-start-1 data-hidden:invisible`,...e})}var dQ={communicator:`decomposition, UX, visual design, copy: anything judged by taste`,builder:`architecture, foundations, tricky logic, reviews`,grunt:`well-specified mechanical work`};function fQ({presets:e,value:t,onChange:n}){let[r,i]=(0,v.useState)(),a=e.map(kv),o=(e,r)=>n({...t,[e]:r}),s=(e,n,r)=>{let i=[...t[e]],[a]=i.splice(n,1);i.splice(r,0,a),o(e,i)};return(0,S.jsxs)(TE,{children:[(0,S.jsx)(AE,{children:`A goal's node runs on the first preset of its tier whose usage limit isn't hit and that has a free worker. A tier with no presets here runs on the run's agents.`}),Ov.map(e=>{let n=t[e],c=a.filter(e=>!n.includes(e));return(0,S.jsxs)(DE,{children:[(0,S.jsxs)(kE,{children:[e,` `,(0,S.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:dQ[e]})]}),(0,S.jsx)(`ol`,{className:`flex flex-col gap-1`,children:n.map((t,c)=>(0,S.jsxs)(`li`,{draggable:!0,onDragStart:()=>i({tier:e,index:c}),onDragOver:t=>r?.tier===e&&t.preventDefault(),onDrop:()=>{r?.tier===e&&s(e,r.index,c),i(void 0)},className:`flex items-center gap-1 rounded-md border px-2 py-1 text-sm`,children:[(0,S.jsx)(td,{className:`size-4 cursor-grab text-muted-foreground`}),(0,S.jsxs)(`span`,{className:`flex-1`,children:[c+1,`. `,t,!a.includes(t)&&(0,S.jsx)(`span`,{className:`text-destructive`,children:` (no such preset)`})]}),(0,S.jsx)(vf,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Move up`,disabled:c===0,onClick:()=>s(e,c,c-1),children:(0,S.jsx)(yu,{})}),(0,S.jsx)(vf,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Move down`,disabled:c===n.length-1,onClick:()=>s(e,c,c+1),children:(0,S.jsx)(hu,{})}),(0,S.jsx)(vf,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Remove from tier`,onClick:()=>o(e,n.filter(e=>e!==t)),children:(0,S.jsx)(Fd,{})})]},t))}),c.length>0&&(0,S.jsx)(qE,{label:`Add a preset to ${e}`,className:`w-56`,items:[{value:``,label:`Add a preset…`},...c.map(e=>({value:e,label:e}))],value:``,onChange:t=>t&&o(e,[...n,t])})]},e)})]})}function pQ(){let{snapshot:e,error:t,act:n}=af(),[r,i]=(0,v.useState)(``);return e?(0,S.jsx)(PI,{title:`Live Agent`,agent:(0,S.jsx)(nQ,{agent:e.settings.chat.agent,prompt:r,onPromptChange:i}),children:(0,S.jsx)(mQ,{snapshot:e,error:t,act:n,onAsk:i})}):(0,S.jsx)(`div`,{className:`flex min-h-svh items-center justify-center gap-2 p-4 text-muted-foreground`,children:t??(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(By,{}),` Loading`]})})}function mQ({snapshot:e,error:t,act:n,onAsk:r}){let[i,a]=bx(`tab`,`queue`),{isMobile:o,setOpen:s,setOpenMobile:c}=kI(),{on:l,status:u}=e,d=e.jobs.filter(e=>e.state===`queued`&&!e.of&&!e.goal).length,f=e.jobs.filter(e=>e.goal&&e.state!==`removed`&&e.state!==`done`),p=f.filter(e=>e.blocked===`checkpoint`).length,m=l&&u?[`since ${Kd(Zd(u.run))}`,u.limit===null?`always waits for usage resets`:u.limit===1?`stops at usage limits`:`waits for ${u.limit-1} usage reset${u.limit>2?`s`:``}`,u.until&&`until ${Kd(u.until)}`].filter(Boolean).join(` · `):``;return(0,S.jsxs)(`div`,{className:`mx-auto flex min-h-svh w-full max-w-5xl flex-col gap-6 p-4`,children:[(0,S.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3`,children:[(0,S.jsxs)(`div`,{className:`flex flex-1 items-center gap-2`,children:[(0,S.jsxs)(`h1`,{className:`flex items-center gap-2 font-heading text-xl font-semibold`,children:[(0,S.jsx)(qZ,{working:l}),`Factory`]}),(0,S.jsx)(cf,{variant:l?`accent`:`outline`,children:l?`on`:`off`}),(0,S.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:m})]}),(0,S.jsx)(kZ,{snapshot:e,act:n}),(0,S.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,S.jsx)(aZ,{}),(0,S.jsx)(sQ,{snapshot:e,act:n})]})]}),t&&(0,S.jsx)(`p`,{role:`alert`,className:`text-sm wrap-anywhere whitespace-pre-line text-destructive`,children:t}),(0,S.jsxs)(lx,{value:i,onValueChange:a,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`div`,{className:`min-w-0 overflow-x-auto overflow-y-hidden`,children:(0,S.jsxs)(dx,{children:[(0,S.jsxs)(fx,{value:`queue`,children:[(0,S.jsx)(ad,{}),`Queue`,d?` (${d})`:``]}),(0,S.jsxs)(fx,{value:`goals`,children:[(0,S.jsx)(jd,{}),`Goals`,f.length?` (${f.length})`:``,p>0&&(0,S.jsx)(cf,{variant:`accent`,children:p})]}),(0,S.jsxs)(fx,{value:`candidates`,children:[(0,S.jsx)(rd,{}),`Candidates`]}),(0,S.jsxs)(fx,{value:`results`,children:[(0,S.jsx)(dd,{}),`Results`]}),(0,S.jsxs)(fx,{value:`activity`,children:[(0,S.jsx)(pu,{}),`Activity`]})]})}),(0,S.jsx)(`div`,{className:`ml-auto`})]}),(0,S.jsx)(px,{value:`queue`,children:(0,S.jsx)(oQ,{snapshot:e,act:n,onCandidates:()=>a(`candidates`)})}),(0,S.jsx)(px,{value:`goals`,children:(0,S.jsx)(zZ,{snapshot:e,act:n})}),(0,S.jsx)(px,{value:`candidates`,children:(0,S.jsx)(DZ,{snapshot:e,act:n})}),(0,S.jsx)(px,{value:`activity`,children:(0,S.jsx)(ED,{snapshot:e,act:n})}),(0,S.jsx)(px,{value:`results`,children:(0,S.jsx)(eD,{snapshot:e,act:n,onAsk:e=>{r(e),(o?c:s)(!0)}})})]})]})}(0,y.createRoot)(document.getElementById(`root`)).render((0,S.jsx)(v.StrictMode,{children:(0,S.jsx)(F,{themes:b,storageKey:Zl,children:(0,S.jsx)(Yl,{children:(0,S.jsx)(pQ,{})})})}));
80
+ `)}function oQ(e,t,n){let r=t?t.isError?`error`:`complete`:n?`running`:`error`,i=t&&aQ(t.content);return{id:e.id,name:e.name,status:r,output:i,...WI(e,r,i)}}function sQ({agent:e,prompt:t,onPromptChange:n}){let[r,i]=(0,v.useState)(tQ),[a,o]=(0,v.useState)();(0,v.useEffect)(()=>{let e=new EventSource(`/api/chat`);return e.onopen=()=>i(tQ),e.onmessage=e=>i(t=>nQ(t,JSON.parse(e.data))),()=>e.close()},[]);async function s(e){try{return await e(),o(void 0),!0}catch(e){return o(e.message),!1}}return(0,S.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,S.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[tf(e),` looks through the candidates and queues jobs once you agree. It never turns the factory on.`]}),(0,S.jsxs)(vf,{variant:`outline`,size:`sm`,disabled:r.messages.length===0,onClick:()=>void s(rf.resetChat),children:[(0,S.jsx)(xd,{}),`New chat`]})]}),r.dialogs[0]&&(0,S.jsx)($Z,{dialog:r.dialogs[0],onAnswer:e=>void s(()=>rf.answerChat({id:r.dialogs[0].id,...e}))},r.dialogs[0].id),(0,S.jsx)(mI,{messages:iQ(r),prompt:t,onPromptChange:n,busy:r.busy,model:r.model,error:a??r.error,placeholder:`What should the factory work on next?`,emptyTitle:`Plan the queue`,emptyDescription:`For example: pick five auto jobs for tonight that won't conflict.`,onSend:e=>s(()=>rf.chat(e)),onStop:()=>void s(rf.abortChat)})]})}function cQ(e,t){let n=e.agent?ef({...e,agent:e.agent}):``,r=e.after.flatMap(e=>{let n=t.get(e);return n&&n.state!==`done`?[Xd(n.item)]:[]}),i=r.length>0&&`after ${r.join(`, `)}`;return[e.item.play,e.item.level,n,i].filter(Boolean).join(` · `)}function lQ({job:e,byId:t}){return(0,S.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,S.jsx)(dD,{state:e.state}),cQ(e,t)]})}function uQ({ref:e,children:t}){return(0,S.jsx)(bX.div,{ref:e,layout:`position`,exit:{opacity:0,x:64},transition:{duration:.2},children:t})}function dQ({snapshot:e,act:t,onCandidates:n}){let{jobs:r,status:i,on:a,settings:o}=e,s=new Map(r.map(e=>[e.id,e])),c=r.filter(e=>e.state===`queued`&&e.source===`pick`),l=r.filter(e=>e.state===`queued`&&e.source===`auto`),u=(n,r)=>(0,S.jsx)(mD,{item:n.item,job:n,snapshot:e,act:t,actions:r&&(0,S.jsx)(vf,{variant:`destructive`,size:`sm`,className:`sm:mr-auto`,onClick:()=>t(()=>rf.remove(n.id)),children:`Remove from queue`})}),d=e=>(0,S.jsxs)(Xl,{children:[(0,S.jsx)(Gl,{render:(0,S.jsx)(vf,{variant:`ghost`,size:`icon-sm`,"aria-label":`Remove from queue`,onClick:()=>t(()=>rf.remove(e.id))}),children:(0,S.jsx)(Fd,{})}),(0,S.jsx)(Kl,{children:`Remove from queue`})]});return(0,S.jsxs)(`div`,{className:`flex flex-col gap-8 pt-2`,children:[a&&i&&i.pools.map(e=>{let t=e.stopped??(e.until?`sleeps until ${Kd(e.until)}`:``);return(0,S.jsx)(Kx,{title:`${e.name}: limits hit ${e.limits} of ${i.limit??`∞`}${t?`, ${t}`:``}`,children:(0,S.jsx)(Ix,{children:i.workers.filter(t=>t.pool===e.name).map(e=>{let t=e.job?s.get(e.job):void 0,n=t?void 0:e.until?`until ${Kd(e.until)}`:e.reason??`waiting for work`,r=Ov.filter(t=>o.tiers[t].includes(e.preset)),i=t?.notes.findLast(e=>e.kind===`step`&&e.attempt===t.attempts.length+1),a=t?.notes.findLast(e=>e.kind!==`step`);return(0,S.jsx)(Gx,{title:(0,S.jsxs)(S.Fragment,{children:[e.id,` `,(0,S.jsx)(cf,{variant:Qd[e.state],children:e.state}),r.map(e=>(0,S.jsx)(cf,{variant:`secondary`,className:`ml-1`,children:e},e)),e.preset===e.agent&&(0,S.jsxs)(Xl,{children:[(0,S.jsx)(Gl,{render:(0,S.jsx)(cf,{variant:`outline`,className:`ml-1`}),children:`untiered`}),(0,S.jsxs)(Kl,{children:[`The run's own `,e.agent,` worker, for jobs without a tier, like maintenance picks.`]})]})]}),meta:(0,S.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[t&&(0,S.jsxs)(`span`,{className:`flex items-center gap-2 text-foreground`,children:[(0,S.jsx)(uD,{state:t.state}),u(t,!1)]}),(0,S.jsx)(`span`,{children:[n,$d(e),t?`${Jd(e.since)} min`:`since ${Kd(e.since)}`,e.context&&`${Math.round(e.context/1e3)}k context`].filter(Boolean).join(` · `)}),i&&(0,S.jsxs)(`span`,{className:`text-foreground`,children:[i.text,i.of?` (${i.done??0}/${i.of})`:``]}),e.activity&&(0,S.jsx)(`span`,{children:e.activity}),a&&(0,S.jsxs)(`span`,{children:[Kd(a.at),` `,a.kind,`: `,a.text]})]})},e.id)})})},e.name)}),(0,S.jsx)(Kx,{title:`Your picks (${c.length})`,children:c.length===0?(0,S.jsxs)(Vd,{children:[(0,S.jsxs)(Hd,{children:[(0,S.jsx)(Ud,{children:`Nothing picked`}),(0,S.jsx)(Wd,{children:`Picks go before anything auto mode queues. Find work under Candidates.`})]}),(0,S.jsx)(Gd,{children:(0,S.jsx)(vf,{variant:`outline`,onClick:n,children:`Browse candidates`})})]}):(0,S.jsx)(Ix,{children:(0,S.jsx)(xJ,{mode:`popLayout`,initial:!1,children:c.map((e,n)=>(0,S.jsx)(uQ,{children:(0,S.jsxs)(Gx,{leading:(0,S.jsx)(uD,{state:e.state}),title:u(e,!0),meta:(0,S.jsx)(lQ,{job:e,byId:s}),children:[(0,S.jsx)(vf,{variant:`ghost`,size:`icon-sm`,"aria-label":`Move up`,disabled:n===0,onClick:()=>t(()=>rf.move(e.id,n-1)),children:(0,S.jsx)(yu,{})}),(0,S.jsx)(vf,{variant:`ghost`,size:`icon-sm`,"aria-label":`Move down`,disabled:n===c.length-1,onClick:()=>t(()=>rf.move(e.id,n+1)),children:(0,S.jsx)(hu,{})}),d(e)]})},e.id))})})}),(0,S.jsx)(Kx,{title:`Auto (${l.length})`,children:l.length===0?(0,S.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o.auto.on?`Auto mode tops this up to 5 jobs per agent while the factory is on.`:`Auto mode is off. Turn it on to keep the queue topped up from workwork.`}):(0,S.jsx)(Ix,{children:(0,S.jsx)(xJ,{mode:`popLayout`,initial:!1,children:l.map(e=>(0,S.jsx)(uQ,{children:(0,S.jsx)(Gx,{leading:(0,S.jsx)(uD,{state:e.state}),title:u(e,!0),meta:(0,S.jsx)(lQ,{job:e,byId:s}),children:d(e)})},e.id))})})})]})}function fQ({snapshot:e,act:t}){let[n,r]=(0,v.useState)(!1);return(0,S.jsxs)(My,{open:n,onOpenChange:r,children:[(0,S.jsx)(Ny,{render:(0,S.jsx)(vf,{variant:`ghost`,size:`icon`,"aria-label":`Settings`}),children:(0,S.jsx)(Cd,{})}),(0,S.jsxs)(Iy,{className:`sm:max-w-xl`,children:[(0,S.jsxs)(Ly,{children:[(0,S.jsx)(zy,{children:`Settings`}),(0,S.jsx)(By,{children:`Defaults for every run, and what auto mode may queue. Closing without saving discards changes.`})]}),(0,S.jsx)(pQ,{snapshot:e,act:t,onSaved:()=>r(!1)})]})]})}function pQ({snapshot:e,act:t,onSaved:n}){let[r,i]=(0,v.useState)(e.settings),[a,o]=(0,v.useState)([]),[s,c]=(0,v.useState)([]),l={...r,auto:{...r.auto,on:e.settings.auto.on}},u=JSON.stringify(l)===JSON.stringify(e.settings);(0,v.useEffect)(()=>{rf.candidates().then(e=>{o([...new Set(e.items.map(e=>e.play))].sort()),c([...new Set(e.items.map(e=>e.repo))].sort())})},[e.candidates.at]);let d=r.auto,f=e=>i({...r,auto:{...d,...e}});return(0,S.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),t(async()=>{await rf.saveSettings(l),n()})},children:[(0,S.jsxs)(ux,{defaultValue:`runs`,children:[(0,S.jsxs)(fx,{children:[(0,S.jsx)(px,{value:`runs`,children:`Runs`}),(0,S.jsx)(px,{value:`presets`,children:`Presets`}),(0,S.jsx)(px,{value:`tiers`,children:`Tiers`}),(0,S.jsx)(px,{value:`auto`,children:`Auto mode`}),(0,S.jsx)(px,{value:`chat`,children:`Live Agent`})]}),(0,S.jsxs)(`div`,{className:`mt-2 grid`,children:[(0,S.jsx)(hQ,{value:`runs`,children:(0,S.jsxs)(EE,{children:[(0,S.jsx)(UE,{value:r,onChange:e=>i({...r,...e})}),(0,S.jsxs)(OE,{orientation:`horizontal`,children:[(0,S.jsx)(AE,{htmlFor:`idle`,children:`Minutes without a sign of life before an attempt times out`}),(0,S.jsx)(Uf,{id:`idle`,type:`number`,className:`w-20`,min:1,value:r.idle,onChange:e=>i({...r,idle:Number(e.target.value)})})]})]})}),(0,S.jsx)(hQ,{value:`presets`,children:(0,S.jsx)(mQ,{value:r.presets,onChange:e=>i({...r,presets:e})})}),(0,S.jsx)(hQ,{value:`tiers`,children:(0,S.jsx)(_Q,{presets:r.presets,value:r.tiers,onChange:e=>i({...r,tiers:e})})}),(0,S.jsx)(hQ,{value:`auto`,children:(0,S.jsxs)(EE,{children:[(0,S.jsx)(jE,{children:`While the factory is on, auto mode keeps up to 5 jobs per agent queued, cheapest attention first, and never queues a candidate that already had a job. An empty filter allows everything.`}),(0,S.jsxs)(OE,{children:[(0,S.jsx)(AE,{children:`Levels`}),(0,S.jsx)(CZ,{multiple:!0,variant:`outline`,value:d.levels,onValueChange:e=>f({levels:e}),children:[`auto`,`skim`,`decide`].map(e=>(0,S.jsx)(wZ,{value:e,children:e},e))})]}),(0,S.jsxs)(OE,{children:[(0,S.jsx)(AE,{children:`Plays`}),(0,S.jsx)(CZ,{multiple:!0,variant:`outline`,className:`flex-wrap`,value:d.plays,onValueChange:e=>f({plays:e}),children:a.map(e=>(0,S.jsx)(wZ,{value:e,children:e},e))})]}),(0,S.jsxs)(OE,{children:[(0,S.jsx)(AE,{children:`Repos`}),(0,S.jsx)(CZ,{multiple:!0,variant:`outline`,className:`flex-wrap`,value:d.repos,onValueChange:e=>f({repos:e}),children:s.map(e=>(0,S.jsx)(wZ,{value:e,children:Yd(e)},e))})]})]})}),(0,S.jsx)(hQ,{value:`chat`,children:(0,S.jsxs)(EE,{children:[(0,S.jsx)(jE,{children:`The agent you plan the queue with. Changing it starts a new chat.`}),(0,S.jsxs)(OE,{orientation:`horizontal`,children:[(0,S.jsx)(JE,{label:`Chat agent`,className:`w-24 flex-none`,items:qx.map(e=>({value:e,label:tf(e)})),value:r.chat.agent,onChange:e=>e&&i({...r,chat:{agent:e}})}),(0,S.jsx)(KE,{agent:r.chat.agent,value:r.chat,onChange:e=>i({...r,chat:{...e,agent:r.chat.agent}})})]})]})})]})]}),(0,S.jsx)(Ry,{children:(0,S.jsx)(vf,{type:`submit`,disabled:u,children:`Save`})})]})}function mQ({value:e,onChange:t}){let n=(n,r)=>t(e.map((e,t)=>t===n?r:e));return(0,S.jsxs)(EE,{children:[(0,S.jsx)(jE,{children:`Queue a candidate with one of these from the arrow next to its Queue button. Tiers run on them too: workers is how many run at once (empty: one once a tier lists it), and k ctx the context size, in thousands of tokens, where the agent compacts (empty: 90 for Haiku, 200 otherwise).`}),e.map((r,i)=>(0,S.jsxs)(OE,{orientation:`horizontal`,children:[(0,S.jsx)(JE,{label:`Preset agent`,className:`w-24 flex-none`,items:qx.map(e=>({value:e,label:tf(e)})),value:r.agent,onChange:e=>e&&n(i,{agent:e})}),(0,S.jsx)(KE,{agent:r.agent,value:r,onChange:e=>n(i,{...r,...e,agent:r.agent})}),(0,S.jsx)(Uf,{"aria-label":`Workers`,type:`number`,min:0,className:`w-24`,placeholder:`workers`,value:r.workers??``,onChange:e=>n(i,{...r,workers:e.target.value===``?void 0:Number(e.target.value)})}),(0,S.jsx)(Uf,{"aria-label":`Compact at, thousands of tokens`,type:`number`,min:10,className:`w-20`,placeholder:`k ctx`,value:r.compactAt?r.compactAt/1e3:``,onChange:e=>n(i,{...r,compactAt:e.target.value===``?void 0:Number(e.target.value)*1e3})}),(0,S.jsx)(vf,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Remove preset`,onClick:()=>t(e.filter((e,t)=>t!==i)),children:(0,S.jsx)(Fd,{})})]},i)),(0,S.jsxs)(vf,{type:`button`,variant:`outline`,className:`self-start`,onClick:()=>t([...e,{agent:qx[0]}]),children:[(0,S.jsx)(_d,{}),` Add preset`]})]})}function hQ(e){return(0,S.jsx)(mx,{keepMounted:!0,hidden:!1,className:`col-start-1 row-start-1 data-hidden:invisible`,...e})}var gQ={communicator:`decomposition, UX, visual design, copy: anything judged by taste`,builder:`architecture, foundations, tricky logic, reviews`,grunt:`well-specified mechanical work`};function _Q({presets:e,value:t,onChange:n}){let[r,i]=(0,v.useState)(),a=e.map(Av),o=(e,r)=>n({...t,[e]:r}),s=(e,n,r)=>{let i=[...t[e]],[a]=i.splice(n,1);i.splice(r,0,a),o(e,i)};return(0,S.jsxs)(EE,{children:[(0,S.jsx)(jE,{children:`A goal's node runs on the first preset of its tier whose usage limit isn't hit and that has a free worker. A tier with no presets here runs on the run's agents.`}),Ov.map(e=>{let n=t[e],c=a.filter(e=>!n.includes(e));return(0,S.jsxs)(OE,{children:[(0,S.jsxs)(AE,{children:[e,` `,(0,S.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:gQ[e]})]}),(0,S.jsx)(`ol`,{className:`flex flex-col gap-1`,children:n.map((t,c)=>(0,S.jsxs)(`li`,{draggable:!0,onDragStart:()=>i({tier:e,index:c}),onDragOver:t=>r?.tier===e&&t.preventDefault(),onDrop:()=>{r?.tier===e&&s(e,r.index,c),i(void 0)},className:`flex items-center gap-1 rounded-md border px-2 py-1 text-sm`,children:[(0,S.jsx)(td,{className:`size-4 cursor-grab text-muted-foreground`}),(0,S.jsxs)(`span`,{className:`flex-1`,children:[c+1,`. `,t,!a.includes(t)&&(0,S.jsx)(`span`,{className:`text-destructive`,children:` (no such preset)`})]}),(0,S.jsx)(vf,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Move up`,disabled:c===0,onClick:()=>s(e,c,c-1),children:(0,S.jsx)(yu,{})}),(0,S.jsx)(vf,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Move down`,disabled:c===n.length-1,onClick:()=>s(e,c,c+1),children:(0,S.jsx)(hu,{})}),(0,S.jsx)(vf,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Remove from tier`,onClick:()=>o(e,n.filter(e=>e!==t)),children:(0,S.jsx)(Fd,{})})]},t))}),c.length>0&&(0,S.jsx)(JE,{label:`Add a preset to ${e}`,className:`w-56`,items:[{value:``,label:`Add a preset…`},...c.map(e=>({value:e,label:e}))],value:``,onChange:t=>t&&o(e,[...n,t])})]},e)})]})}function vQ(){let{snapshot:e,error:t,act:n}=af(),[r,i]=(0,v.useState)(``);return e?(0,S.jsx)(II,{title:`Live Agent`,agent:(0,S.jsx)(sQ,{agent:e.settings.chat.agent,prompt:r,onPromptChange:i}),children:(0,S.jsx)(yQ,{snapshot:e,error:t,act:n,onAsk:i})}):(0,S.jsx)(`div`,{className:`flex min-h-svh items-center justify-center gap-2 p-4 text-muted-foreground`,children:t??(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Vy,{}),` Loading`]})})}function yQ({snapshot:e,error:t,act:n,onAsk:r}){let[i,a]=xx(`tab`,`queue`),{isMobile:o,setOpen:s,setOpenMobile:c}=jI(),{on:l,status:u}=e,d=e.jobs.filter(e=>e.state===`queued`&&!e.of&&!e.goal).length,f=e.jobs.filter(e=>e.goal&&e.state!==`removed`&&e.state!==`done`),p=f.filter(e=>e.blocked===`checkpoint`).length,m=l&&u?[`since ${Kd(Zd(u.run))}`,u.until&&`until ${Kd(u.until)}`,...u.pools.map(e=>e.stopped?`${e.name} out of limits`:e.until?`${e.name} sleeps until ${Kd(e.until)}`:void 0)].filter(Boolean).join(` · `):``;return(0,S.jsxs)(`div`,{className:`mx-auto flex min-h-svh w-full max-w-5xl flex-col gap-6 p-4`,children:[(0,S.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3`,children:[(0,S.jsxs)(`div`,{className:`flex flex-1 items-center gap-2`,children:[(0,S.jsxs)(`h1`,{className:`flex items-center gap-2 font-heading text-xl font-semibold`,children:[(0,S.jsx)(QZ,{working:l}),`Factory`]}),(0,S.jsx)(cf,{variant:l?`accent`:`outline`,children:l?`on`:`off`}),(0,S.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:m})]}),(0,S.jsx)(jZ,{snapshot:e,act:n}),(0,S.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,S.jsx)(sZ,{}),(0,S.jsx)(fQ,{snapshot:e,act:n})]})]}),t&&(0,S.jsx)(`p`,{role:`alert`,className:`text-sm wrap-anywhere whitespace-pre-line text-destructive`,children:t}),(0,S.jsxs)(ux,{value:i,onValueChange:a,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`div`,{className:`min-w-0 overflow-x-auto overflow-y-hidden`,children:(0,S.jsxs)(fx,{children:[(0,S.jsxs)(px,{value:`queue`,children:[(0,S.jsx)(ad,{}),`Queue`,d?` (${d})`:``]}),(0,S.jsxs)(px,{value:`goals`,children:[(0,S.jsx)(jd,{}),`Goals`,f.length?` (${f.length})`:``,p>0&&(0,S.jsx)(cf,{variant:`accent`,children:p})]}),(0,S.jsxs)(px,{value:`candidates`,children:[(0,S.jsx)(rd,{}),`Candidates`]}),(0,S.jsxs)(px,{value:`results`,children:[(0,S.jsx)(dd,{}),`Results`]}),(0,S.jsxs)(px,{value:`activity`,children:[(0,S.jsx)(pu,{}),`Activity`]})]})}),(0,S.jsx)(`div`,{className:`ml-auto`})]}),(0,S.jsx)(mx,{value:`queue`,children:(0,S.jsx)(dQ,{snapshot:e,act:n,onCandidates:()=>a(`candidates`)})}),(0,S.jsx)(mx,{value:`goals`,children:(0,S.jsx)(HZ,{snapshot:e,act:n})}),(0,S.jsx)(mx,{value:`candidates`,children:(0,S.jsx)(kZ,{snapshot:e,act:n})}),(0,S.jsx)(mx,{value:`activity`,children:(0,S.jsx)(OD,{snapshot:e,act:n})}),(0,S.jsx)(mx,{value:`results`,children:(0,S.jsx)(tD,{snapshot:e,act:n,onAsk:e=>{r(e),(o?c:s)(!0)}})})]})]})}(0,y.createRoot)(document.getElementById(`root`)).render((0,S.jsx)(v.StrictMode,{children:(0,S.jsx)(F,{themes:b,storageKey:Zl,children:(0,S.jsx)(Yl,{children:(0,S.jsx)(vQ,{})})})}));