PageSourceSearch

https://data-analyst-frontend.vercel.app/_next/static/chunks/81-ed…?dpl=dpl_EZXNWfd3Vgnn36WFVB46Xw7P1Tnq

js data-analyst-frontend.vercel.app collected 2026-10-03 06:31:13 UTC 448,729 bytes, 7 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[81],{565:(e,t,n)=>{"use strict";var r,i,a,s,o,l,u,c;n.d(t,{BM:()=>m,CW:()=>d,Ee:()=>b,HP:()=>v,JQ:()=>p,Ny:()=>w,On:()=>x,cx:()=>f,es:()=>_,lV:()=>h,ok:()=>g,ol:()=>y});let d=(r=/[A-Za-z]/,function(e){return null!==e&&e>-1&&r.test(String.fromCharCode(e))}),h=(i=/[\dA-Za-z]/,function(e){return null!==e&&e>-1&&i.test(String.fromCharCode(e))}),f=(a=/[#-'*+\--9=?A-Z^-~]/,function(e){return null!==e&&e>-1&&a.test(String.fromCharCode(e))});function p(e){return null!==e&&(e<32||127===e)}let m=(s=/\d/,function(e){return null!==e&&e>-1&&s.test(String.fromCharCode(e))}),g=(o=/[\dA-Fa-f]/,function(e){return null!==e&&e>-1&&o.test(String.fromCharCode(e))}),y=(l=/[!-/:-@[-`{-~]/,function(e){return null!==e&&e>-1&&l.test(String.fromCharCode(e))});function v(e){return null!==e&&e<-2}function b(e){return null!==e&&(e<0||32===e)}function x(e){return -2===e||-1===e||32===e}let _=(u=/\p{P}|\p{S}/u,function(e){return null!==e&&e>-1&&u.test(String.fromCharCode(e))}),w=(c=/\s/,function(e){return null!==e&&e>-1&&c.test(String.fromCharCode(e))})},1028:(e,t,n)=>{"use strict";function r(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}n.d(t,{W:()=>r})},1306:(e,t,n)=>{"use strict";n.d(t,{X:()=>c});var r=n(23360),i=n(12115),a=n(9862),s=n(44162),o=n(88068),l=n(95155),u=()=>{let e=(0,a.vd)(),t=(0,i.useCallback)(t=>{let n=e.getState().setIsHovering,r=()=>{n(!0)},i=()=>{n(!1)};return t.addEventListener("mouseenter",r),t.addEventListener("mouseleave",i),()=>{t.removeEventListener("mouseenter",r),t.removeEventListener("mouseleave",i),n(!1)}},[e]);return(0,s.s)(t)},c=(0,i.forwardRef)((e,t)=>{let n=u(),i=(0,o.s)(t,n);return(0,l.jsx)(r.sG.div,{...e,ref:i})});c.displayName="MessagePrimitive.Root"},4617:(e,t)=>{var n;!function(){"use strict";var r={}.hasOwnProperty;function i(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=a(e,function(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return i.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var n in e)r.call(e,n)&&e[n]&&(t=a(t,n));return t}(n)))}return e}function a(e,t){return t?e?e+" "+t:e+t:e}e.exports?(i.default=i,e.exports=i):void 0!==(n=(function(){return i}).apply(t,[]))&&(e.exports=n)}()},7049:(e,t,n)=>{"use strict";n.d(t,{P:()=>s});var r=n(37364),i=n(12115),a=n(40617),s=(0,r.x)("ThreadPrimitive.ScrollToBottom",()=>{let e=(0,a.qZ)(e=>e.isAtBottom),t=(0,a.D0)(),n=(0,i.useCallback)(()=>{t.getState().scrollToBottom()},[t]);return e?null:n})},8135:()=>{},8755:(e,t,n)=>{"use strict";n.d(t,{H_:()=>th,UC:()=>tl,YJ:()=>tu,q7:()=>td,VF:()=>tm,JU:()=>tc,ZL:()=>to,z6:()=>tf,hN:()=>tp,bL:()=>ta,wv:()=>tg,Pb:()=>ty,G5:()=>tb,ZP:()=>tv,l9:()=>ts});var r=n(12115),i=n(93610),a=n(88068),s=n(18166),o=n(1488),l=n(23360),u=n(12317),c=n(95155);function d(e){let t=e+"CollectionProvider",[n,i]=(0,s.A)(t),[o,l]=n(t,{collectionRef:{current:null},itemMap:new Map}),d=e=>{let{scope:t,children:n}=e,i=r.useRef(null),a=r.useRef(new Map).current;return(0,c.jsx)(o,{scope:t,itemMap:a,collectionRef:i,children:n})};d.displayName=t;let h=e+"CollectionSlot",f=r.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=l(h,n),s=(0,a.s)(t,i.collectionRef);return(0,c.jsx)(u.DX,{ref:s,children:r})});f.displayName=h;let p=e+"CollectionItemSlot",m="data-radix-collection-item",g=r.forwardRef((e,t)=>{let{scope:n,children:i,...s}=e,o=r.useRef(null),d=(0,a.s)(t,o),h=l(p,n);return r.useEffect(()=>(h.itemMap.set(o,{ref:o,...s}),()=>void h.itemMap.delete(o))),(0,c.jsx)(u.DX,{[m]:"",ref:d,children:i})});return g.displayName=p,[{Provider:d,Slot:f,ItemSlot:g},function(t){let n=l(e+"CollectionConsumer",t);return r.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll("[".concat(m,"]")));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])},i]}var h=r.createContext(void 0);function f(e){let t=r.useContext(h);return e||t||"ltr"}var p=n(73741),m=n(62292),g=n(20196),y=n(67668),v=n(40905),b=n(17323),x=n(17028),_=n(41524),w="rovingFocusGroup.onEntryFocus",k={bubbles:!1,cancelable:!0},S="RovingFocusGroup",[E,T,I]=d(S),[C,A]=(0,s.A)(S,[I]),[R,P]=C(S),O=r.forwardRef((e,t)=>
1(0,c.jsx)(E.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,c.jsx)(E.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,c.jsx)(M,{...e,ref:t})})}));O.displayName=S;var M=r.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:s,loop:u=!1,dir:d,currentTabStopId:h,defaultCurrentTabStopId:p,onCurrentTabStopIdChange:m,onEntryFocus:g,preventScrollOnEntryFocus:y=!1,...v}=e,b=r.useRef(null),x=(0,a.s)(t,b),S=f(d),[E=null,I]=(0,o.i)({prop:h,defaultProp:p,onChange:m}),[C,A]=r.useState(!1),P=(0,_.c)(g),O=T(n),M=r.useRef(!1),[N,j]=r.useState(0);return r.useEffect(()=>{let e=b.current;if(e)return e.addEventListener(w,P),()=>e.removeEventListener(w,P)},[P]),(0,c.jsx)(R,{scope:n,orientation:s,dir:S,loop:u,currentTabStopId:E,onItemFocus:r.useCallback(e=>I(e),[I]),onItemShiftTab:r.useCallback(()=>A(!0),[]),onFocusableItemAdd:r.useCallback(()=>j(e=>e+1),[]),onFocusableItemRemove:r.useCallback(()=>j(e=>e-1),[]),children:(0,c.jsx)(l.sG.div,{tabIndex:C||0===N?-1:0,"data-orientation":s,...v,ref:x,style:{outline:"none",...e.style},onMouseDown:(0,i.m)(e.onMouseDown,()=>{M.current=!0}),onFocus:(0,i.m)(e.onFocus,e=>{let t=!M.current;if(e.target===e.currentTarget&&t&&!C){let t=new CustomEvent(w,k);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=O().filter(e=>e.focusable);L([e.find(e=>e.active),e.find(e=>e.id===E),...e].filter(Boolean).map(e=>e.ref.current),y)}}M.current=!1}),onBlur:(0,i.m)(e.onBlur,()=>A(!1))})})}),N="RovingFocusGroupItem",j=r.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:a=!0,active:s=!1,tabStopId:o,...u}=e,d=(0,y.B)(),h=o||d,f=P(N,n),p=f.currentTabStopId===h,m=T(n),{onFocusableItemAdd:g,onFocusableItemRemove:v}=f;return r.useEffect(()=>{if(a)return g(),()=>v()},[a,g,v]),(0,c.jsx)(E.ItemSlot,{scope:n,id:h,focusable:a,active:s,children:(0,c.jsx)(l.sG.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...u,ref:t,onMouseDown:(0,i.m)(e.onMouseDown,e=>{a?f.onItemFocus(h):e.preventDefault()}),onFocus:(0,i.m)(e.onFocus,()=>f.onItemFocus(h)),onKeyDown:(0,i.m)(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey){f.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=function(e,t,n){var r;let i=(r=e.key,"rtl"!==n?r:"ArrowLeft"===r?"ArrowRight":"ArrowRight"===r?"ArrowLeft":r);if(!("vertical"===t&&["ArrowLeft","ArrowRight"].includes(i))&&!("horizontal"===t&&["ArrowUp","ArrowDown"].includes(i)))return D[i]}(e,f.orientation,f.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=m().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)n.reverse();else if("prev"===t||"next"===t){"prev"===t&&n.reverse();let r=n.indexOf(e.currentTarget);n=f.loop?function(e,t){return e.map((n,r)=>e[(t+r)%e.length])}(n,r+1):n.slice(r+1)}setTimeout(()=>L(n))}})})})});j.displayName=N;var D={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function L(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}var B=n(15587),F=n(64065),z=["Enter"," "],U=["ArrowUp","PageDown","End"],Z=["ArrowDown","PageUp","Home",...U],H={ltr:[...z,"ArrowRight"],rtl:[...z,"ArrowLeft"]},V={ltr:["ArrowLeft"],rtl:["ArrowRight"]},$="Menu",[q,W,K]=d($),[J,Y]=(0,s.A)($,[K,v.Bk,A]),G=(0,v.Bk)(),X=A(),[Q,ee]=J($),[et,en]=J($),er=e=>{let{__scopeMenu:t,open:n=!1,children:i,dir:a,onOpenChange:s,modal:o=!0}=e,l=G(t),[u,d]=r.useState(null),h=r.useRef(!1),p=(0,_.c)(s),m=f(a);return r.useEffect(()=>{let e=()=>{h.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},t=()=>h.current=!1;return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}},[]),(0,c.jsx)(v.bL,{...l,children:(0,c.jsx)(Q,{scope:t,open:n,onOpenChange:p,content:u,onContentChange:d,children:(0,c.jsx)(et,{scope:t,onClose:r.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:h,dir:m,modal:o,children:i})})})};er.displayName=$;var ei=r.forwardRef((e,t)=>
1{let{__scopeMenu:n,...r}=e,i=G(n);return(0,c.jsx)(v.Mz,{...i,...r,ref:t})});ei.displayName="MenuAnchor";var ea="MenuPortal",[es,eo]=J(ea,{forceMount:void 0}),el=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=ee(ea,t);return(0,c.jsx)(es,{scope:t,forceMount:n,children:(0,c.jsx)(x.C,{present:n||a.open,children:(0,c.jsx)(b.Z,{asChild:!0,container:i,children:r})})})};el.displayName=ea;var eu="MenuContent",[ec,ed]=J(eu),eh=r.forwardRef((e,t)=>{let n=eo(eu,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=ee(eu,e.__scopeMenu),s=en(eu,e.__scopeMenu);return(0,c.jsx)(q.Provider,{scope:e.__scopeMenu,children:(0,c.jsx)(x.C,{present:r||a.open,children:(0,c.jsx)(q.Slot,{scope:e.__scopeMenu,children:s.modal?(0,c.jsx)(ef,{...i,ref:t}):(0,c.jsx)(ep,{...i,ref:t})})})})}),ef=r.forwardRef((e,t)=>{let n=ee(eu,e.__scopeMenu),s=r.useRef(null),o=(0,a.s)(t,s);return r.useEffect(()=>{let e=s.current;if(e)return(0,B.Eq)(e)},[]),(0,c.jsx)(em,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:(0,i.m)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),ep=r.forwardRef((e,t)=>{let n=ee(eu,e.__scopeMenu);return(0,c.jsx)(em,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),em=r.forwardRef((e,t)=>{let{__scopeMenu:n,loop:s=!1,trapFocus:o,onOpenAutoFocus:l,onCloseAutoFocus:d,disableOutsidePointerEvents:h,onEntryFocus:f,onEscapeKeyDown:y,onPointerDownOutside:b,onFocusOutside:x,onInteractOutside:_,onDismiss:w,disableOutsideScroll:k,...S}=e,E=ee(eu,n),T=en(eu,n),I=G(n),C=X(n),A=W(n),[R,P]=r.useState(null),M=r.useRef(null),N=(0,a.s)(t,M,E.onContentChange),j=r.useRef(0),D=r.useRef(""),L=r.useRef(0),B=r.useRef(null),z=r.useRef("right"),H=r.useRef(0),V=k?F.A:r.Fragment,$=k?{as:u.DX,allowPinchZoom:!0}:void 0,q=e=>{var t,n;let r=D.current+e,i=A().filter(e=>!e.disabled),a=document.activeElement,s=null===(t=i.find(e=>
1e.ref.current===a))||void 0===t?void 0:t.textValue,o=function(e,t,n){var r;let i=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,a=(r=Math.max(n?e.indexOf(n):-1,0),e.map((t,n)=>e[(r+n)%e.length]));1===i.length&&(a=a.filter(e=>e!==n));let s=a.find(e=>e.toLowerCase().startsWith(i.toLowerCase()));return s!==n?s:void 0}(i.map(e=>e.textValue),r,s),l=null===(n=i.find(e=>e.textValue===o))||void 0===n?void 0:n.ref.current;!function e(t){D.current=t,window.clearTimeout(j.current),""!==t&&(j.current=window.setTimeout(()=>e(""),1e3))}(r),l&&setTimeout(()=>l.focus())};r.useEffect(()=>()=>window.clearTimeout(j.current),[]),(0,m.Oh)();let K=r.useCallback(e=>{var t,n;return z.current===(null===(t=B.current)||void 0===t?void 0:t.side)&&function(e,t){return!!t&&function(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let s=t[e].x,o=t[e].y,l=t[a].x,u=t[a].y;o>r!=u>r&&n<(l-s)*(r-o)/(u-o)+s&&(i=!i)}return i}({x:e.clientX,y:e.clientY},t)}(e,null===(n=B.current)||void 0===n?void 0:n.area)},[]);return(0,c.jsx)(ec,{scope:n,searchRef:D,onItemEnter:r.useCallback(e=>{K(e)&&e.preventDefault()},[K]),onItemLeave:r.useCallback(e=>{var t;K(e)||(null===(t=M.current)||void 0===t||t.focus(),P(null))},[K]),onTriggerLeave:r.useCallback(e=>{K(e)&&e.preventDefault()},[K]),pointerGraceTimerRef:L,onPointerGraceIntentChange:r.useCallback(e=>{B.current=e},[]),children:(0,c.jsx)(V,{...$,children:(0,c.jsx)(g.n,{asChild:!0,trapped:o,onMountAutoFocus:(0,i.m)(l,e=>{var t;e.preventDefault(),null===(t=M.current)||void 0===t||t.focus({preventScroll:!0})}),onUnmountAutoFocus:d,children:(0,c.jsx)(p.qW,{asChild:!0,disableOutsidePointerEvents:h,onEscapeKeyDown:y,onPointerDownOutside:b,onFocusOutside:x,onInteractOutside:_,onDismiss:w,children:(0,c.jsx)(O,{asChild:!0,...C,dir:T.dir,orientation:"vertical",loop:s,currentTabStopId:R,onCurrentTabStopIdChange:P,onEntryFocus:(0,i.m)(f,e=>{T.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,c.jsx)(v.UC,{role:"menu","aria-orientation":"vertical","data-state":eH(E.open),"data-radix-menu-content":"",dir:T.dir,...I,...S,ref:N,style:{outline:"none",...S.style},onKeyDown:(0,i.m)(S.onKeyDown,e=>{let t=e.target.closest("[data-radix-menu-content]")===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=1===e.key.length;t&&("Tab"===e.key&&e.preventDefault(),!n&&r&&q(e.key));let i=M.current;if(e.target!==i||!Z.includes(e.key))return;e.preventDefault();let a=A().filter(e=>!e.disabled).map(e=>e.ref.current);U.includes(e.key)&&a.reverse(),function(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}(a)}),onBlur:(0,i.m)(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(j.current),D.current="")}),onPointerMove:(0,i.m)(e.onPointerMove,eq(e=>{let t=e.target,n=H.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>H.current?"right":"left";z.current=t,H.current=e.clientX}}))})})})})})})});eh.displayName=eu;var eg=r.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,c.jsx)(l.sG.div,{role:"group",...r,ref:t})});eg.displayName="MenuGroup";var ey=r.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,c.jsx)(l.sG.div,{...r,ref:t})});ey.displayName="MenuLabel";var ev="MenuItem",eb="menu.itemSelect",ex=r.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:s,...o}=e,u=r.useRef(null),d=en(ev,e.__scopeMenu),h=ed(ev,e.__scopeMenu),f=(0,a.s)(t,u),p=r.useRef(!1);return(0,c.jsx)(e_,{...o,ref:f,disabled:n,onClick:(0,i.m)(e.onClick,()=>{let e=u.current;if(!n&&e){let t=new CustomEvent(eb,{bubbles:!0,cancelable:!0});e.addEventListener(eb,e=>null==s?void 0:s(e),{once:!0}),(0,l.hO)(e,t),t.defaultPrevented?p.current=!1:d.onClose()}}),onPointerDown:t=>{var n;null===(n=e.onPointerDown)||void 0===n||n.call(e,t),p.current=!0},onPointerUp:(0,i.m)(e.onPointerUp,e=>{var t;p.current||null===(t=e.currentTarget)||void 0===t||t.click()}),onKeyDown:(0,i.m)(e.onKeyDown,e=>{let t=""!==h.searchRef.current;!n&&(!t||" "!==e.key)&&z.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});ex.displayName=ev;var e_=r.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:s=!1,textValue:o,...u}=e,d=ed(ev,n),h=X(n),f=r.useRef(null),p=(0,a.s)(t,f),[m,g]=r.useState(!1),[y,v]=r.useState("");return r.useEffect(()=>{let e=f.current;if(e){var t;v((null!==(t=e.textContent)&&void 0!==t?t:"").trim())}},[u.children]),(0,c.jsx)(q.ItemSlot,{scope:n,disabled:s,textValue:null!=o?o:y,children:(0,c.jsx)(j,{asChild:!0,...h,focusable:!s,children:(0,c.jsx)(l.sG.div,{role:"menuitem","data-highlighted":m?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...u,ref:p,onPointerMove:(0,i.m)(e.onPointerMove,eq(e=>{s?d.onItemLeave(e):(d.onItemEnter(e),e.defaultPrevented||e.currentTarget.focu
1s({preventScroll:!0}))})),onPointerLeave:(0,i.m)(e.onPointerLeave,eq(e=>d.onItemLeave(e))),onFocus:(0,i.m)(e.onFocus,()=>g(!0)),onBlur:(0,i.m)(e.onBlur,()=>g(!1))})})})}),ew=r.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...a}=e;return(0,c.jsx)(eR,{scope:e.__scopeMenu,checked:n,children:(0,c.jsx)(ex,{role:"menuitemcheckbox","aria-checked":eV(n)?"mixed":n,...a,ref:t,"data-state":e$(n),onSelect:(0,i.m)(a.onSelect,()=>null==r?void 0:r(!!eV(n)||!n),{checkForDefaultPrevented:!1})})})});ew.displayName="MenuCheckboxItem";var ek="MenuRadioGroup",[eS,eE]=J(ek,{value:void 0,onValueChange:()=>{}}),eT=r.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=(0,_.c)(r);return(0,c.jsx)(eS,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,c.jsx)(eg,{...i,ref:t})})});eT.displayName=ek;var eI="MenuRadioItem",eC=r.forwardRef((e,t)=>{let{value:n,...r}=e,a=eE(eI,e.__scopeMenu),s=n===a.value;return(0,c.jsx)(eR,{scope:e.__scopeMenu,checked:s,children:(0,c.jsx)(ex,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":e$(s),onSelect:(0,i.m)(r.onSelect,()=>{var e;return null===(e=a.onValueChange)||void 0===e?void 0:e.call(a,n)},{checkForDefaultPrevented:!1})})})});eC.displayName=eI;var eA="MenuItemIndicator",[eR,eP]=J(eA,{checked:!1}),eO=r.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=eP(eA,n);return(0,c.jsx)(x.C,{present:r||eV(a.checked)||!0===a.checked,children:(0,c.jsx)(l.sG.span,{...i,ref:t,"data-state":e$(a.checked)})})});eO.displayName=eA;var eM=r.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,c.jsx)(l.sG.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});eM.displayName="MenuSeparator";var eN=r.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=G(n);return(0,c.jsx)(v.i3,{...i,...r,ref:t})});eN.displayName="MenuArrow";var ej="MenuSub",[eD,eL]=J(ej),eB=e=>{let{__scopeMenu:t,children:n,open:i=!1,onOpenChange:a}=e,s=ee(ej,t),o=G(t),[l,u]=r.useState(null),[d,h]=r.useState(null),f=(0,_.c)(a);return r.useEffect(()=>(!1===s.open&&f(!1),()=>f(!1)),[s.open,f]),(0,c.jsx)(v.bL,{...o,children:(0,c.jsx)(Q,{scope:t,open:i,onOpenChange:f,content:d,onContentChange:h,children:(0,c.jsx)(eD,{scope:t,contentId:(0,y.B)(),triggerId:(0,y.B)(),trigger:l,onTriggerChange:u,children:n})})})};eB.displayName=ej;var eF="MenuSubTrigger",ez=r.forwardRef((e,t)=>{let n=ee(eF,e.__scopeMenu),s=en(eF,e.__scopeMenu),o=eL(eF,e.__scopeMenu),l=ed(eF,e.__scopeMenu),u=r.useRef(null),{pointerGraceTimerRef:d,onPointerGraceIntentChange:h}=l,f={__scopeMenu:e.__scopeMenu},p=r.useCallback(()=>{u.current&&window.clearTimeout(u.current),u.current=null},[]);return r.useEffect(()=>p,[p]),r.useEffect(()=>{let e=d.current;return()=>{window.clearTimeout(e),h(null)}},[d,h]),(0,c.jsx)(ei,{asChild:!0,...f,children:(0,c.jsx)(e_,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":eH(n.open),...e,ref:(0,a.t)(t,o.onTriggerChange),onClick:t=>{var r;null===(r=e.onClick)||void 0===r||r.call(e,t),e.disabled||t.defaultPrevented||(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:(0,i.m)(e.onPointerMove,eq(t=>{l.onItemEnter(t),t.defaultPrevented||e.disabled||n.open||u.current||(l.onPointerGraceIntentChange(null),u.current=window.setTimeout(()=>{n.onOpenChange(!0),p()},100))})),onPointerLeave:(0,i.m)(e.onPointerLeave,eq(e=>{var t,r;p();let i=null===(t=n.content)||void 0===t?void 0:t.getBoundingClientRect();if(i){let t=null===(r=n.content)||void 0===r?void 0:r.dataset.side,a="right"===t,s=i[a?"left":"right"],o=i[a?"right":"left"];l.onPointerGraceIntentChange({area:[{x:e.clientX+(a?-5:5),y:e.clientY},{x:s,y:i.top},{x:o,y:i.top},{x:o,y:i.bottom},{x:s,y:i.bottom}],side:t}),window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.onPointerGraceIntentChange(null),300)}else{if(l.onTriggerLeave(e),e.defaultPrevented)return;l.onPointerGraceIntentChange(null)}})),onKeyDown:(0,i.m)(e.onKeyDown,t=>{let r=""!==l.searchRef.current;if(!e.disabled&&(!r||" "!==t.key)&&H[s.dir].includes(t.key)){var i;n.onOpenChange(!0),null===(i=n.content)||void 0===i||i.focus(),t.preventDefault()}})})})});
1ez.displayName=eF;var eU="MenuSubContent",eZ=r.forwardRef((e,t)=>{let n=eo(eu,e.__scopeMenu),{forceMount:s=n.forceMount,...o}=e,l=ee(eu,e.__scopeMenu),u=en(eu,e.__scopeMenu),d=eL(eU,e.__scopeMenu),h=r.useRef(null),f=(0,a.s)(t,h);return(0,c.jsx)(q.Provider,{scope:e.__scopeMenu,children:(0,c.jsx)(x.C,{present:s||l.open,children:(0,c.jsx)(q.Slot,{scope:e.__scopeMenu,children:(0,c.jsx)(em,{id:d.contentId,"aria-labelledby":d.triggerId,...o,ref:f,align:"start",side:"rtl"===u.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{var t;u.isUsingKeyboardRef.current&&(null===(t=h.current)||void 0===t||t.focus()),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:(0,i.m)(e.onFocusOutside,e=>{e.target!==d.trigger&&l.onOpenChange(!1)}),onEscapeKeyDown:(0,i.m)(e.onEscapeKeyDown,e=>{u.onClose(),e.preventDefault()}),onKeyDown:(0,i.m)(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=V[u.dir].includes(e.key);if(t&&n){var r;l.onOpenChange(!1),null===(r=d.trigger)||void 0===r||r.focus(),e.preventDefault()}})})})})})});function eH(e){return e?"open":"closed"}function eV(e){return"indeterminate"===e}function e$(e){return eV(e)?"indeterminate":e?"checked":"unchecked"}function eq(e){return t=>"mouse"===t.pointerType?e(t):void 0}eZ.displayName=eU;var eW="DropdownMenu",[eK,eJ]=(0,s.A)(eW,[Y]),eY=Y(),[eG,eX]=eK(eW),eQ=e=>{let{__scopeDropdownMenu:t,children:n,dir:i,open:a,defaultOpen:s,onOpenChange:l,modal:u=!0}=e,d=eY(t),h=r.useRef(null),[f=!1,p]=(0,o.i)({prop:a,defaultProp:s,onChange:l});return(0,c.jsx)(eG,{scope:t,triggerId:(0,y.B)(),triggerRef:h,contentId:(0,y.B)(),open:f,onOpenChange:p,onOpenToggle:r.useCallback(()=>p(e=>!e),[p]),modal:u,children:(0,c.jsx)(er,{...d,open:f,onOpenChange:p,dir:i,modal:u,children:n})})};eQ.displayName=eW;var e0="DropdownMenuTrigger",e1=r.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...s}=e,o=eX(e0,n),u=eY(n);return(0,c.jsx)(ei,{asChild:!0,...u,children:(0,c.jsx)(l.sG.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...s,ref:(0,a.t)(t,o.triggerRef),onPointerDown:(0,i.m)(e.onPointerDown,e=>{r||0!==e.button||!1!==e.ctrlKey||(o.onOpenToggle(),o.open||e.preventDefault())}),onKeyDown:(0,i.m)(e.onKeyDown,e=>{!r&&(["Enter"," "].includes(e.key)&&o.onOpenToggle(),"ArrowDown"===e.key&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(e.key)&&e.preventDefault())})})})});e1.displayName=e0;var e2=e=>{let{__scopeDropdownMenu:t,...n}=e,r=eY(t);return(0,c.jsx)(el,{...r,...n})};e2.displayName="DropdownMenuPortal";var e5="DropdownMenuContent",e4=r.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...a}=e,s=eX(e5,n),o=eY(n),l=r.useRef(!1);return(0,c.jsx)(eh,{id:s.contentId,"aria-labelledby":s.triggerId,...o,...a,ref:t,onCloseAutoFocus:(0,i.m)(e.onCloseAutoFocus,e=>{var t;l.current||null===(t=s.triggerRef.current)||void 0===t||t.focus(),l.current=!1,e.preventDefault()}),onInteractOutside:(0,i.m)(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey,r=2===t.button||n;(!s.modal||r)&&(l.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});e4.displayName=e5;var e9=r.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=eY(n);return(0,c.jsx)(eg,{...i,...r,ref:t})});e9.displayName="DropdownMenuGroup";var e6=r.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=eY(n);return(0,c.jsx)(ey,{...i,...r,ref:t})});e6.displayName="DropdownMenuLabel";var e3=r.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=eY(n);return(0,c.jsx)(ex,{...i,...r,ref:t})});e3.displayName="DropdownMenuItem";var e8=r.forwardRef((e,t)=>
1{let{__scopeDropdownMenu:n,...r}=e,i=eY(n);return(0,c.jsx)(ew,{...i,...r,ref:t})});e8.displayName="DropdownMenuCheckboxItem";var e7=r.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=eY(n);return(0,c.jsx)(eT,{...i,...r,ref:t})});e7.displayName="DropdownMenuRadioGroup";var te=r.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=eY(n);return(0,c.jsx)(eC,{...i,...r,ref:t})});te.displayName="DropdownMenuRadioItem";var tt=r.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=eY(n);return(0,c.jsx)(eO,{...i,...r,ref:t})});tt.displayName="DropdownMenuItemIndicator";var tn=r.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=eY(n);return(0,c.jsx)(eM,{...i,...r,ref:t})});tn.displayName="DropdownMenuSeparator",r.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=eY(n);return(0,c.jsx)(eN,{...i,...r,ref:t})}).displayName="DropdownMenuArrow";var tr=r.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=eY(n);return(0,c.jsx)(ez,{...i,...r,ref:t})});tr.displayName="DropdownMenuSubTrigger";var ti=r.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=eY(n);return(0,c.jsx)(eZ,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});ti.displayName="DropdownMenuSubContent";var ta=eQ,ts=e1,to=e2,tl=e4,tu=e9,tc=e6,td=e3,th=e8,tf=e7,tp=te,tm=tt,tg=tn,ty=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,s=eY(t),[l=!1,u]=(0,o.i)({prop:r,defaultProp:a,onChange:i});return(0,c.jsx)(eB,{...s,open:l,onOpenChange:u,children:n})},tv=tr,tb=ti},9859:(e,t,n)=>{"use strict";n.d(t,{j:()=>r});var r=class{constructor(e,t,n){this.contentBinding=e,this.messageApi=t,this.threadApi=n}get path(){return this.contentBinding.path}__internal_bindMethods(){this.addToolResult=this.addToolResult.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this)}getState(){return this.contentBinding.getState()}addToolResult(e){let t=this.contentBinding.getState();if(!t)throw Error("Content part is not available");if("tool-call"!==t.type)throw Error("Tried to add tool result to non-tool content part");if(!this.messageApi)throw Error("Message API is not available. This is likely a bug in assistant-ui.");if(!this.threadApi)throw Error("Thread API is not available");let n=this.messageApi.getState();if(!n)throw Error("Message is not available");let r=t.toolName,i=t.toolCallId;this.threadApi.getState().addToolResult({messageId:n.id,toolName:r,toolCallId:i,result:e})}subscribe(e){return this.contentBinding.subscribe(e)}}},9862:(e,t,n)=>{"use strict";n.d(t,{JX:()=>c,LN:()=>u,Nf:()=>o,iP:()=>d,uW:()=>h,vd:()=>f});var r=n(12115),i=n(88804),a=n(4703),s=n(88668),o=(0,r.createContext)(null),l=(0,i.h)(o,"a component passed to <ThreadPrimitive.Messages components={...} />");function u(e){let t=l(e);return t?t.useMessageRuntime():null}var c=(0,s.k)(u),d=(0,s.k)(e=>{var t,n;return null!==(n=null===(t=u(e))||void 0===t?void 0:t.composer)&&void 0!==n?n:null}),{useMessageUtils:h,useMessageUtilsStore:f}=(0,a.o)(l,"useMessageUtils")},10553:(e,t,n)=>{"use strict";var r=n(95714).Buffer;let i=void 0!==r,a=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,s=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function o(e,t,n){null==n&&null!==t&&"object"==typeof t&&(n=t,t=void 0),i&&r.isBuffer(e)&&(e=e.toString()),e&&65279===e.charCodeAt(0)&&(e=e.slice(1));let o=JSON.parse(e,t);if(null===o||"object"!=typeof o)return o;let u=n&&n.protoAction||"error",c=n&&n.constructorAction||"error";if("ignore"===u&&"ignore"===c)return o;if("ignore"!==u&&"ignore"!==c){if(!1===a.test(e)&&!1===s.test(e))return o}else if("ignore"!==u&&"ignore"===c){if(!1===a.test(e))return o}else if(!1===s.test(e))return o;return l(o,{protoAction:u,constructorAction:c,safe:n&&n.safe})}function l(e,{protoAction:t="error",constructorAction:n="error",safe:r}={}){let i=[e];for(;i.length;){let e=i;for(let a of(i=[],e)){if("ignore"!==t&&Object.prototype.hasOwnProperty.call(a,"__proto__")){if(!0===r)return null;if("error"===t)throw SyntaxError("Object contains forbidden prototype property");delete a.__proto__}if("ignore"!==n&&Object.prototype.hasOwnProperty.call(a,"constructor")&&Object.prototype.hasOwnProperty.call(a.constructor,"prototype")){if(!0===r)return null;if("error"===n)throw SyntaxError("Object contains forbidden prototype property");delete a.constructor}for(let e in a){let t=a[e];t&&"object"==typeof t&&i.push(t)}}}return e}function u(e,t,n){let r=Error.stackTraceLimit;Error.stackTraceLimit=0;try{return o(e,t,n)}finally{Error.stackTraceLimit=r}}e.exports=u,e.exports.default=u,e.exports.parse=u,e.exports.safeParse=function(e,t){let n=Error.
1stackTraceLimit;Error.stackTraceLimit=0;try{return o(e,t,{safe:!0})}catch(e){return null}finally{Error.stackTraceLimit=n}},e.exports.scan=l},14019:(e,t,n)=>{"use strict";n.d(t,{v:()=>s});var r=n(37364),i=n(12115),a=n(9862),s=(0,r.x)("BranchPickerPrimitive.Previous",()=>{let e=(0,a.LN)(),t=(0,a.JX)(e=>e.branchNumber<=1),n=(0,i.useCallback)(()=>{e.switchToBranch({position:"previous"})},[e]);return t?null:n})},14239:(e,t,n)=>{"use strict";n.d(t,{o:()=>v});var r=n(12115),i=n(81865),a=n(99827),s=()=>(0,a.v)(e=>{let t=new Map;return Object.freeze({getToolUI:e=>{let n=t.get(e),r=n?.at(-1);return r||null},setToolUI:(n,r)=>{let i=t.get(n);return i||(i=[],t.set(n,i)),i.push(r),e({}),()=>{let t=i.indexOf(r);-1!==t&&i.splice(t,1),t===i.length&&e({})}}})}),o=n(99723),l=n(86903),u=n(77369),c=n(36505),d=n(75828),h=n(95155),f=e=>{let[t]=(0,r.useState)(()=>(0,a.v)(()=>e));return(0,r.useEffect)(()=>{(0,c.Q)(e),(0,c.Q)(e.composer),(0,l.s)(t).setState(e,!0)},[e,t]),t},p=e=>{let{children:t,listItemRuntime:n,runtime:i}=e,a=f(i),[s]=(0,r.useState)(()=>({useThreadRuntime:a}));return(0,h.jsx)(u.X,{runtime:n,children:(0,h.jsx)(o.qm.Provider,{value:s,children:(0,h.jsx)(d.U,{children:t})})})},m=e=>{let[t]=(0,r.useState)(()=>(0,a.v)(()=>e));return(0,r.useEffect)(()=>{(0,c.Q)(e),(0,c.Q)(e.threads),(0,l.s)(t).setState(e,!0)},[e,t]),t},g=()=>(0,r.useMemo)(()=>s(),[]),y=e=>{var t;return null===(t=e._core)||void 0===t?void 0:t.RenderComponent},v=(0,r.memo)(e=>{let{children:t,runtime:n}=e,a=m(n),s=g(),[o]=(0,r.useState)(()=>({useToolUIs:s,useAssistantRuntime:a})),l=y(n);return(0,h.jsxs)(i.WF.Provider,{value:o,children:[l&&(0,h.jsx)(l,{}),(0,h.jsx)(p,{runtime:n.thread,listItemRuntime:n.threads.mainItem,children:t})]})})},15220:(e,t,n)=>{"use strict";n.d(t,{e:()=>O});var r=n(93610),i=n(88068),a=n(12317),s=n(12115);function o(){return(o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(null,arguments)}var l=s.useLayoutEffect,u=function(e){var t=s.useRef(e);return l(function(){t.current=e}),t},c=function(e,t){if("function"==typeof e){e(t);return}e.current=t},d=function(e,t){var n=s.useRef();return s.useCallback(function(r){e.current=r,n.current&&c(n.current,null),n.current=t,t&&c(t,r)},[t])},h={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0",display:"block"},f=function(e){Object.keys(h).forEach(function(t){e.style.setProperty(t,h[t],"important")})},p=null,m=function(e,t){var n=e.scrollHeight;return"border-box"===t.sizingStyle.boxSizing?n+t.borderSize:n-t.paddingSize},g=function(){},y=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak","wordSpacing","scrollbarGutter"],v=!!document.documentElement.currentStyle,b=function(e){var t=window.getComputedStyle(e);if(null===t)return null;var n=y.reduce(function(e,n){return e[n]=t[n],e},{}),r=n.boxSizing;if(""===r)return null;v&&"border-box"===r&&(n.width=parseFloat(n.width)+parseFloat(n.borderRightWidth)+parseFloat(n.borderLeftWidth)+parseFloat(n.paddingRight)+parseFloat(n.paddingLeft)+"px");var i=parseFloat(n.paddingBottom)+parseFloat(n.paddingTop),a=parseFloat(n.borderBottomWidth)+parseFloat(n.borderTopWidth);return{sizingStyle:n,paddingSize:i,borderSize:a}};function x(e,t,n){var r=u(n);s.useLayoutEffect(function(){var n=function(e){return r.current(e)};if(e)return e.addEventListener(t,n),function(){return e.removeEventListener(t,n)}},[])}var _=function(e,t){x(document.body,"reset",function(n){e.current.form===n.target&&t(n)})},w=function(e){x(window,"resize",e)},k=function(e){x(document.fonts,"loadingdone",e)},S=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],E=s.forwardRef(function(e,t){var n=e.cacheMeasurements,r=e.maxRows,i=e.minRows,a=e.onChange,l=void 0===a?g:a,u=e.onHeightChange,c=void 0===u?g:u,h=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,S),y=void 0!==h.value,v=s.useRef(null),x=d(v,t),E=s.useRef(0),T=s.useRef(),I=function(){var e,t,a,s,o,l,u,d,h,g,y,x=v.current,_=n&&T.current?T.current:b(x);if(_){T.current=_;var w=(e=x.value||x.placeholder||"x",void 0===(t=i)&&(t=1),void 0===(a=r)&&(a=1/0),p||((p=document.createElement("textarea")).setAttribute("tabindex","-1"),p.setAttribute("aria-hidden","true"),f(p)),null===p.parentNode&&document.body.appendChild(p),s=_.paddingSize,o=_.borderSize,u=(l=_.sizingStyle).boxSizing,Object.keys(l).forEach(function(e){p.style[e]=l[e]}),f(p),p.value=e,d=m(p,_),p.value=e,d=m(p,_),p.value="x",g=(h=p.scrollHeight-s)*t,"border-box"===u&&(g=g+s+o),d=Math.max(g,d),y=h*a,"border-box"===u&&(y=y+s+o),[d=Math.min(y,d),h]),k=w[0],S=w[1];E.current!==k&&(E.current=k,x.style.setProperty("height",k+"px","important"),c(k,{rowHeight:S}
1))}};return s.useLayoutEffect(I),_(v,function(){if(!y){var e=v.current,t=e.value;requestAnimationFrame(function(){t!==e.value&&I()})}}),w(I),k(I),s.createElement("textarea",o({},h,{onChange:function(e){y||I(),l(e)},ref:x}))}),T=n(68621),I=n(99723),C=n(95630),A=n(34462),R=n(58432),P=n(95155),O=(0,s.forwardRef)((e,t)=>{var n,o;let{autoFocus:l=!1,asChild:u,disabled:c,onChange:d,onKeyDown:h,submitOnEnter:f=!0,cancelOnEscape:p=!0,unstable_focusOnRunStart:m=!0,unstable_focusOnScrollToBottom:g=!0,unstable_focusOnThreadSwitched:y=!0,...v}=e,b=(0,R.pK)(),x=(0,I.Mp)(),_=(0,T.I)(),w=(0,T.s)(e=>e.isEditing?e.text:""),k=u?a.DX:E,S=null!==(o=null!==(n=(0,I._W)(e=>e.isDisabled))&&void 0!==n?n:c)&&void 0!==o&&o,O=(0,s.useRef)(null),M=(0,i.s)(t,O);(0,C.U)(e=>{p&&_.getState().canCancel&&(_.cancel(),e.preventDefault())});let N=l&&!S,j=(0,s.useCallback)(()=>{let e=O.current;e&&N&&(e.focus({preventScroll:!0}),e.setSelectionRange(e.value.length,e.value.length))},[N]);return(0,s.useEffect)(()=>j(),[j]),(0,A.O)(()=>{"thread"===_.type&&g&&j()}),(0,s.useEffect)(()=>{if("thread"===_.type&&m)return x.unstable_on("run-start",j)},[m]),(0,s.useEffect)(()=>{if("thread"===_.type&&y)return b.unstable_on("switched-to",j)},[y]),(0,P.jsx)(k,{name:"input",value:w,...v,ref:M,disabled:S,onChange:(0,r.m)(d,e=>{if(_.getState().isEditing)return _.setText(e.target.value)}),onKeyDown:(0,r.m)(h,e=>{if(!S&&f&&!e.nativeEvent.isComposing&&"Enter"===e.key&&!1===e.shiftKey){let{isRunning:r}=x.getState();if(!r){var t,n;e.preventDefault(),null===(n=O.current)||void 0===n||null===(t=n.closest("form"))||void 0===t||t.requestSubmit()}}})})});O.displayName="ComposerPrimitive.Input"},15905:(e,t,n)=>{"use strict";n.d(t,{I:()=>c});var r=n(12115),i=n(93610),a=n(23360),s=n(9862),o=n(68621),l=n(95155),u=function(){let{copiedDuration:e=3e3}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=(0,s.LN)(),n=(0,o.I)(),i=(0,s.uW)(e=>e.setIsCopied),a=(0,s.JX)(e=>("assistant"!==e.role||"running"!==e.status.type)&&e.content.some(e=>"text"===e.type&&e.text.length>0)),l=(0,r.useCallback)(()=>{let{isEditing:r,text:a}=n.getState(),s=r?a:t.unstable_getCopyText();navigator.clipboard.writeText(s).then(()=>{i(!0),setTimeout(()=>i(!1),e)})},[t,i,n,e]);return a?l:null},c=(0,r.forwardRef)((e,t)=>{let{copiedDuration:n,onClick:r,disabled:o,...c}=e,d=(0,s.uW)(e=>e.isCopied),h=u({copiedDuration:n});return(0,l.jsx)(a.sG.button,{type:"button",...d?{"data-copied":"true"}:{},...c,ref:t,disabled:o||!h,onClick:(0,i.m)(r,()=>{null==h||h()})})});c.displayName="ActionBarPrimitive.Copy"},18090:(e,t,n)=>{"use strict";n.d(t,{N:()=>i});var r=n(565);function i(e,t,n,i){let a=i?i-1:Number.POSITIVE_INFINITY,s=0;return function(i){return(0,r.On)(i)?(e.enter(n),function i(o){return(0,r.On)(o)&&s++<a?(e.consume(o),i):(e.exit(n),t(o))}(i)):t(i)}}},18560:(e,t,n)=>{"use strict";n.d(t,{B:()=>a});var r=n(18090),i=n(565);let a={partial:!0,tokenize:function(e,t,n){return function(t){return(0,i.On)(t)?(0,r.N)(e,a,"linePrefix")(t):a(t)};function a(e){return null===e||(0,i.HP)(e)?t(e):n(e)}}}},20660:(e,t,n)=>{"use strict";n.d(t,{c:()=>y});var r=n(88068),i=n(23360),a=n(12115),s=n(99723),o=n(41524),l=n(44162),u=e=>{let t=(0,o.c)(e),n=(0,a.useCallback)(e=>{let n=new ResizeObserver(()=>{t()}),r=new MutationObserver(()=>{t()});return n.observe(e),r.observe(e,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),()=>{n.disconnect(),r.disconnect()}},[t]);return(0,l.s)(n)},c=n(34462),d=n(86903),h=n(40617),f=e=>{let{autoScroll:t=!0}=e,n=(0,a.useRef)(null),i=(0,h.D0)(),o=(0,a.useRef)(0),f=(0,a.useRef)(!1),p=e=>{let r=n.current;r&&t&&(f.current=!0,r.scrollTo({top:r.scrollHeight,behavior:e}))},m=()=>{let e=n.current;if(!e)return;let t=i.getState().isAtBottom,r=e.scrollHeight-e.scrollTop<=e.clientHeight+1;!r&&o.current<e.scrollTop||(r&&(f.current=!1),r!==t&&(0,d.s)(i).setState({isAtBottom:r})),o.current=e.scrollTop},g=u(()=>{(f.current||i.getState().isAtBottom)&&p("instant"),m()}),y=(0,l.s)(e=>(e.addEventListener("scroll",m),()=>{e.removeEventListener("scroll",m)}));(0,c.O)(()=>{p("auto")});let v=(0,s.Mp)();return(0,a.useEffect)(()=>v.unstable_on("run-start",()=>p("auto")),[]),(0,r.s)(g,y,n)},p=n(75828),m=n(95155),g=(0,a.forwardRef)((e,t)=>{let{autoScroll:n,children:a,...s}=e,o=f({autoScroll:n}),l=(0,r.s)(t,o);return(0,m.jsx)(i.sG.div,{...s,ref:l,children:a})}),y=(0,a.forwardRef)((e,t)=>(0,m.jsx)(p.U,{children:(0,m.jsx)(g,{...e,ref:t})}));y.displayName="ThreadPrimitive.Viewport"},21773:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});let r=(0,n(67401).A)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])}
1,22104:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});let r=(0,n(67401).A)("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]])},23920:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});let r=(0,n(67401).A)("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},24087:(e,t,n)=>{"use strict";n.d(t,{h:()=>s});var r=n(9862),i=n(95155),a=()=>(0,r.JX)(e=>e.branchCount),s=()=>{let e=a();return(0,i.jsx)(i.Fragment,{children:e})};s.displayName="BranchPickerPrimitive.Count"},27234:(e,t,n)=>{"use strict";n.d(t,{I:()=>l,y:()=>u});var r=n(37364),i=n(12115),a=n(53562),s=n(99723),o=n(68621),l=()=>{let e=(0,o.I)(),t=(0,s.Mp)(),n=(0,a.y)([t,e],(e,t)=>e.isRunning||!t.isEditing||t.isEmpty),r=(0,i.useCallback)(()=>{e.send()},[e]);return n?null:r},u=(0,r.x)("ComposerPrimitive.Send",l)},27432:(e,t,n)=>{"use strict";n.d(t,{r:()=>a});var r=n(37364),i=n(58432),a=(0,r.x)("ThreadListItemPrimitive.Trigger",()=>{let e=(0,i.pK)();return()=>{e.switchTo()}})},27816:(e,t,n)=>{"use strict";n.d(t,{C:()=>r});let r=function(e){var t,n,o;if(null==e)return a;
1if("function"==typeof e){return t=e,function(e,n,r){return!!(s(e)&&t.call(this,e,"number"==typeof n?n:void 0,r||void 0))}}if("object"==typeof e){return Array.isArray(e)?function(e){let t=[],n=-1;for(;++n<e.length;)t[n]=r(e[n]);return i(function(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1})}(e):(n=e,i(function(e){let t;for(t in n)if(e[t]!==n[t])return!1;return!0}))}if("string"==typeof e){return o=e,i(function(e){return e&&e.type===o})}throw Error("Expected function, string, or object as test")};function i(e){return function(t,n,r){return!!(s(t)&&e.call(this,t,"number"==typeof n?n:void 0,r||void 0))}}function a(){return!0}function s(e){return null!==e&&"object"==typeof e&&"type"in e}},28358:(e,t,n)=>{"use strict";n.d(t,{T:()=>a});var r=n(58432),i=n(95155),a=e=>{let{fallback:t}=e,n=(0,r.Xi)(e=>e.title);return(0,i.jsx)(i.Fragment,{children:n||t})};a.displayName="ThreadListItemPrimitive.Title"},29424:(e,t,n)=>{"use strict";function r(){}function i(){}n.d(t,{HB:()=>i,ok:()=>r})},30938:(e,t,n)=>{"use strict";function r(e,t,n,r){let i;let a=e.length,s=0;if(t=t<0?-t>a?0:a+t:t>a?a:t,n=n>0?n:0,r.length<1e4)(i=Array.from(r)).unshift(t,n),e.splice(...i);else for(n&&e.splice(t,n);s<r.length;)(i=r.slice(s,s+1e4)).unshift(t,0),e.splice(...i),s+=1e4,t+=1e4}function i(e,t){return e.length>0?(r(e,e.length,0,t),e):t}n.d(t,{V:()=>i,m:()=>r})},32415:(e,t,n)=>{"use strict";n.d(t,{e:()=>x});var r=n(12115),i=n(99723),a=n(99827),s=n(9862),o=()=>(0,a.v)(e=>({isCopied:!1,setIsCopied:t=>{e({isCopied:t})},isHovering:!1,setIsHovering:t=>{e({isHovering:t})}})),l=n(86903),u=n(36505),c=n(95155),d=e=>{let[t]=(0,r.useState)(()=>(0,a.v)(()=>e));return(0,r.useEffect)(()=>{(0,u.Q)(e),(0,l.s)(t).setState(e,!0)},[e,t]),t},h=()=>{let[e]=(0,r.useState)(()=>o());return e},f=e=>{let{runtime:t,children:n}=e,i=d(t),a=h(),[o]=(0,r.useState)(()=>({useMessageRuntime:i,useMessageUtils:a}));return(0,c.jsx)(s.Nf.Provider,{value:o,children:n})},p=(e,t)=>e.Message===t.Message&&e.EditComposer===t.EditComposer&&e.UserEditComposer===t.UserEditComposer&&e.AssistantEditComposer===t.AssistantEditComposer&&e.SystemEditComposer===t.SystemEditComposer&&e.UserMessage===t.UserMessage&&e.AssistantMessage===t.AssistantMessage&&e.SystemMessage===t.SystemMessage,m=()=>null,g=(e,t,n)=>{var r,i,a,s,o,l,u,c,d,h,f,p;switch(t){case"user":if(n)return null!==(a=null!==(i=null!==(r=e.UserEditComposer)&&void 0!==r?r:e.EditComposer)&&void 0!==i?i:e.UserMessage)&&void 0!==a?a:e.Message;return null!==(s=e.UserMessage)&&void 0!==s?s:e.Message;case"assistant":if(n)return null!==(u=null!==(l=null!==(o=e.AssistantEditComposer)&&void 0!==o?o:e.EditComposer)&&void 0!==l?l:e.AssistantMessage)&&void 0!==u?u:e.Message;return null!==(c=e.AssistantMessage)&&void 0!==c?c:e.Message;case"system":if(n)return null!==(f=null!==(h=null!==(d=e.SystemEditComposer)&&void 0!==d?d:e.EditComposer)&&void 0!==h?h:e.SystemMessage)&&void 0!==f?f:e.Message;return null!==(p=e.SystemMessage)&&void 0!==p?p:m;default:throw Error("Unknown message role: ".concat(t))}},y=e=>{let{components:t}=e,n=g(t,(0,s.JX)(e=>e.role),(0,s.iP)(e=>e.isEditing));return(0,c.jsx)(n,{})},v=(0,r.memo)(e=>{let{messageIndex:t,components:n}=e,a=(0,i.Mp)(),s=(0,r.useMemo)(()=>a.getMesssageByIndex(t),[a,t]);return(0,c.jsx)(f,{runtime:s,children:(0,c.jsx)(y,{components:n})})},(e,t)=>e.messageIndex===t.messageIndex&&p(e.components,t.components)),b=e=>{let{components:t}=e,n=(0,i._W)(e=>e.messages.length);return 0===n?null:Array.from({length:n},(e,n)=>(0,c.jsx)(v,{messageIndex:n,components:t},n))};b.displayName="ThreadPrimitive.Messages";var x=(0,r.memo)(b,(e,t)=>p(e.components,t.components))},33473:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});let r=(0,n(67401).A)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},34462:(e,t,n)=>{"use strict";n.d(t,{O:()=>s});var r=n(41524),i=n(12115),a=n(40617),s=e=>{let t=(0,r.c)(e),n=(0,a.qZ)(e=>e.onScrollToBottom);(0,i.useEffect)(()=>n(t),[n,t])}},34678:(e,t,n)=>{"use strict";n.d(t,{c:()=>c});var r=n(12115),i=n(9862),a=n(41524),s=n(87062),o=n(86903),l=class{start(){null===this.animationFrameId&&(this.lastUpdateTime=Date.now(),this.animate())}stop(){null!==this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}constructor(e,t){this.animationFrameId=null,this.lastUpdateTime=Date.now(),this.targetText="",this.animate=()=>{let e=Date.now(),t=e-this.lastUpdateTime,n=this.targetText.length-this.currentText.length,r=Math.min(5,250/n),i=0;for(;t>=r&&i<n;)i++,t-=r;i!==n?this.animationFrameId=requestAnimationFrame(this.animate):this.animationFrameId=null,0!==i&&(this.currentText=this.targetText.slice(0,this.currentText.length+i),this.lastUpdateTime=e-t,this.setText(this.currentText))},this.currentText=e,this.setText=t}},u=Object.freeze({type:"running"}),c=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],{text:n}=e,c=(0,i.JX)({optional:!0,selector:e=>e.id}),d=(0,r.useRef)(c),[h,f]=(0,r.useState)(n),p=(0,s.Bs)({optional:!0}),m=(0,a.c)(t=>{if(f(t),p){let n=h!==t||"running"===e.status.type?u:e.status;(0,o.s)(p).setState(n,!0)}});(0,r.useEffect)(()=>
1{if(p){let t=h!==n||"running"===e.status.type?u:e.status;(0,o.s)(p).setState(t,!0)}},[p,n,h,e.status]);let[g]=(0,r.useState)(new l(n,m));return(0,r.useEffect)(()=>{if(!t){g.stop();return}if(d.current!==c||!n.startsWith(g.targetText)){d.current=c,m(n),g.currentText=n,g.targetText=n,g.stop();return}g.targetText=n,g.start()},[m,g,c,t,n]),(0,r.useEffect)(()=>()=>{g.stop()},[g]),(0,r.useMemo)(()=>t?{type:"text",text:h,status:n===h?e.status:u}:e,[t,h,e,n])}},34732:(e,t,n)=>{"use strict";var r=n(95714).Buffer;let i=void 0!==r,a=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,s=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function o(e,t,n){null==n&&null!==t&&"object"==typeof t&&(n=t,t=void 0),i&&r.isBuffer(e)&&(e=e.toString()),e&&65279===e.charCodeAt(0)&&(e=e.slice(1));let o=JSON.parse(e,t);if(null===o||"object"!=typeof o)return o;let u=n&&n.protoAction||"error",c=n&&n.constructorAction||"error";if("ignore"===u&&"ignore"===c)return o;if("ignore"!==u&&"ignore"!==c){if(!1===a.test(e)&&!1===s.test(e))return o}else if("ignore"!==u&&"ignore"===c){if(!1===a.test(e))return o}else if(!1===s.test(e))return o;return l(o,{protoAction:u,constructorAction:c,safe:n&&n.safe})}function l(e,{protoAction:t="error",constructorAction:n="error",safe:r}={}){let i=[e];for(;i.length;){let e=i;for(let a of(i=[],e)){if("ignore"!==t&&Object.prototype.hasOwnProperty.call(a,"__proto__")){if(!0===r)return null;if("error"===t)throw SyntaxError("Object contains forbidden prototype property");delete a.__proto__}if("ignore"!==n&&Object.prototype.hasOwnProperty.call(a,"constructor")&&Object.prototype.hasOwnProperty.call(a.constructor,"prototype")){if(!0===r)return null;if("error"===n)throw SyntaxError("Object contains forbidden prototype property");delete a.constructor}for(let e in a){let t=a[e];t&&"object"==typeof t&&i.push(t)}}}return e}function u(e,t,n){let{stackTraceLimit:r}=Error;Error.stackTraceLimit=0;try{return o(e,t,n)}finally{Error.stackTraceLimit=r}}e.exports=u,e.exports.default=u,e.exports.parse=u,e.exports.safeParse=function(e,t){let{stackTraceLimit:n}=Error;Error.stackTraceLimit=0;try{return o(e,t,{safe:!0})}catch(e){return null}finally{Error.stackTraceLimit=n}},e.exports.scan=l},34919:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var n=null;if(!e||"string"!=typeof e)return n;var r=(0,i.default)(e),a="function"==typeof t;return r.forEach(function(e){if("declaration"===e.type){var r=e.property,i=e.value;a?t(r,i,e):i&&((n=n||{})[r]=i)}}),n};var i=r(n(80466))},36240:(e,t,n)=>{"use strict";n.d(t,{A:()=>u});var r=n(81865),i=n(12115),a=n(23360),s=n(93610),o=n(95155),l=()=>{let e=(0,r.Ij)();return()=>{e.switchToNewThread()}},u=(0,i.forwardRef)((e,t)=>{let{onClick:n,disabled:i,...u}=e,c=(0,r._K)(e=>e.newThread===e.mainThreadId),d=l();return(0,o.jsx)(a.sG.button,{type:"button",...c?{"data-active":"true","aria-current":"true"}:null,...u,ref:t,disabled:i||!d,onClick:(0,s.m)(n,()=>{null==d||d()})})});u.displayName="ThreadListPrimitive.New"},37364:(e,t,n)=>{"use strict";n.d(t,{x:()=>o});var r=n(12115),i=n(23360),a=n(93610),s=n(95155),o=(e,t,n=[])=>{let o=(0,r.forwardRef)((e,r)=>{let o={},l={};Object.keys(e).forEach(t=>{n.includes(t)?o[t]=e[t]:l[t]=e[t]});let u=t(o)??void 0;return(0,s.jsx)(i.sG.button,{type:"button",...l,ref:r,disabled:l.disabled||!u,onClick:(0,a.m)(l.onClick,u)})});return o.displayName=e,o}},37795:(e,t,n)=>{"use strict";n.d(t,{dc:()=>a,VG:()=>s});var r=n(27816);let i=[],a=!1;function s(e,t,n,s){let o;"function"==typeof t&&"function"!=typeof n?(s=n,n=t):o=t;let l=(0,r.C)(o),u=s?-1:1;(function e(r,o,c){let d=r&&"object"==typeof r?r:{};if("string"==typeof d.type){let e="string"==typeof d.tagName?d.tagName:"string"==typeof d.name?d.name:void 0;Object.defineProperty(h,"name",{value:"node ("+r.type+(e?"<"+e+">":"")+")"})}return h;function h(){var d;let h,f,p,m=i;if((!t||l(r,o,c[c.length-1]||void 0))&&(m=Array.isArray(d=n(r,c))?d:"number"==typeof d?[!0,d]:null==d?i:[d])[0]===a)return m;if("children"in r&&r.children&&r.children&&"skip"!==m[0])for(f=(s?r.children.length:-1)+u,p=c.concat(r);f>-1&&f<r.children.length;){if((h=e(r.children[f],f,p)())[0]===a)return h;f="number"==typeof h[1]?h[1]:f+u}return m}})(e,void 0,[])()}},38792:(e,t,n)=>{"use strict";n.d(t,{U:()=>l});var r=n(93610),i=n(23360),a=n(12115),s=n(27234),o=n(95155),l=(0,a.forwardRef)((e,t)=>{let{onSubmit:n,...a}=e,l=(0,s.I)();return(0,o.jsx)(i.sG.form,{...a,ref:t,onSubmit:(0,r.m)(n,e=>{e.preventDefault(),l&&l()})})});l.displayName="ComposerPrimitive.Root"},40600:(e,t,n)=>{"use strict";n.d(t,{w:()=>P});var r=n(12115),i=n(81865),a=n(61565),s=n(99827),o=n(86903),l=n(9859),u=n(36505),c=n(95155),d={type:"complete"},h={type:"running"},f=e=>{let{children:t,text:n,isRunning:i}=e,[f]=(0,r.useState)(()=>{let e=(0,s.v)(()=>({status:i?h:d,type:"text",text:n})),t=new l.j({path:{ref:"text",threadSelector:{type:"main"},messageSelector:{type:"messageId",messageId:""},contentPartSelector:{type:"index",index:0}},getState:e.getState,subscribe:e.subscribe});return(0,u.Q)(t),{useContentPartRuntime:(0,s.v)(()=>t),useContentPart:e}});return(0,r.useEffect)(()=>{let e=f.useContentPart.getState(),t=e.text!==n,r=i?h:d,a=e.status!==r;(t||a)&&(0,o.s)(f.useContentPart).setState({type:"text",text:n,status:r},!0)},[f,i,n]),(0,c.jsx)(a.A_.Provider,{value:f,children:t})},p=n(9862),m=e=>{let[t]=(0,r.useState)(()=>(0,s.v)(()=>e));return(0,r.useEffect)(()=>{(0,u.Q)(e),(0,o.s)(t).setState(e,!0)},[e,t]),t},g=e=>{let{runtime:t,children:n}=e,i=m(t),[s]=(0,r.useState)(()=>({useContentPartRuntime:i}));return(0,c.jsx)(a.A_.Provider,{value:s,children:n})},y=n(77426),v=n(34678),b=(0,r.forwardRef)((e,t)=>{let{smooth:n=!0,component:r="span",...i}=e,{text:a,status:s}=(0,v.c)((0,y.X)(),n);return(0,c.jsx)(r,{"data-status":s.type,...i,ref:t,children:a})});b.displayName="ContentPartPrimitive.Text";var x=n(23360),_=()=>(0,a.iy)(e=>{if("image"!==e.type)throw Error("ContentPartImage can only be used inside image content parts.");return e}),w=(0,r.forwardRef)((e,t)=>{let{image:n}=_();return(0,c.jsx)(x.sG.img,{src:n,...e,ref:t})});w.displayName="ContentPartPrimitive.Image";var k=e=>{let{children:t}=e;return(0,a.iy)(e=>"running"===e.status.type)?t:null};k.displayName="ContentPartPrimitive.InProgress";var S=e=>{var t;let{Fallback:n,...r}=e,a=null!==(t=(0,i.Dr)(e=>e.getToolUI(r.toolName)))&&void 0!==t?t:n;return a?(0,c.jsx)(a,{...r}):null},E={Text:()=>(0,c.jsxs)("p",{style:{whiteSpace:"pre-line"},children:[(0,c.jsx)(b,{}),(0,c.jsx)(k,{children:(0,c.jsx)("span",{style:{fontFamily:"revert"},children:" ●"})})]}),Reasoning:()=>null,Source:()=>null,Image:()=>(0,c.jsx)(w,{}),File:()=>null,Unstable_Audio:()=>null},T=e=>{let{components:{Text:t=E.Text,Reasoning:n=E.Reasoning,Image:r=E.Image,Source:i=E.Source,File:s=E.File,Unstable_Audio:o=E.Unstable_Audio,tools:l={}}={}}=e,u=(0,a.g1)(),d=(0,a.iy)(),h=d.type;if("tool-call"===h){var f,p;let e=e=>u.addToolResult(e);if("Override"in l)return(0,c.jsx)(l.Override,{...d,addResult:e});
1let t=null!==(p=null===(f=l.by_name)||void 0===f?void 0:f[d.toolName])&&void 0!==p?p:l.Fallback;return(0,c.jsx)(S,{...d,Fallback:t,addResult:e})}if("requires-action"===d.status.type)throw Error("Encountered unexpected requires-action status");switch(h){case"text":return(0,c.jsx)(t,{...d});case"reasoning":return(0,c.jsx)(n,{...d});case"source":return(0,c.jsx)(i,{...d});case"image":return(0,c.jsx)(r,{...d});case"file":return(0,c.jsx)(s,{...d});case"audio":return(0,c.jsx)(o,{...d});default:throw Error("Unknown content part type: ".concat(h))}},I=(0,r.memo)(e=>{let{partIndex:t,components:n}=e,i=(0,p.LN)(),a=(0,r.useMemo)(()=>i.getContentPartByIndex(t),[i,t]);return(0,c.jsx)(g,{runtime:a,children:(0,c.jsx)(T,{components:n})})},(e,t)=>{var n,r,i,a,s,o,l,u,c,d,h,f,p,m;return e.partIndex===t.partIndex&&(null===(n=e.components)||void 0===n?void 0:n.Text)===(null===(r=t.components)||void 0===r?void 0:r.Text)&&(null===(i=e.components)||void 0===i?void 0:i.Reasoning)===(null===(a=t.components)||void 0===a?void 0:a.Reasoning)&&(null===(s=e.components)||void 0===s?void 0:s.Source)===(null===(o=t.components)||void 0===o?void 0:o.Source)&&(null===(l=e.components)||void 0===l?void 0:l.Image)===(null===(u=t.components)||void 0===u?void 0:u.Image)&&(null===(c=e.components)||void 0===c?void 0:c.File)===(null===(d=t.components)||void 0===d?void 0:d.File)&&(null===(h=e.components)||void 0===h?void 0:h.Unstable_Audio)===(null===(f=t.components)||void 0===f?void 0:f.Unstable_Audio)&&(null===(p=e.components)||void 0===p?void 0:p.tools)===(null===(m=t.components)||void 0===m?void 0:m.tools)}),C=Object.freeze({type:"complete"}),A=e=>{let{status:t,component:n}=e;return(0,c.jsx)(f,{text:"",isRunning:"running"===t.type,children:(0,c.jsx)(n,{type:"text",text:"",status:t})})},R=(0,r.memo)(e=>{var t,n;let{components:r}=e,i=null!==(t=(0,p.JX)(e=>e.status))&&void 0!==t?t:C;return(null==r?void 0:r.Empty)?(0,c.jsx)(r.Empty,{status:i}):(0,c.jsx)(A,{status:i,component:null!==(n=null==r?void 0:r.Text)&&void 0!==n?n:E.Text})},(e,t)=>{var n,r,i,a;return(null===(n=e.components)||void 0===n?void 0:n.Empty)===(null===(r=t.components)||void 0===r?void 0:r.Empty)&&(null===(i=e.components)||void 0===i?void 0:i.Text)===(null===(a=t.components)||void 0===a?void 0:a.Text)}),P=e=>{let{components:t}=e,n=(0,p.JX)(e=>e.content.length);return 0===n?(0,c.jsx)(R,{components:t}):Array.from({length:n},(e,n)=>(0,c.jsx)(I,{partIndex:n,components:t},n))};P.displayName="MessagePrimitive.Content"},40617:(e,t,n)=>{"use strict";n.d(t,{D0:()=>u,Ek:()=>s,qZ:()=>l});var r=n(12115),i=n(88804),a=n(4703),s=(0,r.createContext)(null),o=(0,i.h)(s,"ThreadPrimitive.Viewport"),{useThreadViewport:l,useThreadViewportStore:u}=(0,a.o)(o,"useThreadViewport")},40905:(e,t,n)=>{"use strict";n.d(t,{Mz:()=>eJ,i3:()=>eG,UC:()=>eY,bL:()=>eK,Bk:()=>eO});var r=n(12115);let i=["top","right","bottom","left"],a=Math.min,s=Math.max,o=Math.round,l=Math.floor,u=e=>({x:e,y:e}),c={left:"right",right:"left",bottom:"top",top:"bottom"},d={start:"end",end:"start"};function h(e,t){return"function"==typeof e?e(t):e}function f(e){return e.split("-")[0]}function p(e){return e.split("-")[1]}function m(e){return"x"===e?"y":"x"}function g(e){return"y"===e?"height":"width"}function y(e){return["top","bottom"].includes(f(e))?"y":"x"}function v(e){return e.replace(/start|end/g,e=>d[e])}function b(e){return e.replace(/left|right|bottom|top/g,e=>c[e])}function x(e){return"number"!=typeof e?{top:0,right:0,bottom:0,left:0,...e}:{top:e,right:e,bottom:e,left:e}}function _(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function w(e,t,n){let r,{reference:i,floating:a}=e,s=y(t),o=m(y(t)),l=g(o),u=f(t),c="y"===s,d=i.x+i.width/2-a.width/2,h=i.y+i.height/2-a.height/2,v=i[l]/2-a[l]/2;switch(u){case"top":r={x:d,y:i.y-a.height};break;case"bottom":r={x:d,y:i.y+i.height};break;case"right":r={x:i.x+i.width,y:h};break;case"left":r={x:i.x-a.width,y:h};break;default:r={x:i.x,y:i.y}}switch(p(t)){case"start":r[o]-=v*(n&&c?-1:1);break;case"end":r[o]+=v*(n&&c?-1:1)}return r}let k=async(e,t,n)=>{let{placement:r="bottom",strategy:i="absolute",middleware:a=[],platform:s}
1=n,o=a.filter(Boolean),l=await (null==s.isRTL?void 0:s.isRTL(t)),u=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:c,y:d}=w(u,r,l),h=r,f={},p=0;for(let n=0;n<o.length;n++){let{name:a,fn:m}=o[n],{x:g,y:y,data:v,reset:b}=await m({x:c,y:d,initialPlacement:r,placement:h,strategy:i,middlewareData:f,rects:u,platform:s,elements:{reference:e,floating:t}});c=null!=g?g:c,d=null!=y?y:d,f={...f,[a]:{...f[a],...v}},b&&p<=50&&(p++,"object"==typeof b&&(b.placement&&(h=b.placement),b.rects&&(u=!0===b.rects?await s.getElementRects({reference:e,floating:t,strategy:i}):b.rects),{x:c,y:d}=w(u,h,l)),n=-1)}return{x:c,y:d,placement:h,strategy:i,middlewareData:f}};async function S(e,t){var n;void 0===t&&(t={});let{x:r,y:i,platform:a,rects:s,elements:o,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:f=!1,padding:p=0}=h(t,e),m=x(p),g=o[f?"floating"===d?"reference":"floating":d],y=_(await a.getClippingRect({element:null==(n=await (null==a.isElement?void 0:a.isElement(g)))||n?g:g.contextElement||await (null==a.getDocumentElement?void 0:a.getDocumentElement(o.floating)),boundary:u,rootBoundary:c,strategy:l})),v="floating"===d?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,b=await (null==a.getOffsetParent?void 0:a.getOffsetParent(o.floating)),w=await (null==a.isElement?void 0:a.isElement(b))&&await (null==a.getScale?void 0:a.getScale(b))||{x:1,y:1},k=_(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:v,offsetParent:b,strategy:l}):v);return{top:(y.top-k.top+m.top)/w.y,bottom:(k.bottom-y.bottom+m.bottom)/w.y,left:(y.left-k.left+m.left)/w.x,right:(k.right-y.right+m.right)/w.x}}function E(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function T(e){return i.some(t=>e[t]>=0)}async function I(e,t){let{placement:n,platform:r,elements:i}=e,a=await (null==r.isRTL?void 0:r.isRTL(i.floating)),s=f(n),o=p(n),l="y"===y(n),u=["left","top"].includes(s)?-1:1,c=a&&l?-1:1,d=h(t,e),{mainAxis:m,crossAxis:g,alignmentAxis:v}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return o&&"number"==typeof v&&(g="end"===o?-1*v:v),l?{x:g*c,y:m*u}:{x:m*u,y:g*c}}function C(){return"undefined"!=typeof window}function A(e){return O(e)?(e.nodeName||"").toLowerCase():"#document"}function R(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function P(e){var t;return null==(t=(O(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function O(e){return!!C()&&(e instanceof Node||e instanceof R(e).Node)}function M(e){return!!C()&&(e instanceof Element||e instanceof R(e).Element)}function N(e){return!!C()&&(e instanceof HTMLElement||e instanceof R(e).HTMLElement)}function j(e){return!!C()&&"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof R(e).ShadowRoot)}function D(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=U(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(i)}function L(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch(e){return!1}})}function B(e){let t=F(),n=M(e)?U(e):e;return["transform","translate","scale","rotate","perspective"].some(e=>!!n[e]&&"none"!==n[e])||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","translate","scale","rotate","perspective","filter"].some(e=>(n.willChange||"").includes(e))||["paint","layout","strict","content"].some(e=>(n.contain||"").includes(e))}function F(){return"undefined"!=typeof CSS&&!!CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")}function z(e){return["html","body","#document"].includes(A(e))}function U(e){return R(e).getComputedStyle(e)}function Z(e){return M(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function H(e){if("html"===A(e))return e;let t=e.assignedSlot||e.parentNode||j(e)&&e.host||P(e);return j(t)?t.host:t}
1function V(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);let i=function e(t){let n=H(t);return z(n)?t.ownerDocument?t.ownerDocument.body:t.body:N(n)&&D(n)?n:e(n)}(e),a=i===(null==(r=e.ownerDocument)?void 0:r.body),s=R(i);if(a){let e=$(s);return t.concat(s,s.visualViewport||[],D(i)?i:[],e&&n?V(e):[])}return t.concat(i,V(i,[],n))}function $(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function q(e){let t=U(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=N(e),a=i?e.offsetWidth:n,s=i?e.offsetHeight:r,l=o(n)!==a||o(r)!==s;return l&&(n=a,r=s),{width:n,height:r,$:l}}function W(e){return M(e)?e:e.contextElement}function K(e){let t=W(e);if(!N(t))return u(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=q(t),s=(a?o(n.width):n.width)/r,l=(a?o(n.height):n.height)/i;return s&&Number.isFinite(s)||(s=1),l&&Number.isFinite(l)||(l=1),{x:s,y:l}}let J=u(0);function Y(e){let t=R(e);return F()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:J}function G(e,t,n,r){var i;void 0===t&&(t=!1),void 0===n&&(n=!1);let a=e.getBoundingClientRect(),s=W(e),o=u(1);t&&(r?M(r)&&(o=K(r)):o=K(e));let l=(void 0===(i=n)&&(i=!1),r&&(!i||r===R(s))&&i)?Y(s):u(0),c=(a.left+l.x)/o.x,d=(a.top+l.y)/o.y,h=a.width/o.x,f=a.height/o.y;if(s){let e=R(s),t=r&&M(r)?R(r):r,n=e,i=$(n);for(;i&&r&&t!==n;){let e=K(i),t=i.getBoundingClientRect(),r=U(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,s=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,d*=e.y,h*=e.x,f*=e.y,c+=a,d+=s,i=$(n=R(i))}}return _({width:h,height:f,x:c,y:d})}function X(e,t){let n=Z(e).scrollLeft;return t?t.left+n:G(P(e)).left+n}function Q(e,t,n){void 0===n&&(n=!1);let r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-(n?0:X(e,r)),y:r.top+t.scrollTop}}function ee(e,t,n){let r;if("viewport"===t)r=function(e,t){let n=R(e),r=P(e),i=n.visualViewport,a=r.clientWidth,s=r.clientHeight,o=0,l=0;if(i){a=i.width,s=i.height;let e=F();(!e||e&&"fixed"===t)&&(o=i.offsetLeft,l=i.offsetTop)}return{width:a,height:s,x:o,y:l}}(e,n);else if("document"===t)r=function(e){let t=P(e),n=Z(e),r=e.ownerDocument.body,i=s(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=s(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+X(e),l=-n.scrollTop;return"rtl"===U(r).direction&&(o+=s(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:l}}(P(e));else if(M(t))r=function(e,t){let n=G(e,!0,"fixed"===t),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=N(e)?K(e):u(1),s=e.clientWidth*a.x,o=e.clientHeight*a.y;return{width:s,height:o,x:i*a.x,y:r*a.y}}(t,n);else{let n=Y(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return _(r)}function et(e){return"static"===U(e).position}function en(e,t){if(!N(e)||"fixed"===U(e).position)return null;if(t)return t(e);let n=e.offsetParent;return P(e)===n&&(n=n.ownerDocument.body),n}function er(e,t){let n=R(e);if(L(e))return n;if(!N(e)){let t=H(e);for(;t&&!z(t);){if(M(t)&&!et(t))return t;t=H(t)}return n}let r=en(e,t);for(;r&&["table","td","th"].includes(A(r))&&et(r);)r=en(r,t);return r&&z(r)&&et(r)&&!B(r)?n:r||function(e){let t=H(e);for(;N(t)&&!z(t);){if(B(t))return t;if(L(t))break;t=H(t)}return null}(e)||n}let ei=async function(e){let t=this.getOffsetParent||er,n=this.getDimensions,r=await n(e.floating);return{reference:function(e,t,n){let r=N(t),i=P(t),a="fixed"===n,s=G(e,!0,a,t),o={scrollLeft:0,scrollTop:0},l=u(0);if(r||!r&&!a){if(("body"!==A(t)||D(i))&&(o=Z(t)),r){let e=G(t,!0,a,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else i&&(l.x=X(i))}let c=!i||r||a?u(0):Q(i,o);return{x:s.left+o.scrollLeft-l.x-c.x,y:s.top+o.scrollTop-l.y-c.y,width:s.width,height:s.height}}(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},ea={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a="fixed"===i,s=P(r),o=!!t&&L(t.floating);if(r===s||o&&a)return n;let l={scrollLeft:0,scrollTop:0},c=u(1),d=u(0),h=N(r);if((h||!h&&!a)&&(("body"!==A(r)||D(s))&&(l=Z(r)),N(r))){let e=G(r);c=K(r),d.x=e.x+r.clientLeft,d.y=e.y+r.clientTop}let f=!s||h||a?u(0):Q(s,l,!0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+d.x+f.x,y:n.y*c.y-l.scrollTop*c.y+d.y+f.y}},getDocumentElement:P,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,o=[..."clippingAncestors"===n?L(t)?[]:function(e,t){let n=t.get(e);if(n)return n;let r=V(e,[],!1).filter(e=>M(e)&&"body"!==A(e)),i=null,a="fixed"===U(e).position,s=a?H(e):e;for(;M(s)&&!z(s);){let t=U(s),n=B(s);n||"fixed"!==t.position||(i=null),(a?!n&&!i:!n&&"static"===t.position&&!!i&&["absolute","fixed"].includes(i.position)||D(s)&&!n&&function e(t,n){let r=H(t);return!(r===n||!M(r)||z(r))&&("fixed"===U(r).position||e(r,n))}(e,s))?r=r.filter(e=>e!==s):i=t,s=H(s)}return t.set(e,r),r}(t,this._c):[].concat(n),r],l=o[0],u=o.reduce((e,n)=>{let r=ee(t,n,i);return e.top=s(r.top,e.top),e.right=a(r.right,e.right),e.bottom=a(r.bottom,e.bottom),e.left=s(r.left,e.left),e},ee(t,l,i));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}},getOffsetParent:er,getElementRects:ei,getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){let{width:t,height:n}=q(e);return{width:t,height:n}},getScale:K,isElement:M,isRTL:function(e){return"rtl"===U(e).direction}};function es(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}let eo=e=>({name:"arrow",options:e,async fn(t){let{x:n,y:r,placement:i,rects:o,platform:l,elements:u,middlewareData:c}=t,{element:d,padding:f=0}=h(e,t)||{};if(null==d)return{};let v=x(f),b={x:n,y:r},_=m(y(i)),w=g(_),k=await l.getDimensions(d),S="y"===_,E=S?"clientHeight":"clientWidth",T=o.reference[w]+o.reference[_]-b[_]-o.floating[w],I=b[_]-o.reference[_],C=await (null==l.getOffsetParent?void 0:l.getOffsetParent(d)),A=C?C[E]:0;A&&await (null==l.isElement?void 0:l.isElement(C))||(A=u.floating[E]||o.floating[w]);let R=A/2-k[w]/2-1,P=a(v[S?"top":"left"],R),O=a(v[S?"bottom":"right"],R),M=A-k[w]-O,N=A/2-k[w]/2+(T/2-I/2),j=s(P,a(N,M)),D=!c.arrow&&null!=p(i)&&N!==j&&o.reference[w]/2-(N<P?P:O)-k[w]/2<0,L=D?N<P?N-P:N-M:0;return{[_]:b[_]+L,data:{[_]:j,centerOffset:N-j-L,...D&&{alignmentOffset:L}},reset:D}}}
1),el=(e,t,n)=>{let r=new Map,i={platform:ea,...n},a={...i.platform,_c:r};return k(e,t,{...i,platform:a})};var eu=n(47650),ec="undefined"!=typeof document?r.useLayoutEffect:r.useEffect;function ed(e,t){let n,r,i;if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if((n=e.length)!==t.length)return!1;for(r=n;0!=r--;)if(!ed(e[r],t[r]))return!1;return!0}if((n=(i=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!({}).hasOwnProperty.call(t,i[r]))return!1;for(r=n;0!=r--;){let n=i[r];if(("_owner"!==n||!e.$$typeof)&&!ed(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function eh(e){return"undefined"==typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ef(e,t){let n=eh(e);return Math.round(t*n)/n}function ep(e){let t=r.useRef(e);return ec(()=>{t.current=e}),t}let em=e=>({name:"arrow",options:e,fn(t){let{element:n,padding:r}="function"==typeof e?e(t):e;return n&&({}).hasOwnProperty.call(n,"current")?null!=n.current?eo({element:n.current,padding:r}).fn(t):{}:n?eo({element:n,padding:r}).fn(t):{}}}),eg=(e,t)=>({...function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;let{x:i,y:a,placement:s,middlewareData:o}=t,l=await I(t,e);return s===(null==(n=o.offset)?void 0:n.placement)&&null!=(r=o.arrow)&&r.alignmentOffset?{}:{x:i+l.x,y:a+l.y,data:{...l,placement:s}}}}}(e),options:[e,t]}),ey=(e,t)=>({...function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){let{x:n,y:r,placement:i}=t,{mainAxis:o=!0,crossAxis:l=!1,limiter:u={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=h(e,t),d={x:n,y:r},p=await S(t,c),g=y(f(i)),v=m(g),b=d[v],x=d[g];if(o){let e="y"===v?"top":"left",t="y"===v?"bottom":"right",n=b+p[e],r=b-p[t];b=s(n,a(b,r))}if(l){let e="y"===g?"top":"left",t="y"===g?"bottom":"right",n=x+p[e],r=x-p[t];x=s(n,a(x,r))}let _=u.fn({...t,[v]:b,[g]:x});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[v]:o,[g]:l}}}}}}(e),options:[e,t]}),ev=(e,t)=>({...function(e){return void 0===e&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:s}=t,{offset:o=0,mainAxis:l=!0,crossAxis:u=!0}=h(e,t),c={x:n,y:r},d=y(i),p=m(d),g=c[p],v=c[d],b=h(o,t),x="number"==typeof b?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(l){let e="y"===p?"height":"width",t=a.reference[p]-a.floating[e]+x.mainAxis,n=a.reference[p]+a.reference[e]-x.mainAxis;g<t?g=t:g>n&&(g=n)}if(u){var _,w;let e="y"===p?"width":"height",t=["top","left"].includes(f(i)),n=a.reference[d]-a.floating[e]+(t&&(null==(_=s.offset)?void 0:_[d])||0)+(t?0:x.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:(null==(w=s.offset)?void 0:w[d])||0)-(t?x.crossAxis:0);v<n?v=n:v>r&&(v=r)}return{[p]:g,[d]:v}}}}(e),options:[e,t]}),eb=(e,t)=>({...function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r,i,a,s;let{placement:o,middlewareData:l,rects:u,initialPlacement:c,platform:d,elements:x}=t,{mainAxis:_=!0,crossAxis:w=!0,fallbackPlacements:k,fallbackStrategy:E="bestFit",fallbackAxisSideDirection:T="none",flipAlignment:I=!0,...C}=h(e,t);if(null!=(n=l.arrow)&&n.alignmentOffset)return{};let A=f(o),R=y(c),P=f(c)===c,O=await (null==d.isRTL?void 0:d.isRTL(x.floating)),M=k||(P||!I?[b(c)]:function(e){let t=b(e);return[v(e),t,v(t)]}(c)),N="none"!==T;!k&&N&&M.push(...function(e,t,n,r){let i=p(e),a=function(e,t,n){let r=["left","right"],i=["right","left"];switch(e){case"top":case"bottom":if(n)return t?i:r;return t?r:i;case"left":case"right":return t?["top","bottom"]:["bottom","top"];default:return[]}}(f(e),"start"===n,r);return i&&(a=a.map(e=>e+"-"+i),t&&(a=a.concat(a.map(v)))),a}(c,I,T,O));let j=[c,...M],D=await S(t,C),L=[],B=(null==(r=l.flip)?void 0:r.overflows)||[];if(_&&L.push(D[A]),w){let e=function(e,t,n){void 0===n&&(n=!1);let r=p(e),i=m(y(e)),a=g(i),s="x"===i?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[a]>t.floating[a]&&(s=b(s)),[s,b(s)]}(o,u,O);L.push(D[e[0]],D[e[1]])}if(B=[...B,{placement:o,overflows:L}],!L.every(e=>e<=0)){let e=((null==(i=l.flip)?void 0:i.index)||0)+1,t=j[e];if(t)return{data:{index:e,overflows:B},reset:{placement:t}};let n=null==(a=B.filter(e=>e.overflows[0]<=0).sort((e,t)=>
1e.overflows[1]-t.overflows[1])[0])?void 0:a.placement;if(!n)switch(E){case"bestFit":{let e=null==(s=B.filter(e=>{if(N){let t=y(e.placement);return t===R||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:s[0];e&&(n=e);break}case"initialPlacement":n=c}if(o!==n)return{reset:{placement:n}}}return{}}}}(e),options:[e,t]}),ex=(e,t)=>({...function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,r;let i,o;let{placement:l,rects:u,platform:c,elements:d}=t,{apply:m=()=>{},...g}=h(e,t),v=await S(t,g),b=f(l),x=p(l),_="y"===y(l),{width:w,height:k}=u.floating;"top"===b||"bottom"===b?(i=b,o=x===(await (null==c.isRTL?void 0:c.isRTL(d.floating))?"start":"end")?"left":"right"):(o=b,i="end"===x?"top":"bottom");let E=k-v.top-v.bottom,T=w-v.left-v.right,I=a(k-v[i],E),C=a(w-v[o],T),A=!t.middlewareData.shift,R=I,P=C;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(P=T),null!=(r=t.middlewareData.shift)&&r.enabled.y&&(R=E),A&&!x){let e=s(v.left,0),t=s(v.right,0),n=s(v.top,0),r=s(v.bottom,0);_?P=w-2*(0!==e||0!==t?e+t:s(v.left,v.right)):R=k-2*(0!==n||0!==r?n+r:s(v.top,v.bottom))}await m({...t,availableWidth:P,availableHeight:R});let O=await c.getDimensions(d.floating);return w!==O.width||k!==O.height?{reset:{rects:!0}}:{}}}}(e),options:[e,t]}),e_=(e,t)=>({...function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){let{rects:n}=t,{strategy:r="referenceHidden",...i}=h(e,t);switch(r){case"referenceHidden":{let e=E(await S(t,{...i,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:T(e)}}}case"escaped":{let e=E(await S(t,{...i,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:T(e)}}}default:return{}}}}}(e),options:[e,t]}),ew=(e,t)=>({...em(e),options:[e,t]});var ek=n(23360),eS=n(95155),eE=r.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,eS.jsx)(ek.sG.svg,{...a,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:(0,eS.jsx)("polygon",{points:"0,0 30,0 15,10"})})});eE.displayName="Arrow";var eT=n(88068),eI=n(18166),eC=n(41524),eA=n(46611),eR="Popper",[eP,eO]=(0,eI.A)(eR),[eM,eN]=eP(eR),ej=e=>{let{__scopePopper:t,children:n}=e,[i,a]=r.useState(null);return(0,eS.jsx)(eM,{scope:t,anchor:i,onAnchorChange:a,children:n})};ej.displayName=eR;var eD="PopperAnchor",eL=r.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:i,...a}=e,s=eN(eD,n),o=r.useRef(null),l=(0,eT.s)(t,o);return r.useEffect(()=>{s.onAnchorChange((null==i?void 0:i.current)||o.current)}),i?null:(0,eS.jsx)(ek.sG.div,{...a,ref:l})});eL.displayName=eD;var eB="PopperContent",[eF,ez]=eP(eB),eU=r.forwardRef((e,t)=>{var n,i,o,u,c,d,h,f;let{__scopePopper:p,side:m="bottom",sideOffset:g=0,align:y="center",alignOffset:v=0,arrowPadding:b=0,avoidCollisions:x=!0,collisionBoundary:_=[],collisionPadding:w=0,sticky:k="partial",hideWhenDetached:S=!1,updatePositionStrategy:E="optimized",onPlaced:T,...I}=e,C=eN(eB,p),[A,R]=r.useState(null),O=(0,eT.s)(t,e=>R(e)),[M,N]=r.useState(null),j=function(e){let[t,n]=r.useState(void 0);return(0,eA.N)(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{let r,i;if(!Array.isArray(t)||!t.length)return;let a=t[0];if("borderBoxSize"in a){let e=a.borderBoxSize,t=Array.isArray(e)?e[0]:e;r=t.inlineSize,i=t.blockSize}else r=e.offsetWidth,i=e.offsetHeight;n({width:r,height:i})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}n(void 0)},[e]),t}(M),D=null!==(h=null==j?void 0:j.width)&&void 0!==h?h:0,L=null!==(f=null==j?void 0:j.height)&&void 0!==f?f:0,B="number"==typeof w?w:{top:0,right:0,bottom:0,left:0,...w},F=Array.isArray(_)?_:[_],z=F.length>0,U={padding:B,boundary:F.filter(e$),altBoundary:z},{refs:Z,floatingStyles:H,placement:$,isPositioned:q,middlewareData:K}=function(e){void 0===e&&(e={});let{placement:t="bottom",strategy:n="absolute",middleware:i=[],platform:a,elements:{reference:s,floating:o}={},transform:l=!0,whileElementsMounted:u,open:c}=e,[d,h]=r.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=r.useState(i);ed(f,i)||p(i);let[m,g]=r.useState(null),[y,v]=r.useState(null),b=r.useCallback(e=>
1{e!==k.current&&(k.current=e,g(e))},[]),x=r.useCallback(e=>{e!==S.current&&(S.current=e,v(e))},[]),_=s||m,w=o||y,k=r.useRef(null),S=r.useRef(null),E=r.useRef(d),T=null!=u,I=ep(u),C=ep(a),A=ep(c),R=r.useCallback(()=>{if(!k.current||!S.current)return;let e={placement:t,strategy:n,middleware:f};C.current&&(e.platform=C.current),el(k.current,S.current,e).then(e=>{let t={...e,isPositioned:!1!==A.current};P.current&&!ed(E.current,t)&&(E.current=t,eu.flushSync(()=>{h(t)}))})},[f,t,n,C,A]);ec(()=>{!1===c&&E.current.isPositioned&&(E.current.isPositioned=!1,h(e=>({...e,isPositioned:!1})))},[c]);let P=r.useRef(!1);ec(()=>(P.current=!0,()=>{P.current=!1}),[]),ec(()=>{if(_&&(k.current=_),w&&(S.current=w),_&&w){if(I.current)return I.current(_,w,R);R()}},[_,w,R,I,T]);let O=r.useMemo(()=>({reference:k,floating:S,setReference:b,setFloating:x}),[b,x]),M=r.useMemo(()=>({reference:_,floating:w}),[_,w]),N=r.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=ef(M.floating,d.x),r=ef(M.floating,d.y);return l?{...e,transform:"translate("+t+"px, "+r+"px)",...eh(M.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}},[n,l,M.floating,d.x,d.y]);return r.useMemo(()=>({...d,update:R,refs:O,elements:M,floatingStyles:N}),[d,R,O,M,N])}({strategy:"fixed",placement:m+("center"!==y?"-"+y:""),whileElementsMounted:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e,t,n,r){let i;void 0===r&&(r={});let{ancestorScroll:o=!0,ancestorResize:u=!0,elementResize:c="function"==typeof ResizeObserver,layoutShift:d="function"==typeof IntersectionObserver,animationFrame:h=!1}=r,f=W(e),p=o||u?[...f?V(f):[],...V(t)]:[];p.forEach(e=>{o&&e.addEventListener("scroll",n,{passive:!0}),u&&e.addEventListener("resize",n)});let m=f&&d?function(e,t){let n,r=null,i=P(e);function o(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return!function u(c,d){void 0===c&&(c=!1),void 0===d&&(d=1),o();let h=e.getBoundingClientRect(),{left:f,top:p,width:m,height:g}=h;if(c||t(),!m||!g)return;let y=l(p),v=l(i.clientWidth-(f+m)),b={rootMargin:-y+"px "+-v+"px "+-l(i.clientHeight-(p+g))+"px "+-l(f)+"px",threshold:s(0,a(1,d))||1},x=!0;function _(t){let r=t[0].intersectionRatio;if(r!==d){if(!x)return u();r?u(!1,r):n=setTimeout(()=>{u(!1,1e-7)},1e3)}1!==r||es(h,e.getBoundingClientRect())||u(),x=!1}try{r=new IntersectionObserver(_,{...b,root:i.ownerDocument})}catch(e){r=new IntersectionObserver(_,b)}r.observe(e)}(!0),o}(f,n):null,g=-1,y=null;c&&(y=new ResizeObserver(e=>{let[r]=e;r&&r.target===f&&y&&(y.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var e;null==(e=y)||e.observe(t)})),n()}),f&&!h&&y.observe(f),y.observe(t));let v=h?G(e):null;return h&&function t(){let r=G(e);v&&!es(v,r)&&n(),v=r,i=requestAnimationFrame(t)}(),n(),()=>{var e;p.forEach(e=>{o&&e.removeEventListener("scroll",n),u&&e.removeEventListener("resize",n)}),null==m||m(),null==(e=y)||e.disconnect(),y=null,h&&cancelAnimationFrame(i)}}(...t,{animationFrame:"always"===E})},elements:{reference:C.anchor},middleware:[eg({mainAxis:g+L,alignmentAxis:v}),x&&ey({mainAxis:!0,crossAxis:!1,limiter:"partial"===k?ev():void 0,...U}),x&&eb({...U}),ex({...U,apply:e=>{let{elements:t,rects:n,availableWidth:r,availableHeight:i}=e,{width:a,height:s}=n.reference,o=t.floating.style;o.setProperty("--radix-popper-available-width","".concat(r,"px")),o.setProperty("--radix-popper-available-height","".concat(i,"px")),o.setProperty("--radix-popper-anchor-width","".concat(a,"px")),o.setProperty("--radix-popper-anchor-height","".concat(s,"px"))}}),M&&ew({element:M,padding:b}),eq({arrowWidth:D,arrowHeight:L}),S&&e_({strategy:"referenceHidden",...U})]}),[J,Y]=eW($),X=(0,eC.c)(T);(0,eA.N)(()=>{q&&(null==X||X())},[q,X]);let Q=null===(n=K.arrow)||void 0===n?void 0:n.x,ee=null===(i=K.arrow)||void 0===i?void 0:i.y,et=(null===(o=K.arrow)||void 0===o?void 0:o.centerOffset)!==0,[en,er]=r.useState();return(0,eA.N)(()=>{A&&er(window.getComputedStyle(A).zIndex)},[A]),(0,eS.jsx)("div",{ref:Z.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:q?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:en,"--radix-popper-transform-origin":[null===(u=K.transformOrigin)||void 0===u?void 0:u.x,null===(c=K.transformOrigin)||void 0===c?void 0:c.y].join(" "),...(null===(d=K.hide)||void 0===d?void 0:d.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:(0,eS.jsx)(eF,{scope:p,placedSide:J,onArrowChange:N,arrowX:Q,arrowY:ee,shouldHideArrow:et,children:(0,eS.jsx)(ek.sG.div,{"data-side":J,"data-align":Y,...I,ref:O,style:{...I.style,animation:q?void 0:"none"}})})})});eU.displayName=eB;var eZ="PopperArrow",eH={top:"bottom",right:"left",bottom:"top",left:"r
1ight"},eV=r.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=ez(eZ,n),a=eH[i.placedSide];return(0,eS.jsx)("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:(0,eS.jsx)(eE,{...r,ref:t,style:{...r.style,display:"block"}})})});function e$(e){return null!==e}eV.displayName=eZ;var eq=e=>({name:"transformOrigin",options:e,fn(t){var n,r,i,a,s;let{placement:o,rects:l,middlewareData:u}=t,c=(null===(n=u.arrow)||void 0===n?void 0:n.centerOffset)!==0,d=c?0:e.arrowWidth,h=c?0:e.arrowHeight,[f,p]=eW(o),m={start:"0%",center:"50%",end:"100%"}[p],g=(null!==(a=null===(r=u.arrow)||void 0===r?void 0:r.x)&&void 0!==a?a:0)+d/2,y=(null!==(s=null===(i=u.arrow)||void 0===i?void 0:i.y)&&void 0!==s?s:0)+h/2,v="",b="";return"bottom"===f?(v=c?m:"".concat(g,"px"),b="".concat(-h,"px")):"top"===f?(v=c?m:"".concat(g,"px"),b="".concat(l.floating.height+h,"px")):"right"===f?(v="".concat(-h,"px"),b=c?m:"".concat(y,"px")):"left"===f&&(v="".concat(l.floating.width+h,"px"),b=c?m:"".concat(y,"px")),{data:{x:v,y:b}}}});function eW(e){let[t,n="center"]=e.split("-");return[t,n]}var eK=ej,eJ=eL,eY=eU,eG=eV},40926:(e,t,n)=>{"use strict";var r=n(95714).Buffer;let i=void 0!==r,a=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,s=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function o(e,t,n){null==n&&null!==t&&"object"==typeof t&&(n=t,t=void 0),i&&r.isBuffer(e)&&(e=e.toString()),e&&65279===e.charCodeAt(0)&&(e=e.slice(1));let o=JSON.parse(e,t);if(null===o||"object"!=typeof o)return o;let u=n&&n.protoAction||"error",c=n&&n.constructorAction||"error";if("ignore"===u&&"ignore"===c)return o;if("ignore"!==u&&"ignore"!==c){if(!1===a.test(e)&&!1===s.test(e))return o}else if("ignore"!==u&&"ignore"===c){if(!1===a.test(e))return o}else if(!1===s.test(e))return o;return l(o,{protoAction:u,constructorAction:c,safe:n&&n.safe})}function l(e,{protoAction:t="error",constructorAction:n="error",safe:r}={}){let i=[e];for(;i.length;){let e=i;for(let a of(i=[],e)){if("ignore"!==t&&Object.prototype.hasOwnProperty.call(a,"__proto__")){if(!0===r)return null;if("error"===t)throw SyntaxError("Object contains forbidden prototype property");delete a.__proto__}if("ignore"!==n&&Object.prototype.hasOwnProperty.call(a,"constructor")&&Object.prototype.hasOwnProperty.call(a.constructor,"prototype")){if(!0===r)return null;if("error"===n)throw SyntaxError("Object contains forbidden prototype property");delete a.constructor}for(let e in a){let t=a[e];t&&"object"==typeof t&&i.push(t)}}}return e}function u(e,t,n){let{stackTraceLimit:r}=Error;Error.stackTraceLimit=0;try{return o(e,t,n)}finally{Error.stackTraceLimit=r}}e.exports=u,e.exports.default=u,e.exports.parse=u,e.exports.safeParse=function(e,t){let{stackTraceLimit:n}=Error;Error.stackTraceLimit=0;try{return o(e,t,{safe:!0})}catch(e){return null}finally{Error.stackTraceLimit=n}},e.exports.scan=l},44162:(e,t,n)=>{"use strict";n.d(t,{s:()=>i});var r=n(12115),i=e=>{let t=(0,r.useRef)(void 0);return(0,r.useCallback)(n=>{t.current&&t.current(),n&&(t.current=e(n))},[e])}},45375:(e,t,n)=>{"use strict";n.d(t,{UC:()=>q,ZL:()=>$,Kq:()=>Z,bL:()=>H,l9:()=>V});var r=n(12115),i=n(93610),a=n(88068),s=n(18166),o=n(73741),l=n(67668),u=n(40905),c=n(17323),d=n(17028),h=n(23360),f=n(12317),p=n(1488),m=n(95155),g=r.forwardRef((e,t)=>(0,m.jsx)(h.sG.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));g.displayName="VisuallyHidden";var[y,v]=(0,s.A)("Tooltip",[u.Bk]),b=(0,u.Bk)(),x="TooltipProvider",_="tooltip.open",[w,k]=y(x),S=e=>{let{__scopeTooltip:t,delayDuration:n=700,skipDelayDuration:i=300,disableHoverableContent:a=!1,children:s}=e,[o,l]=r.useState(!0),u=r.useRef(!1),c=r.useRef(0);return r.useEffect(()=>
1{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,m.jsx)(w,{scope:t,isOpenDelayed:o,delayDuration:n,onOpen:r.useCallback(()=>{window.clearTimeout(c.current),l(!1)},[]),onClose:r.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>l(!0),i)},[i]),isPointerInTransitRef:u,onPointerInTransitChange:r.useCallback(e=>{u.current=e},[]),disableHoverableContent:a,children:s})};S.displayName=x;var E="Tooltip",[T,I]=y(E),C=e=>{let{__scopeTooltip:t,children:n,open:i,defaultOpen:a=!1,onOpenChange:s,disableHoverableContent:o,delayDuration:c}=e,d=k(E,e.__scopeTooltip),h=b(t),[f,g]=r.useState(null),y=(0,l.B)(),v=r.useRef(0),x=null!=o?o:d.disableHoverableContent,w=null!=c?c:d.delayDuration,S=r.useRef(!1),[I=!1,C]=(0,p.i)({prop:i,defaultProp:a,onChange:e=>{e?(d.onOpen(),document.dispatchEvent(new CustomEvent(_))):d.onClose(),null==s||s(e)}}),A=r.useMemo(()=>I?S.current?"delayed-open":"instant-open":"closed",[I]),R=r.useCallback(()=>{window.clearTimeout(v.current),v.current=0,S.current=!1,C(!0)},[C]),P=r.useCallback(()=>{window.clearTimeout(v.current),v.current=0,C(!1)},[C]),O=r.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{S.current=!0,C(!0),v.current=0},w)},[w,C]);return r.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]),(0,m.jsx)(u.bL,{...h,children:(0,m.jsx)(T,{scope:t,contentId:y,open:I,stateAttribute:A,trigger:f,onTriggerChange:g,onTriggerEnter:r.useCallback(()=>{d.isOpenDelayed?O():R()},[d.isOpenDelayed,O,R]),onTriggerLeave:r.useCallback(()=>{x?P():(window.clearTimeout(v.current),v.current=0)},[P,x]),onOpen:R,onClose:P,disableHoverableContent:x,children:n})})};C.displayName=E;var A="TooltipTrigger",R=r.forwardRef((e,t)=>{let{__scopeTooltip:n,...s}=e,o=I(A,n),l=k(A,n),c=b(n),d=r.useRef(null),f=(0,a.s)(t,d,o.onTriggerChange),p=r.useRef(!1),g=r.useRef(!1),y=r.useCallback(()=>p.current=!1,[]);return r.useEffect(()=>()=>document.removeEventListener("pointerup",y),[y]),(0,m.jsx)(u.Mz,{asChild:!0,...c,children:(0,m.jsx)(h.sG.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...s,ref:f,onPointerMove:(0,i.m)(e.onPointerMove,e=>{"touch"===e.pointerType||g.current||l.isPointerInTransitRef.current||(o.onTriggerEnter(),g.current=!0)}),onPointerLeave:(0,i.m)(e.onPointerLeave,()=>{o.onTriggerLeave(),g.current=!1}),onPointerDown:(0,i.m)(e.onPointerDown,()=>{p.current=!0,document.addEventListener("pointerup",y,{once:!0})}),onFocus:(0,i.m)(e.onFocus,()=>{p.current||o.onOpen()}),onBlur:(0,i.m)(e.onBlur,o.onClose),onClick:(0,i.m)(e.onClick,o.onClose)})})});R.displayName=A;var P="TooltipPortal",[O,M]=y(P,{forceMount:void 0}),N=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=I(P,t);return(0,m.jsx)(O,{scope:t,forceMount:n,children:(0,m.jsx)(d.C,{present:n||a.open,children:(0,m.jsx)(c.Z,{asChild:!0,container:i,children:r})})})};N.displayName=P;var j="TooltipContent",D=r.forwardRef((e,t)=>{let n=M(j,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...a}=e,s=I(j,e.__scopeTooltip);return(0,m.jsx)(d.C,{present:r||s.open,children:s.disableHoverableContent?(0,m.jsx)(z,{side:i,...a,ref:t}):(0,m.jsx)(L,{side:i,...a,ref:t})})}),L=r.forwardRef((e,t)=>{let n=I(j,e.__scopeTooltip),i=k(j,e.__scopeTooltip),s=r.useRef(null),o=(0,a.s)(t,s),[l,u]=r.useState(null),{trigger:c,onClose:d}=n,h=s.current,{onPointerInTransitChange:f}=i,p=r.useCallback(()=>{u(null),f(!1)},[f]),g=r.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=function(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw Error("unreachable")}}(r,n.getBoundingClientRect());u(function(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+!!(e.y>t.y)),function(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return(n.pop(),1===t.length&&1===n.length&&t[0].x===n[0].x&&t[0].y===n[0].y)?t:t.concat(n)}(t)}([...function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5,r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n})}return r}(r,i),...function(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}(t.getBoundingClientRect())])),f(!0)},[f]);return r.useEffect(()=>()=>
1p(),[p]),r.useEffect(()=>{if(c&&h){let e=e=>g(e,h),t=e=>g(e,c);return c.addEventListener("pointerleave",e),h.addEventListener("pointerleave",t),()=>{c.removeEventListener("pointerleave",e),h.removeEventListener("pointerleave",t)}}},[c,h,g,p]),r.useEffect(()=>{if(l){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=(null==c?void 0:c.contains(t))||(null==h?void 0:h.contains(t)),i=!function(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let s=t[e].x,o=t[e].y,l=t[a].x,u=t[a].y;o>r!=u>r&&n<(l-s)*(r-o)/(u-o)+s&&(i=!i)}return i}(n,l);r?p():i&&(p(),d())};return document.addEventListener("pointermove",e),()=>document.removeEventListener("pointermove",e)}},[c,h,l,d,p]),(0,m.jsx)(z,{...e,ref:o})}),[B,F]=y(E,{isInside:!1}),z=r.forwardRef((e,t)=>{let{__scopeTooltip:n,children:i,"aria-label":a,onEscapeKeyDown:s,onPointerDownOutside:l,...c}=e,d=I(j,n),h=b(n),{onClose:p}=d;return r.useEffect(()=>(document.addEventListener(_,p),()=>document.removeEventListener(_,p)),[p]),r.useEffect(()=>{if(d.trigger){let e=e=>{let t=e.target;(null==t?void 0:t.contains(d.trigger))&&p()};return window.addEventListener("scroll",e,{capture:!0}),()=>window.removeEventListener("scroll",e,{capture:!0})}},[d.trigger,p]),(0,m.jsx)(o.qW,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:e=>e.preventDefault(),onDismiss:p,children:(0,m.jsxs)(u.UC,{"data-state":d.stateAttribute,...h,...c,ref:t,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[(0,m.jsx)(f.xV,{children:i}),(0,m.jsx)(B,{scope:n,isInside:!0,children:(0,m.jsx)(g,{id:d.contentId,role:"tooltip",children:a||i})})]})})});D.displayName=j;var U="TooltipArrow";r.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=b(n);return F(U,n).isInside?null:(0,m.jsx)(u.i3,{...i,...r,ref:t})}).displayName=U;var Z=S,H=C,V=R,$=N,q=D},46967:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});let r=(0,n(67401).A)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},48213:(e,t,n)=>{"use strict";function r(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}n.d(t,{B:()=>r})},52252:(e,t,n)=>{"use strict";n.d(t,{Y_:()=>l,x1:()=>o});var r=n(12115),i=n(95155),a=(e,t)=>"string"==typeof e?e===t:JSON.stringify(e)===JSON.stringify(t),s=(e,t)=>!!e&&!!t&&JSON.stringify(e?.properties)===JSON.stringify(t?.properties)&&a(e?.children,t?.children),o=(e,t)=>s(e.node,t.node),l=(e={})=>Object.fromEntries(Object.entries(e??{}).map(([e,t])=>t?[e,(0,r.memo)(({node:e,...n})=>(0,i.jsx)(t,{...n}),o)]:[e,t]))},53562:(e,t,n)=>{"use strict";n.d(t,{y:()=>a});var r=n(12115),i=e=>{let t=t=>{let n=e.map(e=>e.subscribe(t));return()=>{for(let e of n)e()}};return n=>{let i=()=>n(...e.map(e=>e.getState()));return(0,r.useSyncExternalStore)(t,i,i)}},a=(e,t)=>(0,r.useMemo)(()=>i(e),e)(t)},53928:(e,t,n)=>{"use strict";n.d(t,{K:()=>s});var r=n(23360),i=n(12115),a=n(95155),s=(0,i.forwardRef)((e,t)=>(0,a.jsx)(r.sG.div,{...e,ref:t}));s.displayName="ThreadPrimitive.Root"},54039:(e,t,n)=>{"use strict";n.d(t,{s:()=>s});var r=n(9862),i=n(53562),a=e=>{let t=(0,r.LN)(),n=(0,r.vd)();return(0,i.y)([t,n],(t,n)=>{var r;let{role:i,attachments:a,content:s,branchCount:o,isLast:l,speech:u,submittedFeedback:c}=t,{isCopied:d,isHovering:h}=n;return(!0!==e.hasBranches||!(o<2))&&(!e.user||"user"===i)&&(!e.assistant||"assistant"===i)&&(!e.system||"system"===i)&&(!0!==e.lastOrHover||!!h||!!l)&&(!0!==e.copied||!!d)&&(!1!==e.copied||!d)&&(!0!==e.speaking||null!=u)&&(!1!==e.speaking||null==u)&&(!0!==e.hasAttachments||"user"===i&&!!a.length)&&(!1!==e.hasAttachments||"user"!==i||!a.length)&&(!0!==e.hasContent||0!==s.length)&&(!1!==e.hasContent||!(s.length>0))&&(void 0===e.submittedFeedback||(null!==(r=null==c?void 0:c.type)&&void 0!==r?r:null)===e.submittedFeedback)&&!0})},s=e=>{let{children:t,...n}=e;return a(n)?t:null};s.displayName="MessagePrimitive.If"},57478:(e,t,n)=>{"use strict";n.d(t,{g:()=>l});var r=n(12115),i=n(77369),a=n(81865),s=n(95155),o=(0,r.memo)(e=>{let{partIndex:t,archived:n,components:o}=e,l=(0,a.Ij)(),u=(0,r.useMemo)(()=>n?l.threads.getArchivedItemByIndex(t):l.threads.getItemByIndex(t),[l,t,n]),c=o.ThreadListItem;return(0,s.jsx)(i.X,{runtime:u,children:(0,s.jsx)(c,{})})},(e,t)=>e.partIndex===t.partIndex&&e.archived===t.archived&&e.components.ThreadListItem===t.components.ThreadListItem),l=e=>{let{archived:t=!1,components:n}=e;return Array.from({length:(0,a._K)(e=>t?e.archivedThreads.length:e.threads.length)},(e,r)=>(0,s.jsx)(o,{partIndex:r,archived:t,components:n},r))};l.displayName="ThreadListPrimitive.Items"},58432:(e,t,n)=>{"use strict";n.d(t,{Xi:()=>u,pK:()=>l,vz:()=>s});var r=n(12115),i=n(88804),a=n(88668),s=(0,r.createContext)(null),o=(0,i.h)(s,"a component passed to <ThreadListPrimitive.Items components={...}>");function l(e){let t=o(e);return t?t.useThreadListItemRuntime():null}var u=(0,a.k)(l)},59263:(e,t,n)=>{"use strict";n.d(t,{$7:()=>o,U_:()=>l,fv:()=>s});var r=n(12115),i=n(52252),a=n(95155),s=(0,r.createContext)(null),o=()=>null!==(0,r.useContext)(s),l=(0,r.memo)(e=>{let{children:t,...n}=e;return(0,a.jsx)(s.Provider,{value:n,children:t})},i.x1)},59721:e=>{"use strict";var t=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===n.call(e)},s=function(e){if(!e||"[object Object]"!==n.call(e))return!1;var r,i=t.call(e,"constructor"),a=e.constructor&&e.constructor.prototype&&t.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!i&&!a)return!1;for(r in e);return void 0===r||t.call(e,r)},o=function(e,t){r&&"__proto__"===t.name?r(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,n){if("__proto__"===n){if(!t.call(e,n))return;if(i)return i(e,n).value}return e[n]};e.exports=function e(){var t,n,r,i,u,c,d=arguments[0],h=1,f=arguments.length,p=!1;for("boolean"==typeof d&&(p=d,d=arguments[1]||{},h=2),(null==d||"object"!=typeof d&&"function"!=typeof d)&&(d={});h<f;++h)if(t=arguments[h],null!=t)for(n in t)r=l(d,n),d!==(i=l(t,n))&&(p&&i&&(s(i)||(u=a(i)))?(u?(u=!1,c=r&&a(r)?r:[]):c=r&&s(r)?r:{},o(d,{name:n,newValue:e(p,c,i)})):void 0!==i&&o(d,{name:n,newValue:i}));return d}}
1,60872:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});let r=(0,n(67401).A)("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},61565:(e,t,n)=>{"use strict";n.d(t,{A_:()=>s,g1:()=>l,iy:()=>u});var r=n(12115),i=n(88804),a=n(88668),s=(0,r.createContext)(null),o=(0,i.h)(s,"a component passed to <MessagePrimitive.Content components={...}>");function l(e){let t=o(e);return t?t.useContentPartRuntime():null}var u=(0,a.k)(l)},64731:(e,t,n)=>{"use strict";n.d(t,{l:()=>s});var r=n(9862),i=n(95155),a=()=>(0,r.JX)(e=>e.branchNumber),s=()=>{let e=a();return(0,i.jsx)(i.Fragment,{children:e})};s.displayName="BranchPickerPrimitive.Number"},65001:(e,t,n)=>{"use strict";n.d(t,{i:()=>l});var r=n(37364),i=n(12115),a=n(9862),s=n(99723),o=n(53562),l=(0,r.x)("ActionBarPrimitive.Reload",()=>{let e=(0,a.LN)(),t=(0,s.Mp)(),n=(0,o.y)([t,e],(e,t)=>e.isRunning||e.isDisabled||"assistant"!==t.role),r=(0,i.useCallback)(()=>{e.reload()},[e]);return n?null:r})},65186:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});let r=(0,n(67401).A)("SendHorizontal",[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]])},66261:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});let r=(0,n(67401).A)("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]])},67827:(e,t,n)=>{"use strict";n.d(t,{i:()=>nL});var r={};n.r(r),n.d(r,{cg:()=>s.c,a2:()=>o.a2,D0:()=>o.D0});var i={};n.r(i),n.d(i,{boolean:()=>w,booleanish:()=>k,commaOrSpaceSeparated:()=>C,commaSeparated:()=>I,number:()=>E,overloadedBoolean:()=>S,spaceSeparated:()=>T});var a={};n.r(a),n.d(a,{attentionMarkers:()=>tb,contentInitial:()=>tf,disable:()=>tx,document:()=>th,flow:()=>tm,flowInitial:()=>tp,insideSpan:()=>tv,string:()=>tg,text:()=>ty});var s=n(34678),o=n(87062),l=n(77426),u=n(12115),c=n(29424);let d=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,h=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,f={};function p(e,t){return((t||f).jsx?h:d).test(e)}let m=/[ \t\n\f\r]/g;function g(e){return""===e.replace(m,"")}class y{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}}function v(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new y(n,r,t)}function b(e){return e.toLowerCase()}y.prototype.normal={},y.prototype.property={},y.prototype.space=void 0;class x{constructor(e,t){this.attribute=t,this.property=e}}x.prototype.attribute="",x.prototype.booleanish=!1,x.prototype.boolean=!1,x.prototype.commaOrSpaceSeparated=!1,x.prototype.commaSeparated=!1,x.prototype.defined=!1,x.prototype.mustUseProperty=!1,x.prototype.number=!1,x.prototype.overloadedBoolean=!1,x.prototype.property="",x.prototype.spaceSeparated=!1,x.prototype.space=void 0;let _=0,w=A(),k=A(),S=A(),E=A(),T=A(),I=A(),C=A();function A(){return 2**++_}let R=Object.keys(i);class P extends x{constructor(e,t,n,r){let a=-1;if(super(e,t),function(e,t,n){n&&(e[t]=n)}(this,"space",r),"number"==typeof n)for(;++a<R.length;){let e=R[a];!function(e,t,n){n&&(e[t]=n)}(this,R[a],(n&i[e])===i[e])}}}function O(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new P(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[b(r)]=r,n[b(a.attribute)]=r}return new y(t,n,e.space)}P.prototype.defined=!0;let M=O({properties:{ariaActiveDescendant:null,ariaAtomic:k,ariaAutoComplete:null,ariaBusy:k,ariaChecked:k,ariaColCount:E,ariaColIndex:E,ariaColSpan:E,ariaControls:T,ariaCurrent:null,ariaDescribedBy:T,ariaDetails:null,ariaDisabled:k,ariaDropEffect:T,ariaErrorMessage:null,ariaExpanded:k,ariaFlowTo:T,ariaGrabbed:k,ariaHasPopup:null,ariaHidden:k,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:T,ariaLevel:E,ariaLive:null,ariaModal:k,ariaMultiLine:k,ariaMultiSelectable:k,ariaOrientation:null,ariaOwns:T,ariaPlaceholder:null,ariaPosInSet:E,ariaPressed:k,ariaReadOnly:k,ariaRelevant:null,ariaRequired:k,ariaRoleDescription:T,ariaRowCount:E,ariaRowIndex:E,ariaRowSpan:E,ariaSelected:k,ariaSetSize:E,ariaSort:null,ariaValueMax:E,ariaValueMin:E,ariaValueNow:E,ariaValueText:null,role:null},transform:(e,t)=>
vendor: 4,641 bytes, line 1
1"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function N(e,t){return t in e?e[t]:t}function j(e,t){return N(e,t.toLowerCase())}let D=O({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:I,acceptCharset:T,accessKey:T,action:null,allow:null,allowFullScreen:w,allowPaymentRequest:w,allowUserMedia:w,alt:null,as:null,async:w,autoCapitalize:null,autoComplete:T,autoFocus:w,autoPlay:w,blocking:T,capture:null,charSet:null,checked:w,cite:null,className:T,cols:E,colSpan:null,content:null,contentEditable:k,controls:w,controlsList:T,coords:E|I,crossOrigin:null,data:null,dateTime:null,decoding:null,default:w,defer:w,dir:null,dirName:null,disabled:w,download:S,draggable:k,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:w,formTarget:null,headers:T,height:E,hidden:w,high:E,href:null,hrefLang:null,htmlFor:T,httpEquiv:T,id:null,imageSizes:null,imageSrcSet:null,inert:w,inputMode:null,integrity:null,is:null,isMap:w,itemId:null,itemProp:T,itemRef:T,itemScope:w,itemType:T,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:w,low:E,manifest:null,max:null,maxLength:E,media:null,method:null,min:null,minLength:E,multiple:w,muted:w,name:null,nonce:null,noModule:w,noValidate:w,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:w,optimum:E,pattern:null,ping:T,placeholder:null,playsInline:w,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:w,referrerPolicy:null,rel:T,required:w,reversed:w,rows:E,rowSpan:E,sandbox:T,scope:null,scoped:w,seamless:w,selected:w,shadowRootClonable:w,shadowRootDelegatesFocus:w,shadowRootMode:null,shape:null,size:E,sizes:null,slot:null,span:E,spellCheck:k,src:null,srcDoc:null,srcLang:null,srcSet:null,start:E,step:null,style:null,tabIndex:E,target:null,title:null,translate:null,type:null,typeMustMatch:w,useMap:null,value:k,width:E,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:T,axis:null,background:null,bgColor:null,border:E,borderColor:null,bottomMargin:E,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:w,declare:w,event:null,face:null,frame:null,frameBorder:null,hSpace:E,leftMargin:E,link:null,longDesc:null,lowSrc:null,marginHeight:E,marginWidth:E,noResize:w,noHref:w,noShade:w,noWrap:w,object:null,profile:null,prompt:null,rev:null,rightMargin:E,rules:null,scheme:null,scrolling:k,standby:null,summary:null,text:null,topMargin:E,valueType:null,version:null,vAlign:null,vLink:null,vSpace:E,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:w,disableRemotePlayback:w,prefix:null,property:null,results:E,security:null,unselectable:null},space:"html",transform:j}),L=O({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",colorRen
1dering:"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",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:C,accentHeight:E,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:E,amplitude:E,arabicForm:null,ascent:E,attributeName:null,attributeType:null,azimuth:E,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:E,by:null,calcMode:null,capHeight:E,className:T,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRen
1dering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:E,diffuseConstant:E,direction:null,display:null,dur:null,divisor:E,dominantBaseline:null,download:w,dx:null,dy:null,edgeMode:null,editable:null,elevation:E,enableBackground:null,end:null,event:null,exponent:E,externalResourcesRequired:null,fill:null,fillOpacity:E,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:I,g2:I,glyphName:I,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:E,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:E,horizOriginX:E,horizOriginY:E,id:null,ideographic:E,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:E,k:E,k1:E,k2:E,k3:E,k4:E,kernelMatrix:C,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:E,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:E,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:E,overlineThickness:E,paintOrder:null,panose1:null,path:null,pathLength:E,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:T,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:E,pointsAtY:E,pointsAtZ:E,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:C,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:C,rev:C,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:C,requiredFeatures:C,requiredFonts:C,requiredFormats:C,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:E,specularExponent:E,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:E,strikethroughThickness:E,string:null,stroke:null,strokeDashArray:C,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:E,strokeOpacity:E,strokeWidth:null,style:null,surfaceScale:E,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:C,tabIndex:E,tableValues:null,target:null,targetX:E,targetY:E,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:C,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:E,underlineThickness:E,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:E,values:null,vAlphabetic:E,vMathematical:E,vectorEffect:null,vHanging:E,vIdeographic:E,version:null,vertAdvY:E,vertOriginX:E,vertOriginY:E,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:E,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:N}),B=O({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>
1"xlink:"+t.slice(5).toLowerCase()}),F=O({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:j}),z=O({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),U=v([M,D,B,F,z],"html"),Z=v([M,L,B,F,z],"svg"),H=/[A-Z]/g,V=/-[a-z]/g,$=/^data[-\w.:]+$/i;function q(e){return"-"+e.toLowerCase()}function W(e){return e.charAt(1).toUpperCase()}let K={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"};var J=n(34919);let Y=J.default||J,G=function(e){let t=e&&e.position&&e.position.end||{};if("number"==typeof t.line&&t.line>0&&"number"==typeof t.column&&t.column>0)return{line:t.line,column:t.column,offset:"number"==typeof t.offset&&t.offset>-1?t.offset:void 0}},X=function(e){let t=e&&e.position&&e.position.start||{};if("number"==typeof t.line&&t.line>0&&"number"==typeof t.column&&t.column>0)return{line:t.line,column:t.column,offset:"number"==typeof t.offset&&t.offset>-1?t.offset:void 0}};function Q(e){return e&&"object"==typeof e?"position"in e||"type"in e?et(e.position):"start"in e||"end"in e?et(e):"line"in e||"column"in e?ee(e):"":""}function ee(e){return en(e&&e.line)+":"+en(e&&e.column)}function et(e){return ee(e&&e.start)+"-"+ee(e&&e.end)}function en(e){return e&&"number"==typeof e?e:1}class er extends Error{constructor(e,t,n){super(),"string"==typeof t&&(n=t,t=void 0);let r="",i={},a=!1;if(t&&(i="line"in t&&"column"in t?{place:t}:"start"in t&&"end"in t?{place:t}:"type"in t?{ancestors:[t],place:t.position}:{...t}),"string"==typeof e?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&"string"==typeof n){let e=n.indexOf(":");-1===e?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let s=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=s?s.column:void 0,this.fatal=void 0,this.file,this.message=r,this.line=s?s.line:void 0,this.name=Q(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&&"string"==typeof i.cause.stack?i.cause.stack:"",this.actual,this.expected,this.note,this.url}}er.prototype.file="",er.prototype.name="",er.prototype.reason="",er.prototype.message="",er.prototype.stack="",er.prototype.column=void 0,er.prototype.line=void 0,er.prototype.ancestors=void 0,er.prototype.cause=void 0,er.prototype.fatal=void 0,er.prototype.place=void 0,er.prototype.ruleId=void 0,er.prototype.source=void 0;let ei={}.hasOwnProperty,ea=new Map,es=/[A-Z]/g,eo=/-([a-z])/g,el=new Set(["table","tbody","thead","tfoot","tr"]),eu=new Set(["td","th"]),ec="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function ed(e,t,n){var r;return"element"===t.type?function(e,t,n){let r=e.schema,i=r;"svg"===t.tagName.toLowerCase()&&"html"===r.space&&(i=Z,e.schema=i),e.ancestors.push(t);let a=em(e,t.tagName,!1),s=function(e,t){let n,r;let i={};for(r in t.properties)if("children"!==r&&ei.call(t.properties,r)){let a=function(e,t,n){let r=function(e,t){let n=b(t),r=t,i=x;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&$.test(t)){if("-"===t.charAt(4)){let e=t.slice(5).replace(V,W);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!V.test(e)){let n=e.replace(H,q);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}i=P}return new i(r,t)}(e.schema,t);if(!(null==n||"number"==typeof n&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?function(e,t){let n={};return(""===e[e.length-1]?[...e,""]:e).join((n.padRight?" ":"")+","+(!1===n.padLeft?"":" ")).trim()}(n):n.join(" ").trim()),"style"===r.property){let t="object"==typeof n?n:function(e,t){let n={};try{Y(t,function(e,t){let r=e;"--"!==r.slice(0,2)&&("-ms-"===r.slice(0,4)&&(r="ms-"+r.slice(4)),r=r.replace(eo,ey)),n[r]=t})}catch(t){if(!e.ignoreInvalidStyle){let n=new er("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:t,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=ec+"#cannot-parse-style-attribute",n}}return n}(e,String(n));return"css"===e.stylePropertyNameCase&&(t=function(e){let t;let n={};for(t in e)ei.call(e,t)&&(n[function(e){let t=e.replace(es,ev);return"ms-"===t.slice(0,3)&&(t="-"+t),t}(t)]=e[t]);return n}(t)),["style",t]}return["react"===e.elementAttributeNameCase&&r.space?K[r.property]||r.property:r.attribute,n]}}(e,r,t.properties[r]);if(a){let[r,s]=a;e.tableCellAlignToStyle&&"align"===r&&"string"==typeof s&&eu.has(t.tagName)?n=s:i[r]=s}}return n&&((i.style||(i.style={}))["css"===e.stylePropertyNameCase?"text-align":"textAlign"]=n),i}(e,t),o=ep(e,t);return el.has(t.tagName)&&(o=o.filter(function(e){return"string"!=typeof e||!("object"==typeof e?"text"===e.type&&g(e.value):g(e))})),eh(e,s,a,t),ef(s,o),e.ancestors.pop(),e.schema=r,e.create(t,a,s,n)}
1(e,t,n):"mdxFlowExpression"===t.type||"mdxTextExpression"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return(0,c.ok)("ExpressionStatement"===n.type),e.evaluater.evaluateExpression(n.expression)}eg(e,t.position)}(e,t):"mdxJsxFlowElement"===t.type||"mdxJsxTextElement"===t.type?function(e,t,n){let r=e.schema,i=r;"svg"===t.name&&"html"===r.space&&(i=Z,e.schema=i),e.ancestors.push(t);let a=null===t.name?e.Fragment:em(e,t.name,!0),s=function(e,t){let n={};for(let r of t.attributes)if("mdxJsxExpressionAttribute"===r.type){if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];(0,c.ok)("ExpressionStatement"===t.type);let i=t.expression;(0,c.ok)("ObjectExpression"===i.type);let a=i.properties[0];(0,c.ok)("SpreadElement"===a.type),Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else eg(e,t.position)}else{let i;let a=r.name;if(r.value&&"object"==typeof r.value){if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];(0,c.ok)("ExpressionStatement"===t.type),i=e.evaluater.evaluateExpression(t.expression)}else eg(e,t.position)}else i=null===r.value||r.value;n[a]=i}return n}(e,t),o=ep(e,t);return eh(e,s,a,t),ef(s,o),e.ancestors.pop(),e.schema=r,e.create(t,a,s,n)}(e,t,n):"mdxjsEsm"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);eg(e,t.position)}(e,t):"root"===t.type?function(e,t,n){let r={};return ef(r,ep(e,t)),e.create(t,e.Fragment,r,n)}(e,t,n):"text"===t.type?(r=0,t.value):void 0}function eh(e,t,n,r){"string"!=typeof n&&n!==e.Fragment&&e.passNode&&(t.node=r)}function ef(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function ep(e,t){let n=[],r=-1,i=e.passKeys?new Map:ea;for(;++r<t.children.length;){let a;let s=t.children[r];if(e.passKeys){let e="element"===s.type?s.tagName:"mdxJsxFlowElement"===s.type||"mdxJsxTextElement"===s.type?s.name:void 0;if(e){let t=i.get(e)||0;a=e+"-"+t,i.set(e,t+1)}}let o=ed(e,s,a);void 0!==o&&n.push(o)}return n}function em(e,t,n){let r;if(n){if(t.includes(".")){let e;let n=t.split("."),i=-1;for(;++i<n.length;){let t=p(n[i])?{type:"Identifier",name:n[i]}:{type:"Literal",value:n[i]};e=e?{type:"MemberExpression",object:e,property:t,computed:!!(i&&"Literal"===t.type),optional:!1}:t}(0,c.ok)(e,"always a result"),r=e}else r=p(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t}}else r={type:"Literal",value:t};if("Literal"===r.type){let t=r.value;return ei.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);eg(e)}function eg(e,t){let n=new er("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=ec+"#cannot-handle-mdx-estrees-without-createevaluater",n}function ey(e,t){return t.toUpperCase()}function ev(e){return"-"+e.toLowerCase()}let eb={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"]};var ex=n(95155),e_=n(84737),ew=n(30938);class ek{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=null==t?Number.POSITIVE_INFINITY:t;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){this.setCursor(Math.trunc(e));let r=this.right.splice(this.right.length-(t||0),Number.POSITIVE_INFINITY);return n&&eS(this.left,n),r.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),eS(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),eS(this.right,e.reverse())}setCursor(e){if(e!==this.left.length&&(!(e>this.left.length)||0!==this.right.length)&&(!(e<0)||0!==this.left.length)){if(e<this.left.length){let t=this.left.splice(e,Number.POSITIVE_INFINITY);eS(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);eS(this.left,t.reverse())}}}}function eS(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 eE(e){let t,n,r,i,a,s,o;let l={},u=-1,c=new ek(e);for(;++u<c.length;){for(;u in l;)u=l[u];if(t=c.get(u),u&&"chunkFlow"===t[1].type&&"listItemPrefix"===c.get(u-1)[1].type&&((r=0)<(s=t[1]._tokenizer.events).length&&"lineEndingBlank"===s[r][1].type&&(r+=2),r<s.length&&"content"===s[r][1].type))for(;++r<s.length&&"content"!==s[r][1].type;)"chunkText"===s[r][1].type&&(s[r][1]._isInFirstContentOfListItem=!0,r++);if("enter"===t[0])t[1].contentType&&(Object.assign(l,function(e,t){let n,r;let i=e.get(t)[1],a=e.get(t)[2],s=t-1,o=[],l=i._tokenizer;!l&&(l=a.parser[i.contentType](i.start),i._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));let u=l.events,c=[],d={},h=-1,f=i,p=0,m=0,g=[0];for(;f;){for(;e.get(++s)[1]!==f;);o.push(s),!f._tokenizer&&(n=a.sliceStream(f),f.next||n.push(null),r&&l.defineSki
1p(f.start),f._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(n),f._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),r=f,f=f.next}for(f=i;++h<u.length;)"exit"===u[h][0]&&"enter"===u[h-1][0]&&u[h][1].type===u[h-1][1].type&&u[h][1].start.line!==u[h][1].end.line&&(m=h+1,g.push(m),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(l.events=[],f?(f._tokenizer=void 0,f.previous=void 0):g.pop(),h=g.length;h--;){let t=u.slice(g[h],g[h+1]),n=o.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),h=-1;++h<c.length;)d[p+c[h][0]]=p+c[h][1],p+=c[h][1]-c[h][0]-1;return d}(c,u)),u=l[u],o=!0);else if(t[1]._container){for(r=u,n=void 0;r--;)if("lineEnding"===(i=c.get(r))[1].type||"lineEndingBlank"===i[1].type)"enter"===i[0]&&(n&&(c.get(n)[1].type="lineEndingBlank"),i[1].type="lineEnding",n=r);else if("linePrefix"===i[1].type||"listItemIndent"===i[1].type);else break;n&&(t[1].end={...c.get(n)[1].start},(a=c.slice(n,u)).unshift(t),c.splice(n,u-n+1,a))}}return(0,ew.m)(e,0,Number.POSITIVE_INFINITY,c.slice(0)),!o}var eT=n(75234),eI=n(18090),eC=n(565);let eA={tokenize:function(e){let t;let n=e.attempt(this.parser.constructs.contentInitial,function(t){if(null===t){e.consume(t);return}return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),(0,eI.N)(e,n,"linePrefix")},function(n){return e.enter("paragraph"),function n(r){let i=e.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=i),t=i,function t(r){if(null===r){e.exit("chunkText"),e.exit("paragraph"),e.consume(r);return}return(0,eC.HP)(r)?(e.consume(r),e.exit("chunkText"),n):(e.consume(r),t)}(r)}(n)});return n}},eR={tokenize:function(e){let t,n,r;let i=this,a=[],s=0;return o;function o(t){if(s<a.length){let n=a[s];return i.containerState=n[1],e.attempt(n[0].continuation,l,u)(t)}return u(t)}function l(e){if(s++,i.containerState._closeFlow){let n;i.containerState._closeFlow=void 0,t&&y();let r=i.events.length,a=r;for(;a--;)if("exit"===i.events[a][0]&&"chunkFlow"===i.events[a][1].type){n=i.events[a][1].end;break}g(s);let o=r;for(;o<i.events.length;)i.events[o][1].end={...n},o++;return(0,ew.m)(i.events,a+1,0,i.events.slice(r)),i.events.length=o,u(e)}return o(e)}function u(n){if(s===a.length){if(!t)return h(n);if(t.currentConstruct&&t.currentConstruct.concrete)return p(n);i.interrupt=!!(t.currentConstruct&&!t._gfmTableDynamicInterruptHack)}return i.containerState={},e.check(eP,c,d)(n)}function c(e){return t&&y(),g(s),h(e)}function d(e){return i.parser.lazy[i.now().line]=s!==a.length,r=i.now().offset,p(e)}function h(t){return i.containerState={},e.attempt(eP,f,p)(t)}function f(e){return s++,a.push([i.currentConstruct,i.containerState]),h(e)}function p(r){if(null===r){t&&y(),g(0),e.consume(r);return}return t=t||i.parser.flow(i.now()),e.enter("chunkFlow",{_tokenizer:t,contentType:"flow",previous:n}),function t(n){if(null===n){m(e.exit("chunkFlow"),!0),g(0),e.consume(n);return}return(0,eC.HP)(n)?(e.consume(n),m(e.exit("chunkFlow")),s=0,i.interrupt=void 0,o):(e.consume(n),t)}(r)}function m(e,a){let o=i.sliceStream(e);if(a&&o.push(null),e.previous=n,n&&(n.next=e),n=e,t.defineSkip(e.start),t.write(o),i.parser.lazy[e.start.line]){let e,n,a=t.events.length;for(;a--;)if(t.events[a][1].start.offset<r&&(!t.events[a][1].end||t.events[a][1].end.offset>r))return;let o=i.events.length,l=o;for(;l--;)if("exit"===i.events[l][0]&&"chunkFlow"===i.events[l][1].type){if(e){n=i.events[l][1].end;break}e=!0}for(g(s),a=o;a<i.events.length;)i.events[a][1].end={...n},a++;(0,ew.m)(i.events,l+1,0,i.events.slice(o)),i.events.length=a}}function g(t){let n=a.length;for(;n-- >t;){let t=a[n];i.containerState=t[1],t[0].exit.call(i,e)}a.length=t}function y(){t.write([null]),n=void 0,t=void 0,i.containerState._closeFlow=void 0}}},eP={tokenize:function(e,t,n){return(0,eI.N)(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}};var eO=n(18560);let eM={resolve:function(e){return eE(e),e},tokenize:function(e,t){let n;return function(t){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),r(t)};function r(t){return null===t?i(t):(0,eC.HP)(t)?e.check(eN,a,i)(t):(e.consume(t),r)}function i(n){return e.exit("chunkContent"),e.exit("content"),t(n)}function a(t){return e.consume(t),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,r}}},eN={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),
1(0,eI.N)(e,i,"linePrefix")};function i(i){if(null===i||(0,eC.HP)(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&"linePrefix"===a[1].type&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}},ej={tokenize:function(e){let t=this,n=e.attempt(eO.B,function(r){if(null===r){e.consume(r);return}return e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n},e.attempt(this.parser.constructs.flowInitial,r,(0,eI.N)(e,e.attempt(this.parser.constructs.flow,r,e.attempt(eM,r)),"linePrefix")));return n;function r(r){if(null===r){e.consume(r);return}return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t.currentConstruct=void 0,n}}},eD={resolveAll:function(e){return function(e,t){let n,r=-1;for(;++r<=e.length;)void 0===n?e[r]&&"data"===e[r][1].type&&(n=r,r++):e[r]&&"data"===e[r][1].type||(r!==n+2&&(e[n][1].end=e[r-1][1].end,e.splice(n+2,r-n-2),r=n+2),n=void 0);return e}}()},eL=eF("string"),eB=eF("text");function eF(e){var t;return{resolveAll:(t="text"===e?ez:void 0,function(e,n){let r,i=-1;for(;++i<=e.length;)void 0===r?e[i]&&"data"===e[i][1].type&&(r=i,i++):e[i]&&"data"===e[i][1].type||(i!==r+2&&(e[r][1].end=e[i-1][1].end,e.splice(r+2,i-r-2),i=r+2),r=void 0);return t?t(e,n):e}),tokenize:function(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,s);return a;function a(e){return l(e)?i(e):s(e)}function s(e){if(null===e){t.consume(e);return}return t.enter("data"),t.consume(e),o}function o(e){return l(e)?(t.exit("data"),i(e)):(t.consume(e),o)}function l(e){if(null===e)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 ez(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||"lineEnding"===e[n][1].type)&&"data"===e[n-1][1].type){let r;let i=e[n-1][1],a=t.sliceStream(i),s=a.length,o=-1,l=0;for(;s--;){let e=a[s];if("string"==typeof e){for(o=e.length;32===e.charCodeAt(o-1);)l++,o--;if(o)break;o=-1}else if(-2===e)r=!0,l++;else if(-1===e);else{s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){let a={type:n===e.length||r||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:i.start._bufferIndex+o,_index:i.start._index+s,line:i.end.line,column:i.end.column-l,offset:i.end.offset-l},end:{...i.end}};i.end={...a.start},i.start.offset===i.end.offset?Object.assign(i,a):(e.splice(n,0,["enter",a,t],["exit",a,t]),n+=2)}n++}return e}let eU={name:"thematicBreak",tokenize:function(e,t,n){let r,i=0;return function(a){var s;return e.enter("thematicBreak"),r=s=a,function a(s){return s===r?(e.enter("thematicBreakSequence"),function t(n){return n===r?(e.consume(n),i++,t):(e.exit("thematicBreakSequence"),(0,eC.On)(n)?(0,eI.N)(e,a,"whitespace")(n):a(n))}(s)):i>=3&&(null===s||(0,eC.HP)(s))?(e.exit("thematicBreak"),t(s)):n(s)}(s)}}},eZ={continuation:{tokenize:function(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(eO.B,function(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,(0,eI.N)(e,t,"listItemIndent",r.containerState.size+1)(n)},function(n){return r.containerState.furtherBlankLines||!(0,eC.On)(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine
1=void 0,i(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(eV,t,i)(n))});function i(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,(0,eI.N)(e,e.attempt(eZ,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i)}}},exit:function(e){e.exit(this.containerState.type)},name:"list",tokenize:function(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&"linePrefix"===i[1].type?i[2].sliceSerialize(i[1],!0).length:0,s=0;return function(t){let i=r.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===i?!r.containerState.marker||t===r.containerState.marker:(0,eC.BM)(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),"listUnordered"===i)return e.enter("listItemPrefix"),42===t||45===t?e.check(eU,n,o)(t):o(t);if(!r.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),function t(i){return(0,eC.BM)(i)&&++s<10?(e.consume(i),t):(!r.interrupt||s<2)&&(r.containerState.marker?i===r.containerState.marker:41===i||46===i)?(e.exit("listItemValue"),o(i)):n(i)}(t)}return n(t)};function o(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||t,e.check(eO.B,r.interrupt?n:l,e.attempt(eH,c,u))}
1function l(e){return r.containerState.initialBlankLine=!0,a++,c(e)}function u(t){return(0,eC.On)(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),c):n(t)}function c(n){return r.containerState.size=a+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(n)}}},eH={partial:!0,tokenize:function(e,t,n){let r=this;return(0,eI.N)(e,function(e){let i=r.events[r.events.length-1];return!(0,eC.On)(e)&&i&&"listItemPrefixWhitespace"===i[1].type?t(e):n(e)},"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},eV={partial:!0,tokenize:function(e,t,n){let r=this;return(0,eI.N)(e,function(e){let i=r.events[r.events.length-1];return i&&"listItemIndent"===i[1].type&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)},"listItemIndent",r.containerState.size+1)}},e$={continuation:{tokenize:function(e,t,n){let r=this;return function(t){return(0,eC.On)(t)?(0,eI.N)(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):i(t)};function i(r){return e.attempt(e$,t,n)(r)}}},exit:function(e){e.exit("blockQuote")},name:"blockQuote",tokenize:function(e,t,n){let r=this;return function(t){if(62===t){let n=r.containerState;return n.open||(e.enter("blockQuote",{_container:!0}),n.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),i}return n(t)};function i(n){return(0,eC.On)(n)?(e.enter("blockQuotePrefixWhitespace"),e.consume(n),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(n))}}};function eq(e,t,n,r,i,a,s,o,l){let u=l||Number.POSITIVE_INFINITY,c=0;return function(t){return 60===t?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),d):null===t||32===t||41===t||(0,eC.JQ)(t)?n(t):(e.enter(r),e.enter(s),e.enter(o),e.enter("chunkString",{contentType:"string"}),p(t))};function d(n){return 62===n?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),h(n))}function h(t){return 62===t?(e.exit("chunkString"),e.exit(o),d(t)):null===t||60===t||(0,eC.HP)(t)?n(t):(e.consume(t),92===t?f:h)}function f(t){return 60===t||62===t||92===t?(e.consume(t),h):h(t)}function p(i){return!c&&(null===i||41===i||(0,eC.Ee)(i))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(r),t(i)):c<u&&40===i?(e.consume(i),c++,p):41===i?(e.consume(i),c--,p):null===i||32===i||40===i||(0,eC.JQ)(i)?n(i):(e.consume(i),92===i?m:p)}function m(t){return 40===t||41===t||92===t?(e.consume(t),p):p(t)}}function eW(e,t,n,r,i,a){let s;let o=this,l=0;return function(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u};function u(d){return l>999||null===d||91===d||93===d&&!s||94===d&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?n(d):93===d?(e.exit(a),e.enter(i),e.consume(d),e.exit(i),e.exit(r),t):(0,eC.HP)(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),c(d))}function c(t){return null===t||91===t||93===t||(0,eC.HP)(t)||l++>999?(e.exit("chunkString"),u(t)):(e.consume(t),s||(s=!(0,eC.On)(t)),92===t?d:c)}function d(t){return 91===t||92===t||93===t?(e.consume(t),l++,c):c(t)}}function eK(e,t,n,r,i,a){let s;return function(t){return 34===t||39===t||40===t?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),s=40===t?41:t,o):n(t)};function o(n){return n===s?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===s?(e.exit(a),o(s)):null===t?n(t):(0,eC.HP)(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),(0,eI.N)(e,l,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(t))}function u(t){return t===s||null===t||(0,eC.HP)(t)?(e.exit("chunkString"),l(t)):(e.consume(t),92===t?c:u)}function c(t){return t===s||92===t?(e.consume(t),u):u(t)}}function eJ(e,t){let n;return function r(i){return(0,eC.HP)(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):(0,eC.On)(i)?(0,eI.N)(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}var eY=n(48213);let eG={partial:!0,tokenize:function(e,t,n){return function(t){return(0,eC.Ee)(t)?eJ(e,r)(t):n(t)};function r(t){return eK(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function i(t){return(0,eC.On)(t)?(0,eI.N)(e,a,"whitespace")(t):a(t)}function a(e){return null===e||(0,eC.HP)(e)?t(e):n(e)}}},eX={name:"codeIndented",tokenize:function(e,t,n){let r=this;
1return function(t){return e.enter("codeIndented"),(0,eI.N)(e,i,"linePrefix",5)(t)};function i(t){let i=r.events[r.events.length-1];return i&&"linePrefix"===i[1].type&&i[2].sliceSerialize(i[1],!0).length>=4?function t(n){return null===n?a(n):(0,eC.HP)(n)?e.attempt(eQ,t,a)(n):(e.enter("codeFlowValue"),function n(r){return null===r||(0,eC.HP)(r)?(e.exit("codeFlowValue"),t(r)):(e.consume(r),n)}(n))}(t):n(t)}function a(n){return e.exit("codeIndented"),t(n)}}},eQ={partial:!0,tokenize:function(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):(0,eC.HP)(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):(0,eI.N)(e,a,"linePrefix",5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&"linePrefix"===a[1].type&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):(0,eC.HP)(e)?i(e):n(e)}}},e0={name:"setextUnderline",resolveTo:function(e,t){let n,r,i,a=e.length;for(;a--;)if("enter"===e[a][0]){if("content"===e[a][1].type){n=a;break}"paragraph"===e[a][1].type&&(r=a)}else"content"===e[a][1].type&&e.splice(a,1),i||"definition"!==e[a][1].type||(i=a);let s={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};return e[r][1].type="setextHeadingText",i?(e.splice(r,0,["enter",s,t]),e.splice(i+1,0,["exit",e[n][1],t]),e[n][1].end={...e[i][1].end}):e[n][1]=s,e.push(["exit",s,t]),e},tokenize:function(e,t,n){let r;let i=this;return function(t){var s;let o,l=i.events.length;for(;l--;)if("lineEnding"!==i.events[l][1].type&&"linePrefix"!==i.events[l][1].type&&"content"!==i.events[l][1].type){o="paragraph"===i.events[l][1].type;break}return!i.parser.lazy[i.now().line]&&(i.interrupt||o)?(e.enter("setextHeadingLine"),r=t,s=t,e.enter("setextHeadingLineSequence"),function t(n){return n===r?(e.consume(n),t):(e.exit("setextHeadingLineSequence"),(0,eC.On)(n)?(0,eI.N)(e,a,"lineSuffix")(n):a(n))}(s)):n(t)};function a(r){return null===r||(0,eC.HP)(r)?(e.exit("setextHeadingLine"),t(r)):n(r)}}},e1=["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"],e2=["pre","script","style","textarea"],e5={partial:!0,tokenize:function(e,t,n){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(eO.B,t,n)}}},e4={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return(0,eC.HP)(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):n(t)};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}},e9={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return null===t?n(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i)};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}},e6={concrete:!0,name:"codeFenced",tokenize:function(e,t,n){let r;let i=this,a={partial:!0,tokenize:function(e,t,n){let a=0;return function(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),s};function s(t){return e.enter("codeFencedFence"),(0,eC.On)(t)?(0,eI.N)(e,l,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):l(t)}function l(t){return t===r?(e.enter("codeFencedFenceSequence"),function t(i){return i===r?(a++,e.consume(i),t):a>=o?(e.exit("codeFencedFenceSequence"),(0,eC.On)(i)?(0,eI.N)(e,u,"whitespace")(i):u(i)):n(i)}(t)):n(t)}function u(r){return null===r||(0,eC.HP)(r)?(e.exit("codeFencedFence"),t(r)):n(r)}}},s=0,o=0;return function(t){return function(t){let a=i.events[i.events.length-1];return s=a&&"linePrefix"===a[1].type?a[2].sliceSerialize(a[1],!0).length:0,r=t,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),function t(i){return i===r?(o++,e.consume(i),t):o<3?n(i):(e.exit("codeFencedFenceSequence"),(0,eC.On)(i)?(0,eI.N)(e,l,"whitespace")(i):l(i))}(t)}(t)};function l(a){return null===a||(0,eC.HP)(a)?(e.exit("codeFencedFence"),i.interrupt?t(a):e.check(e9,c,p)(a)):(e.enter("co
1deFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),function t(i){return null===i||(0,eC.HP)(i)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),l(i)):(0,eC.On)(i)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),(0,eI.N)(e,u,"whitespace")(i)):96===i&&i===r?n(i):(e.consume(i),t)}(a))}function u(t){return null===t||(0,eC.HP)(t)?l(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),function t(i){return null===i||(0,eC.HP)(i)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),l(i)):96===i&&i===r?n(i):(e.consume(i),t)}(t))}function c(t){return e.attempt(a,p,d)(t)}function d(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),h}function h(t){return s>0&&(0,eC.On)(t)?(0,eI.N)(e,f,"linePrefix",s+1)(t):f(t)}function f(t){return null===t||(0,eC.HP)(t)?e.check(e9,c,p)(t):(e.enter("codeFlowValue"),function t(n){return null===n||(0,eC.HP)(n)?(e.exit("codeFlowValue"),f(n)):(e.consume(n),t)}(t))}function p(n){return e.exit("codeFenced"),t(n)}}},e3=document.createElement("i");function e8(e){let t="&"+e+";";e3.innerHTML=t;let n=e3.textContent;return(59!==n.charCodeAt(n.length-1)||"semi"===e)&&n!==t&&n}let e7={name:"characterReference",tokenize:function(e,t,n){let r,i;let a=this,s=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),o};function o(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),l):(e.enter("characterReferenceValue"),r=31,i=eC.lV,u(t))}function l(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),r=6,i=eC.ok,u):(e.enter("characterReferenceValue"),r=7,i=eC.BM,u(t))}function u(o){if(59===o&&s){let r=e.exit("characterReferenceValue");return i!==eC.lV||e8(a.sliceSerialize(r))?(e.enter("characterReferenceMarker"),e.consume(o),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):n(o)}return i(o)&&s++<r?(e.consume(o),u):n(o)}}},te={name:"characterEscape",tokenize:function(e,t,n){return function(t){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(t),e.exit("escapeMarker"),r};function r(r){return(0,eC.ol)(r)?(e.enter("characterEscapeValue"),e.consume(r),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(r)}}},tt={name:"lineEnding",tokenize:function(e,t){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),(0,eI.N)(e,t,"linePrefix")}}};var tn=n(1028);let tr={name:"labelEnd",resolveAll:function(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),"labelImage"===r.type||"labelLink"===r.type||"labelEnd"===r.type){let e="labelImage"===r.type?4:2;r.type="data",t+=e}}return e.length!==n.length&&(0,ew.m)(e,0,e.length,n),e},resolveTo:function(e,t){let n,r,i,a,s=e.length,o=0;for(;s--;)if(n=e[s][1],r){if("link"===n.type||"labelLink"===n.type&&n._inactive)break;"enter"===e[s][0]&&"labelLink"===n.type&&(n._inactive=!0)}else if(i){if("enter"===e[s][0]&&("labelImage"===n.type||"labelLink"===n.type)&&!n._balanced&&(r=s,"labelLink"!==n.type)){o=2;break}}else"labelEnd"===n.type&&(i=s);let l={type:"labelLink"===e[r][1].type?"link":"image",start:{...e[r][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[r][1].start},end:{...e[i][1].end}},c={type:"labelText",start:{...e[r+o+2][1].end},end:{...e[i-2][1].start}};return a=[["enter",l,t],["enter",u,t]],a=(0,ew.V)(a,e.slice(r+1,r+o+3)),a=(0,ew.V)(a,[["enter",c,t]]),a=(0,ew.V)(a,(0,tn.W)(t.parser.constructs.insideSpan.null,e.slice(r+o+4,i-3),t)),a=(0,ew.V)(a,[["exit",c,t],e[i-2],e[i-1],["exit",u,t]]),a=(0,ew.V)(a,e.slice(i+1)),a=(0,ew.V)(a,[["exit",l,t]]),(0,ew.m)(e,r,e.length,a),e},tokenize:function(e,t,n){let r,i;let a=this,s=a.events.length;for(;s--;)if(("labelImage"===a.events[s][1].type||"labelLink"===a.events[s][1].type)&&!a.events[s][1]._balanced){r=a.events[s][1];break}return function(t){return r?r._inactive?c(t):(i=a.parser.defined.includes((0,eY.B)(a.sliceSerialize({start:r.end,end:a.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelEnd"),o):n(t)};function o(t){return 40===t?e.attempt(ti,u,i?u:c)(t):91===t?e.attempt(ta,u,i?l:c)(t):i?u(t):c(t)}function l(t){return e.attempt(ts,u,c)(t)}function u(e){return t(e)}function c(e){return r._balanced=!0,n(e)}}},ti={tokenize:function(e,t,n){return function(t){return e.enter("resource"),e.enter("resourceMarker"),e.consume(t),e.exit("resourceMarker"),r};function r(t){return(0,eC.Ee)(t)?eJ(e,i)(t):i(t)}function i(t){return 41===t?u(t):eq(e,a,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function a(t){return(0,eC.Ee)(t)?eJ(e,o)(t):u(t)}function s(e){return n(e)}function o(t){return 34===t||39===t||40===t?eK(e,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):u(t)}function l(t){return(0,eC.Ee)(t)?eJ(e,u)(t):u(t)}function u(r){return 41===r?(e.enter("resourceMarker"),e.consume(r),e.exit("resourceMarker"),e.exit("resource"),t):n(r)}}},ta={tokenize:function(e,t,n){let r=this;return function(t){return eW.call(r,e,i,a,"reference","referenceMarker","referenceString")(t)};function i(e){return r.parser.defined.includes((0,eY.B)(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function a(e){return n(e)}}},ts={tokenize:function(e,t,n){return function(t){return e.enter("reference"),e.enter("referenceMarker"),e.consume(t),e.exit("referenceMarker"),r};function r(r){return 93===r?(e.enter("referenceMarker"),e.consume(r),e.exit("referenceMarker"),e.exit("reference"),t):n(r)}}},to={name:"labelStartImage",resolveAll:tr.resolveAll,tokenize:function(e,t,n){let r=this;return function(t){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(t),e.exit("labelImageMarker"),i};function i(t){return 91===t?(e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelImage"),a):n(t)}function a(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}};var tl=n(97492);let tu={name:"attention",resolveAll:function(e,t){let n,r,i,a,s,o,l,u,c=-1;for(;++c<e.length;)if("enter"===e[c][0]&&"attentionSequence"===e[c][1].type&&e[c][1]._close){for(n=c;n--;)if("exit"===e[n][0]&&"attentionSequence"===e[n][1].type&&e[n][1]._open&&t.sliceSerialize(e[
1n][1]).charCodeAt(0)===t.sliceSerialize(e[c][1]).charCodeAt(0)){if((e[n][1]._close||e[c][1]._open)&&(e[c][1].end.offset-e[c][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[c][1].end.offset-e[c][1].start.offset)%3))continue;o=e[n][1].end.offset-e[n][1].start.offset>1&&e[c][1].end.offset-e[c][1].start.offset>1?2:1;let d={...e[n][1].end},h={...e[c][1].start};tc(d,-o),tc(h,o),a={type:o>1?"strongSequence":"emphasisSequence",start:d,end:{...e[n][1].end}},s={type:o>1?"strongSequence":"emphasisSequence",start:{...e[c][1].start},end:h},i={type:o>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[c][1].start}},r={type:o>1?"strong":"emphasis",start:{...a.start},end:{...s.end}},e[n][1].end={...a.start},e[c][1].start={...s.end},l=[],e[n][1].end.offset-e[n][1].start.offset&&(l=(0,ew.V)(l,[["enter",e[n][1],t],["exit",e[n][1],t]])),l=(0,ew.V)(l,[["enter",r,t],["enter",a,t],["exit",a,t],["enter",i,t]]),l=(0,ew.V)(l,(0,tn.W)(t.parser.constructs.insideSpan.null,e.slice(n+1,c),t)),l=(0,ew.V)(l,[["exit",i,t],["enter",s,t],["exit",s,t],["exit",r,t]]),e[c][1].end.offset-e[c][1].start.offset?(u=2,l=(0,ew.V)(l,[["enter",e[c][1],t],["exit",e[c][1],t]])):u=0,(0,ew.m)(e,n-1,c-n+3,l),c=n+l.length-u-2;break}}for(c=-1;++c<e.length;)"attentionSequence"===e[c][1].type&&(e[c][1].type="data");return e},tokenize:function(e,t){let n;let r=this.parser.constructs.attentionMarkers.null,i=this.previous,a=(0,tl.S)(i);return function(s){return n=s,e.enter("attentionSequence"),function s(o){if(o===n)return e.consume(o),s;let l=e.exit("attentionSequence"),u=(0,tl.S)(o),c=!u||2===u&&a||r.includes(o),d=!a||2===a&&u||r.includes(i);return l._open=!!(42===n?c:c&&(a||!d)),l._close=!!(42===n?d:d&&(u||!c)),t(o)}(s)}}};function tc(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}let td={name:"labelStartLink",resolveAll:tr.resolveAll,tokenize:function(e,t,n){let r=this;return function(t){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelLink"),i};function i(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}},th={42:eZ,43:eZ,45:eZ,48:eZ,49:eZ,50:eZ,51:eZ,52:eZ,53:eZ,54:eZ,55:eZ,56:eZ,57:eZ,62:e$},tf={91:{name:"definition",tokenize:function(e,t,n){let r;let i=this;return function(t){var r;return e.enter("definition"),r=t,eW.call(i,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(r)};function a(t){return(r=(0,eY.B)(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),58===t)?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),s):n(t)}function s(t){return(0,eC.Ee)(t)?eJ(e,o)(t):o(t)}function o(t){return eq(e,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function l(t){return e.attempt(eG,u,u)(t)}function u(t){return(0,eC.On)(t)?(0,eI.N)(e,c,"whitespace")(t):c(t)}function c(a){return null===a||(0,eC.HP)(a)?(e.exit("definition"),i.parser.defined.push(r),t(a)):n(a)}}}},tp={[-2]:eX,[-1]:eX,32:eX},tm={35:{name:"headingAtx",resolve:function(e,t){let n,r,i=e.length-2,a=3;return"whitespace"===e[3][1].type&&(a+=2),i-2>a&&"whitespace"===e[i][1].type&&(i-=2),"atxHeadingSequence"===e[i][1].type&&(a===i-1||i-4>a&&"whitespace"===e[i-2][1].type)&&(i-=a+1===i?2:4),i>a&&(n={type:"atxHeadingText",start:e[a][1].start,end:e[i][1].end},r={type:"chunkText",start:e[a][1].start,end:e[i][1].end,contentType:"text"},(0,ew.m)(e,a,i-a+1,[["enter",n,t],["enter",r,t],["exit",r,t],["exit",n,t]])),e},tokenize:function(e,t,n){let r=0;return function(i){var a;return e.enter("atxHeading"),a=i,e.enter("atxHeadingSequence"),function i(a){return 35===a&&r++<6?(e.consume(a),i):null===a||(0,eC.Ee)(a)?(e.exit("atxHeadingSequence"),function n(r){return 35===r?(e.enter("atxHeadingSequence"),function t(r){return 35===r?(e.consume(r),t):(e.exit("atxHeadingSequence"),n(r))}(r)):null===r||(0,eC.HP)(r)?(e.exit("atxHeading"),t(r)):(0,eC.On)(r)?(0,eI.N)(e,n,"whitespace")(r):(e.enter("atxHeadingText"),function t(r){return null===r||35===r||(0,eC.Ee)(r)?(e.exit("atxHeadingText"),n(r)):(e.consume(r),t)}(r))}(a)):n(a)}(a)}}},42:eU,45:[e0,eU],60:{concrete:!0,name:"htmlFlow",resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););return t>1&&"linePrefix"===e[t-2][1].type&&(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},tokenize:function(e,t,n){let r,i,a,s,o;let l=this;return function(t){var n;return n=t,e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(n),u};function u(s){return 33===s?(e.consume(s),c):47===s?(e.consume(s),i=!0,f):63===s?(e.consume(s),r=3,l.interrupt?t:O):(0,eC.CW)(s)?(e.consume(s),a=String.fromCharCode(s),p):n(s)}function c(i){return 45===i?(e.consume(i),r=2,d):91===i?(e.consume(i),r=5,s=0,h):(0,eC.CW)(i)?(e.consume(i),r=4,l.interrupt?t:O):n(i)}function d(r){return 45===r?(e.consume(r),l.interrupt?t:O):n(r)}function h(r){let i="CDATA[";return r===i.charCodeAt(s++)?(e.consume(r),s===i.length)?l.interrupt?t:S:h:n(r)}function f(t){return(0,eC.CW)(t)?(e.consume(t),a=String.fromCharCode(t),p):n(t)}function p(s){if(null===s||47===s||62===s||(0,eC.Ee)(s)){let o=47===s,u=a.toLowerCase();return!o&&!i&&e2.includes(u)?(r=1,l.interrupt?t(s):S(s)):e1.includes(a.toLowerCase())?(r=6,o)?(e.consume(s),m):l.interrupt?t(s):S(s):(r=7,l.interrupt&&!l.parser.lazy[l.now().line]?n(s):i?function t(n){return(0,eC.On)(n)?(e.consume(n),t):w(n)}(s):g(s))}return 45===s||(0,eC.lV)(s)?(e.consume(s),a+=String.fromCharCode(s),p):n(s)}function m(r){return 62===r?(e.consume(r),l.interrupt?t:S):n(r)}function g(t){return 47===t?(e.consume(t),w):58===t||95===t||(0,eC.CW)(t)?(e.consume(t),y):(0,eC.On)(t)?(e.consume(t),g):w(t)}function y(t){return 45===t||46===t||58===t||95===t||(0,eC.lV)(t)?(e.consume(t),y):v(t)}function v(t){return 61===t?(e.consume(t),b):(0,eC.On)(t)?(e.consume(t),v):g(t)}function b(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),o=t,x):(0,eC.On)(t)?(e.consume(t),b):function t(n){return null===n||34===n||39===n||47===n||60===n||61===n||62===n||96===n||(0,eC.Ee)(n)?v(n):(e.consume(n),t)}(t)}function x(t){return t===o?(e.consume(t),o=null,_):null===t||(0,eC.HP)(t)?n(t):(e.consume(t),x)}function _(e){return 47===e||62===e||(0,eC.On)(e)?g(e):n(e)}function w(t){return 62===t?(e.consume(t),k):n(t)}function k(t){return null===t||(0,eC.HP)(t)?S(t):(0,eC.On)(t)?(e.consume(t),k):n(t)}function S(t){return 45===t&&2===r?(e.consume(t),C):60===t&&1===r?(e.consume(t),A):62===t&&4===r?(e.consume(t),M):63===t&&3===r?(e.consume(t),O):93===t&&5===r?(e.consume(t),P):(0,eC.HP)(t)&&(6===r||7===r)?(e.exit("htmlFlowData"),e.check(e5,N,E)(t)):null===t||(0,eC.HP)(t)?(e.exit("htmlFlowData"),E(t)):(e.consume(t),S)}function E(t){return e.check(e4,T,N)(t)}function T(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),I}function I(t){return null===t||(0,eC.HP)(t)?E(t):(e.enter("htmlFlowData"),S(t))}function C(t){return 45===t?(e.consume(t),O):S(t)}function A(t){return 47===t?(e.consume(t),a="",R):S(t)}function R(t){if(62===t){let n=a.toLowerCase();return e2.includes(n)?(e.consume(t),M):S(t)}return(0,eC.CW)(t)&&a.length<8?(e.consume(t),a+=String.fromCharCode(t),R):S(t)}function P(t){return 93===t?(e.consume(t),O):S(t)}function O(t){return 62===t?(e.consume(t),M):45===t&&2===r?(e.consume(t),O):S(t)}function M(t){return null===t||(0,eC.HP)(t)?(e.exit("htmlFlowData"),N(t)):(e.consume(t),M)}function N(n){return e.exit("htmlFlow"),t(n)}}},61:e0,95:eU,96:e6,126:e6},tg={38:e7,92:te},ty={[-5]:tt,[-4]:tt,[-3]:tt,33:to,38:e7,42:tu,60:[{name:"autolink",tokenize:function(e,t,n){let r=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i};function i(t){return(0,eC.CW)(t)?(e.consume(t),a):64===t?n(t):o(t)}function a(t){return 43===t||45===t||46===t||(0,eC.lV)(t)?(r=1,function t(n){return 58===n?(e.consume(n),r=0,s):(43===n||45===n||46===n||(0,eC.lV)(n))&&r++<32?(e.consume(n),t):(r=0,o(n))}(t)):o(t)}function s(r){return 62===r?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(r),e.exit("autolinkMarker"),e.exit("autolink"),t):null===r||32===r||60===r||(0,eC.JQ)(r)?n(r):(e.consume(r),s)}function o(t){return 64===t?(e.consume(t),l):(0,eC.cx)(t)?(e.consume(t),o):n(t)}function l(i){return(0,eC.lV)(i)?function i(a){return 46===a?(e.consume(a),r=0,l):62===a?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(a),e.exit("autolinkMarker"),e.exit("autolink"),t):function t(a){if((45===a||(0,eC.lV)(a))&&r++<63){let n=45===a?t:i;return e.consume(a),n}return n(a)}(a)}(i):n(i)}}},{name:"htmlText",tokenize:function(e,t,n){let r,i,a;let s=this;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),o};function o(t){return 33===t?(e.consume(t),l):47===t?(e.consume(t),x):63===t?(e.consume(t),v):(0,eC.CW)(t)?(e.consume(t),w):n(t)}function l(t){return 45===t?(e.consume(t),u):91===t?(e.consume(t),i=0,f):(0,eC.CW)(t)?(e.consume(t),y):n(t)}function u(t){return 45===t?(e.consume(t),h):n(t)}function c(t){return null===t?n(t):45===t?(e.consume(t),d):(0,eC.HP)(t)?(a=c,R(t)):(e.consume(t),c)}function d(t){return 45===t?(e.consume(t),h):c(t)}function h(e){return 62===e?A(e):45===e?d(e):c(e)}function f(t){let r="CDATA[";return t===r.charCodeAt(i++)?(e.consume(t),i===r.length?p:f):n(t)}function p(t){return null===t?n(t):93===t?(e.consume(t),m):(0,eC.HP)(t)?(a=p,R(t)):(e.consume(t),p)}function m(t){return 93===t?(e.consume(t),g):p(t)}function g(t){return 62===t?A(t):93===t?(e.consume(t),g):p(t)}function y(t){return null===t||62===t?A(t):(0,eC.HP)(t)?(a=y,R(t)):(e.consume(t),y)}function v(t){return null===t?n(t):63===t?(e.consume(t),b):(0,eC.HP)(t)?(a=v,R(t)):(e.consume(t),v)}function b(e){return 62===e?A(e):v(e)}function x(t){return(0,eC.CW)(t)?(e.consume(t),_):n(t)}function _(t){return 45===t||(0,eC.lV)(t)?(e.consume(t),_):function t(n){return(0,eC.HP)(n)?(a=t,R(n)):(0,eC.On)(n)?(e.consume(n),t):A(n)}(t)}function w(t){return 45===t||(0,eC.lV)(t)?(e.consume(t),w):47===t||62===t||(0,eC.Ee)(t)?k(t):n(t)}function k(t){return 47===t?(e.consume(t),A):58===t||95===t||(0,eC.CW)(t)?(e.consume(t),S):(0,eC.HP)(t)?(a=k,R(t)):(0,eC.On)(t)?(e.consume(t),k):A(t)}function S(t){return 45===t||46===t||58===t||95===t||(0,eC.lV)(t)?(e.consume(t),S):function t(n){return 61===n?(e.consume(n),E):(0,eC.HP)(n)?(a=t,R(n)):(0,eC.On)(n)?(e.consume(n),t):k(n)}(t)}function E(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),r=t,T):(0,eC.HP)(t)?(a=E,R(t)):(0,eC.On)(t)?(e.consume(t),E):(e.consume(t),I)}function T(t){return t===r?(e.consume(t),r=void 0,C):null===t?n(t):(0,eC.HP)(t)?(a=T,R(t)):(e.consume(t),T)}function I(t){return null===t||34===t||39===t||60===t||61===t||96===t?n(t):47===t||62===t||(0,eC.Ee)(t)?k(t):(e.consume(t),I)}function C(e){return 47===e||62===e||(0,eC.Ee)(e)?k(e):n(e)}function A(r){return 62===r?(e.consume(r),e.exit("htmlTextData"),e.exit("htmlText"),t):n(r)}function R(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),P}function P(t){return(0,eC.On)(t)?(0,eI.N)(e,O,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):O(t)}function O(t){return e.enter("htmlTextData"),a(t)}}}],91:td,92:[{name:"hardBreakEscape",tokenize:function(e,t,n){return function(t){return e.enter("hardBreakEscape"),e.consume(t),r};function r(r){return(0,eC.HP)(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}},te],93:tr,95:tu,96:{name:"codeText",previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type},resolve:function(e){let t,n,r=e.length-4,i=3;if(("lineEnding"===e[3][1].type||"space"===e[i][1].type)&&("lineEnding"===e[r][1].type||"space"===e[r][1].type)){for(t=i;++t<r;)if("codeTextData"===e[t][1].type){e[i][1].type="codeTextPadding",e[r][1].type="codeTextPadding",i+=2,r-=2;break}}for(t=i-1,r++;++t<=r;)void 0===n?t!==r&&"lineEnding"!==e[t][1].type&&(n=t):(t===r||"lineEnding"===e[t][1].type)&&(e[n][1].type="codeTextData",t!==n+2&&(e[n][1].end=e[t-1][1].end,e.splice(n+2,t-n-2),r-=t-n-2,t=n+2),n=void 0);return e},tokenize:function(e,t,n){let r,i,a=0;
1return function(t){return e.enter("codeText"),e.enter("codeTextSequence"),function t(n){return 96===n?(e.consume(n),a++,t):(e.exit("codeTextSequence"),s(n))}(t)};function s(l){return null===l?n(l):32===l?(e.enter("space"),e.consume(l),e.exit("space"),s):96===l?(i=e.enter("codeTextSequence"),r=0,function n(s){return 96===s?(e.consume(s),r++,n):r===a?(e.exit("codeTextSequence"),e.exit("codeText"),t(s)):(i.type="codeTextData",o(s))}(l)):(0,eC.HP)(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),s):(e.enter("codeTextData"),o(l))}function o(t){return null===t||32===t||96===t||(0,eC.HP)(t)?(e.exit("codeTextData"),s(t)):(e.consume(t),o)}}}},tv={null:[tu,eD]},tb={null:[42,95]},tx={null:[]},t_=/[\0\t\n\r]/g;function tw(e,t){let n=Number.parseInt(e,t);return n<9||11===n||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(65535&n)==65535||(65535&n)==65534||n>1114111?"�":String.fromCodePoint(n)}let tk=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function tS(e,t,n){if(t)return t;if(35===n.charCodeAt(0)){let e=n.charCodeAt(1),t=120===e||88===e;return tw(n.slice(t?2:1),t?16:10)}return e8(n)||e}let tE={}.hasOwnProperty;function tT(e){return{line:e.line,column:e.column,offset:e.offset}}function tI(e,t){if(e)throw Error("Cannot close `"+e.type+"` ("+Q({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Q({start:t.start,end:t.end})+") is open");throw Error("Cannot close document, a token (`"+t.type+"`, "+Q({start:t.start,end:t.end})+") is still open")}function tC(e){let t=this;t.parser=function(n){var r,i;let s,o,l,u;return"string"!=typeof(r={...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})&&(i=r,r=void 0),(function(e){let t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:r(y),autolinkProtocol:u,autolinkEmail:u,atxHeading:r(p),blockQuote:r(function(){return{type:"blockquote",children:[]}}),characterEscape:u,characterReference:u,codeFenced:r(f),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:r(f,i),codeText:r(function(){return{type:"inlineCode",value:""}},i),codeTextData:u,data:u,codeFlowValue:u,definition:r(function(){return{type:"definition",identifier:"",label:null,title:null,url:""}}),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:r(function(){return{type:"emphasis",children:[]}}),hardBreakEscape:r(m),hardBreakTrailing:r(m),htmlFlow:r(g,i),htmlFlowData:u,htmlText:r(g,i),htmlTextData:u,image:r(function(){return{type:"image",title:null,url:"",alt:null}}),label:i,link:r(y),listItem:r(function(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}}),listItemValue:function(e){this.data.expectingFirstListItemValue&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0)},listOrdered:r(v,function(){this.data.expectingFirstListItemValue=!0}),listUnordered:r(v),paragraph:r(function(){return{type:"paragraph",children:[]}}),reference:function(){this.data.referenceType="collapsed"},referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:r(p),strong:r(function(){return{type:"strong",children:[]}}),thematicBreak:r(function(){return{type:"thematicBreak"}})},exit:{atxHeading:s(),atxHeadingSequence:function(e){let t=this.stack[this.stack.length-1];if(!t.depth){let n=this.sliceSerialize(e).length;t.depth=n}},autolink:s(),autolinkEmail:function(e){c.call(this,e),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)},autolinkProtocol:function(e){c.call(this,e),this.stack[this.stack.length-1].url=this.sliceSerialize(e)},blockQuote:s(),characterEscapeValue:c,characterReferenceMarkerHexadecimal:h,characterReferenceMarkerNumeric:h,characterReferenceValue:function(e){let t;let n=this.sliceSerialize(e),r=this.data.characterReferenceType;r?(t=tw(n,"characterReferenceMarkerNumeric"===r?10:16),this.data.characterReferenceType=void 0):t=e8(n);let i=this.stack[this.stack.length-1];i.value+=t},characterReference:function(e){this.stack.pop().position.end=tT(e.end)},codeFenced:s(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}),codeFencedFence:function(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)},codeFencedFenceInfo:function(){let e=this.resume();this.stack[this.stack.length-1].lang=e},codeFencedFenceMeta:function(){let e=this.resume();this.stack[this.stack.length-1].meta=e},codeFlowValue:c,codeIndented:s(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")}),codeText:s(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),codeTextData:c,data:c,definition:s(),definitionDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},definitionLabelString:function(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=(0,eY.B)(this.sliceSerialize(e)).toLowerCase()},definitionTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},emphasis:s(),hardBreakEscape:s(d),hardBreakTrailing:s(d),htmlFlow:s(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlFlowData:c,htmlText:s(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlTextData:c,image:s(function(){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}),label:function(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];if(this.data.inReference=!0,"link"===n.type){let t=e.children;n.children=t}else n.alt=t},labelText:function(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=t.replace(tk,tS),n.identifier=(0,eY.B)(t).toLowerCase()},lineEnding:function(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){n.children[n.children.length-1].position.end=tT(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.t
1ype)&&(u.call(this,e),c.call(this,e))},link:s(function(){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}),listItem:s(),listOrdered:s(),listUnordered:s(),paragraph:s(),referenceString:function(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=(0,eY.B)(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType="full"},resourceDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},resourceTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},resource:function(){this.data.inReference=void 0},setextHeading:s(function(){this.data.setextHeadingSlurpLineEnding=void 0}),setextHeadingLineSequence:function(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).codePointAt(0)?1:2},setextHeadingText:function(){this.data.setextHeadingSlurpLineEnding=!0},strong:s(),thematicBreak:s()}};(function e(t,n){let r=-1;for(;++r<n.length;){let i=n[r];Array.isArray(i)?e(t,i):function(e,t){let n;for(n in t)if(tE.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"enter":case"exit":{let r=t[n];r&&Object.assign(e[n],r)}}}(t,i)}})(t,(e||{}).mdastExtensions||[]);let n={};return function(e){let r={type:"root",children:[]},s={stack:[r],tokenStack:[],config:t,enter:a,exit:o,buffer:i,resume:l,data:n},u=[],c=-1;for(;++c<e.length;)("listOrdered"===e[c][1].type||"listUnordered"===e[c][1].type)&&("enter"===e[c][0]?u.push(c):c=function(e,t,n){let r,i,a,s,o=t-1,l=-1,u=!1;for(;++o<=n;){let t=e[o];switch(t[1].type){case"listUnordered":case"listOrdered":case"blockQuote":"enter"===t[0]?l++:l--,s=void 0;break;case"lineEndingBlank":"enter"===t[0]&&(!r||s||l||a||(a=o),s=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:s=void 0}if(!l&&"enter"===t[0]&&"listItemPrefix"===t[1].type||-1===l&&"exit"===t[0]&&("listUnordered"===t[1].type||"listOrdered"===t[1].type)){if(r){let s=o;for(i=void 0;s--;){let t=e[s];if("lineEnding"===t[1].type||"lineEndingBlank"===t[1].type){if("exit"===t[0])continue;i&&(e[i][1].type="lineEndingBlank",u=!0),t[1].type="lineEnding",i=s}else if("linePrefix"===t[1].type||"blockQuotePrefix"===t[1].type||"blockQuotePrefixWhitespace"===t[1].type||"blockQuoteMarker"===t[1].type||"listItemIndent"===t[1].type);else break}a&&(!i||a<i)&&(r._spread=!0),r.end=Object.assign({},i?e[i][1].start:t[1].end),e.splice(i||o,0,["exit",r,t[2]]),o++,n++}if("listItemPrefix"===t[1].type){let i={type:"listItem",_spread:!1,start:Object.assign({},t[1].start),end:void 0};r=i,e.splice(o,0,["enter",i,t[2]]),o++,n++,a=void 0,s=!0}}}return e[t][1]._spread=u,n}(e,u.pop(),c));for(c=-1;++c<e.length;){let n=t[e[c][0]];tE.call(n,e[c][1].type)&&n[e[c][1].type].call(Object.assign({sliceSerialize:e[c][2].sliceSerialize},s),e[c][1])}if(s.tokenStack.length>0){let e=s.tokenStack[s.tokenStack.length-1];(e[1]||tI).call(s,void 0,e[0])}for(r.position={start:tT(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:tT(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},c=-1;++c<t.transforms.length;)r=t.transforms[c](r)||r;return r};function r(e,t){return function(n){a.call(this,e(n),n),t&&t.call(this,n)}}function i(){this.stack.push({type:"fragment",children:[]})}function a(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:tT(t.start),end:void 0}}function s(e){return function(t){e&&e.call(this,t),o.call(this,t)}}function o(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||tI).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+Q({start:e.start,end:e.end})+"): it’s not open");n.position.end=tT(e.end)}function l(){return(0,e_.d)(this.stack.pop())}function u(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];n&&"text"===n.type||((n={type:"text",value:""}).position={start:tT(e.start),end:void 0},t.push(n)),this.stack.push(n)}function c(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=tT(e.end)}function d(){this.data.atHardBreak=!0}function h(e){this.data.characterReferenceType=e.type}function f(){return{type:"code",lang:null,meta:null,value:""}}function p(){return{type:"heading",depth:0,children:[]}}function m(){return{type:"break"}}function g(){return{type:"html",value:""}}function y(){return{type:"link",title:null,url:"",children:[]}}function v(e){return{type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}})(i)(function(e){for(;!eE(e););return e}((function(e){var t,n,r,i,s;let o={constructs:(0,eT.y)([a,...(e||{}).extensions||[]]),content:(t=eA,function(e){return function(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,c
1olumn:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],s=[],o=[],l={attempt:m(function(e,t){g(e,t.from)}),check:m(p),consume:function(e){(0,eC.HP)(e)?(r.line++,r.column=1,r.offset+=-3===e?2:1,v()):-1!==e&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=e},enter:function(e,t){let n=t||{};return n.type=e,n.start=h(),u.events.push(["enter",n,u]),o.push(n),n},exit:function(e){let t=o.pop();return t.end=h(),u.events.push(["exit",t,u]),t},interrupt:m(p,{interrupt:!0})},u={code:null,containerState:{},defineSkip:function(e){i[e.line]=e.column,v()},events:[],now:h,parser:e,previous:null,sliceSerialize:function(e,t){return function(e,t){let n,r=-1,i=[];for(;++r<e.length;){let a;let s=e[r];if("string"==typeof s)a=s;else switch(s){case -5:a="\r";break;case -4:a="\n";break;case -3:a="\r\n";break;case -2:a=t?" ":"	";break;case -1:if(!t&&n)continue;a=" ";break;default:a=String.fromCharCode(s)}n=-2===s,i.push(a)}return i.join("")}(d(e),t)},sliceStream:d,write:function(e){return(s=(0,ew.V)(s,e),function(){let e;for(;r._index<s.length;){let t=s[r._index];if("string"==typeof t)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)(function(e){c=c(e)})(t.charCodeAt(r._bufferIndex));else(function(e){c=c(e)})(t)}}(),null!==s[s.length-1])?[]:(g(t,0),u.events=(0,tn.W)(a,u.events,u),u.events)}},c=t.tokenize.call(u,l);return t.resolveAll&&a.push(t),u;function d(e){return function(e,t){let n;let r=t.start._index,i=t.start._bufferIndex,a=t.end._index,s=t.end._bufferIndex;if(r===a)n=[e[r].slice(i,s)];else{if(n=e.slice(r,a),i>-1){let e=n[0];"string"==typeof e?n[0]=e.slice(i):n.shift()}s>0&&n.push(e[a].slice(0,s))}return n}(s,e)}function h(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function f(e){c=c(e)}function p(e,t){t.restore()}function m(e,t){return function(n,r,i){var a;let s,o,c,d;return Array.isArray(n)?h(n):"tokenize"in n?h([n]):(a=n,function(e){let t=null!==e&&a[e],n=null!==e&&a.null;return h([...Array.isArray(t)?t:t?[t]:[],...Array.isArray(n)?n:n?[n]:[]])(e)});function h(e){return(s=e,o=0,0===e.length)?i:function(e){return function(n){return(d=y(),c=e,e.partial||(u.currentConstruct=e),e.name&&u.parser.constructs.disable.null.includes(e.name))?p(n):e.tokenize.call(t?Object.assign(Object.create(u),t):u,l,f,p)(n)}}(e[o])}function f(t){return e(c,d),r}function p(e){if(d.restore(),++o<s.length){var n;return n=s[o],function(e){return(d=y(),c=n,n.partial||(u.currentConstruct=n),n.name&&u.parser.constructs.disable.null.includes(n.name))?p(e):n.tokenize.call(t?Object.assign(Object.create(u),t):u,l,f,p)(e)}}return i}}}function g(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&(0,ew.m)(u.events,t,u.events.length-t,e.resolve(u.events.slice(t),u)),e.resolveTo&&(u.events=e.resolveTo(u.events,u))}function y(){let e=h(),t=u.previous,n=u.currentConstruct,i=u.events.length,a=Array.from(o);return{from:i,restore:function(){r=e,u.previous=t,u.currentConstruct=n,u.events.length=i,o=a,v()}}}function v(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}(o,t,e)}),defined:[],document:(n=eR,function(e){return function(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=[],s=[],o=[],l={attempt:m(function(e,t){g(e,t.from)}),check:m(p),consume:function(e){(0,eC.HP)(e)?(r.line++,r.column=1,r.offset+=-3===e?2:1,v()):-1!==e&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=e},enter:function(e,t){let n=t||{};return n.type=e,n.start=h(),u.events.push(["enter",n,u]),o.push(n),n},exit:function(e){let t=o.pop();return t.end=h(),u.events.push(["exit",t,u]),t},interrupt:m(p,{interrupt:!0})},u={code:null,containerState:{},defineSkip:function(e){i[e.line]=e.column,v()},events:[],now:h,parser:e,previous:null,sliceSerialize:function(e,t){return function(e,t){let n,r=-1,i=[];for(;++r<e.length;){let a;let s=e[r];
1if("string"==typeof s)a=s;else switch(s){case -5:a="\r";break;case -4:a="\n";break;case -3:a="\r\n";break;case -2:a=t?" ":"	";break;case -1:if(!t&&n)continue;a=" ";break;default:a=String.fromCharCode(s)}n=-2===s,i.push(a)}return i.join("")}(d(e),t)},sliceStream:d,write:function(e){return(s=(0,ew.V)(s,e),function(){let e;for(;r._index<s.length;){let t=s[r._index];if("string"==typeof t)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)(function(e){c=c(e)})(t.charCodeAt(r._bufferIndex));else(function(e){c=c(e)})(t)}}(),null!==s[s.length-1])?[]:(g(t,0),u.events=(0,tn.W)(a,u.events,u),u.events)}},c=t.tokenize.call(u,l);return t.resolveAll&&a.push(t),u;function d(e){return function(e,t){let n;let r=t.start._index,i=t.start._bufferIndex,a=t.end._index,s=t.end._bufferIndex;if(r===a)n=[e[r].slice(i,s)];else{if(n=e.slice(r,a),i>-1){let e=n[0];"string"==typeof e?n[0]=e.slice(i):n.shift()}s>0&&n.push(e[a].slice(0,s))}return n}(s,e)}function h(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function f(e){c=c(e)}function p(e,t){t.restore()}function m(e,t){return function(n,r,i){var a;let s,o,c,d;return Array.isArray(n)?h(n):"tokenize"in n?h([n]):(a=n,function(e){let t=null!==e&&a[e],n=null!==e&&a.null;return h([...Array.isArray(t)?t:t?[t]:[],...Array.isArray(n)?n:n?[n]:[]])(e)});function h(e){return(s=e,o=0,0===e.length)?i:function(e){return function(n){return(d=y(),c=e,e.partial||(u.currentConstruct=e),e.name&&u.parser.constructs.disable.null.includes(e.name))?p(n):e.tokenize.call(t?Object.assign(Object.create(u),t):u,l,f,p)(n)}}(e[o])}function f(t){return e(c,d),r}function p(e){if(d.restore(),++o<s.length){var n;return n=s[o],function(e){return(d=y(),c=n,n.partial||(u.currentConstruct=n),n.name&&u.parser.constructs.disable.null.includes(n.name))?p(e):n.tokenize.call(t?Object.assign(Object.create(u),t):u,l,f,p)(e)}}return i}}}function g(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&(0,ew.m)(u.events,t,u.events.length-t,e.resolve(u.events.slice(t),u)),e.resolveTo&&(u.events=e.resolveTo(u.events,u))}function y(){let e=h(),t=u.previous,n=u.currentConstruct,i=u.events.length,a=Array.from(o);return{from:i,restore:function(){r=e,u.previous=t,u.currentConstruct=n,u.events.length=i,o=a,v()}}}function v(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}(o,n,e)}),flow:(r=ej,function(e){return function(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=[],s=[],o=[],l={attempt:m(function(e,t){g(e,t.from)}),check:m(p),consume:function(e){(0,eC.HP)(e)?(r.line++,r.column=1,r.offset+=-3===e?2:1,v()):-1!==e&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=e},enter:function(e,t){let n=t||{};return n.type=e,n.start=h(),u.events.push(["enter",n,u]),o.push(n),n},exit:function(e){let t=o.pop();return t.end=h(),u.events.push(["exit",t,u]),t},interrupt:m(p,{interrupt:!0})},u={code:null,containerState:{},defineSkip:function(e){i[e.line]=e.column,v()},events:[],now:h,parser:e,previous:null,sliceSerialize:function(e,t){return function(e,t){let n,r=-1,i=[];for(;++r<e.length;){let a;let s=e[r];if("string"==typeof s)a=s;else switch(s){case -5:a="\r";break;case -4:a="\n";break;case -3:a="\r\n";break;case -2:a=t?" ":"	";break;case -1:if(!t&&n)continue;a=" ";break;default:a=String.fromCharCode(s)}n=-2===s,i.push(a)}return i.join("")}(d(e),t)},sliceStream:d,write:function(e){return(s=(0,ew.V)(s,e),function(){let e;for(;r._index<s.length;){let t=s[r._index];if("string"==typeof t)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)(function(e){c=c(e)})(t.charCodeAt(r._bufferIndex));else(function(e){c=c(e)})(t)}}(),null!==s[s.length-1])?[]:(g(t,0),u.events=(0,tn.W)(a,u.events,u),u.events)}},c=t.tokenize.call(u,l);return t.resolveAll&&a.push(t),u;function d(e){return function(e,t){let n;let r=t.start._index,i=t.start._bufferIndex,a=t.end._index,s=t.end._bufferIndex;if(r===a)n=[e[r].slice(i,s)];else{if(n=e.slice(r,a),i>-1){let e=n[0];"string"==typeof e?n[0]=e.slice(i):n.shift()}s>0&&n.push(e[a].slice(0,s))}return n}(s,e)}function h(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function f(e){c=c(e)}
1function p(e,t){t.restore()}function m(e,t){return function(n,r,i){var a;let s,o,c,d;return Array.isArray(n)?h(n):"tokenize"in n?h([n]):(a=n,function(e){let t=null!==e&&a[e],n=null!==e&&a.null;return h([...Array.isArray(t)?t:t?[t]:[],...Array.isArray(n)?n:n?[n]:[]])(e)});function h(e){return(s=e,o=0,0===e.length)?i:function(e){return function(n){return(d=y(),c=e,e.partial||(u.currentConstruct=e),e.name&&u.parser.constructs.disable.null.includes(e.name))?p(n):e.tokenize.call(t?Object.assign(Object.create(u),t):u,l,f,p)(n)}}(e[o])}function f(t){return e(c,d),r}function p(e){if(d.restore(),++o<s.length){var n;return n=s[o],function(e){return(d=y(),c=n,n.partial||(u.currentConstruct=n),n.name&&u.parser.constructs.disable.null.includes(n.name))?p(e):n.tokenize.call(t?Object.assign(Object.create(u),t):u,l,f,p)(e)}}return i}}}function g(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&(0,ew.m)(u.events,t,u.events.length-t,e.resolve(u.events.slice(t),u)),e.resolveTo&&(u.events=e.resolveTo(u.events,u))}function y(){let e=h(),t=u.previous,n=u.currentConstruct,i=u.events.length,a=Array.from(o);return{from:i,restore:function(){r=e,u.previous=t,u.currentConstruct=n,u.events.length=i,o=a,v()}}}function v(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}(o,r,e)}),lazy:{},string:(i=eL,function(e){return function(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=[],s=[],o=[],l={attempt:m(function(e,t){g(e,t.from)}),check:m(p),consume:function(e){(0,eC.HP)(e)?(r.line++,r.column=1,r.offset+=-3===e?2:1,v()):-1!==e&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=e},enter:function(e,t){let n=t||{};return n.type=e,n.start=h(),u.events.push(["enter",n,u]),o.push(n),n},exit:function(e){let t=o.pop();return t.end=h(),u.events.push(["exit",t,u]),t},interrupt:m(p,{interrupt:!0})},u={code:null,containerState:{},defineSkip:function(e){i[e.line]=e.column,v()},events:[],now:h,parser:e,previous:null,sliceSerialize:function(e,t){return function(e,t){let n,r=-1,i=[];for(;++r<e.length;){let a;let s=e[r];if("string"==typeof s)a=s;else switch(s){case -5:a="\r";break;case -4:a="\n";break;case -3:a="\r\n";break;case -2:a=t?" ":"	";break;case -1:if(!t&&n)continue;a=" ";break;default:a=String.fromCharCode(s)}n=-2===s,i.push(a)}return i.join("")}(d(e),t)},sliceStream:d,write:function(e){return(s=(0,ew.V)(s,e),function(){let e;for(;r._index<s.length;){let t=s[r._index];if("string"==typeof t)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)(function(e){c=c(e)})(t.charCodeAt(r._bufferIndex));else(function(e){c=c(e)})(t)}}(),null!==s[s.length-1])?[]:(g(t,0),u.events=(0,tn.W)(a,u.events,u),u.events)}},c=t.tokenize.call(u,l);return t.resolveAll&&a.push(t),u;function d(e){return function(e,t){let n;let r=t.start._index,i=t.start._bufferIndex,a=t.end._index,s=t.end._bufferIndex;if(r===a)n=[e[r].slice(i,s)];else{if(n=e.slice(r,a),i>-1){let e=n[0];"string"==typeof e?n[0]=e.slice(i):n.shift()}s>0&&n.push(e[a].slice(0,s))}return n}(s,e)}function h(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function f(e){c=c(e)}function p(e,t){t.restore()}function m(e,t){return function(n,r,i){var a;let s,o,c,d;return Array.isArray(n)?h(n):"tokenize"in n?h([n]):(a=n,function(e){let t=null!==e&&a[e],n=null!==e&&a.null;return h([...Array.isArray(t)?t:t?[t]:[],...Array.isArray(n)?n:n?[n]:[]])(e)});function h(e){return(s=e,o=0,0===e.length)?i:function(e){return function(n){return(d=y(),c=e,e.partial||(u.currentConstruct=e),e.name&&u.parser.constructs.disable.null.includes(e.name))?p(n):e.tokenize.call(t?Object.assign(Object.create(u),t):u,l,f,p)(n)}}(e[o])}function f(t){return e(c,d),r}function p(e){if(d.restore(),++o<s.length){var n;return n=s[o],function(e){return(d=y(),c=n,n.partial||(u.currentConstruct=n),n.name&&u.parser.constructs.disable.null.includes(n.name))?p(e):n.tokenize.call(t?Object.assign(Object.create(u),t):u,l,f,p)(e)}}return i}}}function g(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&(0,ew.m)(u.events,t,u.events.length-t,e.resolve(u.events.slice(t),u)),e.resolveTo&&(u.events=e.resolveTo(u.events,u))}function y(){let e=h(),t=u.previous,n=u.currentConstruct,i=u.events.length,a=Array.from(o);return{from:i,restore:function(){r=e,u.previous=t,u.currentConstruct=n,u.events.length=i,o=a,v()}}}function v(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}(o,i,e)}),text:(s=eB,function(e){return function(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,c
1olumn:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],s=[],o=[],l={attempt:m(function(e,t){g(e,t.from)}),check:m(p),consume:function(e){(0,eC.HP)(e)?(r.line++,r.column=1,r.offset+=-3===e?2:1,v()):-1!==e&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=e},enter:function(e,t){let n=t||{};return n.type=e,n.start=h(),u.events.push(["enter",n,u]),o.push(n),n},exit:function(e){let t=o.pop();return t.end=h(),u.events.push(["exit",t,u]),t},interrupt:m(p,{interrupt:!0})},u={code:null,containerState:{},defineSkip:function(e){i[e.line]=e.column,v()},events:[],now:h,parser:e,previous:null,sliceSerialize:function(e,t){return function(e,t){let n,r=-1,i=[];for(;++r<e.length;){let a;let s=e[r];if("string"==typeof s)a=s;else switch(s){case -5:a="\r";break;case -4:a="\n";break;case -3:a="\r\n";break;case -2:a=t?" ":"	";break;case -1:if(!t&&n)continue;a=" ";break;default:a=String.fromCharCode(s)}n=-2===s,i.push(a)}return i.join("")}(d(e),t)},sliceStream:d,write:function(e){return(s=(0,ew.V)(s,e),function(){let e;for(;r._index<s.length;){let t=s[r._index];if("string"==typeof t)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)(function(e){c=c(e)})(t.charCodeAt(r._bufferIndex));else(function(e){c=c(e)})(t)}}(),null!==s[s.length-1])?[]:(g(t,0),u.events=(0,tn.W)(a,u.events,u),u.events)}},c=t.tokenize.call(u,l);return t.resolveAll&&a.push(t),u;function d(e){return function(e,t){let n;let r=t.start._index,i=t.start._bufferIndex,a=t.end._index,s=t.end._bufferIndex;if(r===a)n=[e[r].slice(i,s)];else{if(n=e.slice(r,a),i>-1){let e=n[0];"string"==typeof e?n[0]=e.slice(i):n.shift()}s>0&&n.push(e[a].slice(0,s))}return n}(s,e)}function h(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function f(e){c=c(e)}function p(e,t){t.restore()}function m(e,t){return function(n,r,i){var a;let s,o,c,d;return Array.isArray(n)?h(n):"tokenize"in n?h([n]):(a=n,function(e){let t=null!==e&&a[e],n=null!==e&&a.null;return h([...Array.isArray(t)?t:t?[t]:[],...Array.isArray(n)?n:n?[n]:[]])(e)});function h(e){return(s=e,o=0,0===e.length)?i:function(e){return function(n){return(d=y(),c=e,e.partial||(u.currentConstruct=e),e.name&&u.parser.constructs.disable.null.includes(e.name))?p(n):e.tokenize.call(t?Object.assign(Object.create(u),t):u,l,f,p)(n)}}(e[o])}function f(t){return e(c,d),r}function p(e){if(d.restore(),++o<s.length){var n;return n=s[o],function(e){return(d=y(),c=n,n.partial||(u.currentConstruct=n),n.name&&u.parser.constructs.disable.null.includes(n.name))?p(e):n.tokenize.call(t?Object.assign(Object.create(u),t):u,l,f,p)(e)}}return i}}}function g(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&(0,ew.m)(u.events,t,u.events.length-t,e.resolve(u.events.slice(t),u)),e.resolveTo&&(u.events=e.resolveTo(u.events,u))}function y(){let e=h(),t=u.previous,n=u.currentConstruct,i=u.events.length,a=Array.from(o);return{from:i,restore:function(){r=e,u.previous=t,u.currentConstruct=n,u.events.length=i,o=a,v()}}}function v(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}(o,s,e)})};return o}
1)(i).document().write((o=1,l="",u=!0,function(e,t,n){let r,i,a,c,d;let h=[];for(e=l+("string"==typeof e?e.toString():new TextDecoder(t||void 0).decode(e)),a=0,l="",u&&(65279===e.charCodeAt(0)&&a++,u=void 0);a<e.length;){if(t_.lastIndex=a,c=(r=t_.exec(e))&&void 0!==r.index?r.index:e.length,d=e.charCodeAt(c),!r){l=e.slice(a);break}if(10===d&&a===c&&s)h.push(-3),s=void 0;else switch(s&&(h.push(-5),s=void 0),a<c&&(h.push(e.slice(a,c)),o+=c-a),d){case 0:h.push(65533),o++;break;case 9:for(i=4*Math.ceil(o/4),h.push(-2);o++<i;)h.push(-1);break;case 10:h.push(-4),o=1;break;default:s=!0,o=1}a=c+1}return n&&(s&&h.push(-5),l&&h.push(l),h.push(null)),h})(n,r,!0))))}}let tA="object"==typeof self?self:globalThis,tR=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,s]=t[i];switch(a){case 0:case -1:return n(s,i);case 1:{let e=n([],i);for(let t of s)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of s)e[r(t)]=r(n);return e}case 3:return n(new Date(s),i);case 4:{let{source:e,flags:t}=s;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of s)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of s)e.add(r(t));return e}case 7:{let{name:e,message:t}=s;return n(new tA[e](t),i)}case 8:return n(BigInt(s),i);case"BigInt":return n(Object(BigInt(s)),i);case"ArrayBuffer":return n(new Uint8Array(s).buffer,s);case"DataView":{let{buffer:e}=new Uint8Array(s);return n(new DataView(e),s)}}return n(new tA[a](s),i)};return r},tP=e=>tR(new Map,e)(0),{toString:tO}={},{keys:tM}=Object,tN=e=>{let t=typeof e;if("object"!==t||!e)return[0,t];let n=tO.call(e).slice(8,-1);switch(n){case"Array":return[1,""];case"Object":return[2,""];case"Date":return[3,""];case"RegExp":return[4,""];case"Map":return[5,""];case"Set":return[6,""];case"DataView":return[1,n]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},tj=([e,t])=>0===e&&("function"===t||"symbol"===t),tD=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[s,o]=tN(r);switch(s){case 0:{let t=r;switch(o){case"bigint":s=8,t=r.toString();break;case"function":case"symbol":if(e)throw TypeError("unable to serialize "+o);t=null;break;case"undefined":return i([-1],r)}return i([s,t],r)}case 1:{if(o){let e=r;return"DataView"===o?e=new Uint8Array(r.buffer):"ArrayBuffer"===o&&(e=new Uint8Array(r)),i([o,[...e]],r)}let e=[],t=i([s,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(o)switch(o){case"BigInt":return i([o,r.toString()],r);case"Boolean":case"Number":case"String":return i([o,r.valueOf()],r)}if(t&&"toJSON"in r)return a(r.toJSON());let n=[],l=i([s,n],r);for(let t of tM(r))(e||!tj(tN(r[t])))&&n.push([a(t),a(r[t])]);return l}case 3:return i([s,r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([s,{source:e,flags:t}],r)}case 5:{let t=[],n=i([s,t],r);for(let[n,i]of r)(e||!(tj(tN(n))||tj(tN(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([s,t],r);for(let n of r)(e||!tj(tN(n)))&&t.push(a(n));return n}}let{message:l}=r;return i([s,{name:o,message:l}],r)};return a},tL=(e,{json:t,lossy:n}={})=>{let r=[];return tD(!(t||n),!!t,new Map,r)(e),r},tB="function"==typeof structuredClone?(e,t)=>t&&("json"in t||"lossy"in t)?tP(tL(e,t)):structuredClone(e):(e,t)=>tP(tL(e,t));function tF(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),s="";if(37===a&&(0,eC.lV)(e.charCodeAt(n+1))&&(0,eC.lV)(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(s=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(s=String.fromCharCode(a,t),i=1):s="�"}else s=String.fromCharCode(a);s&&(t.push(e.slice(r,n),encodeURIComponent(s)),r=n+i+1,s=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function tz(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 tU(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}var tZ=n(77885);function tH(e,t){let n=t.referenceType,r="]";if("collapsed"===n?r+="[]":"full"===n&&(r+="["+(t.label||t.identifier)+"]"),"imageReference"===t.type)return[{type:"text",value:"!["+t.alt+r}];let i=e.all(t),a=i[0];a&&"text"===a.type?a.value="["+a.value:i.unshift({type:"text",value:"["});let s=i[i.length-1];return s&&"text"===s.type?s.value+=r:i.push({type:"text",value:r}),i}function tV(e){let t=e.spread;return null==t?e.children.length>1:t}function t$(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;9===t||32===t;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;9===t||32===t;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}let tq={blockquote:function(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)},break:function(e,t){let n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:"\n"}]},code:function(e,t){let n=t.value?t.value+"\n":"",r={};t.lang&&(r.className=["language-"+t.lang]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i={type:"element",tagName:"pre",properties:{},children:[i=e.applyData(t,i)]},e.patch(t,i),i},delete:function(e,t){let n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},emphasis:function(e,t){let n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},footnoteReference:function(e,t){let n;
1let r="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),a=tF(i.toLowerCase()),s=e.footnoteOrder.indexOf(i),o=e.footnoteCounts.get(i);void 0===o?(o=0,e.footnoteOrder.push(i),n=e.footnoteOrder.length):n=s+1,o+=1,e.footnoteCounts.set(i,o);let l={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+a,id:r+"fnref-"+a+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(n)}]};e.patch(t,l);let u={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,u),e.applyData(t,u)},heading:function(e,t){let n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},html:function(e,t){if(e.options.allowDangerousHtml){let n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}},imageReference:function(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return tH(e,t);let i={src:tF(r.url||""),alt:t.alt};null!==r.title&&void 0!==r.title&&(i.title=r.title);let a={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)},image:function(e,t){let n={src:tF(t.url)};null!==t.alt&&void 0!==t.alt&&(n.alt=t.alt),null!==t.title&&void 0!==t.title&&(n.title=t.title);let r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)},inlineCode:function(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)},linkReference:function(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return tH(e,t);let i={href:tF(r.url||"")};null!==r.title&&void 0!==r.title&&(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)},link:function(e,t){let n={href:tF(t.url)};null!==t.title&&void 0!==t.title&&(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)},listItem:function(e,t,n){let r=e.all(t),i=n?function(e){let t=!1;if("list"===e.type){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=tV(n[r])}return t}(n):tV(t),a={},s=[];if("boolean"==typeof t.checked){let e;let n=r[0];n&&"element"===n.type&&"p"===n.tagName?e=n:(e={type:"element",tagName:"p",properties:{},children:[]},r.unshift(e)),e.children.length>0&&e.children.unshift({type:"text",value:" "}),e.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let o=-1;for(;++o<r.length;){let e=r[o];(i||0!==o||"element"!==e.type||"p"!==e.tagName)&&s.push({type:"text",value:"\n"}),"element"!==e.type||"p"!==e.tagName||i?s.push(e):s.push(...e.children)}let l=r[r.length-1];l&&(i||"element"!==l.type||"p"!==l.tagName)&&s.push({type:"text",value:"\n"});let u={type:"element",tagName:"li",properties:a,children:s};return e.patch(t,u),e.applyData(t,u)},list:function(e,t){let n={},r=e.all(t),i=-1;for("number"==typeof t.start&&1!==t.start&&(n.start=t.start);++i<r.length;){let e=r[i];if("element"===e.type&&"li"===e.tagName&&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)},paragraph:function(e,t){let n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},root:function(e,t){let n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)},strong:function(e,t){let n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},table:function(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=X(t.children[1]),s=G(t.children[t.children.length-1]);a&&s&&(r.position={start:a,end:s}),i.push(r)}let a={type:"element",tagName:"table",properties:{}
1,children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)},tableCell:function(e,t){let n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},tableRow:function(e,t,n){let r=n?n.children:void 0,i=0===(r?r.indexOf(t):1)?"th":"td",a=n&&"table"===n.type?n.align:void 0,s=a?a.length:t.children.length,o=-1,l=[];for(;++o<s;){let n=t.children[o],r={},s=a?a[o]:void 0;s&&(r.align=s);let u={type:"element",tagName:i,properties:r,children:[]};n&&(u.children=e.all(n),e.patch(n,u),u=e.applyData(n,u)),l.push(u)}let u={type:"element",tagName:"tr",properties:{},children:e.wrap(l,!0)};return e.patch(t,u),e.applyData(t,u)},text:function(e,t){let n={type:"text",value:function(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(t$(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(t$(t.slice(i),i>0,!1)),a.join("")}(String(t.value))};return e.patch(t,n),e.applyData(t,n)},thematicBreak:function(e,t){let n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)},toml:tW,yaml:tW,definition:tW,footnoteDefinition:tW};function tW(){}let tK={}.hasOwnProperty,tJ={};function tY(e,t){e.position&&(t.position=function(e){let t=X(e),n=G(e);if(t&&n)return{start:t,end:n}}(e))}function tG(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;"string"==typeof t&&("element"===n.type?n.tagName=t:n={type:"element",tagName:t,properties:{},children:"children"in n?n.children:[n]}),"element"===n.type&&i&&Object.assign(n.properties,tB(i)),"children"in n&&n.children&&null!=r&&(n.children=r)}return n}function tX(e,t){let n=[],r=-1;for(t&&n.push({type:"text",value:"\n"});++r<e.length;)r&&n.push({type:"text",value:"\n"}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:"\n"}),n}function tQ(e){let t=0,n=e.charCodeAt(t);for(;9===n||32===n;)t++,n=e.charCodeAt(t);return e.slice(t)}function t0(e,t){let n=function(e,t){let n=t||tJ,r=new Map,i=new Map,a={all:function(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&&"break"===n[r-1].type&&(Array.isArray(i)||"text"!==i.type||(i.value=tQ(i.value)),!Array.isArray(i)&&"element"===i.type)){let e=i.children[0];e&&"text"===e.type&&(e.value=tQ(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t},applyData:tG,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...tq,...n.handlers},one:function(e,t){let n=e.type,r=a.handlers[n];if(tK.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,r=tB(n);return r.children=a.all(e),r}return tB(e)}return(a.options.unknownHandler||function(e,t){let n=t.data||{},r="value"in t&&!(tK.call(n,"hProperties")||tK.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)})(a,e,t)},options:n,patch:tY,wrap:tX};return(0,tZ.YR)(e,function(e){if("definition"===e.type||"footnoteDefinition"===e.type){let t="definition"===e.type?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a}(e,t),r=n.one(e,void 0),i=function(e){let t="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||tz,r=e.options.footnoteBackLabel||tU,i=e.options.footnoteLabel||"Footnotes",a=e.options.footnoteLabelTagName||"h2",s=e.options.footnoteLabelProperties||{className:["sr-only"]},o=[],l=-1;for(;++l<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[l]);if(!i)continue;let a=e.all(i),s=String(i.identifier).toUpperCase(),u=tF(s.toLowerCase()),c=0,d=[],h=e.footnoteCounts.get(s);for(;void 0!==h&&++c<=h;){d.length>0&&d.push({type:"text",value:" "});let e="string"==typeof n?n:n(l,c);"string"==typeof e&&(e={type:"text",value:e}),d.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+u+(c>1?"-"+c:""),dataFootnoteBackref:"",ariaLabel:"string"==typeof r?r:r(l,c),className:["data-footnote-backref"]},children:Array.isArray(e)?e:[e]})}
1let f=a[a.length-1];if(f&&"element"===f.type&&"p"===f.tagName){let e=f.children[f.children.length-1];e&&"text"===e.type?e.value+=" ":f.children.push({type:"text",value:" "}),f.children.push(...d)}else a.push(...d);let p={type:"element",tagName:"li",properties:{id:t+"fn-"+u},children:e.wrap(a,!0)};e.patch(i,p),o.push(p)}if(0!==o.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...tB(s),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(o,!0)},{type:"text",value:"\n"}]}}(n),a=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&((0,c.ok)("children"in a),a.children.push({type:"text",value:"\n"},i)),a}function t1(e,t){return e&&"run"in e?async function(n,r){let i=t0(n,{file:r,...t});await e.run(i,r)}:function(n,r){return t0(n,{file:r,...e||t})}}function t2(e){if(e)throw e}var t5=n(59721);function t4(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}let t9={basename:function(e,t){let n;if(void 0!==t&&"string"!=typeof t)throw TypeError('"ext" argument must be a string');t6(e);let r=0,i=-1,a=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;a--;)if(47===e.codePointAt(a)){if(n){r=a+1;break}}else i<0&&(n=!0,i=a+1);return i<0?"":e.slice(r,i)}if(t===e)return"";let s=-1,o=t.length-1;for(;a--;)if(47===e.codePointAt(a)){if(n){r=a+1;break}}else s<0&&(n=!0,s=a+1),o>-1&&(e.codePointAt(a)===t.codePointAt(o--)?o<0&&(i=a):(o=-1,i=s));return r===i?i=s:i<0&&(i=e.length),e.slice(r,i)},dirname:function(e){let t;if(t6(e),0===e.length)return".";let n=-1,r=e.length;for(;--r;)if(47===e.codePointAt(r)){if(t){n=r;break}}else t||(t=!0);return n<0?47===e.codePointAt(0)?"/":".":1===n&&47===e.codePointAt(0)?"//":e.slice(0,n)},extname:function(e){let t;t6(e);let n=e.length,r=-1,i=0,a=-1,s=0;for(;n--;){let o=e.codePointAt(n);if(47===o){if(t){i=n+1;break}continue}r<0&&(t=!0,r=n+1),46===o?a<0?a=n:1!==s&&(s=1):a>-1&&(s=-1)}return a<0||r<0||0===s||1===s&&a===r-1&&a===i+1?"":e.slice(a,r)},join:function(...e){let t,n=-1;for(;++n<e.length;)t6(e[n]),e[n]&&(t=void 0===t?e[n]:t+"/"+e[n]);return void 0===t?".":function(e){t6(e);let t=47===e.codePointAt(0),n=function(e,t){let n,r,i="",a=0,s=-1,o=0,l=-1;for(;++l<=e.length;){if(l<e.length)n=e.codePointAt(l);else if(47===n)break;else n=47;if(47===n){if(s===l-1||1===o);else if(s!==l-1&&2===o){if(i.length<2||2!==a||46!==i.codePointAt(i.length-1)||46!==i.codePointAt(i.length-2)){if(i.length>2){if((r=i.lastIndexOf("/"))!==i.length-1){r<0?(i="",a=0):a=(i=i.slice(0,r)).length-1-i.lastIndexOf("/"),s=l,o=0;continue}}else if(i.length>0){i="",a=0,s=l,o=0;continue}}t&&(i=i.length>0?i+"/..":"..",a=2)}else i.length>0?i+="/"+e.slice(s+1,l):i=e.slice(s+1,l),a=l-s-1;s=l,o=0}else 46===n&&o>-1?o++:o=-1}return i}(e,!t);return 0!==n.length||t||(n="."),n.length>0&&47===e.codePointAt(e.length-1)&&(n+="/"),t?"/"+n:n}(t)},sep:"/"};function t6(e){if("string"!=typeof e)throw TypeError("Path must be a string. Received "+JSON.stringify(e))}let t3={cwd:function(){return"/"}};function t8(e){return!!(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}let t7=["history","path","basename","stem","extname","dirname"];class ne{constructor(e){let t,n;t=e?t8(e)?{path:e}:"string"==typeof e||function(e){return!!(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)?{value:e}:e:{},this.cwd="cwd"in t?"":t3.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<t7.length;){let e=t7[r];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(n in t)t7.includes(n)||(this[n]=t[n])}get basename(){return"string"==typeof this.path?t9.basename(this.path):void 0}set basename(e){nn(e,"basename"),nt(e,"basename"),this.path=t9.join(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?t9.dirname(this.path):void 0}set dirname(e){nr(this.basename,"dirname"),this.path=t9.join(e||"",this.basename)}get extname(){return"string"==typeof this.path?t9.extname(this.path):void 0}set extname(e){if(nt(e,"extname"),nr(this.dirname,"extname"),e){if(46!==e.codePointAt(0))throw Error("`extname` must start with `.`");
1if(e.includes(".",1))throw Error("`extname` cannot contain multiple dots")}this.path=t9.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){t8(e)&&(e=function(e){if("string"==typeof e)e=new URL(e);else if(!t8(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("file:"!==e.protocol){let e=TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(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(37===t.codePointAt(n)&&50===t.codePointAt(n+1)){let e=t.codePointAt(n+2);if(70===e||102===e){let e=TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(t)}(e)}(e)),nn(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?t9.basename(this.path,this.extname):void 0}set stem(e){nn(e,"stem"),nt(e,"stem"),this.path=t9.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 er(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 void 0===this.value?"":"string"==typeof this.value?this.value:new TextDecoder(e||void 0).decode(this.value)}}function nt(e,t){if(e&&e.includes(t9.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+t9.sep+"`")}function nn(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function nr(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}let ni=function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r},na={}.hasOwnProperty;class ns extends ni{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=function(){let e=[],t={run:function(...t){let n=-1,r=t.pop();if("function"!=typeof r)throw TypeError("Expected function as last argument, not "+r);(function i(a,...s){let o=e[++n],l=-1;if(a){r(a);return}for(;++l<t.length;)(null===s[l]||void 0===s[l])&&(s[l]=t[l]);t=s,o?(function(e,t){let n;return function(...t){let a;let s=e.length>t.length;s&&t.push(r);try{a=e.apply(this,t)}catch(e){if(s&&n)throw e;return r(e)}s||(a&&a.then&&"function"==typeof a.then?a.then(i,r):a instanceof Error?r(a):i(a))};function r(e,...i){n||(n=!0,t(e,...i))}function i(e){r(null,e)}})(o,i)(...s):r(null,...s)})(null,...t)},use:function(n){if("function"!=typeof n)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}};return t}()}copy(){let e=new ns,t=-1;for(;++t<this.attachers.length;){let n=this.attachers[t];e.use(...n)}return e.data(t5(!0,{},this.namespace)),e}data(e,t){return"string"==typeof e?2==arguments.length?(nc("data",this.frozen),this.namespace[e]=t,this):na.call(this.namespace,e)&&this.namespace[e]||void 0:e?(nc("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;for(;++this.freezeIndex<this.attachers.length;){let[e,...t]=this.attachers[this.freezeIndex];if(!1===t[0])continue;!0===t[0]&&(t[0]=void 0);let n=e.call(this,...t);"function"==typeof n&&this.transformers.use(n)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();let t=nf(e),n=this.parser||this.Parser;return nl("parse",n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),nl("process",this.parser||this.Parser),nu("process",this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=nf(e),s=n.parse(a);function o(e,n){e||!n?i(e):r?r(n):((0,c.ok)(t,"`done` is defined if `resolve` is not"),t(void 0,n))}n.run(s,a,function(e,t,r){var i,a;if(e||!t||!r)return o(e);let s=n.stringify(t,r);"string"==typeof(i=s)||(a=i)&&"object"==typeof a&&"byteLength"in a&&"byteOffset"in a?r.value=s:r.result=s,o(e,r)})}}processSync(e){let t,n=!1;return this.freeze(),nl("processSync",this.parser||this.Parser),nu("processSync",this.compiler||this.Compiler),this.process(e,function(e,r){n=!0,t2(e),t=r}),nh("processSync","process",n),(0,c.ok)(t,"we either bailed on an error or have a tree"),t}
1run(e,t,n){nd(e),this.freeze();let r=this.transformers;return n||"function"!=typeof t||(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){(0,c.ok)("function"!=typeof t,"`file` can’t be a `done` anymore, we checked");let s=nf(t);r.run(e,s,function(t,r,s){let o=r||e;t?a(t):i?i(o):((0,c.ok)(n,"`done` is defined if `resolve` is not"),n(void 0,o,s))})}}runSync(e,t){let n,r=!1;return this.run(e,t,function(e,t){t2(e),n=t,r=!0}),nh("runSync","run",r),(0,c.ok)(n,"we either bailed on an error or have a tree"),n}stringify(e,t){this.freeze();let n=nf(t),r=this.compiler||this.Compiler;return nu("stringify",r),nd(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(nc("use",this.frozen),null==e);else if("function"==typeof e)s(e,t);else if("object"==typeof e)Array.isArray(e)?a(e):i(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(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");a(e.plugins),e.settings&&(r.settings=t5(!0,r.settings,e.settings))}function a(e){let t=-1;if(null==e);else if(Array.isArray(e))for(;++t<e.length;)!function(e){if("function"==typeof e)s(e,[]);else if("object"==typeof e){if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else i(e)}else throw TypeError("Expected usable value, not `"+e+"`")}(e[t]);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(-1===i)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,s=n[i][1];t4(s)&&t4(r)&&(r=t5(!0,s,r)),n[i]=[e,r,...a]}}}}let no=new ns().freeze();function nl(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `parser`")}function nu(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `compiler`")}function nc(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 nd(e){if(!t4(e)||"string"!=typeof e.type)throw TypeError("Expected node, got `"+e+"`")}function nh(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function nf(e){var t;return(t=e)&&"object"==typeof t&&"message"in t&&"messages"in t?e:new ne(e)}let np=[],nm={allowDangerousHtml:!0},ng=/^(https?|ircs?|mailto|xmpp)$/i,ny=[{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:"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 nv(e){let t=function(e){let t=e.rehypePlugins||np,n=e.remarkPlugins||np,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...nm}:nm;return no().use(tC).use(n).use(t1,r).use(t)}(e),n=function(e){let t=e.children||"",n=new ne;return"string"==typeof t?n.value=t:(0,c.HB)("Unexpected value `"+t+"` for `children` prop, expected `string`"),n}(e);return function(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,s=t.skipHtml,o=t.unwrapDisallowed,l=t.urlTransform||nb;for(let e of ny)Object.hasOwn(t,e.from)&&(0,c.HB)("Unexpected `"+e.from+"` prop, "+(e.to?"use `"+e.to+"` instead":"remove it")+" (see <https://github.com/remarkjs/react-markdown/blob/main/changelog.md#"+e.id+"> for more info)");return n&&a&&(0,c.HB)("Unexpected combined `allowedElements` and `disallowedElements`, expected one or the other"),t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:"root"===e.type?e.children:[e]}),(0,tZ.YR)(e,function(e,t,i){if("raw"===e.type&&i&&"number"==typeof t)return s?i.children.splice(t,1):i.children[t]={type:"text",value:e.value},t;if("element"===e.type){let t;for(t in eb)if(Object.hasOwn(eb,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=eb[t];(null===r||r.includes(e.tagName))&&(e.properties[t]=l(String(n||""),t,e))}}if("element"===e.type){let s=n?!n.includes(e.tagName):!!a&&a.includes(e.tagName);if(!s&&r&&"number"==typeof t&&(s=!r(e,t,i)),s&&i&&"number"==typeof t)return o&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}),function(e,t){var n,r,i,a,s;let o;if(!t||void 0===t.Fragment)throw TypeError("Expected `Fragment` in options");let l=t.filePath||void 0;if(t.development){if("function"!=typeof t.jsxDEV)throw TypeError("Expected `jsxDEV` in options when `development: true`");n=l,r=t.jsxDEV,o=function(e,t,i,a){let s=Array.isArray(i.children),o=X(e);return r(t,i,a,s,{columnNumber:o?o.column-1:void 0,fileName:n,lineNumber:o?o.line:void 0},void 0)}}else{if("function"!=typeof t.jsx)throw TypeError("Expected `jsx` in production options");
1if("function"!=typeof t.jsxs)throw TypeError("Expected `jsxs` in production options");i=0,a=t.jsx,s=t.jsxs,o=function(e,t,n,r){let i=Array.isArray(n.children)?s:a;return r?i(t,n,r):i(t,n)}}let u={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:o,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:l,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:!1!==t.passKeys,passNode:t.passNode||!1,schema:"svg"===t.space?Z:U,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:!1!==t.tableCellAlignToStyle},c=ed(u,e,void 0);return c&&"string"!=typeof c?c:u.create(e,u.Fragment,{children:c||void 0},void 0)}(e,{Fragment:ex.Fragment,components:i,ignoreInvalidStyle:!0,jsx:ex.jsx,jsxs:ex.jsxs,passKeys:!0,passNode:!0})}(t.runSync(t.parse(n),n),e)}function nb(e){let t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return -1===t||-1!==i&&t>i||-1!==n&&t>n||-1!==r&&t>r||ng.test(e.slice(0,t))?e:""}var nx=n(59263),n_=({node:e,...t})=>(0,ex.jsx)("pre",{...t}),nw=({node:e,...t})=>(0,ex.jsx)("code",{...t}),nk=({node:e,components:{Pre:t,Code:n},code:r})=>(0,ex.jsx)(t,{children:(0,ex.jsx)(n,{node:e,children:r})}),nS=()=>null,nE=n(41524),nT=({node:e,components:{Pre:t,Code:n,SyntaxHighlighter:r,CodeHeader:i},language:a,code:s})=>{let o=(0,u.useMemo)(()=>({Pre:t,Code:n}),[t,n]),l=a?r:nk;return(0,ex.jsxs)(ex.Fragment,{children:[(0,ex.jsx)(i,{node:e,language:a,code:s}),(0,ex.jsx)(l,{node:e,components:o,language:a??"unknown",code:s})]})},nI=n(4617),nC=({className:e,...t})=>({className:n,...r})=>({className:nI(e,n),...t,...r}),nA=n(52252),nR=({node:e,components:{Pre:t,Code:n,SyntaxHighlighter:r,CodeHeader:i},componentsByLanguage:a={},children:s,...o})=>{let l=nC((0,u.useContext)(nx.fv)),c=(0,nE.c)(e=>(0,ex.jsx)(t,{...l(e)})),d=nC(o),h=(0,nE.c)(e=>(0,ex.jsx)(n,{...d(e)})),f=/language-(\w+)/.exec(o.className||"")?.[1]??"";if("string"!=typeof s)return(0,ex.jsx)(nk,{node:e,components:{Pre:c,Code:h},code:s});let p=a[f]?.SyntaxHighlighter??r,m=a[f]?.CodeHeader??i;return(0,ex.jsx)(nT,{node:e,components:{Pre:c,Code:h,SyntaxHighlighter:p,CodeHeader:m},language:f||"unknown",code:s})},nP=(0,u.memo)(({node:e,components:t,componentsByLanguage:n,...r})=>(0,nx.$7)()?(0,ex.jsx)(nR,{node:e,components:t,componentsByLanguage:n,...r}):(0,ex.jsx)(t.Code,{...r}),(e,t)=>e.components===t.components&&e.componentsByLanguage===t.componentsByLanguage&&(0,nA.x1)(e,t)),{cg:nO,a2:nM,D0:nN}=r,nj=e=>{let{components:t,componentsByLanguage:n=null==t?void 0:t.by_language,smooth:r=!0,...i}=e,{text:a}=nO((0,l.X)(),r),{pre:s=n_,code:o=nw,SyntaxHighlighter:c=nk,CodeHeader:d=nS}=null!=t?t:{},h=(0,u.useMemo)(()=>({Pre:s,Code:o,SyntaxHighlighter:c,CodeHeader:d}),[s,o,c,d]),f=(0,nE.c)(e=>(0,ex.jsx)(nP,{components:h,componentsByLanguage:n,...e})),p=(0,u.useMemo)(()=>{let{pre:e=n_,code:n=nw,SyntaxHighlighter:r=nk,CodeHeader:i=nS,by_language:a,...s}=null!=t?t:{};return{...s,pre:nx.U_,code:f}},[f,t,n]);return(0,ex.jsx)(nv,{components:p,...i,children:a})},nD=(0,u.forwardRef)((e,t)=>{let{className:n,containerProps:r,containerComponent:i="div",...a}=e,s=nM();return(0,ex.jsx)(i,{"data-status":s.type,...r,className:nI(n,null==r?void 0:r.className),ref:t,children:(0,ex.jsx)(nj,{...a})})});nD.displayName="MarkdownTextPrimitive";var nL=nN(nD)},68621:(e,t,n)=>{"use strict";n.d(t,{I:()=>a,s:()=>s});var r=n(9862),i=n(99723);function a(e){var t;let n=(0,r.LN)({optional:!0}),a=(0,i.Mp)(e);return n?n.composer:null!==(t=null==a?void 0:a.composer)&&void 0!==t?t:null}var s=(0,n(88668).k)(a)},71340:(e,t,n)=>{"use strict";n.d(t,{C:()=>s});var r=n(23360),i=n(12115),a=n(95155),s=(0,i.forwardRef)((e,t)=>(0,a.jsx)(r.sG.div,{...e,ref:t}));s.displayName="ThreadListPrimitive.Root"},72316:(e,t,n)=>{"use strict";n.d(t,{v:()=>d});var r=n(23360),i=n(12115),a=n(9862),s=n(99723),o=n(53562),l=(e=>(e.Hidden="hidden",e.Floating="floating",e.Normal="normal",e))(l||{}),u=e=>{let{hideWhenRunning:t,autohide:n,autohideFloat:r}=e,i=(0,s.Mp)(),l=(0,a.LN)(),u=(0,a.vd)();return(0,o.y)([i,l,u],(e,i,a)=>t&&e.isRunning?"hidden":"always"!==n&&("not-last"!==n||i.isLast)?"normal":a.isHovering?"always"===r||"single-branch"===r&&i.branchCount<=1?"floating":"normal":"hidden")},c=n(95155),d=(0,i.forwardRef)((e,t)=>{let{hideWhenRunning:n,autohide:i,autohideFloat:a,...s}=e,o=u({hideWhenRunning:n,autohide:i,autohideFloat:a});return o===l.Hidden?null:(0,c.jsx)(r.sG.div,{...o===l.Floating?{"data-floating":"true"}:null,...s,ref:t})});d.displayName="ActionBarPrimitive.Root"},74130:(e,t,n)=>{"use strict";n.d(t,{l:()=>s});var r=n(37364),i=n(12115),a=n(9862),s=(0,r.x)("ActionBarPrimitive.Edit",()=>{let e=(0,a.LN)(),t=(0,a.iP)(e=>e.isEditing),n=(0,i.useCallback)(()=>{e.composer.beginEdit()},[e]);return t?null:n})},75234:(e,t,n)=>{"use strict";n.d(t,{y:()=>a});var r=n(30938);let i={}.hasOwnProperty;function a(e){let t={},n=-1;for(;++n<e.length;)!function(e,t){let n;for(n in t){let a;let s=(i.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];if(o)for(a in o){i.call(s,a)||(s[a]=[]);let e=o[a];!function(e,t){let n=-1,i=[];for(;++n<t.length;)("after"===t[n].add?e:i).push(t[n]);(0,r.m)(e,0,0,i)}(s[a],Array.isArray(e)?e:e?[e]:[])}}}(t,e[n]);return t}}
1,75828:(e,t,n)=>{"use strict";n.d(t,{U:()=>c});var r=n(12115),i=n(99827),a=()=>{let e=new Set;return(0,i.v)(()=>({isAtBottom:!0,scrollToBottom:()=>{for(let t of e)t()},onScrollToBottom:t=>(e.add(t),()=>{e.delete(t)})}))},s=n(40617),o=n(86903),l=n(95155),u=()=>{let e=(0,s.D0)({optional:!0}),[t]=(0,r.useState)(()=>a());return(0,r.useEffect)(()=>null==e?void 0:e.getState().onScrollToBottom(()=>{t.getState().scrollToBottom()}),[e,t]),(0,r.useEffect)(()=>{if(e)return t.subscribe(t=>{e.getState().isAtBottom!==t.isAtBottom&&(0,o.s)(e).setState({isAtBottom:t.isAtBottom})})},[t,e]),t},c=e=>{let{children:t}=e,n=u(),[i]=(0,r.useState)(()=>({useThreadViewport:n}));return(0,l.jsx)(s.Ek.Provider,{value:i,children:t})}},77219:(e,t,n)=>{"use strict";n.d(t,{H:()=>s});var r=n(37364),i=n(12115),a=n(9862),s=(0,r.x)("BranchPickerPrimitive.Next",()=>{let e=(0,a.LN)(),t=(0,a.JX)(e=>e.branchNumber>=e.branchCount),n=(0,i.useCallback)(()=>{e.switchToBranch({position:"next"})},[e]);return t?null:n})},77369:(e,t,n)=>{"use strict";n.d(t,{X:()=>c});var r=n(12115),i=n(99827),a=n(58432),s=n(86903),o=n(36505),l=n(95155),u=e=>{let[t]=(0,r.useState)(()=>(0,i.v)(()=>e));return(0,r.useEffect)(()=>{(0,o.Q)(e),(0,s.s)(t).setState(e,!0)},[e,t]),t},c=e=>{let{runtime:t,children:n}=e,i=u(t),[s]=(0,r.useState)(()=>({useThreadListItemRuntime:i}));return(0,l.jsx)(a.vz.Provider,{value:s,children:n})}},77426:(e,t,n)=>{"use strict";n.d(t,{X:()=>i});var r=n(61565),i=()=>(0,r.iy)(e=>{if("text"!==e.type)throw Error("ContentPartText can only be used inside text content parts.");return e})},77885:(e,t,n)=>{"use strict";n.d(t,{YR:()=>i});var r=n(37795);function i(e,t,n,i){let a,s,o;"function"==typeof t&&"function"!=typeof n?(s=void 0,o=t,a=n):(s=t,o=n,a=i),(0,r.VG)(e,s,function(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)},a)}},80466:e=>{var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,r=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e){return e?e.replace(l,""):""}e.exports=function(e,l){if("string"!=typeof e)throw TypeError("First argument must be a string");if(!e)return[];l=l||{};var c=1,d=1;function h(e){var t=e.match(n);t&&(c+=t.length);var r=e.lastIndexOf("\n");d=~r?e.length-r:d+e.length}function f(){var e={line:c,column:d};return function(t){return t.position=new p(e),y(r),t}}function p(e){this.start=e,this.end={line:c,column:d},this.source=l.source}p.prototype.content=e;var m=[];function g(t){var n=Error(l.source+":"+c+":"+d+": "+t);if(n.reason=t,n.filename=l.source,n.line=c,n.column=d,n.source=e,l.silent)m.push(n);else throw n}function y(t){var n=t.exec(e);if(n){var r=n[0];return h(r),e=e.slice(r.length),n}}function v(e){var t;for(e=e||[];t=b();)!1!==t&&e.push(t);return e}function b(){var t=f();if("/"==e.charAt(0)&&"*"==e.charAt(1)){for(var n=2;""!=e.charAt(n)&&("*"!=e.charAt(n)||"/"!=e.charAt(n+1));)++n;if(n+=2,""===e.charAt(n-1))return g("End of comment missing");var r=e.slice(2,n-2);return d+=2,h(r),e=e.slice(n),d+=2,t({type:"comment",comment:r})}}return y(r),function(){var e,n=[];for(v(n);e=function(){var e=f(),n=y(i);if(n){if(b(),!y(a))return g("property missing ':'");var r=y(s),l=e({type:"declaration",property:u(n[0].replace(t,"")),value:r?u(r[0].replace(t,"")):""});return y(o),l}}();)!1!==e&&(n.push(e),v(n));return n}()}},81476:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});let r=(0,n(67401).A)("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]])},82965:(e,t,n)=>{"use strict";n.d(t,{R:()=>i});var r=n(99723),i=e=>{let{children:t}=e;return(0,r._W)(e=>0===e.messages.length)?t:null};i.displayName="ThreadPrimitive.Empty"},84737:(e,t,n)=>{"use strict";n.d(t,{d:()=>i});let r={};function i(e,t){let n=t||r;return a(e,"boolean"!=typeof n.includeImageAlt||n.includeImageAlt,"boolean"!=typeof n.includeHtml||n.includeHtml)}function a(e,t,n){var r;if((r=e)&&"object"==typeof r){if("value"in e)return"html"!==e.type||n?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return s(e.children,t,n)}
1return Array.isArray(e)?s(e,t,n):""}function s(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=a(e[i],t,n);return r.join("")}},85054:(e,t,n)=>{"use strict";n.d(t,{L:()=>s});var r=n(37364),i=n(58432),a=n(12115),s=(0,r.x)("ThreadListItemPrimitive.Archive",()=>{let e=(0,i.pK)();return(0,a.useCallback)(()=>{e.archive()},[e])})},86246:(e,t,n)=>{"use strict";n.d(t,{W:()=>s});var r=n(37364),i=n(12115),a=n(68621),s=(0,r.x)("ComposerPrimitive.Cancel",()=>{let e=(0,a.I)(),t=(0,a.s)(e=>!e.canCancel),n=(0,i.useCallback)(()=>{e.cancel()},[e]);return t?null:n})},86709:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});let r=(0,n(67401).A)("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]])},86903:(e,t,n)=>{"use strict";n.d(t,{s:()=>r});var r=e=>e},87062:(e,t,n)=>{"use strict";n.d(t,{Bs:()=>p,D0:()=>d,a2:()=>f});var r=n(12115),i=n(99827),a=n(61565),s=n(4703),o=n(95155),l=(0,r.createContext)(null),u=e=>({useSmoothStatus:(0,i.v)(()=>e)}),c=e=>{let{children:t}=e,n=h({optional:!0}),i=(0,a.g1)(),[s]=(0,r.useState)(()=>u(i.getState().status));return n?t:(0,o.jsx)(l.Provider,{value:s,children:t})},d=e=>{let t=(0,r.forwardRef)((t,n)=>(0,o.jsx)(c,{children:(0,o.jsx)(e,{...t,ref:n})}));return t.displayName=e.displayName,t};function h(e){let t=(0,r.useContext)(l);if(!(null==e?void 0:e.optional)&&!t)throw Error("This component must be used within a SmoothContextProvider.");return t}var{useSmoothStatus:f,useSmoothStatusStore:p}=(0,s.o)(h,"useSmoothStatus")},87685:(e,t,n)=>{"use strict";n.d(t,{v:()=>a});var r=n(99723),i=e=>(0,r._W)(t=>(!0!==e.empty||0===t.messages.length)&&(!1!==e.empty||0!==t.messages.length)&&(!0!==e.running||!!t.isRunning)&&(!1!==e.running||!t.isRunning)&&(!0!==e.disabled||!!t.isDisabled)&&(!1!==e.disabled||!t.isDisabled)&&!0),a=e=>{let{children:t,...n}=e;return i(n)?t:null};a.displayName="ThreadPrimitive.If"},87725:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});let r=(0,n(67401).A)("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]])},91924:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});let r=(0,n(67401).A)("Dot",[["circle",{cx:"12.1",cy:"12.1",r:"1",key:"18d7e5"}]])},93518:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});let r=(0,n(67401).A)("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]])},93546:(e,t,n)=>{"use strict";n.d(t,{P:()=>o});var r=n(23360),i=n(12115),a=n(58432),s=n(95155),o=(0,i.forwardRef)((e,t)=>{let n=(0,a.Xi)(e=>e.isMain);return(0,s.jsx)(r.sG.div,{...n?{"data-active":"true","aria-current":"true"}:null,...e,ref:t})});o.displayName="ThreadListItemPrimitive.Root"},93612:(e,t,n)=>{"use strict";n.d(t,{Y:()=>o});var r=n(23360),i=n(12115),a=n(54039),s=n(95155),o=(0,i.forwardRef)(({hideWhenSingleBranch:e,...t},n)=>(0,s.jsx)(a.s,{hasBranches:!!e||void 0,children:(0,s.jsx)(r.sG.div,{...t,ref:n})}));o.displayName="BranchPickerPrimitive.Root"},94460:(e,t,n)=>{"use strict";let r,i;n.d(t,{uh:()=>iC});var a,s,o,l,u,c,d,h,f=n(12115),p="vercel.ai.error",m=Symbol.for(p),g=class e extends Error{constructor({name:e,message:t,cause:n}){super(t),this[a]=!0,this.name=e,this.cause=n}static isInstance(t){return e.hasMarker(t,p)}static hasMarker(e,t){let n=Symbol.for(t);return null!=e&&"object"==typeof e&&n in e&&"boolean"==typeof e[n]&&!0===e[n]}};a=m;var y=g,v=Symbol.for("vercel.ai.error.AI_APICallError"),b=Symbol.for("vercel.ai.error.AI_EmptyResponseBodyError"),x="AI_InvalidArgumentError",_=`vercel.ai.error.${x}`,w=Symbol.for(_),k=class extends y{constructor({message:e,cause:t,argument:n}){super({name:x,message:e,cause:t}),this[s]=!0,this.argument=n}static isInstance(e){return y.hasMarker(e,_)}};s=w;var S=Symbol.for("vercel.ai.error.AI_InvalidPromptError"),E=Symbol.for("vercel.ai.error.AI_InvalidResponseDataError"),T=Symbol.for("vercel.ai.error.AI_JSONParseError"),I=Symbol.for("vercel.ai.error.AI_LoadAPIKeyError"),C=Symbol.for("vercel.ai.error.AI_LoadSettingError"),A=Symbol.for("vercel.ai.error.AI_NoContentGeneratedError"),R=Symbol.for("vercel.ai.error.AI_NoSuchMo
1delError"),P=Symbol.for("vercel.ai.error.AI_TooManyEmbeddingValuesForCallError"),O=Symbol.for("vercel.ai.error.AI_TypeValidationError"),M=Symbol.for("vercel.ai.error.AI_UnsupportedFunctionalityError");function N(e){return null===e||"string"==typeof e||"number"==typeof e||"boolean"==typeof e||(Array.isArray(e)?e.every(N):"object"==typeof e&&Object.entries(e).every(([e,t])=>"string"==typeof e&&N(t)))}let j=(e,t=21)=>(n=t)=>{let r="",i=0|n;for(;i--;)r+=e[Math.random()*e.length|0];return r};n(10553),n(2818);var D=(({prefix:e,size:t=16,alphabet:n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:r="-"}={})=>{let i=j(n,t);if(null==e)return i;if(n.includes(r))throw new k({argument:"separator",message:`The separator "${r}" must not be part of the alphabet "${n}".`});return t=>`${e}${r}${i(t)}`})();function L(e){return e instanceof Error&&("AbortError"===e.name||"TimeoutError"===e.name)}var B=Symbol.for("vercel.ai.validator"),F=()=>globalThis.fetch,{btoa:z,atob:U}=globalThis;!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw Error()},e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>"number"!=typeof t[t[e]]),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(o||(o={})),(l||(l={})).mergeShapes=(e,t)=>({...e,...t});let Z=o.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),H=e=>{switch(typeof e){case"undefined":return Z.undefined;case"string":return Z.string;case"number":return isNaN(e)?Z.nan:Z.number;case"boolean":return Z.boolean;case"function":return Z.function;case"bigint":return Z.bigint;case"symbol":return Z.symbol;case"object":if(Array.isArray(e))return Z.array;if(null===e)return Z.null;if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return Z.promise;if("undefined"!=typeof Map&&e instanceof Map)return Z.map;if("undefined"!=typeof Set&&e instanceof Set)return Z.set;if("undefined"!=typeof Date&&e instanceof Date)return Z.date;return Z.object;default:return Z.unknown}}
vendor: 4,484 bytes, line 1
1,V=o.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class $ extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(r);else if("invalid_return_type"===i.code)r(i.returnTypeError);else if("invalid_arguments"===i.code)r(i.argumentsError);else if(0===i.path.length)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(e){if(!(e instanceof $))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,o.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){let t={},n=[];for(let r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}$.create=e=>new $(e);let q=(e,t)=>{let n;switch(e.code){case V.invalid_type:n=e.received===Z.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case V.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,o.jsonStringifyReplacer)}`;break;case V.unrecognized_keys:n=`Unrecognized key(s) in object: ${o.joinValues(e.keys,", ")}`;break;case V.invalid_union:n="Invalid input";break;case V.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${o.joinValues(e.options)}`;break;case V.invalid_enum_value:n=`Invalid enum value. Expected ${o.joinValues(e.options)}, received '${e.received}'`;break;case V.invalid_arguments:n="Invalid function arguments";break;case V.invalid_return_type:n="Invalid function return type";break;case V.invalid_date:n="Invalid date";break;case V.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:o.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case V.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case V.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case V.custom:n="Invalid input";break;case V.invalid_intersection_types:n="Intersection results could not be merged";break;case V.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case V.not_finite:n="Number must be finite";break;default:n=t.defaultError,o.assertNever(e)}return{message:n}},W=q;function K(){return W}let J=e=>
1{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],s={...i,path:a};if(void 0!==i.message)return{...i,path:a,message:i.message};let o="";for(let e of r.filter(e=>!!e).slice().reverse())o=e(s,{data:t,defaultError:o}).message;return{...i,path:a,message:o}};function Y(e,t){let n=K(),r=J({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===q?void 0:q].filter(e=>!!e)});e.common.issues.push(r)}class G{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){let n=[];for(let r of t){if("aborted"===r.status)return X;"dirty"===r.status&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let e of t){let t=await e.key,r=await e.value;n.push({key:t,value:r})}return G.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if("aborted"===t.status||"aborted"===i.status)return X;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"!==t.value&&(void 0!==i.value||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}}let X=Object.freeze({status:"aborted"}),Q=e=>({status:"dirty",value:e}),ee=e=>({status:"valid",value:e}),et=e=>"aborted"===e.status,en=e=>"dirty"===e.status,er=e=>"valid"===e.status,ei=e=>"undefined"!=typeof Promise&&e instanceof Promise;function ea(e,t,n,r){if("a"===n&&!r)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function es(e,t,n,r,i){if("m"===r)throw TypeError("Private method is not writable");if("a"===r&&!i)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(e,n):i?i.value=n:t.set(e,n),n}"function"==typeof SuppressedError&&SuppressedError,function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(u||(u={}));class eo{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}let el=(e,t)=>
1{if(er(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new $(e.common.issues);return this._error=t,this._error}}};function eu(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{var a,s;let{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:i.defaultError}:void 0===i.data?{message:null!==(a=null!=o?o:r)&&void 0!==a?a:i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:null!==(s=null!=o?o:n)&&void 0!==s?s:i.defaultError}},description:i}}class ec{get description(){return this._def.description}_getType(e){return H(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:H(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new G,ctx:{common:e.parent.common,data:e.data,parsedType:H(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(ei(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){return Promise.resolve(this._parse(e))}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;let r={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:H(e)},i=this._parseSync({data:e,path:r.path,parent:r});return el(r,i)}"~validate"(e){var t,n;let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:H(e)};if(!this["~standard"].async)try{let t=this._parseSync({data:e,path:[],parent:r});return er(t)?{value:t.value}:{issues:r.common.issues}}catch(e){(null===(n=null===(t=null==e?void 0:e.message)||void 0===t?void 0:t.toLowerCase())||void 0===n?void 0:n.includes("encountered"))&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(e=>er(e)?{value:e.value}:{issues:r.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:H(e)},r=this._parse({data:e,path:n.path,parent:n});return el(n,await (ei(r)?r:Promise.resolve(r)))}refine(e,t){let n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:V.custom,...n(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then(e=>!!e||(a(),!1)):!!i||(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>!!e(n)||(r.addIssue("function"==typeof t?t(n,r):t),!1))}_refinement(e){return new e4({schema:this,typeName:h.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return e9.create(this,this._def)}nullable(){return e6.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return eU.create(this)}promise(){return e5.create(this,this._def)}or(e){return eH.create([this,e],this._def)}and(e){return eq.create(this,e,this._def)}transform(e){return new e4({...eu(this._def),schema:this,typeName:h.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new e3({...eu(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:h.ZodDefault})}brand(){return new tt({typeName:h.ZodBranded,type:this,...eu(this._def)})}catch(e){return new e8({...eu(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:h.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return tn.create(this,e)}readonly(){return tr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let ed=/^c[^\s-]{8,}
1$/i,eh=/^[0-9a-z]+$/,ef=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ep=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,em=/^[a-z0-9_-]{21}$/i,eg=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ey=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,ev=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,eb=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ex=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,e_=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ew=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ek=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,eS=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,eE="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",eT=RegExp(`^${eE}$`);function eI(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function eC(e){let t=`${eE}T${eI(e)}`,n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,RegExp(`^${t}$`)}class eA extends ec{_parse(e){var t,n,i,a;let s;if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Z.string){let t=this._getOrReturnCtx(e);return Y(t,{code:V.invalid_type,expected:Z.string,received:t.parsedType}),X}let l=new G;for(let u of this._def.checks)if("min"===u.kind)e.data.length<u.value&&(Y(s=this._getOrReturnCtx(e,s),{code:V.too_small,minimum:u.value,type:"string",inclusive:!0,exact:!1,message:u.message}),l.dirty());else if("max"===u.kind)e.data.length>u.value&&(Y(s=this._getOrReturnCtx(e,s),{code:V.too_big,maximum:u.value,type:"string",inclusive:!0,exact:!1,message:u.message}),l.dirty());else if("length"===u.kind){let t=e.data.length>u.value,n=e.data.length<u.value;(t||n)&&(s=this._getOrReturnCtx(e,s),t?Y(s,{code:V.too_big,maximum:u.value,type:"string",inclusive:!0,exact:!0,message:u.message}):n&&Y(s,{code:V.too_small,minimum:u.value,type:"string",inclusive:!0,exact:!0,message:u.message}),l.dirty())}else if("email"===u.kind)ev.test(e.data)||(Y(s=this._getOrReturnCtx(e,s),{validation:"email",code:V.invalid_string,message:u.message}),l.dirty());else if("emoji"===u.kind)r||(r=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),r.test(e.data)||(Y(s=this._getOrReturnCtx(e,s),{validation:"emoji",code:V.invalid_string,message:u.message}),l.dirty());else if("uuid"===u.kind)ep.test(e.data)||(Y(s=this._getOrReturnCtx(e,s),{validation:"uuid",code:V.invalid_string,message:u.message}),l.dirty());else if("nanoid"===u.kind)em.test(e.data)||(Y(s=this._getOrReturnCtx(e,s),{validation:"nanoid",code:V.invalid_string,message:u.message}),l.dirty());else if("cuid"===u.kind)ed.test(e.data)||(Y(s=this._getOrReturnCtx(e,s),{validation:"cuid",code:V.invalid_string,message:u.message}),l.dirty());else if("cuid2"===u.kind)eh.test(e.data)||(Y(s=this._getOrReturnCtx(e,s),{validation:"cuid2",code:V.invalid_string,message:u.message}),l.dirty());else if("ulid"===u.kind)ef.test(e.data)||(Y(s=this._getOrReturnCtx(e,s),{validation:"ulid",code:V.invalid_string,message:u.message}),l.dirty());else if("url"===u.kind)try{new URL(e.data)}catch(t){Y(s=this._getOrReturnCtx(e,s),{validation:"url",code:V.invalid_string,message:u.message}),l.dirty()}else"regex"===u.kind?(u.regex.lastIndex=0,u.regex.test(e.data)||(Y(s=this._getOrReturnCtx(e,s),{validation:"regex",code:V.invalid_string,message:u.message}),l.dirty())):"trim"===u.kind?e.data=e.data.trim():"includes"===u.kind?e.data.includes(u.value,u.position)||(Y(s=this._getOrReturnCtx(e,s),{code:V.invalid_string,validation:{includes:u.value,position:u.position},message:u.message}),l.dirty()):"toLowerCase"===u.kind?e.data=e.data.toLowerCase():"toUpperCase"===u.kind?e.data=e.data.toUpperCase():"startsWith"===u.kind?e.data.startsWith(u.value)||(Y(s=this._getOrReturnCtx(e,s),{code:V.invalid_string,validation:{startsWith:u.value},message:u.message}),l.dirty()):"endsWith"===u.kind?e.data.endsWith(u.value)||(Y(s=this._getOrReturnCtx(e,s),{code:V.invalid_string,validation:{endsWith:u.value},message:u.message}),l.dirty()):"datetime"===u.kind?eC(u).test(e.data)||(Y(s=this._getOrReturnCtx(e,s),{code:V.invalid_string,validation:"datetime",message:u.message}),l.dirty()):"date"===u.kind?eT.test(e.data)||(Y(s=this._getOrReturnCtx(e,s),{code:V.invalid_string,validation:"date",message:u.message}),l.dirty()):"time"===u.kind?RegExp(`^${eI(u)}$`).test(e.data)||(Y(s=this._getOrReturnCtx(e,s),{code:V.invalid_string,validation:"time",message:u.message}),l.dirty()):"duration"===u.kind?ey.test(e.data)||(Y(s=this._getOrReturnCtx(e,s),{validation:"duration",code:V.invalid_string,message:u.message}),l.dirty()):"ip"===u.kind?(t=e.data,!(("v4"===(n=u.version)||!n)&&eb.test(t)||("v6"===n||!n)&&e_.test(t))&&(Y(s=this._getOrReturnCtx(e,s),{validation:"ip",code:V.invalid_string,message:u.message}),l.dirty())):"jwt"===u.kind?!function(e,t){if(!eg.test(e))return!1;
1try{let[n]=e.split("."),r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));if("object"!=typeof i||null===i||!i.typ||!i.alg||t&&i.alg!==t)return!1;return!0}catch(e){return!1}}(e.data,u.alg)&&(Y(s=this._getOrReturnCtx(e,s),{validation:"jwt",code:V.invalid_string,message:u.message}),l.dirty()):"cidr"===u.kind?(i=e.data,!(("v4"===(a=u.version)||!a)&&ex.test(i)||("v6"===a||!a)&&ew.test(i))&&(Y(s=this._getOrReturnCtx(e,s),{validation:"cidr",code:V.invalid_string,message:u.message}),l.dirty())):"base64"===u.kind?ek.test(e.data)||(Y(s=this._getOrReturnCtx(e,s),{validation:"base64",code:V.invalid_string,message:u.message}),l.dirty()):"base64url"===u.kind?eS.test(e.data)||(Y(s=this._getOrReturnCtx(e,s),{validation:"base64url",code:V.invalid_string,message:u.message}),l.dirty()):o.assertNever(u);return{status:l.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:V.invalid_string,...u.errToObj(n)})}_addCheck(e){return new eA({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...u.errToObj(e)})}url(e){return this._addCheck({kind:"url",...u.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...u.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...u.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...u.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...u.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...u.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...u.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...u.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...u.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...u.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...u.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...u.errToObj(e)})}datetime(e){var t,n;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...u.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...u.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...u.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...u.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...u.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...u.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...u.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...u.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...u.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...u.errToObj(t)})}nonempty(e){return this.min(1,u.errToObj(e))}trim(){return new eA({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new eA({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new eA({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}eA.create=e=>{var t;return new eA({checks:[],typeName:h.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...eu(e)})};class eR extends ec{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){let t;if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Z.number){let t=this._getOrReturnCtx(e);return Y(t,{code:V.invalid_type,expected:Z.number,received:t.parsedType}),X}let n=new G;for(let r of this._def.checks)"int"===r.kind?o.isInteger(e.data)||(Y(t=this._getOrReturnCtx(e,t),{code:V.invalid_type,expected:"integer",received:"float",message:r.message}),n.dirty()):"min"===r.kind?(r.inclusive?e.data<r.value:e.data<=r.value)&&(Y(t=this._getOrReturnCtx(e,t),{code:V.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):"max"===r.kind?(r.inclusive?e.data>r.value:e.data>=r.value)&&(Y(t=this._getOrReturnCtx(e,t),{code:V.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):"multipleOf"===r.kind?0!==function(e,t){let n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}(e.data,r.value)&&(Y(t=this._getOrReturnCtx(e,t),{code:V.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(Y(t=this._getOrReturnCtx(e,t),{code:V.not_finite,message:r.message}),n.dirty()):o.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,u.toString(t))}gt(e,t){return this.setLimit("min",e,!1,u.toString(t))}lte(e,t){return this.setLimit("max",e,!0,u.toString(t))}lt(e,t){return this.setLimit("max",e,!1,u.toString(t))}setLimit(e,t,n,r){return new eR({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:u.toString(r)}]})}_addCheck(e){return new eR({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:u.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:u.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:u.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:u.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:u.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:u.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:u.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:u.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:u.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&o.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}eR.create=e=>new eR({checks:[],typeName:h.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...eu(e)});class eP extends ec{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){let t;if(this._def.coerce)try{e.data=BigInt(e.data)}catch(t){return this._getInvalidInput(e)}if(this._getType(e)!==Z.bigint)return this._getInvalidInput(e);let n=new G;for(let r of this._def.checks)"min"===r.kind?(r.inclusive?e.data<r.value:e.data<=r.value)&&(Y(t=this._getOrReturnCtx(e,t),{code:V.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):"max"===r.kind?(r.inclusive?e.data>r.value:e.data>=r.value)&&(Y(t=this._getOrReturnCtx(e,t),{code:V.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):"multipleOf"===r.kind?e.data%r.value!==BigInt(0)&&(Y(t=this._getOrReturnCtx(e,t),{code:V.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):o.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return Y(t,{code:V.invalid_type,expected:Z.bigint,received:t.parsedType}),X}gte(e,t){return this.setLimit("min",e,!0,u.toString(t))}gt(e,t){return this.setLimit("min",e,!1,u.toString(t))}lte(e,t){return this.setLimit("max",e,!0,u.toString(t))}lt(e,t){return this.setLimit("max",e,!1,u.toString(t))}setLimit(e,t,n,r){return new eP({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:u.toString(r)}]})}_addCheck(e){return new eP({...this._def,checks:[...this._def.checks,e]})}
1positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:u.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:u.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:u.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:u.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:u.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}eP.create=e=>{var t;return new eP({checks:[],typeName:h.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...eu(e)})};class eO extends ec{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Z.boolean){let t=this._getOrReturnCtx(e);return Y(t,{code:V.invalid_type,expected:Z.boolean,received:t.parsedType}),X}return ee(e.data)}}eO.create=e=>new eO({typeName:h.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...eu(e)});class eM extends ec{_parse(e){let t;if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Z.date){let t=this._getOrReturnCtx(e);return Y(t,{code:V.invalid_type,expected:Z.date,received:t.parsedType}),X}if(isNaN(e.data.getTime()))return Y(this._getOrReturnCtx(e),{code:V.invalid_date}),X;let n=new G;for(let r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(Y(t=this._getOrReturnCtx(e,t),{code:V.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),n.dirty()):"max"===r.kind?e.data.getTime()>r.value&&(Y(t=this._getOrReturnCtx(e,t),{code:V.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),n.dirty()):o.assertNever(r);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new eM({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:u.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:u.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}eM.create=e=>new eM({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:h.ZodDate,...eu(e)});class eN extends ec{_parse(e){if(this._getType(e)!==Z.symbol){let t=this._getOrReturnCtx(e);return Y(t,{code:V.invalid_type,expected:Z.symbol,received:t.parsedType}),X}return ee(e.data)}}eN.create=e=>new eN({typeName:h.ZodSymbol,...eu(e)});class ej extends ec{_parse(e){if(this._getType(e)!==Z.undefined){let t=this._getOrReturnCtx(e);return Y(t,{code:V.invalid_type,expected:Z.undefined,received:t.parsedType}),X}return ee(e.data)}}ej.create=e=>new ej({typeName:h.ZodUndefined,...eu(e)});class eD extends ec{_parse(e){if(this._getType(e)!==Z.null){let t=this._getOrReturnCtx(e);return Y(t,{code:V.invalid_type,expected:Z.null,received:t.parsedType}),X}return ee(e.data)}}eD.create=e=>new eD({typeName:h.ZodNull,...eu(e)});class eL extends ec{constructor(){super(...arguments),this._any=!0}_parse(e){return ee(e.data)}}eL.create=e=>new eL({typeName:h.ZodAny,...eu(e)});class eB extends ec{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ee(e.data)}}eB.create=e=>new eB({typeName:h.ZodUnknown,...eu(e)});class eF extends ec{_parse(e){let t=this._getOrReturnCtx(e);return Y(t,{code:V.invalid_type,expected:Z.never,received:t.parsedType}),X}}eF.create=e=>new eF({typeName:h.ZodNever,...eu(e)});class ez extends ec{_parse(e){if(this._getType(e)!==Z.undefined){let t=this._getOrReturnCtx(e);return Y(t,{code:V.invalid_type,expected:Z.void,received:t.parsedType}),X}return ee(e.data)}}ez.create=e=>new ez({typeName:h.ZodVoid,...eu(e)});class eU extends ec{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==Z.array)return Y(t,{code:V.invalid_type,expected:Z.array,received:t.parsedType}),X;if(null!==r.exactLength){let e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(Y(t,{code:e?V.too_big:V.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(null!==r.minLength&&t.data.length<r.minLength.value&&(Y(t,{code:V.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),null!==r.maxLength&&t.data.length>r.maxLength.value&&(Y(t,{code:V.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new eo(t,e,t.path,n)))).then(e=>G.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new eo(t,e,t.path,n)));return G.mergeArray(n,i)}
1get element(){return this._def.type}min(e,t){return new eU({...this._def,minLength:{value:e,message:u.toString(t)}})}max(e,t){return new eU({...this._def,maxLength:{value:e,message:u.toString(t)}})}length(e,t){return new eU({...this._def,exactLength:{value:e,message:u.toString(t)}})}nonempty(e){return this.min(1,e)}}eU.create=(e,t)=>new eU({type:e,minLength:null,maxLength:null,exactLength:null,typeName:h.ZodArray,...eu(t)});class eZ extends ec{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;let e=this._def.shape(),t=o.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==Z.object){let t=this._getOrReturnCtx(e);return Y(t,{code:V.invalid_type,expected:Z.object,received:t.parsedType}),X}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof eF&&"strip"===this._def.unknownKeys))for(let e in n.data)i.includes(e)||a.push(e);let s=[];for(let e of i){let t=r[e],i=n.data[e];s.push({key:{status:"valid",value:e},value:t._parse(new eo(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof eF){let e=this._def.unknownKeys;if("passthrough"===e)for(let e of a)s.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)a.length>0&&(Y(n,{code:V.unrecognized_keys,keys:a}),t.dirty());else if("strip"===e);else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];s.push({key:{status:"valid",value:t},value:e._parse(new eo(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of s){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>G.mergeObjectSync(t,e)):G.mergeObjectSync(t,s)}get shape(){return this._def.shape()}strict(e){return u.errToObj,new eZ({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var r,i,a,s;let o=null!==(a=null===(i=(r=this._def).errorMap)||void 0===i?void 0:i.call(r,t,n).message)&&void 0!==a?a:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(s=u.errToObj(e).message)&&void 0!==s?s:o}:{message:o}}}:{}})}strip(){return new eZ({...this._def,unknownKeys:"strip"})}passthrough(){return new eZ({...this._def,unknownKeys:"passthrough"})}extend(e){return new eZ({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new eZ({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:h.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new eZ({...this._def,catchall:e})}pick(e){let t={};return o.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new eZ({...this._def,shape:()=>t})}omit(e){let t={};return o.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new eZ({...this._def,shape:()=>t})}deepPartial(){return function e(t){if(t instanceof eZ){let n={};for(let r in t.shape){let i=t.shape[r];n[r]=e9.create(e(i))}return new eZ({...t._def,shape:()=>n})}if(t instanceof eU)return new eU({...t._def,type:e(t.element)});if(t instanceof e9)return e9.create(e(t.unwrap()));if(t instanceof e6)return e6.create(e(t.unwrap()));if(t instanceof eW)return eW.create(t.items.map(t=>e(t)));else return t}(this)}partial(e){let t={};return o.objectKeys(this.shape).forEach(n=>{let r=this.shape[n];e&&!e[n]?t[n]=r:t[n]=r.optional()}),new eZ({...this._def,shape:()=>t})}required(e){let t={};return o.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof e9;)e=e._def.innerType;t[n]=e}}),new eZ({...this._def,shape:()=>t})}keyof(){return e0(o.objectKeys(this.shape))}}eZ.create=(e,t)=>new eZ({shape:()=>e,unknownKeys:"strip",catchall:eF.create(),typeName:h.ZodObject,...eu(t)}),eZ.strictCreate=(e,t)=>new eZ({shape:()=>e,unknownKeys:"strict",catchall:eF.create(),typeName:h.ZodObject,...eu(t)}),eZ.lazycreate=(e,t)=>
1new eZ({shape:e,unknownKeys:"strip",catchall:eF.create(),typeName:h.ZodObject,...eu(t)});class eH extends ec{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(function(e){for(let t of e)if("valid"===t.result.status)return t.result;for(let n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new $(e.ctx.common.issues));return Y(t,{code:V.invalid_union,unionErrors:n}),X});{let e;let r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if("valid"===a.status)return a;"dirty"!==a.status||e||(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new $(e));return Y(t,{code:V.invalid_union,unionErrors:i}),X}}get options(){return this._def.options}}eH.create=(e,t)=>new eH({options:e,typeName:h.ZodUnion,...eu(t)});let eV=e=>{if(e instanceof eX)return eV(e.schema);if(e instanceof e4)return eV(e.innerType());if(e instanceof eQ)return[e.value];if(e instanceof e1)return e.options;if(e instanceof e2)return o.objectValues(e.enum);else if(e instanceof e3)return eV(e._def.innerType);else if(e instanceof ej)return[void 0];else if(e instanceof eD)return[null];else if(e instanceof e9)return[void 0,...eV(e.unwrap())];else if(e instanceof e6)return[null,...eV(e.unwrap())];else if(e instanceof tt)return eV(e.unwrap());else if(e instanceof tr)return eV(e.unwrap());else if(e instanceof e8)return eV(e._def.innerType);else return[]};class e$ extends ec{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Z.object)return Y(t,{code:V.invalid_type,expected:Z.object,received:t.parsedType}),X;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(Y(t,{code:V.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),X)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let r=new Map;for(let n of t){let t=eV(n.shape[e]);if(!t.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of t){if(r.has(i))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);r.set(i,n)}}return new e$({typeName:h.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...eu(n)})}}class eq extends ec{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(et(e)||et(r))return X;let i=function e(t,n){let r=H(t),i=H(n);if(t===n)return{valid:!0,data:t};if(r===Z.object&&i===Z.object){let r=o.objectKeys(n),i=o.objectKeys(t).filter(e=>-1!==r.indexOf(e)),a={...t,...n};for(let r of i){let i=e(t[r],n[r]);if(!i.valid)return{valid:!1};a[r]=i.data}return{valid:!0,data:a}}if(r===Z.array&&i===Z.array){if(t.length!==n.length)return{valid:!1};let r=[];for(let i=0;i<t.length;i++){let a=e(t[i],n[i]);if(!a.valid)return{valid:!1};r.push(a.data)}return{valid:!0,data:r}}if(r===Z.date&&i===Z.date&&+t==+n)return{valid:!0,data:t};return{valid:!1}}(e.value,r.value);return i.valid?((en(e)||en(r))&&t.dirty(),{status:t.value,value:i.data}):(Y(n,{code:V.invalid_intersection_types}),X)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}eq.create=(e,t,n)=>new eq({left:e,right:t,typeName:h.ZodIntersection,...eu(n)});class eW extends ec{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Z.array)return Y(n,{code:V.invalid_type,expected:Z.array,received:n.parsedType}),X;if(n.data.length<this._def.items.length)return Y(n,{code:V.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),X;!this._def.rest&&n.data.length>this._def.items.length&&(Y(n,{code:V.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new eo(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>G.mergeArray(t,e)):G.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new eW({...this._def,rest:e})}}eW.create=(e,t)=>
1{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new eW({items:e,typeName:h.ZodTuple,rest:null,...eu(t)})};class eK extends ec{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Z.object)return Y(n,{code:V.invalid_type,expected:Z.object,received:n.parsedType}),X;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new eo(n,e,n.path,e)),value:a._parse(new eo(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?G.mergeObjectAsync(t,r):G.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){return new eK(t instanceof ec?{keyType:e,valueType:t,typeName:h.ZodRecord,...eu(n)}:{keyType:eA.create(),valueType:e,typeName:h.ZodRecord,...eu(t)})}}class eJ extends ec{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Z.map)return Y(n,{code:V.invalid_type,expected:Z.map,received:n.parsedType}),X;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new eo(n,e,n.path,[a,"key"])),value:i._parse(new eo(n,t,n.path,[a,"value"]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if("aborted"===r.status||"aborted"===i.status)return X;("dirty"===r.status||"dirty"===i.status)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}{let e=new Map;for(let n of a){let r=n.key,i=n.value;if("aborted"===r.status||"aborted"===i.status)return X;("dirty"===r.status||"dirty"===i.status)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}}eJ.create=(e,t,n)=>new eJ({valueType:t,keyType:e,typeName:h.ZodMap,...eu(n)});class eY extends ec{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Z.set)return Y(n,{code:V.invalid_type,expected:Z.set,received:n.parsedType}),X;let r=this._def;null!==r.minSize&&n.data.size<r.minSize.value&&(Y(n,{code:V.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),null!==r.maxSize&&n.data.size>r.maxSize.value&&(Y(n,{code:V.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let n=new Set;for(let r of e){if("aborted"===r.status)return X;"dirty"===r.status&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let s=[...n.data.values()].map((e,t)=>i._parse(new eo(n,e,n.path,t)));return n.common.async?Promise.all(s).then(e=>a(e)):a(s)}min(e,t){return new eY({...this._def,minSize:{value:e,message:u.toString(t)}})}max(e,t){return new eY({...this._def,maxSize:{value:e,message:u.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}eY.create=(e,t)=>new eY({valueType:e,minSize:null,maxSize:null,typeName:h.ZodSet,...eu(t)});class eG extends ec{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Z.function)return Y(t,{code:V.invalid_type,expected:Z.function,received:t.parsedType}),X;function n(e,n){return J({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,K(),q].filter(e=>!!e),issueData:{code:V.invalid_arguments,argumentsError:n}})}function r(e,n){return J({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,K(),q].filter(e=>!!e),issueData:{code:V.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof e5){let e=this;return ee(async function(...t){let s=new $([]),o=await e._def.args.parseAsync(t,i).catch(e=>{throw s.addIssue(n(t,e)),s}),l=await Reflect.apply(a,this,o);return await e._def.returns._def.type.parseAsync(l,i).catch(e=>{throw s.addIssue(r(l,e)),s})})}{let e=this;return ee(function(...t){let s=e._def.args.safeParse(t,i);if(!s.success)throw new $([n(t,s.error)]);let o=Reflect.apply(a,this,s.data),l=e._def.returns.safeParse(o,i);if(!l.success)throw new $([r(o,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new eG({...this._def,args:eW.create(e).rest(eB.create())})}returns(e){return new eG({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new eG({args:e||eW.create([]).rest(eB.create()),returns:t||eB.create(),typeName:h.ZodFunction,...eu(n)})}}class eX extends ec{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}eX.create=(e,t)=>
1new eX({getter:e,typeName:h.ZodLazy,...eu(t)});class eQ extends ec{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return Y(t,{received:t.data,code:V.invalid_literal,expected:this._def.value}),X}return{status:"valid",value:e.data}}get value(){return this._def.value}}function e0(e,t){return new e1({values:e,typeName:h.ZodEnum,...eu(t)})}eQ.create=(e,t)=>new eQ({value:e,typeName:h.ZodLiteral,...eu(t)});class e1 extends ec{constructor(){super(...arguments),c.set(this,void 0)}_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),n=this._def.values;return Y(t,{expected:o.joinValues(n),received:t.parsedType,code:V.invalid_type}),X}if(ea(this,c,"f")||es(this,c,new Set(this._def.values),"f"),!ea(this,c,"f").has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return Y(t,{received:t.data,code:V.invalid_enum_value,options:n}),X}return ee(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return e1.create(e,{...this._def,...t})}exclude(e,t=this._def){return e1.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}c=new WeakMap,e1.create=e0;class e2 extends ec{constructor(){super(...arguments),d.set(this,void 0)}_parse(e){let t=o.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Z.string&&n.parsedType!==Z.number){let e=o.objectValues(t);return Y(n,{expected:o.joinValues(e),received:n.parsedType,code:V.invalid_type}),X}if(ea(this,d,"f")||es(this,d,new Set(o.getValidEnumValues(this._def.values)),"f"),!ea(this,d,"f").has(e.data)){let e=o.objectValues(t);return Y(n,{received:n.data,code:V.invalid_enum_value,options:e}),X}return ee(e.data)}get enum(){return this._def.values}}d=new WeakMap,e2.create=(e,t)=>new e2({values:e,typeName:h.ZodNativeEnum,...eu(t)});class e5 extends ec{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==Z.promise&&!1===t.common.async?(Y(t,{code:V.invalid_type,expected:Z.promise,received:t.parsedType}),X):ee((t.parsedType===Z.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}e5.create=(e,t)=>new e5({type:e,typeName:h.ZodPromise,...eu(t)});class e4 extends ec{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===h.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{Y(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===r.type){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return X;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===r.status?X:"dirty"===r.status||"dirty"===t.value?Q(r.value):r});{if("aborted"===t.value)return X;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===r.status?X:"dirty"===r.status||"dirty"===t.value?Q(r.value):r}}if("refinement"===r.type){let e=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1!==n.common.async)return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>"aborted"===n.status?X:("dirty"===n.status&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))));{let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===r.status?X:("dirty"===r.status&&t.dirty(),e(r.value),{status:t.value,value:r.value})}}if("transform"===r.type){if(!1!==n.common.async)return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>er(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):e);{let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!er(e))return e;let a=r.transform(e.value,i);if(a instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}}o.assertNever(r)}}
1e4.create=(e,t,n)=>new e4({schema:e,typeName:h.ZodEffects,effect:t,...eu(n)}),e4.createWithPreprocess=(e,t,n)=>new e4({schema:t,effect:{type:"preprocess",transform:e},typeName:h.ZodEffects,...eu(n)});class e9 extends ec{_parse(e){return this._getType(e)===Z.undefined?ee(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}e9.create=(e,t)=>new e9({innerType:e,typeName:h.ZodOptional,...eu(t)});class e6 extends ec{_parse(e){return this._getType(e)===Z.null?ee(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}e6.create=(e,t)=>new e6({innerType:e,typeName:h.ZodNullable,...eu(t)});class e3 extends ec{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===Z.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}e3.create=(e,t)=>new e3({innerType:e,typeName:h.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...eu(t)});class e8 extends ec{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ei(r)?r.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new $(n.common.issues)},input:n.data})})):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new $(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}e8.create=(e,t)=>new e8({innerType:e,typeName:h.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...eu(t)});class e7 extends ec{_parse(e){if(this._getType(e)!==Z.nan){let t=this._getOrReturnCtx(e);return Y(t,{code:V.invalid_type,expected:Z.nan,received:t.parsedType}),X}return{status:"valid",value:e.data}}}e7.create=e=>new e7({typeName:h.ZodNaN,...eu(e)});let te=Symbol("zod_brand");class tt extends ec{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class tn extends ec{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?X:"dirty"===e.status?(t.dirty(),Q(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?X:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new tn({in:e,out:t,typeName:h.ZodPipeline})}}class tr extends ec{_parse(e){let t=this._def.innerType._parse(e),n=e=>(er(e)&&(e.value=Object.freeze(e.value)),e);return ei(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}}function ti(e,t){let n="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof n?{message:n}:n}function ta(e,t={},n){return e?eL.create().superRefine((r,i)=>{var a,s;let o=e(r);if(o instanceof Promise)return o.then(e=>{var a,s;if(!e){let e=ti(t,r),o=null===(s=null!==(a=e.fatal)&&void 0!==a?a:n)||void 0===s||s;i.addIssue({code:"custom",...e,fatal:o})}});if(!o){let e=ti(t,r),o=null===(s=null!==(a=e.fatal)&&void 0!==a?a:n)||void 0===s||s;i.addIssue({code:"custom",...e,fatal:o})}}):eL.create()}tr.create=(e,t)=>new tr({innerType:e,typeName:h.ZodReadonly,...eu(t)});let ts={object:eZ.lazycreate};!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(h||(h={}));let to=eA.create,tl=eR.create,tu=e7.create,tc=eP.create,td=eO.create,th=eM.
1create,tf=eN.create,tp=ej.create,tm=eD.create,tg=eL.create,ty=eB.create,tv=eF.create,tb=ez.create,tx=eU.create,t_=eZ.create,tw=eZ.strictCreate,tk=eH.create,tS=e$.create,tE=eq.create,tT=eW.create,tI=eK.create,tC=eJ.create,tA=eY.create,tR=eG.create,tP=eX.create,tO=eQ.create,tM=e1.create,tN=e2.create,tj=e5.create,tD=e4.create,tL=e9.create,tB=e6.create,tF=e4.createWithPreprocess,tz=tn.create;var tU=Object.freeze({__proto__:null,defaultErrorMap:q,setErrorMap:function(e){W=e},getErrorMap:K,makeIssue:J,EMPTY_PATH:[],addIssueToContext:Y,ParseStatus:G,INVALID:X,DIRTY:Q,OK:ee,isAborted:et,isDirty:en,isValid:er,isAsync:ei,get util(){return o},get objectUtil(){return l},ZodParsedType:Z,getParsedType:H,ZodType:ec,datetimeRegex:eC,ZodString:eA,ZodNumber:eR,ZodBigInt:eP,ZodBoolean:eO,ZodDate:eM,ZodSymbol:eN,ZodUndefined:ej,ZodNull:eD,ZodAny:eL,ZodUnknown:eB,ZodNever:eF,ZodVoid:ez,ZodArray:eU,ZodObject:eZ,ZodUnion:eH,ZodDiscriminatedUnion:e$,ZodIntersection:eq,ZodTuple:eW,ZodRecord:eK,ZodMap:eJ,ZodSet:eY,ZodFunction:eG,ZodLazy:eX,ZodLiteral:eQ,ZodEnum:e1,ZodNativeEnum:e2,ZodPromise:e5,ZodEffects:e4,ZodTransformer:e4,ZodOptional:e9,ZodNullable:e6,ZodDefault:e3,ZodCatch:e8,ZodNaN:e7,BRAND:te,ZodBranded:tt,ZodPipeline:tn,ZodReadonly:tr,custom:ta,Schema:ec,ZodSchema:ec,late:ts,get ZodFirstPartyTypeKind(){return h},coerce:{string:e=>eA.create({...e,coerce:!0}),number:e=>eR.create({...e,coerce:!0}),boolean:e=>eO.create({...e,coerce:!0}),bigint:e=>eP.create({...e,coerce:!0}),date:e=>eM.create({...e,coerce:!0})},any:tg,array:tx,bigint:tc,boolean:td,date:th,discriminatedUnion:tS,effect:tD,enum:tM,function:tR,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>ta(t=>t instanceof e,t),intersection:tE,lazy:tP,literal:tO,map:tC,nan:tu,nativeEnum:tN,never:tv,null:tm,nullable:tB,number:tl,object:t_,oboolean:()=>td().optional(),onumber:()=>tl().optional(),optional:tL,ostring:()=>to().optional(),pipeline:tz,preprocess:tF,promise:tj,record:tI,set:tA,strictObject:tw,string:to,symbol:tf,transformer:tD,tuple:tT,undefined:tp,union:tk,unknown:ty,void:tb,NEVER:X,ZodIssueCode:V,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:$});tU.object({maxTokens:tU.number().int().positive().optional(),temperature:tU.number().optional(),topP:tU.number().optional(),presencePenalty:tU.number().optional(),frequencyPenalty:tU.number().optional(),seed:tU.number().int().optional(),headers:tU.record(tU.string().optional()).optional()}),tU.object({apiKey:tU.string().optional(),baseUrl:tU.string().optional(),modelName:tU.string().optional()});var tZ=e=>Array.from(e).map(e=>e.getModelContext()).sort((e,t)=>(t.priority??0)-(e.priority??0)).reduce((e,t)=>{if(t.system&&(e.system?e.system+=`
2
3${t.system}`:e.system=t.system),t.tools)for(let[n,r]of Object.entries(t.tools)){let t=e.tools?.[n];if(t&&t!==r)throw Error(`You tried to define a tool with the name ${n}, but it already exists.`);e.tools||(e.tools={}),e.tools[n]=r}return t.config&&(e.config={...e.config,...t.config}),t.callSettings&&(e.callSettings={...e.callSettings,...t.callSettings}),e},{}),tH=class{_providers=new Set;getModelContext(){return tZ(this._providers)}registerModelContextProvider(e){this._providers.add(e);let t=e.subscribe?.(()=>{this.notifySubscribers()});return this.notifySubscribers(),()=>{this._providers.delete(e),t?.(),this.notifySubscribers()}}_subscribers=new Set;notifySubscribers(){for(let e of this._subscribers)e()}subscribe(e){return this._subscribers.add(e),()=>this._subscribers.delete(e)}},tV=class{_contextProvider=new tH;registerModelContextProvider(e){return this._contextProvider.registerModelContextProvider(e)}},t$=j("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7),tq=()=>`__optimistic__${t$()}`,tW=(e,{id:t=t$(),status:n={type:"complete",reason:"unknown"},attachments:r=[]}={})=>{let i={id:t,createdAt:new Date},a=e.role;switch(a){case"assistant":return{...i,role:a,content:e.content.map(e=>"tool-call"===e.type?{...e,argsText:JSON.stringify(e.args)}:e),status:n,metadata:{unstable_annotations:[],unstable_data:[],steps:[],custom:{}}};case"user":return{...i,role:a,content:e.content,attachments:r,metadata:{custom:{}}};case"system":return{...i,role:a,content:e.content,metadata:{custom:{}}};default:throw Error(`Unknown message role: ${a}`)}},tK=(e,t)=>void 0===t?e.status?.type==="requires-action"&&"tool-calls"===e.status.reason&&e.content.every(e=>"tool-call"!==e.type||!!e.result):e.status?.type==="requires-action"&&"tool-calls"===e.status.reason&&e.content.every(e=>"tool-call"!==e.type||!!e.result||!t.includes(e.toolName)),tJ=Object.freeze({type:"running"}),tY=Object.freeze({type:"complete",reason:"unknown"}),tG=(e,t)=>e&&t?tJ:tY,tX=n(40926),tQ=Symbol("partial-json-count"),t0=e=>{try{return tX.parse(e)}catch{try{let[t,n]=function(e){let t=["ROOT"],n=-1,r=null;function i(e,i,a){switch(e){case'"':n=i,t.pop(),t.push(a),t.push("INSIDE_STRING");break;case"f":case"t":case"n":n=i,r=i,t.pop(),t.push(a),t.push("INSIDE_LITERAL");break;case"-":t.pop(),t.push(a),t.push("INSIDE_NUMBER");break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n=i,t.pop(),t.push(a),t.push("INSIDE_NUMBER");break;case"{":n=i,t.pop(),t.push(a),t.push("INSIDE_OBJECT_START");break;case"[":n=i,t.pop(),t.push(a),t.push("INSIDE_ARRAY_START")}}function a(e,r){switch(e){case",":t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break;case"}":n=r,t.pop()}}function s(e,r){switch(e){case",":t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break;case"]":n=r,t.pop()}}for(let o=0;o<e.length;o++){let l=e[o];switch(t[t.length-1]){case"ROOT":i(l,o,"FINISH");break;case"INSIDE_OBJECT_START":switch(l){case'"':t.pop(),t.push("INSIDE_OBJECT_KEY");break;case"}":n=o,t.pop()}break;case"INSIDE_OBJECT_AFTER_COMMA":'"'===l&&(t.pop(),t.push("INSIDE_OBJECT_KEY"));break;case"INSIDE_OBJECT_KEY":'"'===l&&(t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY"));break;case"INSIDE_OBJECT_AFTER_KEY":":"===l&&(t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE"));break;case"INSIDE_OBJECT_BEFORE_VALUE":i(l,o,"INSIDE_OBJECT_AFTER_VALUE");break;case"INSIDE_OBJECT_AFTER_VALUE":a(l,o);break;case"INSIDE_STRING":switch(l){case'"':t.pop(),n=o;break;case"\\":t.push("INSIDE_STRING_ESCAPE");break;default:n=o}break;case"INSIDE_ARRAY_START":"]"===l?(n=o,t.pop()):(n=o,i(l,o,"INSIDE_ARRAY_AFTER_VALUE"));break;case"INSIDE_ARRAY_AFTER_VALUE":switch(l){case",":t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break;case"]":n=o,t.pop();break;default:n=o}break;case"INSIDE_ARRAY_AFTER_COMMA":i(l,o,"INSIDE_ARRAY_AFTER_VALUE");break;case"INSIDE_STRING_ESCAPE":t.pop(),n=o;break;case"INSIDE_NUMBER":switch(l){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n=o;break;case"e":case"E":case"-":case".":break;case",":t.pop(),"INSIDE_ARRAY_AFTER_VALUE"===t[t.length-1]&&s(l,o),"INSIDE_OBJECT_AFTER_VALUE"===t[t.length-1]&&a(l,o);break;case"}":t.pop(),"INSIDE_OBJECT_AFTER_VALUE"===t[t.length-1]&&a(l,o);break;case"]":t.pop(),"INSIDE_ARRAY_AFTER_VALUE"===t[t.length-1]&&s(l,o);break;default:t.pop()}break;case"INSIDE_LITERAL":{let i=e.substring(r,o+1);"false".startsWith(i)||"true".startsWith(i)||"null".startsWith(i)?n=o:(t.pop(),"INSIDE_OBJECT_AFTER_VALUE"===t[t.length-1]?a(l,o):"INSIDE_ARRAY_AFTER_VALUE"===t[t.length-1]&&s(l,o))}}}let o=e.slice(0,n+1),l=0;for(let n=t.length-1;n>=0;n--)switch(t[n]){case"INSIDE_STRING":o+='"',l++;break;case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":o+="}",l++;break;case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":o+="]",l++;break;case"INSIDE_LITERAL":{let t=e.substring(r,e.length);"true".startsWith(t)?o+="true".slice(t.length):"false".startsWith(t)?o+="false".slice(t.length):"null".startsWith(t)&&(o+="null".slice(t.length))}}return[o,l]}(e),r=tX.parse(t);return r[tQ]=n,r}catch{return}}},t1=Object.freeze({type:"complete"}),t2=(e,t,n,r)=>{if(0===n.length)return e;if("object"!=typeof t||null===t)return t1;let i=n.at(-1);if(!Object.prototype.hasOwnProperty.call(t,i))return e;let a=Object.keys(t);return a[a.length-1]!==i?t1:t2(e,t[i],n.slice(0,-1),r-1)},t5=(e,t,n)=>{let{role:r,id:i,createdAt:a,attachments:s,status:o,metadata:l}=e,u={id:i??t,createdAt:a??new Date},c="string"==typeof e.content?[{type:"text",text:e.content}]:e.content;if("user"!==r&&s)throw Error("attachments are only supported for user messages");if("assistant"!==r&&o)throw Error("status is only supported for assistant messages");if("assistant"!==r&&l?.steps)throw Error("metadata.steps is only supported for assistant messages");switch(r){case"assistant":return{...u,role:r,content:c.map(e=>{let t=e.type;switch(t){case"text":case"reasoning":if(0===e.text.trim().length)return null;return e;case"source":return e;case"tool-call":if(e.args)return{...e,toolCallId:e.toolCallId??"tool-"+t$(),args:e.args,argsText:JSON.stringify(e.args)};return{...e,toolCallId:e.toolCallId??"tool-"+t$(),args:e.args??t0(e.argsText??"{}"),argsText:e.argsText??""};default:throw Error(`Unsupported assistant content part type: ${t}`)}}).filter(e=>!!e),status:o??n,metadata:{unstable_annotations:l?.unstable_annotations??[],unstable_data:l?.unstable_data??[],custom:l?.custom??{},steps:l?.steps??[]}};case"user":return{...u,role:r,content:c.map(e=>{let t=e.type;switch(t){case"text":case"image":case"audio":case"file":return e;default:throw Error(`Unsupported user content part type: ${t}`)}}),attachments:s??[],metadata:{custom:l?.custom??{}}};case"system":if(1!==c.length||"text"!==c[0].type)throw Error("System messages must have exactly one text content part.");return{...u,role:r,content:c,metadata:{custom:l?.custom??{}}};default:throw Error(`Unknown message role: ${r}`)}},t4={fromArray:e=>{let t=e.map(e=>t5(e,t$(),tG(!1,!1)));return{messages:t.map((e,n)=>({parentId:n>0?t[n-1].id:null,message:e}))}}},t9=e=>e.next?t9(e.next):"current"in e?e:null,t6=class{constructor(e){this.func=e}_value=null;get value(){return null===this._value&&(this._value=this.func()),this._value}dirty(){this._value=null}},t3=class{messages=new Map;head=null;root={children:[],next:null};performOp(e,t,n){let r=t.prev??this.root,i=e??this.root;
3if("relink"!==n||r!==i){if("link"!==n&&(r.children=r.children.filter(e=>e!==t.current.id),r.next===t)){let e=r.children.at(-1),t=e?this.messages.get(e):null;if(void 0===t)throw Error("MessageRepository(performOp/cut): Fallback sibling message not found. This is likely an internal bug in assistant-ui.");r.next=t}if("cut"!==n){for(let n=e;n;n=n.prev)if(n.current.id===t.current.id)throw Error("MessageRepository(performOp/link): A message with the same id already exists in the parent tree. This error occurs if the same message id is found multiple times. This is likely an internal bug in assistant-ui.");i.children=[...i.children,t.current.id],(t9(t)===this.head||null===i.next)&&(i.next=t),t.prev=e}}}_messages=new t6(()=>{let e=Array(this.head?.level??0);for(let t=this.head;t;t=t.prev)e[t.level]=t.current;return e});getMessages(){return this._messages.value}addOrUpdateMessage(e,t){let n=this.messages.get(t.id),r=e?this.messages.get(e):null;if(void 0===r)throw Error("MessageRepository(addOrUpdateMessage): Parent message not found. This is likely an internal bug in assistant-ui.");if(n){n.current=t,this.performOp(r,n,"relink"),this._messages.dirty();return}let i={prev:r,current:t,next:null,children:[],level:r?r.level+1:0};this.messages.set(t.id,i),this.performOp(r,i,"link"),this.head===r&&(this.head=i),this._messages.dirty()}getMessage(e){let t=this.messages.get(e);if(!t)throw Error("MessageRepository(updateMessage): Message not found. This is likely an internal bug in assistant-ui.");return{parentId:t.prev?.current.id??null,message:t.current}}appendOptimisticMessage(e,t){let n;do n=tq();while(this.messages.has(n));return this.addOrUpdateMessage(e,tW(t,{id:n,status:{type:"running"}})),n}deleteMessage(e,t){let n=this.messages.get(e);if(!n)throw Error("MessageRepository(deleteMessage): Optimistic message not found. This is likely an internal bug in assistant-ui.");let r=void 0===t?n.prev:null===t?null:this.messages.get(t);if(void 0===r)throw Error("MessageRepository(deleteMessage): Replacement not found. This is likely an internal bug in assistant-ui.");for(let e of n.children){let t=this.messages.get(e);if(!t)throw Error("MessageRepository(deleteMessage): Child message not found. This is likely an internal bug in assistant-ui.");this.performOp(r,t,"relink")}this.performOp(null,n,"cut"),this.messages.delete(e),this.head===n&&(this.head=t9(r??this.root)),this._messages.dirty()}getBranches(e){let t=this.messages.get(e);if(!t)throw Error("MessageRepository(getBranches): Message not found. This is likely an internal bug in assistant-ui.");let{children:n}=t.prev??this.root;return n}switchToBranch(e){let t=this.messages.get(e);if(!t)throw Error("MessageRepository(switchToBranch): Branch not found. This is likely an internal bug in assistant-ui.");
3(t.prev??this.root).next=t,this.head=t9(t),this._messages.dirty()}resetHead(e){if(null===e){this.head=null,this._messages.dirty();return}let t=this.messages.get(e);if(!t)throw Error("MessageRepository(resetHead): Branch not found. This is likely an internal bug in assistant-ui.");this.head=t;for(let e=t;e;e=e.prev)e.prev&&(e.prev.next=e);this._messages.dirty()}clear(){this.messages.clear(),this.head=null,this.root={children:[],next:null},this._messages.dirty()}export(){let e=[];for(let[,t]of this.messages)e.push({message:t.current,parentId:t.prev?.current.id??null});return{headId:this.head?.current.id??null,messages:e}}import({headId:e,messages:t}){for(let{message:e,parentId:n}of t)this.addOrUpdateMessage(n,e);this.resetHead(e??t.at(-1)?.message.id??null)}},t8=class{_subscribers=new Set;subscribe(e){return this._subscribers.add(e),()=>this._subscribers.delete(e)}waitForUpdate(){return new Promise(e=>{let t=this.subscribe(()=>{t(),e()})})}_notifySubscribers(){let e=[];for(let t of this._subscribers)try{t()}catch(t){e.push(t)}if(e.length>0){if(1===e.length)throw e[0];throw AggregateError(e)}}},t7=e=>"complete"===e.status.type,ne=class extends t8{isEditing=!0;getAttachmentAccept(){return this.getAttachmentAdapter()?.accept??"*"}_attachments=[];get attachments(){return this._attachments}setAttachments(e){this._attachments=e,this._notifySubscribers()}get isEmpty(){return!this.text.trim()&&!this.attachments.length}_text="";get text(){return this._text}_role="user";get role(){return this._role}_runConfig={};get runConfig(){return this._runConfig}setText(e){this._text!==e&&(this._text=e,this._notifySubscribers())}setRole(e){this._role!==e&&(this._role=e,this._notifySubscribers())}setRunConfig(e){this._runConfig!==e&&(this._runConfig=e,this._notifySubscribers())}_emptyTextAndAttachments(){this._attachments=[],this._text="",this._notifySubscribers()}async _onClearAttachments(){let e=this.getAttachmentAdapter();e&&await Promise.all(this._attachments.map(t=>e.remove(t)))}async reset(){if(0===this._attachments.length&&""===this._text&&"user"===this._role&&0===Object.keys(this._runConfig).length)return;this._role="user",this._runConfig={};let e=this._onClearAttachments();this._emptyTextAndAttachments(),await e}async clearAttachments(){let e=this._onClearAttachments();this.setAttachments([]),await e}async send(){let e=this.getAttachmentAdapter(),t=e&&this.attachments.length>0?await Promise.all(this.attachments.map(async t=>t7(t)?t:await e.send(t))):[],n={role:this.role,content:this.text?[{type:"text",text:this.text}]:[],attachments:t,runConfig:this.runConfig};this._emptyTextAndAttachments(),this.handleSend(n),this._notifyEventSubscribers("send")}cancel(){this.handleCancel()}async addAttachment(e){let t=this.getAttachmentAdapter();if(!t)throw Error("Attachments are not supported");let n=e=>{let t=this._attachments.findIndex(t=>t.id===e.id);-1!==t?this._attachments=[...this._attachments.slice(0,t),e,...this._attachments.slice(t+1)]:(this._attachments=[...this._attachments,e],this._notifyEventSubscribers("attachment_add")),this._notifySubscribers()},r=t.add({file:e});if(Symbol.asyncIterator in r)for await(let e of r)n(e);else n(await r);this._notifyEventSubscribers("attachment_add"),this._notifySubscribers()}async removeAttachment(e){let t=this.getAttachmentAdapter();if(!t)throw Error("Attachments are not supported");let n=this._attachments.findIndex(t=>t.id===e);if(-1===n)throw Error("Attachment not found");let r=this._attachments[n];await t.remove(r),this._attachments=[...this._attachments.slice(0,n),...this._attachments.slice(n+1)],this._notifySubscribers()}_eventSubscribers=new Map;_notifyEventSubscribers(e){let t=this._eventSubscribers.get(e);if(t)for(let e of t)e()}unstable_on(e,t){let n=this._eventSubscribers.get(e);return n?n.add(t):this._eventSubscribers.set(e,new Set([t])),()=>{let n=this._eventSubscribers.get(e);n&&n.delete(t)}}},nt=class extends ne{constructor(e){super(),this.runtime=e,this.connect()}_canCancel=!1;get canCancel(){return this._canCancel}get attachments(){return super.attachments}getAttachmentAdapter(){return this.runtime.adapters?.attachments}connect(){return this.runtime.subscribe(()=>{this.canCancel!==this.runtime.capabilities.cancel&&(this._canCancel=this.runtime.capabilities.cancel,this._notifySubscribers())})}async handleSend(e){this.runtime.append({...e,parentId:this.runtime.messages.at(-1)?.id??null,sourceId:null})}async handleCancel(){this.runtime.cancelRun()}},nn=e=>e.content.filter(e=>"text"===e.type).map(e=>e.text).join("\n\n"),nr=class extends ne{constructor(e,t,{parentId:n,message:r}){super(),this.runtime=e,this.endEditCallback=t,this._parentId=n,this._sourceId=r.id,this._previousText=nn(r),this.setText(this._previousText),this.setRole(r.role),this.setAttachments(r.attachments??[]),this._nonTextParts=r.content.filter(e=>"text"!==e.type),this.setRunConfig({...e.composer.runConfig})}get canCancel(){return!0}getAttachmentAdapter(){return this.runtime.adapters?.attachments}_nonTextParts;_previousText;_parentId;_sourceId;async handleSend(e){nn(e)!==this._previousText&&this.runtime.append({...e,content:[...e.content,...this._nonTextParts],parentId:this._parentId,sourceId:this._sourceId}),this.handleCancel()}handleCancel(){this.endEditCallback(),this._notifySubscribers()}},ni=class{constructor(e){this._contextProvider=e}_subscriptions=new Set;_isInitialized=!1;repository=new t3;get messages(){return this.repository.getMessages()}composer=new nt(this);getModelContext(){return this._contextProvider.getModelContext()}_editComposers=new Map;getEditComposer(e){return this._editComposers.get(e)}beginEdit(e){if(this._editComposers.has(e))throw Error("Edit already in progress");this._editComposers.set(e,new nr(this,()=>this._editComposers.delete(e),this.repository.getMessage(e))),this._notifySubscribers()}getMessageById(e){return this.repository.getMessage(e)}getBranches(e){return this.repository.getBranches(e)}switchToBranch(e){this.repository.switchToBranch(e),this._notifySubscribers()}_notifySubscribers(){for(let e of this._subscriptions)e()}_notifyEventSubscribers(e){let t=this._eventSubscribers.get(e);if(t)for(let e of t)e()}subscribe(e){return this._subscriptions.add(e),()=>this._subscriptions.delete(e)}_submittedFeedback={};getSubmittedFeedback(e){return this._submittedFeedback[e]}submitFeedback({messageId:e,type:t}){let n=this.adapters?.feedback;if(!n)throw Error("Feedback adapter not configured");let{message:r}=this.repository.getMessage(e);n.submit({message:r,type:t}),this._submittedFeedback[e]={type:t},this._notifySubscribers()}_stopSpeaking;speech;speak(e){let t=this.adapters?.speech;if(!t)throw Error("Speech adapter not configured");let{message:n}=this.repository.getMessage(e);this._stopSpeaking?.();let r=t.speak(nn(n)),i=r.subscribe(()=>{"ended"===r.status.type?(this._stopSpeaking=void 0,this.speech=void 0):this.speech={messageId:e,status:r.status},this._notifySubscribers()});this.speech={messageId:e,status:r.status},this._notifySubscribers(),this._stopSpeaking=()=>{r.cancel(),i(),this.speech=void 0,this._stopSpeaking=void 0}}stopSpeaking(){if(!this._stopSpeaking)throw Error("No message is being spoken");this._stopSpeaking(),this._notifySubscribers()}ensureInitialized(){this._isInitialized||(this._isInitialized=!0,this._notifyEventSubscribers("initialize"))}export(){return this.repository.export()}import(e){this.ensureInitialized(),this.repository.clear(),this.repository.import(e),this._notifySubscribers()}_eventSubscribers=new Map;unstable_on(e,t){if("model-context-update"===e)return this._contextProvider.subscribe?.(t)??(()=>{});let n=this._eventSubscribers.get(e);return n?n.add(t):this._eventSubscribers.set(e,new Set([t])),()=>{this._eventSubscribers.get(e).delete(t)}}},na=class extends ni{capabilities={switchToBranch:!0,edit:!0,reload:!0,cancel:!0,unstable_copy:!0,speech:!1,attachments:!1,feedback:!1};abortController=null;isDisabled=!1;_suggestions=[];_suggestionsController=null;get suggestions(){return this._suggestions}get adapters(){return this._options.adapters}constructor(e,t){super(e),this.__internal_setOptions(t)}_options;_lastRunConfig={};get extras(){}__internal_setOptions(e){if(this._options===e)return;this._options=e;let t=!1,n=e.adapters?.speech!==void 0;this.capabilities.speech!==n&&(this.capabilities.speech=n,t=!0);let r=e.adapters?.attachments!==void 0;this.capabilities.attachments!==r&&(this.capabilities.attachments=r,t=!0);let i=e.adapters?.feedback!==void 0;this.capabilities.feedback!==i&&(this.capabilities.feedback=i,t=!0),t&&this._notifySubscribers()}_loadPromise;__internal_load(){if(this._loadPromise)return this._loadPromise;let e=this.adapters.history?.load()??Promise.resolve(null);return this._loadPromise=e.then(e=>{e&&(this.repository.import(e),this._notifySubscribers())}),this._loadPromise}async append(e){this.ensureInitialized();let t=tW(e,{attachments:e.attachments});this.repository.addOrUpdateMessage(e.parentId,t),this._options.adapters.history?.append({parentId:e.parentId,message:t}),e.startRun??"user"===e.role?await this.startRun({parentId:t.id,sourceId:e.sourceId,runConfig:e.runConfig??{}}):(this.repository.resetHead(t.id),this._notifySubscribers())}async startRun({parentId:e,runConfig:t}){this.ensureInitialized(),this.repository.resetHead(e);let n={id:t$(),role:"assistant",status:{type:"running"},content:[],metadata:{unstable_annotations:[],unstable_data:[],steps:[],custom:{}},createdAt:new Date};this._notifyEventSubscribers("run-start");try{this._suggestions=[],this._suggestionsController?.abort(),this._suggestionsController=null;do n=await this.performRoundtrip(e,n,t);while(tK(n,this._options.unstable_humanToolNames))}finally{this._notifyEventSubscribers("run-end")}this._suggestionsController=new AbortController;let r=this._suggestionsController.signal;if(this.adapters.suggestion&&n.status?.type!=="requires-action"){let e=this.adapters.suggestion?.generate({messages:this.messages});if(Symbol.asyncIterator in e)for await(let t of e){if(r.aborted)break;this._suggestions=t}else{let t=await e;if(r.aborted)return;this._suggestions=t}}}
3async performRoundtrip(e,t,n){let r=this.repository.getMessages();this.abortController?.abort(),this.abortController=new AbortController;let i=t.content,a=t.metadata?.unstable_annotations,s=t.metadata?.unstable_data,o=t.metadata?.steps,l=t.metadata?.custom,u=n=>{let r=n.metadata?.steps,u=r?[...o??[],...r]:void 0,c=n.metadata?.unstable_annotations,d=n.metadata?.unstable_data,h=c?[...a??[],...c]:void 0,f=d?[...s??[],...d]:void 0;t={...t,...n.content?{content:[...i,...n.content??[]]}:void 0,status:n.status??t.status,...n.metadata?{metadata:{...t.metadata,...h?{unstable_annotations:h}:void 0,...f?{unstable_data:f}:void 0,...u?{steps:u}:void 0,...n.metadata?.custom?{custom:{...l??{},...n.metadata.custom}}:void 0}}:void 0},this.repository.addOrUpdateMessage(e,t),this._notifySubscribers()},c=this._options.maxSteps??2;if((t.metadata?.steps?.length??0)>=c)return u({status:{type:"incomplete",reason:"tool-calls"}}),t;u({status:{type:"running"}});try{this._lastRunConfig=n??{};let e=this.getModelContext(),i=this.adapters.chatModel.run({messages:r,runConfig:this._lastRunConfig,abortSignal:this.abortController.signal,context:e,config:e,unstable_assistantMessageId:t.id,unstable_getMessage:()=>t});if(Symbol.asyncIterator in i)for await(let e of i)u(e);else u(await i);this.abortController=null,"running"===t.status.type&&u({status:{type:"complete",reason:"unknown"}})}catch(e){if(this.abortController=null,e instanceof Error&&"AbortError"===e.name)u({status:{type:"incomplete",reason:"cancelled"}});else throw u({status:{type:"incomplete",reason:"error",error:e instanceof Error?e.message:`[${typeof e}] ${new String(e).toString()}`}}),e}finally{("complete"===t.status.type||"incomplete"===t.status.type)&&await this._options.adapters.history?.append({parentId:e,message:t})}return t}cancelRun(){this.abortController?.abort(),this.abortController=null}addToolResult({messageId:e,toolCallId:t,result:n}){let r=this.repository.getMessage(e),{parentId:i}=r,{message:a}=r;if("assistant"!==a.role)throw Error("Tried to add tool result to non-assistant message");let s=!1,o=!1,l=a.content.map(e=>"tool-call"!==e.type||e.toolCallId!==t?e:(o=!0,e.result||(s=!0),{...e,result:n}));if(!o)throw Error("Tried to add tool result to non-existing tool call");a={...a,content:l},this.repository.addOrUpdateMessage(i,a),s&&tK(a,this._options.unstable_humanToolNames)&&this.performRoundtrip(i,a,this._lastRunConfig)}},ns=Object.freeze([]),no=class extends t8{_mainThread;constructor(e){super(),this._mainThread=e()}getMainThreadRuntimeCore(){return this._mainThread}get newThreadId(){throw Error("Method not implemented.")}get threadIds(){throw ns}get archivedThreadIds(){throw ns}get mainThreadId(){return"__DEFAULT_ID__"}getThreadRuntimeCore(){throw Error("Method not implemented.")}getLoadThreadsPromise(){throw Error("Method not implemented.")}getItemById(e){if(e===this.mainThreadId)return{status:"regular",threadId:this.mainThreadId,remoteId:this.mainThreadId,externalId:void 0,title:void 0,isMain:!0};throw Error("Method not implemented")}async switchToThread(){throw Error("Method not implemented.")}switchToNewThread(){throw Error("Method not implemented.")}rename(){throw Error("Method not implemented.")}archive(){throw Error("Method not implemented.")}unarchive(){throw Error("Method not implemented.")}delete(){throw Error("Method not implemented.")}initialize(){throw Error("Method not implemented.")}generateTitle(){throw Error("Method not implemented.")}},nl=class extends tV{threads;Provider=void 0;_options;constructor(e,t){super(),this._options=e,this.threads=new no(()=>new na(this._contextProvider,this._options)),t&&this.threads.getMainThreadRuntimeCore().import(t4.fromArray(t))}},nu=n(95155),nc=(0,f.createContext)(null),nd=({adapters:e,children:t})=>{let n=(0,f.useContext)(nc);return(0,nu.jsx)(nc.Provider,{value:{...n,...e},children:t})},nh=()=>(0,f.useContext)(nc),nf=n(99827),np=n(81865),nm=n(77369),ng=n(58432),ny=class extends t8{startThreadRuntime(e){return this.instances.has(e)||(this.instances.set(e,{}),this.useAliveThreadsKeysChanged.setState({},!0)),new Promise((t,n)=>{let r=()=>{let r=this.instances.get(e);if(r){if(!r.runtime)return;i(),t(r.runtime)}else i(),n(Error("Thread was deleted before runtime was started"))},i=this.subscribe(r);r()})}getThreadRuntimeCore(e){let t=this.instances.get(e);if(!t)throw Error("getThreadRuntimeCore not found. This is a bug in assistant-ui.");return t.runtime}stopThreadRuntime(e){this.instances.delete(e),this.useAliveThreadsKeysChanged.setState({},!0)}setRuntimeHook(e){this.useRuntimeHook.getState().useRuntime!==e&&this.useRuntimeHook.setState({useRuntime:e},!0)}constructor(e){super(),this.instances=new Map,this.useAliveThreadsKeysChanged=(0,nf.v)(()=>({})),this._InnerActiveThreadProvider=()=>{let{id:e}=(0,ng.Xi)(),{useRuntime:t}=this.useRuntimeHook(),n=t(),r=n.thread.__internal_threadBinding,i=(0,f.useCallback)(()=>{let t=this.instances.get(e);if(!t)throw Error("Thread not found. This is a bug in assistant-ui.");t.runtime=r.getState(),a&&this._notifySubscribers()},[e,r]),a=(0,f.useRef)(!1);a.current||i(),(0,f.useEffect)(()=>(a.current=!0,i(),r.outerSubscribe(i)),[r]);let s=(0,ng.pK)();return(0,f.useEffect)(()=>n.threads.main.unstable_on("initialize",()=>
3{if("new"===s.getState().status){s.initialize();let e=n.thread.unstable_on("run-end",()=>{e(),s.generateTitle()})}}),[n,s]),null},this._OuterActiveThreadProvider=(0,f.memo)(e=>{let{threadId:t,provider:n}=e,r=(0,np.Ij)(),i=(0,f.useMemo)(()=>r.threads.getItemById(t),[r,t]);return(0,nu.jsx)(nm.X,{runtime:i,children:(0,nu.jsx)(n,{children:(0,nu.jsx)(this._InnerActiveThreadProvider,{})})})}),this.__internal_RenderThreadRuntimes=e=>{let{provider:t}=e;return this.useAliveThreadsKeysChanged(),Array.from(this.instances.keys()).map(e=>(0,nu.jsx)(this._OuterActiveThreadProvider,{threadId:e,provider:t},e))},this.useRuntimeHook=(0,nf.v)(()=>({useRuntime:e}))}},nv=Error("This is the empty thread, a placeholder for the main thread. You cannot perform any actions on this thread instance. This error is probably because you tried to call a thread method in your render function. Call the method inside a `useEffect` hook instead."),nb={getMessageById(){},getBranches:()=>[],switchToBranch(){throw nv},append(){throw nv},startRun(){throw nv},cancelRun(){throw nv},addToolResult(){throw nv},speak(){throw nv},stopSpeaking(){throw nv},getSubmittedFeedback(){},submitFeedback(){throw nv},getModelContext:()=>({}),composer:{attachments:[],getAttachmentAccept:()=>"*",async addAttachment(){throw nv},async removeAttachment(){throw nv},isEditing:!1,canCancel:!1,isEmpty:!0,text:"",setText(){throw nv},role:"user",setRole(){throw nv},runConfig:{},setRunConfig(){throw nv},async reset(){},async clearAttachments(){},send(){throw nv},cancel(){},subscribe:()=>()=>{},unstable_on:()=>()=>{}},getEditComposer(){},beginEdit(){throw nv},speech:void 0,capabilities:{switchToBranch:!1,edit:!1,reload:!1,cancel:!1,unstable_copy:!1,speech:!1,attachments:!1,feedback:!1},isDisabled:!0,messages:[],suggestions:[],extras:void 0,subscribe:()=>()=>{},import(){throw nv},export:()=>({messages:[]}),unstable_on:()=>()=>{}},nx=(e,t,n)=>n.reduce((e,n)=>n?.(e,t)??e,e),n_=class extends t8{_pendingTransforms=[];_baseValue;_cachedValue;constructor(e){super(),this._baseValue=e,this._cachedValue=e}_updateState(){this._cachedValue=this._pendingTransforms.reduce((e,t)=>nx(e,t.task,[t.loading,t.optimistic]),this._baseValue),this._notifySubscribers()}get baseValue(){return this._baseValue}get value(){return this._cachedValue}update(e){this._baseValue=e,this._updateState()}async optimisticUpdate(e){let t=e.execute(),n={...e,task:t};try{this._pendingTransforms.push(n),this._updateState();let r=await t;return this._baseValue=nx(this._baseValue,r,[e.optimistic,e.then]),r}finally{let e=this._pendingTransforms.indexOf(n);e>-1&&this._pendingTransforms.splice(e,1),this._updateState()}}},nw=n(34732),nk={toResponse:(e,t)=>new Response(nk.toByteStream(e,t)),fromResponse:(e,t)=>nk.fromByteStream(e.body,t),toByteStream:(e,t)=>e.pipeThrough(t),fromByteStream:(e,t)=>e.pipeThrough(t)},nS=class extends TransformStream{constructor(e){super(),Object.defineProperty(this,"readable",{value:e(super.readable),writable:!1})}},nE=(TransformStream,class{_controller;constructor(e){this._controller=e}append(e){return this._controller.enqueue({type:"text-delta",textDelta:e}),this}close(){this._controller.close()}}),nT=e=>new ReadableStream({start:t=>e.start?.(new nE(t)),pull:t=>e.pull?.(new nE(t)),cancel:t=>e.cancel?.(t)}),nI=class{constructor(e,t){this._controller=e,this._options=t,this._controller.enqueue({type:"tool-call-begin",toolCallId:this._options.toolCallId,toolName:this._options.toolName}),nT({start:e=>{this._argsTextController=e}}).pipeTo(new WritableStream({write:e=>{if("text-delta"!==e.type)throw Error("Unexpected chunk type");this._controller.enqueue({type:"tool-call-delta",toolCallId:this._options.toolCallId,argsTextDelta:e.textDelta})}}))}get toolCallId(){return this._options.toolCallId}get toolName(){return this._options.toolName}get argsText(){return this._argsTextController}_argsTextController;setResult(e){this._controller.enqueue({type:"tool-result",toolCallId:this._options.toolCallId,result:e})}close(){this._controller.close()}},nC=e=>{let t={toolCallId:e.toolCallId,toolName:e.toolName};return new ReadableStream({start:n=>e.start?.(new nI(n,t)),pull:n=>e.pull?.(new nI(n,t)),cancel:t=>e.cancel?.(t)})},nA=()=>{let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}},nR=()=>{let e,t;let n=[],r=!1,i=i=>{i.promise||(i.promise=i.reader.read().then(({done:a,value:s})=>{i.promise=void 0,a?(n.splice(n.indexOf(i),1),r&&0===n.length&&e.close()):e.enqueue(s),t?.resolve(),t=void 0}).catch(r=>
3{n.forEach(e=>{e.reader.cancel()}),n.length=0,e.error(r),t?.reject(r),t=void 0}))};return{stream:new ReadableStream({start(t){e=t},pull:async()=>(n.map(e=>(i(e),e.promise)),(t=nA()).promise),cancel(){n.forEach(e=>{e.reader.cancel()}),n.length=0}}),seal(){r=!0,0===n.length&&e.close()},addStream(e){if(r)throw Error("Cannot add streams after the run callback has settled.");let t={reader:e.getReader()};n.push(t),1===n.length&&i(t)}}},nP=class{_transformStream;get writable(){return this._transformStream.writable}get readable(){return this._transformStream.readable}constructor(){this._transformStream=new nS(e=>{let t=new TransformStream({transform(e,t){t.enqueue({type:"text-delta",textDelta:e})}});return e.pipeThrough(new TextDecoderStream).pipeThrough(t)})}},nO=e=>{try{return nw.parse(e)}catch{try{return nw.parse(function(e){let t=["ROOT"],n=-1,r=null;function i(e,i,a){switch(e){case'"':n=i,t.pop(),t.push(a),t.push("INSIDE_STRING");break;case"f":case"t":case"n":n=i,r=i,t.pop(),t.push(a),t.push("INSIDE_LITERAL");break;case"-":t.pop(),t.push(a),t.push("INSIDE_NUMBER");break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n=i,t.pop(),t.push(a),t.push("INSIDE_NUMBER");break;case"{":n=i,t.pop(),t.push(a),t.push("INSIDE_OBJECT_START");break;case"[":n=i,t.pop(),t.push(a),t.push("INSIDE_ARRAY_START")}}function a(e,r){switch(e){case",":t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break;case"}":n=r,t.pop()}}function s(e,r){switch(e){case",":t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break;case"]":n=r,t.pop()}}for(let o=0;o<e.length;o++){let l=e[o];switch(t[t.length-1]){case"ROOT":i(l,o,"FINISH");break;case"INSIDE_OBJECT_START":switch(l){case'"':t.pop(),t.push("INSIDE_OBJECT_KEY");break;case"}":n=o,t.pop()}break;case"INSIDE_OBJECT_AFTER_COMMA":'"'===l&&(t.pop(),t.push("INSIDE_OBJECT_KEY"));break;case"INSIDE_OBJECT_KEY":'"'===l&&(t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY"));break;case"INSIDE_OBJECT_AFTER_KEY":":"===l&&(t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE"));break;case"INSIDE_OBJECT_BEFORE_VALUE":i(l,o,"INSIDE_OBJECT_AFTER_VALUE");break;case"INSIDE_OBJECT_AFTER_VALUE":a(l,o);break;case"INSIDE_STRING":switch(l){case'"':t.pop(),n=o;break;case"\\":t.push("INSIDE_STRING_ESCAPE");break;default:n=o}break;case"INSIDE_ARRAY_START":"]"===l?(n=o,t.pop()):(n=o,i(l,o,"INSIDE_ARRAY_AFTER_VALUE"));break;case"INSIDE_ARRAY_AFTER_VALUE":switch(l){case",":t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break;case"]":n=o,t.pop();break;default:n=o}break;case"INSIDE_ARRAY_AFTER_COMMA":i(l,o,"INSIDE_ARRAY_AFTER_VALUE");break;case"INSIDE_STRING_ESCAPE":t.pop(),n=o;break;case"INSIDE_NUMBER":switch(l){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n=o;break;case"e":case"E":case"-":case".":break;case",":t.pop(),"INSIDE_ARRAY_AFTER_VALUE"===t[t.length-1]&&s(l,o),"INSIDE_OBJECT_AFTER_VALUE"===t[t.length-1]&&a(l,o);break;case"}":t.pop(),"INSIDE_OBJECT_AFTER_VALUE"===t[t.length-1]&&a(l,o);break;case"]":t.pop(),"INSIDE_ARRAY_AFTER_VALUE"===t[t.length-1]&&s(l,o);break;default:t.pop()}break;case"INSIDE_LITERAL":{let i=e.substring(r,o+1);"false".startsWith(i)||"true".startsWith(i)||"null".startsWith(i)?n=o:(t.pop(),"INSIDE_OBJECT_AFTER_VALUE"===t[t.length-1]?a(l,o):"INSIDE_ARRAY_AFTER_VALUE"===t[t.length-1]&&s(l,o))}}}let o=e.slice(0,n+1);for(let n=t.length-1;n>=0;n--)switch(t[n]){case"INSIDE_STRING":o+='"';break;case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":o+="}";break;case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":o+="]";break;case"INSIDE_LITERAL":{let t=e.substring(r,e.length);"true".startsWith(t)?o+="true".slice(t.length):"false".startsWith(t)?o+="false".slice(t.length):"null".startsWith(t)&&(o+="null".slice(t.length))}}return o}(e))}catch{return}}},nM=()=>{let e={role:"assistant",content:[],status:{type:"running"},metadata:{steps:[],custom:{}}};return new TransformStream({transform(t,n){let{type:r}=t;switch(r){case"text-delta":e=nN(e,t.textDelta),n.enqueue(e);break;case"tool-call-begin":{let{toolCallId:r,toolName:i}=t;e=nj(e,r,i),n.enqueue(e);break}case"tool-call-delta":{let{toolCallId:r,argsTextDelta:i}=t;e=nD(e,r,i),n.enqueue(e);break}case"tool-result":{let{toolCallId:r,result:i}=t;e=nL(e,r,i),n.enqueue(e);break}case"error":{let{error:r}=t;e=nF(e,r),n.enqueue(e);break}default:throw Error(`Unsupported chunk type: ${r}`)}},flush(t){e=nB(e),t.enqueue(e)}})},nN=(e,t)=>{let n=e.content??[],r=e.content?.at(-1);return r?.type!=="text"?r={type:"text",text:t,status:{type:"running"}}
3:(n=n.slice(0,-1),r={type:"text",text:r.text+t,status:{type:"running"}}),{...e,content:n.concat([r])}},nj=(e,t,n)=>({...e,content:[...e.content,{type:"tool-call",toolCallId:t,toolName:n,argsText:"",args:{},status:{type:"running",isArgsComplete:!1}}]}),nD=(e,t,n)=>{let r=e.content.findIndex(e=>"tool-call"===e.type&&e.toolCallId===t);if(-1===r)throw Error(`Received tool call delta for unknown tool call "${t}".`);let i=e.content[r],a=i.argsText+n;return{...e,content:[...e.content.slice(0,r),{...i,argsText:a,args:nO(a)},...e.content.slice(r+1)]}},nL=(e,t,n)=>{let r=!1,i=e.content?.map(e=>"tool-call"!==e.type||e.toolCallId!==t?e:(r=!0,{...e,result:n}));if(!r)throw Error(`Received tool result for unknown tool call "${t}". This is likely an internal bug in assistant-ui.`);return{...e,content:i}},nB=e=>({...e,status:{type:"complete",reason:"unknown"}}),nF=(e,t)=>({...e,status:{type:"incomplete",reason:"error",error:t}}),nz=class e{constructor(e){this.readable=e,this.readable=e}static fromAssistantStream(t){return new e(t.pipeThrough(nM()))}async unstable_result(){let e;for await(let t of this)e=t;return e||{role:"assistant",status:{type:"complete",reason:"unknown"},content:[],metadata:{steps:[],custom:{}}}}[Symbol.asyncIterator](){let e=this.readable.getReader();return{async next(){let{done:t,value:n}=await e.read();return t?{done:!0,value:void 0}:{done:!1,value:n}}}}tee(){let[t,n]=this.readable.tee();return[new e(t),new e(n)]}},nU=(e,t)=>{let n=e.threadIdMap[t];if(void 0!==n)return e.threadData[n]},nZ=(e,t,n)=>{let r=nU(e,t);if(!r)return e;let{threadId:i,remoteId:a,status:s}=r;if(s===n)return e;let o={...e};switch(s){case"new":o.newThreadId=void 0;break;case"regular":o.threadIds=o.threadIds.filter(e=>e!==i);break;case"archived":o.archivedThreadIds=o.archivedThreadIds.filter(e=>e!==i);break;default:throw Error("Unsupported state: ".concat(s))}switch(n){case"regular":o.threadIds=[i,...o.threadIds];break;case"archived":o.archivedThreadIds=[i,...o.archivedThreadIds];break;case"deleted":o.threadData=Object.fromEntries(Object.entries(o.threadData).filter(e=>{let[t]=e;return t!==i})),o.threadIdMap=Object.fromEntries(Object.entries(o.threadIdMap).filter(e=>{let[t]=e;return t!==i&&t!==a}));break;default:throw Error("Unsupported state: ".concat(n))}return"deleted"!==n&&(o.threadData={...o.threadData,[i]:{...r,status:n}}),o},nH=class extends t8{getLoadThreadsPromise(){return this._loadThreadsPromise||(this._loadThreadsPromise=this._state.optimisticUpdate({execute:()=>this._options.adapter.list(),loading:e=>({...e,isLoading:!0}),then:(e,t)=>{let n=[],r=[],i={},a={};for(let e of t.threads){switch(e.status){case"regular":n.push(e.remoteId);break;case"archived":r.push(e.remoteId);break;default:{let t=e.status;throw Error("Unsupported state: ".concat(t))}}let t=e.remoteId;i[e.remoteId]=t,a[t]={threadId:e.remoteId,remoteId:e.remoteId,externalId:e.externalId,status:e.status,title:e.title,initializeTask:Promise.resolve({remoteId:e.remoteId,externalId:e.externalId})}}return{...e,threadIds:n,archivedThreadIds:r,threadIdMap:{...e.threadIdMap,...i},threadData:{...e.threadData,...a}}}}).then(()=>{})),this._loadThreadsPromise}__internal_setOptions(e){var t;if(this._options===e)return;this._options=e;let n=null!==(t=e.adapter.unstable_Provider)&&void 0!==t?t:f.Fragment;n!==this.useProvider.getState().Provider&&this.useProvider.setState({Provider:n},!0),this._hookManager.setRuntimeHook(e.runtimeHook)}__internal_load(){this.getLoadThreadsPromise()}get threadIds(){return this._state.value.threadIds}get archivedThreadIds(){return this._state.value.archivedThreadIds}get newThreadId(){return this._state.value.newThreadId}get mainThreadId(){return this._mainThreadId}getMainThreadRuntimeCore(){let e=this._hookManager.getThreadRuntimeCore(this._mainThreadId);return e||nb}getThreadRuntimeCore(e){let t=this.getItemById(e);if(!t)throw Error("Thread not found");let n=this._hookManager.getThreadRuntimeCore(t.threadId);if(!n)throw Error("Thread not found");return n}getItemById(e){return nU(this._state.value,e)}async switchToThread(e){let t=this.getItemById(e);if(!t)throw Error("Thread not found");if(this._mainThreadId===t.threadId)return;let n=this._hookManager.startThreadRuntime(t.threadId);void 0!==this.mainThreadId?await n:n.then(()=>this._notifySubscribers()),"archived"===t.status&&await this.unarchive(t.threadId),this._mainThreadId=t.threadId,this._notifySubscribers()}async switchToNewThread(){for(;void 0!==this._state.baseValue.newThreadId&&void 0===this._state.value.newThreadId;)await this._state.waitForUpdate();let e=this._state.value,t=this._state.value.newThreadId;if(void 0===t){do t="__LOCALID_".concat(t$());while(e.threadIdMap[t]);let n=t;this._state.update({...e,newThreadId:t,threadIdMap:{...e.threadIdMap,[t]:n},threadData:{...e.threadData,[t]:{status:"new",threadId:t}}})}return this.switchToThread(t)}rename(e,t){let n=this.getItemById(e);if(!n)throw Error("Thread not found");if("new"===n.status)throw Error("Thread is not yet initialized");return this._state.optimisticUpdate({execute:async()=>{let{remoteId:e}=await n.initializeTask;return this._options.adapter.rename(e,t)},optimistic:n=>{let r=nU(n,e);return r?{...n,threadData:{...n.threadData,[r.threadId]:{...r,title:t}}}:n}})}async _ensureThreadIsNotMain(e){e===this._mainThreadId&&await this.switchToNewThread()}async archive(e){let t=this.getItemById(e);if(!t)throw Error("Thread not found");if("regular"!==t.status)throw Error("Thread is not yet initialized or already archived");return this._state.optimisticUpdate({execute:async()=>{await this._ensureThreadIsNotMain(t.threadId);let{remoteId:e}=await t.initializeTask;return this._options.adapter.archive(e)},optimistic:e=>nZ(e,t.threadId,"archived")})}unarchive(e){let t=this.getItemById(e);if(!t)throw Error("Thread not found");if("archived"!==t.status)throw Error("Thread is not archived");return this._state.optimisticUpdate({execute:async()=>{try{let{remoteId:e}=await t.initializeTask;return await this._options.adapter.unarchive(e)}catch(e){throw await this._ensureThreadIsNotMain(t.threadId),e}},optimistic:e=>nZ(e,t.threadId,"regular")})}async delete(e){let t=this.getItemById(e);if(!t)throw Error("Thread not found");if("regular"!==t.status&&"archived"!==t.status)throw Error("Thread is not yet initialized");return this._state.optimisticUpdate({execute:async()=>{await this._ensureThreadIsNotMain(t.threadId);let{remoteId:e}=await t.initializeTask;return await this._options.adapter.delete(e)},optimistic:e=>nZ(e,t.threadId,"deleted")})}constructor(e,t){super(),this._state=new n_({isLoading:!1,newThreadId:void 0,threadIds:[],archivedThreadIds:[],threadIdMap:{},threadData:{}}),this.initialize=async e=>{if(this._state.value.newThreadId!==e){let t=this.getItemById(e);if(!t)throw Error("Thread not found");if("new"===t.status)throw Error("Unexpected new state");return t.initializeTask}return this._state.optimisticUpdate({execute:()=>this._options.adapter.initialize(e),optimistic:t=>nZ(t,e,"regular"),loading:(t,n)=>({...t,threadData:{...t.threadData,[e]:{...t.threadData[e],initializeTask:n}}}),then:(t,n)=>{let{remoteId:r,externalId:i}=n,a=nU(t,e);return a?{...t,threadIdMap:{...t.threadIdMap,[r]:e}
3,threadData:{...t.threadData,[e]:{...a,initializeTask:Promise.resolve({remoteId:r,externalId:i}),remoteId:r,externalId:i}}}:t}})},this.generateTitle=async e=>{let t=this.getItemById(e);if(!t)throw Error("Thread not found");if("new"===t.status)throw Error("Thread is not yet initialized");let{remoteId:n}=await t.initializeTask,r=this.getThreadRuntimeCore(e).messages,i=await this._options.adapter.generateTitle(n,r);for await(let e of nz.fromAssistantStream(i)){var a,s;let n=null!==(s=null===(a=e.content.filter(e=>"text"===e.type)[0])||void 0===a?void 0:a.text)&&void 0!==s?s:"New Thread",r=this._state.baseValue;this._state.update({...r,threadData:{...r.threadData,[t.threadId]:{...t,title:n}}})}},this.useBoundIds=(0,nf.v)(()=>[]),this.__internal_RenderComponent=()=>{let e=(0,f.useId)();(0,f.useEffect)(()=>(this.useBoundIds.setState(t=>[...t,e],!0),()=>{this.useBoundIds.setState(t=>t.filter(t=>t!==e),!0)}),[]);let t=this.useBoundIds(),{Provider:n}=this.useProvider(),r={modelContext:this.contextProvider};return(0===t.length||t[0]===e)&&(0,nu.jsx)(nd,{adapters:r,children:(0,nu.jsx)(this._hookManager.__internal_RenderThreadRuntimes,{provider:n})})},this.contextProvider=t,this._state.subscribe(()=>this._notifySubscribers()),this._hookManager=new ny(e.runtimeHook),this.useProvider=(0,nf.v)(()=>{var t;return{Provider:null!==(t=e.adapter.unstable_Provider)&&void 0!==t?t:f.Fragment}}),this.__internal_setOptions(e),this.switchToNewThread()}},nV=class{_subscriptions=new Set;_connection;get isConnected(){return!!this._connection}notifySubscribers(){for(let e of this._subscriptions)e()}_updateConnection(){this._subscriptions.size>0?this._connection||(this._connection=this._connect()):(this._connection?.(),this._connection=void 0)}subscribe(e){return this._subscriptions.add(e),this._updateConnection(),()=>{this._subscriptions.delete(e),this._updateConnection()}}},n$=Symbol("skip-update"),nq=class extends nV{constructor(e){super(),this.binding=e}get path(){return this.binding.path}_previousStateDirty=!0;_previousState;getState=()=>{if(!this.isConnected||this._previousStateDirty){let e=this.binding.getState();e!==n$&&(this._previousState=e),this._previousStateDirty=!1}if(void 0===this._previousState)throw Error("Entry not available in the store");return this._previousState};_connect(){return this.binding.subscribe(()=>{this._previousStateDirty=!0,this.notifySubscribers()})}},nW=class{constructor(e,t){this._core=e,this._threadListBinding=t}get path(){return this._core.path}__internal_bindMethods(){this.switchTo=this.switchTo.bind(this),this.rename=this.rename.bind(this),this.archive=this.archive.bind(this),this.unarchive=this.unarchive.bind(this),this.delete=this.delete.bind(this),this.initialize=this.initialize.bind(this),this.generateTitle=this.generateTitle.bind(this),this.subscribe=this.subscribe.bind(this),this.unstable_on=this.unstable_on.bind(this),this.getState=this.getState.bind(this)}getState(){return this._core.getState()}switchTo(){let e=this._core.getState();return this._threadListBinding.switchToThread(e.id)}rename(e){let t=this._core.getState();return this._threadListBinding.rename(t.id,e)}archive(){let e=this._core.getState();return this._threadListBinding.archive(e.id)}unarchive(){let e=this._core.getState();return this._threadListBinding.unarchive(e.id)}delete(){let e=this._core.getState();return this._threadListBinding.delete(e.id)}initialize(){let e=this._core.getState();return this._threadListBinding.initialize(e.id)}generateTitle(){let e=this._core.getState();return this._threadListBinding.generateTitle(e.id)}unstable_on(e,t){let n=this._core.getState().isMain;return this.subscribe(()=>{let r=this._core.getState().isMain;if(n!==r)n=r,("switched-to"!==e||r)&&("switched-away"===e&&r||t())})}subscribe(e){return this._core.subscribe(e)}},nK=class extends nV{constructor(e){super(),this.binding=e;let t=e.getState();if(t===n$)throw Error("Entry not available in the store");this._previousState=t}get path(){return this.binding.path}_previousState;getState=()=>(this.isConnected||this._syncState(),this._previousState);_syncState(){let e=this.binding.getState();return!(e===n$||function(e,t){if(void 0===e&&void 0===t)return!0;
3if(void 0===e||void 0===t)return!1;for(let n of Object.keys(e))if(!Object.is(e[n],t[n]))return!1;return!0}(e,this._previousState))&&(this._previousState=e,!0)}_connect(){return this.binding.subscribe(()=>{this._syncState()&&this.notifySubscribers()})}},nJ=Symbol("innerMessage"),nY=(Symbol("innerMessages"),class{constructor(e){this._core=e}get path(){return this._core.path}__internal_bindMethods(){this.getState=this.getState.bind(this),this.remove=this.remove.bind(this),this.subscribe=this.subscribe.bind(this)}getState(){return this._core.getState()}subscribe(e){return this._core.subscribe(e)}}),nG=class extends nY{constructor(e,t){super(e),this._composerApi=t}remove(){let e=this._composerApi.getState();if(!e)throw Error("Composer is not available");return e.removeAttachment(this.getState().id)}},nX=class extends nG{get source(){return"thread-composer"}},nQ=class extends nG{get source(){return"edit-composer"}},n0=class extends nY{get source(){return"message"}constructor(e){super(e)}remove(){throw Error("Message attachments cannot be removed")}},n1=class extends nV{constructor(e){super(),this.config=e}getState(){return this.config.binding.getState()}outerSubscribe(e){return this.config.binding.subscribe(e)}_connect(){let e=()=>{this.notifySubscribers()},t=this.config.binding.getState(),n=t?.unstable_on(this.config.event,e),r=this.outerSubscribe(()=>{let r=this.config.binding.getState();r!==t&&(t=r,n?.(),n=this.config.binding.getState()?.unstable_on(this.config.event,e))});return()=>{r?.(),n?.()}}},n2=Object.freeze([]),n5=Object.freeze({}),n4=e=>Object.freeze({type:"thread",isEditing:e?.isEditing??!1,canCancel:e?.canCancel??!1,isEmpty:e?.isEmpty??!0,attachments:e?.attachments??n2,text:e?.text??"",role:e?.role??"user",runConfig:e?.runConfig??n5,value:e?.text??""}),n9=e=>Object.freeze({type:"edit",isEditing:e?.isEditing??!1,canCancel:e?.canCancel??!1,isEmpty:e?.isEmpty??!0,text:e?.text??"",role:e?.role??"user",attachments:e?.attachments??n2,runConfig:e?.runConfig??n5,value:e?.text??""}),n6=class{constructor(e){this._core=e}get path(){return this._core.path}__internal_bindMethods(){this.setText=this.setText.bind(this),this.setRunConfig=this.setRunConfig.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.addAttachment=this.addAttachment.bind(this),this.reset=this.reset.bind(this),this.clearAttachments=this.clearAttachments.bind(this),this.send=this.send.bind(this),this.cancel=this.cancel.bind(this),this.setRole=this.setRole.bind(this),this.getAttachmentAccept=this.getAttachmentAccept.bind(this),this.getAttachmentByIndex=this.getAttachmentByIndex.bind(this),this.unstable_on=this.unstable_on.bind(this)}setText(e){let t=this._core.getState();if(!t)throw Error("Composer is not available");t.setText(e)}setRunConfig(e){let t=this._core.getState();if(!t)throw Error("Composer is not available");t.setRunConfig(e)}addAttachment(e){let t=this._core.getState();if(!t)throw Error("Composer is not available");return t.addAttachment(e)}reset(){let e=this._core.getState();if(!e)throw Error("Composer is not available");return e.reset()}clearAttachments(){let e=this._core.getState();if(!e)throw Error("Composer is not available");return e.clearAttachments()}send(){let e=this._core.getState();if(!e)throw Error("Composer is not available");e.send()}cancel(){let e=this._core.getState();if(!e)throw Error("Composer is not available");e.cancel()}setRole(e){let t=this._core.getState();if(!t)throw Error("Composer is not available");t.setRole(e)}subscribe(e){return this._core.subscribe(e)}_eventSubscriptionSubjects=new Map;unstable_on(e,t){let n=this._eventSubscriptionSubjects.get(e);return n||(n=new n1({event:e,binding:this._core}),this._eventSubscriptionSubjects.set(e,n)),n.subscribe(t)}getAttachmentAccept(){let e=this._core.getState();if(!e)throw Error("Composer is not available");return e.getAttachmentAccept()}},n3=class extends n6{get path(){return this._core.path}get type(){return"thread"}_getState;constructor(e){let t=new nq({path:e.path,getState:()=>n4(e.getState()),subscribe:t=>e.subscribe(t)});super({path:e.path,getState:()=>e.getState(),subscribe:e=>t.subscribe(e)}),this._getState=t.getState.bind(t)}getState(){return this._getState()}getAttachmentByIndex(e){return new nX(new nK({path:{...this.path,attachmentSource:"thread-composer",attachmentSelector:{type:"index",index:e},ref:this.path.ref+`${this.path.ref}.attachments[${e}]`}
3,getState:()=>{let t=this.getState().attachments[e];return t?{...t,source:"thread-composer"}:n$},subscribe:e=>this._core.subscribe(e)}),this._core)}},n8=class extends n6{constructor(e,t){let n=new nq({path:e.path,getState:()=>n9(e.getState()),subscribe:t=>e.subscribe(t)});super({path:e.path,getState:()=>e.getState(),subscribe:e=>n.subscribe(e)}),this._beginEdit=t,this._getState=n.getState.bind(n)}get path(){return this._core.path}get type(){return"edit"}_getState;__internal_bindMethods(){super.__internal_bindMethods(),this.beginEdit=this.beginEdit.bind(this)}getState(){return this._getState()}beginEdit(){this._beginEdit()}getAttachmentByIndex(e){return new nQ(new nK({path:{...this.path,attachmentSource:"edit-composer",attachmentSelector:{type:"index",index:e},ref:this.path.ref+`${this.path.ref}.attachments[${e}]`},getState:()=>{let t=this.getState().attachments[e];return t?{...t,source:"edit-composer"}:n$},subscribe:e=>this._core.subscribe(e)}),this._core)}},n7=n(9859),re=class extends nV{constructor(e){super(),this.binding=e}get path(){return this.binding.path}getState(){return this.binding.getState()}outerSubscribe(e){return this.binding.subscribe(e)}_connect(){let e=()=>{this.notifySubscribers()},t=this.binding.getState(),n=t?.subscribe(e),r=this.outerSubscribe(()=>{let r=this.binding.getState();r!==t&&(t=r,n?.(),n=this.binding.getState()?.subscribe(e),e())});return()=>{r?.(),n?.()}}},rt=Object.freeze({type:"complete"}),rn=(e,t,n)=>{if("assistant"!==e.role)return rt;if("tool-call"===n.type)return n.result?rt:e.status;let r=t===Math.max(0,e.content.length-1);return"requires-action"===e.status.type?rt:r?e.status:rt},rr=(e,t)=>{let n=e.content[t];if(!n)return n$;let r=rn(e,t,n);return Object.freeze({...n,[nJ]:n[nJ],status:r})},ri=class{constructor(e,t){this._core=e,this._threadBinding=t,this.composer=new n8(new re({path:{...this.path,ref:this.path.ref+`${this.path.ref}.composer`,composerSource:"edit"},getState:this._getEditComposerRuntimeCore,subscribe:e=>this._threadBinding.subscribe(e)}),()=>this._threadBinding.getState().beginEdit(this._core.getState().id))}get path(){return this._core.path}__internal_bindMethods(){this.reload=this.reload.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.getContentPartByIndex=this.getContentPartByIndex.bind(this),this.getContentPartByToolCallId=this.getContentPartByToolCallId.bind(this),this.getAttachmentByIndex=this.getAttachmentByIndex.bind(this),this.unstable_getCopyText=this.unstable_getCopyText.bind(this),this.speak=this.speak.bind(this),this.stopSpeaking=this.stopSpeaking.bind(this),this.submitFeedback=this.submitFeedback.bind(this),this.switchToBranch=this.switchToBranch.bind(this)}composer;_getEditComposerRuntimeCore=()=>this._threadBinding.getState().getEditComposer(this._core.getState().id);getState(){return this._core.getState()}reload(e={}){let t=this._getEditComposerRuntimeCore(),n=t??this._threadBinding.getState().composer,{runConfig:r=(t??n).runConfig}=e,i=this._core.getState();if("assistant"!==i.role)throw Error("Can only reload assistant messages");this._threadBinding.getState().startRun({parentId:i.parentId,sourceId:i.id,runConfig:r})}speak(){let e=this._core.getState();return this._threadBinding.getState().speak(e.id)}stopSpeaking(){let e=this._core.getState(),t=this._threadBinding.getState();if(t.speech?.messageId===e.id)this._threadBinding.getState().stopSpeaking();else throw Error("Message is not being spoken")}submitFeedback({type:e}){let t=this._core.getState();this._threadBinding.getState().submitFeedback({messageId:t.id,type:e})}switchToBranch({position:e,branchId:t}){let n=this._core.getState();if(t&&e)throw Error("May not specify both branchId and position");if(!t&&!e)throw Error("Must specify either branchId or position");let r=this._threadBinding.getState().getBranches(n.id),i=t;if("previous"===e?i=r[n.branchNumber-2]:"next"===e&&(i=r[n.branchNumber]),!i)throw Error("Branch not found");this._threadBinding.getState().switchToBranch(i)}unstable_getCopyText(){return nn(this.getState())}subscribe(e){return this._core.subscribe(e)}getContentPartByIndex(e){if(e<0)throw Error("Content part index must be >= 0");return new n7.j(new nK({path:{...this.path,ref:this.path.ref+`${this.path.ref}.content[${e}]`,contentPartSelector:{type:"index",index:e}},getState:()=>rr(this.getState(),e),subscribe:e=>this._core.subscribe(e)}),this._core,this._threadBinding)}getContentPartByToolCallId(e){return new n7.j(new nK({path:{...this.path,ref:this.path.ref+`${this.path.ref}.content[toolCallId=${JSON.stringify(e)}]`,contentPartSelector:{type:"toolCallId",toolCallId:e}},getState:()=>{let t=this._core.getState(),n=t.content.findIndex(t=>"tool-call"===t.type&&t.toolCallId===e);return -1===n?n$:rr(t,n)},subscribe:e=>this._core.subscribe(e)}),this._core,this._threadBinding)}getAttachmentByIndex(e){return new n0(new nK({path:{...this.path,ref:this.path.ref+`${this.path.ref}.attachments[${e}]`,attachmentSource:"message",attachmentSelector:{type:"index",index:e}},getState:()=>{let t=this.getState().attachments,n=t?.[e];return n?{...n,source:"message"}:n$},subscribe:e=>this._core.subscribe(e)}))}},ra=e=>({parentId:e.parentId??null,sourceId:e.sourceId??null,runConfig:e.runConfig??{}}),rs=(e,t)=>"string"==typeof t?{parentId:e.at(-1)?.id??null,sourceId:null,runConfig:{},role:"user",content:[{type:"text",text:t}],attachments:[]}:t.role&&t.parentId&&t.attachments?t:{...t,parentId:t.parentId??e.at(-1)?.id??null,sourceId:t.sourceId??null,role:t.role??"user",attachments:t.attachments??[]},ro=(e,t)=>{let n=e.messages.at(-1);return Object.freeze({threadId:t.id,metadata:t,capabilities:e.capabilities,isDisabled:e.isDisabled,isRunning:n?.role==="assistant"&&"running"===n.status.type,messages:e.messages,suggestions:e.suggestions,extras:e.extras,speech:e.speech})},rl=class{get path(){return this._threadBinding.path}get __internal_threadBinding(){return this._threadBinding}_threadBinding;constructor(e,t){let n=new nK({path:e.path,getState:()=>ro(e.getState(),t.getState()),subscribe:n=>{let r=e.subscribe(n),i=t.subscribe(n);return()=>{r(),i()}}});this._threadBinding={path:e.path,getState:()=>e.getState(),getStateState:()=>n.getState(),outerSubscribe:t=>e.outerSubscribe(t),subscribe:t=>e.subscribe(t)},this.composer=new n3(new re({path:{...this.path,ref:this.path.ref+`${this.path.ref}.composer`,composerSource:"thread"},getState:()=>this._threadBinding.getState().composer,subscribe:e=>this._threadBinding.subscribe(e)}))}__internal_bindMethods(){this.append=this.append.bind(this),this.startRun=this.startRun.bind(this),this.cancelRun=this.cancelRun.bind(this),this.stopSpeaking=this.stopSpeaking.bind(this),this.export=this.export.bind(this),this.import=this.import.bind(this),this.getMesssageByIndex=this.getMesssageByIndex.bind(this),this.getMesssageById=this.getMesssageById.bind(this),this.subscribe=this.subscribe.bind(this),this.unstable_on=this.unstable_on.bind(this),this.getModelContext=this.getModelContext.bind(this),this.getModelConfig=this.getModelConfig.bind(this),this.get
3State=this.getState.bind(this)}composer;getState(){return this._threadBinding.getStateState()}append(e){this._threadBinding.getState().append(rs(this._threadBinding.getState().messages,e))}subscribe(e){return this._threadBinding.subscribe(e)}getModelContext(){return this._threadBinding.getState().getModelContext()}getModelConfig(){return this.getModelContext()}startRun(e){return this._threadBinding.getState().startRun(ra(null===e||"string"==typeof e?{parentId:e}:e))}cancelRun(){this._threadBinding.getState().cancelRun()}stopSpeaking(){return this._threadBinding.getState().stopSpeaking()}export(){return this._threadBinding.getState().export()}import(e){this._threadBinding.getState().import(e)}getMesssageByIndex(e){if(e<0)throw Error("Message index must be >= 0");return this._getMessageRuntime({...this.path,ref:this.path.ref+`${this.path.ref}.messages[${e}]`,messageSelector:{type:"index",index:e}},()=>{let t=this._threadBinding.getState().messages,n=t[e];if(n)return{message:n,parentId:t[e-1]?.id??null}})}getMesssageById(e){return this._getMessageRuntime({...this.path,ref:this.path.ref+`${this.path.ref}.messages[messageId=${JSON.stringify(e)}]`,messageSelector:{type:"messageId",messageId:e}},()=>this._threadBinding.getState().getMessageById(e))}_getMessageRuntime(e,t){return new ri(new nK({path:e,getState:()=>{let{message:e,parentId:n}=t()??{},{messages:r,speech:i}=this._threadBinding.getState();if(!e||void 0===n)return n$;let a=this._threadBinding.getState(),s=a.getBranches(e.id),o=a.getSubmittedFeedback(e.id);return{...e,[nJ]:e[nJ],isLast:r.at(-1)?.id===e.id,parentId:n,branchNumber:s.indexOf(e.id)+1,branchCount:s.length,speech:i?.messageId===e.id?i:void 0,submittedFeedback:o}},subscribe:e=>this._threadBinding.subscribe(e)}),this._threadBinding)}_eventSubscriptionSubjects=new Map;unstable_on(e,t){let n=this._eventSubscriptionSubjects.get(e);return n||(n=new n1({event:e,binding:this._threadBinding}),this._eventSubscriptionSubjects.set(e,n)),n.subscribe(t)}},ru=e=>({mainThreadId:e.mainThreadId,newThread:e.newThreadId,threads:e.threadIds,archivedThreads:e.archivedThreadIds}),rc=(e,t)=>{if(void 0===t)return n$;let n=e.getItemById(t);return n?{id:n.threadId,threadId:n.threadId,remoteId:n.remoteId,externalId:n.externalId,title:n.title,status:n.status,isMain:n.threadId===e.mainThreadId}:n$},rd=class{constructor(e,t=rl){this._core=e,this._runtimeFactory=t;let n=new nq({path:{},getState:()=>ru(e),subscribe:t=>e.subscribe(t)});this._getState=n.getState.bind(n),this._mainThreadListItemRuntime=new nW(new nK({path:{ref:"threadItems[main]",threadSelector:{type:"main"}},getState:()=>rc(this._core,this._core.mainThreadId),subscribe:e=>this._core.subscribe(e)}),this._core),this.main=new t(new re({path:{ref:"threads.main",threadSelector:{type:"main"}},getState:()=>e.getMainThreadRuntimeCore(),subscribe:t=>e.subscribe(t)}),this._mainThreadListItemRuntime)}_getState;__internal_bindMethods(){this.switchToThread=this.switchToThread.bind(this),this.switchToNewThread=this.switchToNewThread.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.getById=this.getById.bind(this),this.getItemById=this.getItemById.bind(this),this.getItemByIndex=this.getItemByIndex.bind(this),this.getArchivedItemByIndex=this.getArchivedItemByIndex.bind(this)}switchToThread(e){return this._core.switchToThread(e)}switchToNewThread(){return this._core.switchToNewThread()}getState(){return this._getState()}subscribe(e){return this._core.subscribe(e)}_mainThreadListItemRuntime;main;get mainItem(){return this._mainThreadListItemRuntime}getById(e){return new this._runtimeFactory(new re({path:{ref:"threads[threadId="+JSON.stringify(e)+"]",threadSelector:{type:"threadId",threadId:e}},getState:()=>this._core.getThreadRuntimeCore(e),subscribe:e=>this._core.subscribe(e)}),this.mainItem)}getItemByIndex(e){return new nW(new nK({path:{ref:`threadItems[${e}]`,threadSelector:{type:"index",index:e}},getState:()=>rc(this._core,this._core.threadIds[e]),subscribe:e=>this._core.subscribe(e)}),this._core)}getArchivedItemByIndex(e){return new nW(new nK({path:{ref:`archivedThreadItems[${e}]`,threadSelector:{type:"archiveIndex",index:e}},getState:()=>rc(this._core,this._core.archivedThreadIds[e]),subscribe:e=>this._core.subscribe(e)}),this._core)}getItemById(e){return new nW(new nK({path:{ref:`threadItems[threadId=${e}]`,threadSelector:{type:"threadId",threadId:e}},getState:()=>rc(this._core,e),subscribe:e=>this._core.subscribe(e)}),this._core)}},rh=class{constructor(e){this._core=e,this.threads=new rd(e.threads),this._thread=this.threads.main}threads;get threadList(){return this.threads}_thread;__internal_bindMethods(){this.switchToNewThread=this.switchToNewThread.bind(this),this.switchToThread=this.switchToThread.bind(this),this.registerModelContextProvider=this.registerModelContextProvider.bind(this),this.registerModelConfigProvider=this.registerModelConfigProvider.bind(this),this.reset=this.reset.bind(this)}get thread(){return this._thread}switchToNewThread(){return this._core.threads.switchToNewThread()}switchToThread(e){return this._core.threads.switchToThread(e)}registerModelContextProvider(e){return this._core.registerModelContextProvider(e)}registerModelConfigProvider(e){return this.registerModelContextProvider(e)}reset({initialMessages:e}={}){return this._core.threads.getMainThreadRuntimeCore().import(t4.fromArray(e??[]))}},rf=class extends tV{get RenderComponent(){return this.threads.__internal_RenderComponent}constructor(e){super(),this.threads=new nH(e,this._contextProvider)}},rp=e=>{let[t]=(0,f.useState)(()=>new rf(e));return(0,f.useEffect)(()=>{t.threads.__internal_setOptions(e),t.threads.__internal_load()},[t,e]),(0,f.useMemo)(()=>new rh(t),[t])},rm=e=>{try{let t=e.split(".")[1];if(!t)throw Error("Invalid JWT format");let n=t.replace(/-/g,"+").replace(/_/g,"/");for(;n.length%4!=0;)n+="=";let r=atob(n),i=JSON.parse(r).exp;if(!i||"number"!=typeof i)throw Error('JWT does not contain a valid "exp" field');return 1e3*i}catch(e){throw Error("Unable to determine the token expiry: "+e)}},rg=class{strategy="jwt";cachedToken=null;tokenExpiry=null;#e;constructor(e){this.#e=e}async getAuthHeaders(){let e=Date.now();if(this.cachedToken&&this.tokenExpiry&&this.tokenExpiry-e>3e4)return{Authorization:`Bearer ${this.cachedToken}`};let t=await this.#e();return!!t&&(this.cachedToken=t,this.tokenExpiry=rm(t),{Authorization:`Bearer ${t}`})}readAuthHeaders(e){let t=e.get("Authorization");if(!t)return;let[n,r]=t.split(" ");if("Bearer"!==n||!r)throw Error("Invalid auth header received");this.cachedToken=r,this.tokenExpiry=rm(r)}},ry=class{strategy="api-key";#t;#n;#r;constructor(e,t,n){this.#t=e,this.#n=t,this.#r=n}async getAuthHeaders(){return{Authorization:`Bearer ${this.#t}`,"Aui-User-Id":this.#n,"Aui-Workspace-Id":this.#r}}readAuthHeaders(){}},rv="aui:refresh_token",rb=class{strategy="anon";baseUrl;jwtStrategy;constructor(e){this.baseUrl=e,this.jwtStrategy=new rg(async()=>{let e=Date.now(),t=localStorage.getItem(rv),n=t?JSON.parse(t):void 0;if(n){if(new Date(n.expires_at).getTime()-e>3e4){let e=await fetch(`${this.baseUrl}/v1/auth/tokens/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refresh_token:n.token})});if(e.ok){let{access_token:t,refresh_token:n}=await e.json();return n&&localStorage.setItem(rv,JSON.stringify(n)),t}}else localStorage.removeItem(rv)}let r=await fetch(`${this.baseUrl}/v1/auth/tokens/anonymous`,{method:"POST"});if(!r.ok)return null;let{access_token:i,refresh_token:a}=await r.json();return i&&a?(localStorage.setItem(rv,JSON.stringify(a)),i):null})}async getAuthHeaders(){return this.jwtStrategy.getAuthHeaders()}readAuthHeaders(e){this.jwtStrategy.readAuthHeaders(e)}}
3,rx=class extends Error{constructor(e){super(e),this.name="APIError"}},r_=class{_auth;_baseUrl;constructor(e){if("authToken"in e)this._baseUrl=e.baseUrl,this._auth=new rg(e.authToken);else if("apiKey"in e)this._baseUrl="https://backend.assistant-api.com",this._auth=new ry(e.apiKey,e.userId,e.workspaceId);else if("anonymous"in e)this._baseUrl=e.baseUrl,this._auth=new rb(e.baseUrl);else throw Error("Invalid configuration: Must provide authToken, apiKey, or anonymous configuration")}async initializeAuth(){return!!this._auth.getAuthHeaders()}async makeRawRequest(e,t={}){let n=await this._auth.getAuthHeaders();if(!n)throw Error("Authorization failed");let r={...n,...t.headers,"Content-Type":"application/json"},i=new URLSearchParams;if(t.query)for(let[e,n]of Object.entries(t.query))!1!==n&&(!0===n?i.set(e,"true"):i.set(e,n.toString()));let a=new URL(`${this._baseUrl}/v1${e}`);a.search=i.toString();let s=await fetch(a,{method:t.method??"GET",headers:r,body:t.body?JSON.stringify(t.body):null});if(this._auth.readAuthHeaders(s.headers),!s.ok){let e=await s.text();try{let t=JSON.parse(e);throw new rx(t.message)}catch{throw Error(`Request failed with status ${s.status}, ${e}`)}}return s}async makeRequest(e,t={}){return(await this.makeRawRequest(e,t)).json()}},rw=class{constructor(e){this.cloud=e}async create(){return this.cloud.makeRequest("/auth/tokens",{method:"POST"})}},rk=class{constructor(e){this.cloud=e}async stream(e){let t=await this.cloud.makeRawRequest("/runs/stream",{method:"POST",headers:{Accept:"text/plain"},body:e});return nk.fromResponse(t,new nP)}},rS=class{constructor(e){this.cloud=e}async list(e){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}/messages`)}async create(e,t){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}/messages`,{method:"POST",body:t})}},rE=class{constructor(e){this.cloud=e,this.messages=new rS(e)}messages;async list(e){return this.cloud.makeRequest("/threads",{query:e})}async create(e){return this.cloud.makeRequest("/threads",{method:"POST",body:e})}async update(e,t){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}`,{method:"PUT",body:t})}async delete(e){return this.cloud.makeRequest(`/threads/${encodeURIComponent(e)}`,{method:"DELETE"})}},rT=class{threads;auth;runs;constructor(e){let t=new r_(e);this.threads=new rE(t),this.auth={tokens:new rw(t)},this.runs=new rk(t)}},rI=e=>({role:e.role,content:e.content.map(e=>{let t=e.type;switch(t){case"text":return{type:"text",text:e.text};case"reasoning":return{type:"reasoning",text:e.text};case"source":return e;case"tool-call":return!function e(t){return null===t||"string"==typeof t||"number"==typeof t||"boolean"==typeof t||(Array.isArray(t)?t.every(e):"object"==typeof t&&Object.entries(t).every(([t,n])=>"string"==typeof t&&e(n)))}(e.result)&&console.warn("tool-call result is not JSON! "+JSON.stringify(e)),{type:"tool-call",toolCallId:e.toolCallId,toolName:e.toolName,...JSON.stringify(e.args)===e.argsText?{args:e.args}:{argsText:e.argsText},...e.result?{result:e.result}:{},...e.isError?{isError:!0}:{}};default:throw Error(`Content part type not supported by aui/v0: ${t}`)}}),metadata:e.metadata,...e.status?{status:e.status?.type==="running"?{type:"incomplete",reason:"cancelled"}:e.status}:void 0}),rC=e=>{let t=e.content,n=t5({id:e.id,createdAt:e.created_at,...t},e.id,{type:"complete",reason:"unknown"});return{parentId:e.parent_id,message:n}},rA=class{constructor(e,t){this.cloudRef=e,this.threadListItemRuntime=t}_getIdForLocalId={};async append({parentId:e,message:t}){let{remoteId:n}=await this.threadListItemRuntime.initialize(),r=this.cloudRef.current.threads.messages.create(n,{parent_id:e?await this._getIdForLocalId[e]??e:null,format:"aui/v0",content:rI(t)}).then(({message_id:e})=>(this._getIdForLocalId[t.id]=e,e));return this._getIdForLocalId[t.id]=r,r.then(()=>{})}async load(){let e=this.threadListItemRuntime.getState().remoteId;if(!e)return{messages:[]};let{messages:t}=await this.cloudRef.current.threads.messages.list(e);return{messages:t.filter(e=>"aui/v0"===e.format).map(rC).reverse()}}},rR=e=>{let t=(0,ng.pK)(),[n]=(0,f.useState)(()=>new rA(e,t));return n},rP=(e,t={})=>e.map(e=>rO(e,t)),rO=(e,t={})=>{let n=t.unstable_includeId??!1,r=e.role;switch(r){case"assistant":return{role:r,content:e.content.map(e=>{if("reasoning"===e.type||"source"===e.type)return null;if("tool-call"===e.type){let{argsText:t,...n}=e;return n}return e}).filter(e=>!!e),...n?{unstable_id:e.id}:{}};case"user":return{role:r,content:[...e.content,...e.attachments.map(e=>e.content).flat()],...n?{unstable_id:e.id}:{}};case"system":return{role:r,content:e.content,...n?{unstable_id:e.id}:{}};default:throw Error(`Unknown message role: ${r}`)}},rM=class{list(){return Promise.resolve({threads:[]})}rename(){return Promise.resolve()}archive(){return Promise.resolve()}unarchive(){return Promise.resolve()}delete(){return Promise.resolve()}initialize(e){return Promise.resolve({remoteId:e,externalId:void 0})}generateTitle(){return Promise.resolve(new ReadableStream)}},rN=n(2818),rj=void 0!==rN&&rN?.env?.NEXT_PUBLIC_ASSISTANT_BASE_URL,rD=rj?new rT({baseUrl:rj,anonymous:!0}):void 0,rL=e=>{let t=(0,f.useRef)(e);(0,f.useEffect)(()=>{t.current=e},[e]);let n=(0,f.useCallback)(({children:e})=>{let n=rR({get current(){return t.current.cloud??rD}}),r=(0,f.useMemo)(()=>({history:n}),[n]);return(0,nu.jsx)(nd,{adapters:r,children:e})},[]),r=e.cloud??rD;return r?{list:async()=>{let{threads:e}=await r.threads.list();return{threads:e.map(e=>({status:e.is_archived?"archived":"regular",remoteId:e.id,title:e.title,externalId:e.external_id??void 0}))}},initialize:async()=>{let t=e.create?.()??Promise.resolve(),n=await t,i=n?n.externalId:void 0,{thread_id:a}=await r.threads.create({last_message_at:new Date,external_id:i});return{externalId:i,remoteId:a}},rename:async(e,t)=>r.threads.update(e,{title:t}),archive:async e=>r.threads.update(e,{is_archived:!0}),unarchive:async e=>r.threads.update(e,{is_archived:!1}),delete:async t=>(await e.delete?.(t),r.threads.delete(t)),generateTitle:async(e,t)=>r.runs.stream({thread_id:e,assistant_id:"system/thread_title",messages:rP(t)}),unstable_Provider:n}:new rM},rB=(e,t)=>{var n;let{initialMessages:r,...i}=t,{modelContext:a,...s}=null!==(n=nh())&&void 0!==n?n:{},o=(0,f.useMemo)(()=>({...i,adapters:{...s,...i.adapters,chatModel:e}}),[e,i,s]),[l]=(0,f.useState)(()=>new nl(o,r));return(0,f.useEffect)(()=>{l.threads.getMainThreadRuntimeCore().__internal_setOptions(o),l.threads.getMainThreadRuntimeCore().__internal_load()},[l,o]),(0,f.useEffect)(()=>
3{if(a)return l.registerModelContextProvider(a)},[a,l]),(0,f.useMemo)(()=>new rh(l),[l])},rF=function(e){let{cloud:t,...n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return rp({runtimeHook:()=>rB(e,n),adapter:rL({cloud:t})})};let rz=Symbol("Let zodToJsonSchema decide on which parser to use"),rU={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},rZ=e=>"string"==typeof e?{...rU,name:e}:{...rU,...e},rH=e=>{let t=rZ(e),n=void 0!==t.name?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}};function rV(e,t,n,r){r?.errorMessages&&n&&(e.errorMessage={...e.errorMessage,[t]:n})}function r$(e,t,n,r,i){e[t]=n,rV(e,t,r,i)}function rq(e,t){return ie(e.type._def,t)}let rW=(e,t)=>ie(e.innerType._def,t),rK=(e,t)=>{let n={type:"integer",format:"unix-time"};if("openApi3"===t.target)return n;for(let r of e.checks)switch(r.kind){case"min":r$(n,"minimum",r.value,r.message,t);break;case"max":r$(n,"maximum",r.value,r.message,t)}return n},rJ=e=>(!("type"in e)||"string"!==e.type)&&"allOf"in e,rY={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(void 0===i&&(i=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),i),ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function rG(e,t){let n={type:"string"};if(e.checks)for(let r of e.checks)switch(r.kind){case"min":r$(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,r.value):r.value,r.message,t);break;case"max":r$(n,"maxLength","number"==typeof n.maxLength?Math.min(n.maxLength,r.value):r.value,r.message,t);break;case"email":switch(t.emailStrategy){case"format:email":r0(n,"email",r.message,t);break;case"format:idn-email":r0(n,"idn-email",r.message,t);break;case"pattern:zod":r1(n,rY.email,r.message,t)}break;case"url":r0(n,"uri",r.message,t);break;case"uuid":r0(n,"uuid",r.message,t);break;case"regex":r1(n,r.regex,r.message,t);break;case"cuid":r1(n,rY.cuid,r.message,t);break;case"cuid2":r1(n,rY.cuid2,r.message,t);break;case"startsWith":r1(n,RegExp(`^${rX(r.value,t)}`),r.message,t);break;case"endsWith":r1(n,RegExp(`${rX(r.value,t)}$`),r.message,t);break;case"datetime":r0(n,"date-time",r.message,t);break;case"date":r0(n,"date",r.message,t);break;case"time":r0(n,"time",r.message,t);break;case"duration":r0(n,"duration",r.message,t);break;case"length":r$(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,r.value):r.value,r.message,t),r$(n,"maxLength","number"==typeof n.maxLength?Math.min(n.maxLength,r.value):r.value,r.message,t);break;case"includes":r1(n,RegExp(rX(r.value,t)),r.message,t);break;case"ip":"v6"!==r.version&&r0(n,"ipv4",r.message,t),"v4"!==r.version&&r0(n,"ipv6",r.message,t);break;case"base64url":r1(n,rY.base64url,r.message,t);break;case"jwt":r1(n,rY.jwt,r.message,t);break;case"cidr":"v6"!==r.version&&r1(n,rY.ipv4Cidr,r.message,t),"v4"!==r.version&&r1(n,rY.ipv6Cidr,r.message,t);break;case"emoji":r1(n,rY.emoji(),r.message,t);break;case"ulid":r1(n,rY.ulid,r.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":r0(n,"binary",r.message,t);break;case"contentEncoding:base64":r$(n,"contentEncoding","base64",r.message,t);break;case"pattern:zod":r1(n,rY.base64,r.message,t)}break;case"nanoid":r1(n,rY.nanoid,r.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return n}function rX(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let n=0;n<e.length;
3n++)rQ.has(e[n])||(t+="\\"),t+=e[n];return t}(e):e}let rQ=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function r0(e,t,n,r){e.format||e.anyOf?.some(e=>e.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&r.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.anyOf.push({format:t,...n&&r.errorMessages&&{errorMessage:{format:n}}})):r$(e,"format",t,n,r)}function r1(e,t,n,r){e.pattern||e.allOf?.some(e=>e.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&r.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.allOf.push({pattern:r2(t,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):r$(e,"pattern",r2(t,r),n,r)}function r2(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let n={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},r=n.i?e.source.toLowerCase():e.source,i="",a=!1,s=!1,o=!1;for(let e=0;e<r.length;e++){if(a){i+=r[e],a=!1;continue}if(n.i){if(s){if(r[e].match(/[a-z]/)){o?(i+=r[e],i+=`${r[e-2]}-${r[e]}`.toUpperCase(),o=!1):"-"===r[e+1]&&r[e+2]?.match(/[a-z]/)?(i+=r[e],o=!0):i+=`${r[e]}${r[e].toUpperCase()}`;continue}}else if(r[e].match(/[a-z]/)){i+=`[${r[e]}${r[e].toUpperCase()}]`;continue}}if(n.m){if("^"===r[e]){i+=`(^|(?<=[\r
4]))`;continue}if("$"===r[e]){i+=`($|(?=[\r
5]))`;continue}}if(n.s&&"."===r[e]){i+=s?`${r[e]}\r
6`:`[${r[e]}\r
7]`;continue}i+=r[e],"\\"===r[e]?a=!0:s&&"]"===r[e]?s=!1:s||"["!==r[e]||(s=!0)}try{new RegExp(i)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return i}function r5(e,t){if("openAi"===t.target&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),"openApi3"===t.target&&e.keyType?._def.typeName===h.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,r)=>({...n,[r]:ie(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",r]})??{}}),{}),additionalProperties:!1};let n={type:"object",additionalProperties:ie(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??{}};if("openApi3"===t.target)return n;if(e.keyType?._def.typeName===h.ZodString&&e.keyType._def.checks?.length){let{type:r,...i}=rG(e.keyType._def,t);return{...n,propertyNames:i}}if(e.keyType?._def.typeName===h.ZodEnum)return{...n,propertyNames:{enum:e.keyType._def.values}};if(e.keyType?._def.typeName===h.ZodBranded&&e.keyType._def.type._def.typeName===h.ZodString&&e.keyType._def.type._def.checks?.length){let{type:r,...i}=rq(e.keyType._def,t);return{...n,propertyNames:i}}return n}let r4={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"},r9=(e,t)=>{let n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>ie(e._def,{...t,currentPath:[...t.currentPath,"anyOf",`${n}`]})).filter(e=>!!e&&(!t.strictUnions||"object"==typeof e&&Object.keys(e).length>0));return n.length?{anyOf:n}:void 0},r6=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return ie(e.innerType._def,t);let n=ie(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return n?{anyOf:[{not:{}},n]}:{}},r3=(e,t)=>{if("input"===t.pipeStrategy)return ie(e.in._def,t);if("output"===t.pipeStrategy)return ie(e.out._def,t);let n=ie(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),r=ie(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,r].filter(e=>void 0!==e)}},r8=(e,t)=>ie(e.innerType._def,t),r7=(e,t,n)=>{switch(t){case h.ZodString:return rG(e,n);case h.ZodNumber:return function(e,t){let n={type:"number"};if(!e.checks)return n;for(let r of e.checks)switch(r.kind){case"int":n.type="integer",rV(n,"type",r.message,t);break;case"min":"jsonSchema7"===t.target?r.inclusive?r$(n,"minimum",r.value,r.message,t):r$(n,"exclusiveMinimum",r.value,r.message,t):(r.inclusive||(n.exclusiveMinimum=!0),r$(n,"minimum",r.value,r.message,t));break;case"max":"jsonSchema7"===t.target?r.inclusive?r$(n,"maximum",r.value,r.message,t):r$(n,"exclusiveMaximum",r.value,r.message,t):(r.inclusive||(n.exclusiveMaximum=!0),r$(n,"maximum",r.value,r.message,t));break;case"multipleOf":r$(n,"multipleOf",r.value,r.message,t)}return n}
7(e,n);case h.ZodObject:return function(e,t){let n="openAi"===t.target,r={type:"object",...Object.entries(e.shape()).reduce((e,[r,i])=>{if(void 0===i||void 0===i._def)return e;let a=i.isOptional();a&&n&&(i instanceof e9&&(i=i._def.innerType),i.isNullable()||(i=i.nullable()),a=!1);let s=ie(i._def,{...t,currentPath:[...t.currentPath,"properties",r],propertyPath:[...t.currentPath,"properties",r]});return void 0===s?e:{properties:{...e.properties,[r]:s},required:a?e.required:[...e.required,r]}},{properties:{},required:[]}),additionalProperties:"strict"===t.removeAdditionalStrategy?"ZodNever"===e.catchall._def.typeName?"strict"!==e.unknownKeys:ie(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??!0:"ZodNever"===e.catchall._def.typeName?"passthrough"===e.unknownKeys:ie(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??!0};return r.required.length||delete r.required,r}(e,n);case h.ZodBigInt:return function(e,t){let n={type:"integer",format:"int64"};if(!e.checks)return n;for(let r of e.checks)switch(r.kind){case"min":"jsonSchema7"===t.target?r.inclusive?r$(n,"minimum",r.value,r.message,t):r$(n,"exclusiveMinimum",r.value,r.message,t):(r.inclusive||(n.exclusiveMinimum=!0),r$(n,"minimum",r.value,r.message,t));break;case"max":"jsonSchema7"===t.target?r.inclusive?r$(n,"maximum",r.value,r.message,t):r$(n,"exclusiveMaximum",r.value,r.message,t):(r.inclusive||(n.exclusiveMaximum=!0),r$(n,"maximum",r.value,r.message,t));break;case"multipleOf":r$(n,"multipleOf",r.value,r.message,t)}return n}(e,n);case h.ZodBoolean:return{type:"boolean"};case h.ZodDate:return function e(t,n,r){let i=r??n.dateStrategy;if(Array.isArray(i))return{anyOf:i.map((r,i)=>e(t,n,r))};switch(i){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return rK(t,n)}}(e,n);case h.ZodUndefined:return{not:{}};case h.ZodNull:return"openApi3"===n.target?{enum:["null"],nullable:!0}:{type:"null"};case h.ZodArray:return function(e,t){let n={type:"array"};return e.type?._def&&e.type?._def?.typeName!==h.ZodAny&&(n.items=ie(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&r$(n,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&r$(n,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(r$(n,"minItems",e.exactLength.value,e.exactLength.message,t),r$(n,"maxItems",e.exactLength.value,e.exactLength.message,t)),n}(e,n);case h.ZodUnion:case h.ZodDiscriminatedUnion:return function(e,t){if("openApi3"===t.target)return r9(e,t);let n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in r4&&(!e._def.checks||!e._def.checks.length))){let e=n.reduce((e,t)=>{let n=r4[t._def.typeName];return n&&!e.includes(n)?[...e,n]:e},[]);return{type:e.length>1?e:e[0]}}if(n.every(e=>"ZodLiteral"===e._def.typeName&&!e.description)){let e=n.reduce((e,t)=>{let n=typeof t._def.value;switch(n){case"string":case"number":case"boolean":return[...e,n];case"bigint":return[...e,"integer"];case"object":if(null===t._def.value)return[...e,"null"];default:return e}},[]);if(e.length===n.length){let t=e.filter((e,t,n)=>n.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:n.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(n.every(e=>"ZodEnum"===e._def.typeName))return{type:"string",enum:n.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return r9(e,t)}(e,n);case h.ZodIntersection:return function(e,t){let n=[ie(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),ie(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(e=>!!e),r="jsonSchema2019-09"===t.target?{unevaluatedProperties:!1}:void 0,i=[];return n.forEach(e=>{if(rJ(e))i.push(...e.allOf),void 0===e.unevaluatedProperties&&(r=void 0);else{let t=e;if("additionalProperties"in e&&!1===e.additionalProperties){let{additionalProperties:n,...r}=e;t=r}else r=void 0;i.push(t)}}),i.length?{allOf:i,...r}:void 0}(e,n);case h.ZodTuple:return function(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,n)=>ie(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>
7void 0===t?e:[...e,t],[]),additionalItems:ie(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>ie(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])}}(e,n);case h.ZodRecord:return r5(e,n);case h.ZodLiteral:return function(e,t){let n=typeof e.value;return"bigint"!==n&&"number"!==n&&"boolean"!==n&&"string"!==n?{type:Array.isArray(e.value)?"array":"object"}:"openApi3"===t.target?{type:"bigint"===n?"integer":n,enum:[e.value]}:{type:"bigint"===n?"integer":n,const:e.value}}(e,n);case h.ZodEnum:return{type:"string",enum:Array.from(e.values)};case h.ZodNativeEnum:return function(e){let t=e.values,n=Object.keys(e.values).filter(e=>"number"!=typeof t[t[e]]).map(e=>t[e]),r=Array.from(new Set(n.map(e=>typeof e)));return{type:1===r.length?"string"===r[0]?"string":"number":["string","number"],enum:n}}(e);case h.ZodNullable:return function(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return"openApi3"===t.target?{type:r4[e.innerType._def.typeName],nullable:!0}:{type:[r4[e.innerType._def.typeName],"null"]};if("openApi3"===t.target){let n=ie(e.innerType._def,{...t,currentPath:[...t.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let n=ie(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}(e,n);case h.ZodOptional:return r6(e,n);case h.ZodMap:return function(e,t){return"record"===t.mapStrategy?r5(e,t):{type:"array",maxItems:125,items:{type:"array",items:[ie(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||{},ie(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||{}],minItems:2,maxItems:2}}}
7(e,n);case h.ZodSet:return function(e,t){let n={type:"array",uniqueItems:!0,items:ie(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&r$(n,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&r$(n,"maxItems",e.maxSize.value,e.maxSize.message,t),n}(e,n);case h.ZodLazy:return()=>e.getter()._def;case h.ZodPromise:return ie(e.type._def,n);case h.ZodNaN:case h.ZodNever:return{not:{}};case h.ZodEffects:return function(e,t){return"input"===t.effectStrategy?ie(e.schema._def,t):{}}(e,n);case h.ZodAny:case h.ZodUnknown:return{};case h.ZodDefault:return function(e,t){return{...ie(e.innerType._def,t),default:e.defaultValue()}}(e,n);case h.ZodBranded:return rq(e,n);case h.ZodReadonly:return r8(e,n);case h.ZodCatch:return rW(e,n);case h.ZodPipeline:return r3(e,n);case h.ZodFunction:case h.ZodVoid:case h.ZodSymbol:default:return}};function ie(e,t,n=!1){let r=t.seen.get(e);if(t.override){let i=t.override?.(e,t,r,n);if(i!==rz)return i}if(r&&!n){let e=it(r,t);if(void 0!==e)return e}let i={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,i);let a=r7(e,e.typeName,t),s="function"==typeof a?ie(a(),t):a;if(s&&ii(e,t,s),t.postProcess){let n=t.postProcess(s,e,t);return i.jsonSchema=s,n}return i.jsonSchema=s,s}let it=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:ir(t.currentPath,e.path)};case"none":case"seen":if(e.path.length<t.currentPath.length&&e.path.every((e,n)=>t.currentPath[n]===e))return console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),{};return"seen"===t.$refStrategy?{}:void 0}},ir=(e,t)=>
7{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join("/")},ii=(e,t,n)=>(e.description&&(n.description=e.description,t.markdownDescription&&(n.markdownDescription=e.description)),n),ia=(e,t)=>{let n=rH(t),r="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,r])=>({...e,[t]:ie(r._def,{...n,currentPath:[...n.basePath,n.definitionPath,t]},!0)??{}}),{}):void 0,i="string"==typeof t?t:t?.nameStrategy==="title"?void 0:t?.name,a=ie(e._def,void 0===i?n:{...n,currentPath:[...n.basePath,n.definitionPath,i]},!1)??{},s="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==s&&(a.title=s);let o=void 0===i?r?{...a,[n.definitionPath]:r}:a:{$ref:[..."relative"===n.$refStrategy?[]:n.basePath,n.definitionPath,i].join("/"),[n.definitionPath]:{...r,[i]:a}};return"jsonSchema7"===n.target?o.$schema="http://json-schema.org/draft-07/schema#":("jsonSchema2019-09"===n.target||"openAi"===n.target)&&(o.$schema="https://json-schema.org/draft/2019-09/schema#"),"openAi"===n.target&&("anyOf"in o||"oneOf"in o||"allOf"in o||"type"in o&&Array.isArray(o.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),o};var is=e=>Object.entries(e).map(([e,t])=>({type:"function",name:e,...t.description?{description:t.description}:void 0,parameters:t.parameters instanceof tU.ZodType?ia(t.parameters):t.parameters})),io=(e=>(e.TextDelta="0",e.Data="2",e.Error="3",e.Annotation="8",e.ToolCall="9",e.ToolCallResult="a",e.ToolCallBegin="b",e.ToolCallDelta="c",e.FinishMessage="d",e.FinishStep="e",e.StartStep="f",e.ReasoningDelta="g",e.Source="h",e))(io||{}),il=class extends TransformStream{constructor(e){super(),Object.defineProperty(this,"readable",{value:e(super.readable),writable:!1})}},iu=e=>{let t=e.indexOf(":");if(-1===t)throw Error("Invalid stream part");return{type:e.slice(0,t),value:JSON.parse(e.slice(t+1))}},ic=(e,t)=>{let n=e.content??[],r=e.content?.at(-1);return r?.type!=="reasoning"?r={type:"reasoning",text:t}:(n=n.slice(0,-1),r={type:"reasoning",text:r.text+t}),{...e,content:n.concat([r])}},id=(e,t)=>{let n=e.content??[],r=e.content?.at(-1);return r?.type!=="text"?r={type:"text",text:t}:(n=n.slice(0,-1),r={type:"text",text:r.text+t}),{...e,content:n.concat([r])}},ih=(e,t,n,r)=>{let i=e.content??[],a=i.findIndex(e=>"tool-call"===e.type&&e.toolCallId===t),s=-1===a?null:i[a];if(null==s)i=[...i,s={type:"tool-call",toolCallId:t,toolName:n,argsText:r,args:r?t0(r):{}}];else{let e=s.argsText+r;s={...s,argsText:e,args:r?t0(e):{}},i=[...i.slice(0,a),s,...i.slice(a+1)]}return{...e,content:i}},ip=(e,t,n,r)=>{let i=!1,a=e.content?.map(e=>{if("tool-call"!==e.type||e.toolCallId!==t)return e;if(i=!0,e.toolName!==n)throw Error(`Tool call ${t} found with tool name ${e.toolName}, but expected ${n}`);return{...e,result:r}});if(!i)throw Error(`Received tool result for unknown tool call "${n}" / "${t}". This is likely an internal bug in assistant-ui.`);return{...e,content:a}},im=(e,t)=>({...e,metadata:{...e.metadata,unstable_annotations:[...e.metadata?.unstable_annotations??[],...t.annotations]}}),ig=(e,t)=>({...e,metadata:{...e.metadata,unstable_data:[...e.metadata?.unstable_data??[],...t.data]}}),iy=(e,t)=>{let{type:n,...r}=t,i=[...e.metadata?.steps??[],{usage:r.usage}];return{...e,metadata:{...e.metadata,steps:i}}},iv=(e,t)=>{let{type:n,...r}=t,i=[...e.metadata?.steps??[],{logprobs:r.logprobs,usage:r.usage}];return{...e,status:ix(t),metadata:{...e.metadata,steps:i}}},ib=(e,t)=>({...e,content:[...e.content,{type:"source",...t.source}]}),ix=e=>"tool-calls"===e.finishReason?{type:"requires-action",reason:"tool-calls"}:"stop"===e.finishReason||"unknown"===e.finishReason?{type:"complete",reason:e.finishReason}:{type:"incomplete",reason:e.finishReason},i_=e=>({...e,status:{type:"incomplete",reason:"cancelled"}}),iw=()=>{let e=[],t={role:"assistant",content:[]},n={role:"tool",content:[]};return{addTextContentPart:r=>{n.content.length>0&&(e.push(t),e.push(n),t={role:"assistant",content:[]},n={role:"tool",content:[]}),t.content.push(r)},addToolCallPart:e=>{t.content.push({type:"tool-call",toolCallId:e.toolCallId,toolName:e.toolName,args:e.args}),n.content.push({type:"tool-result",toolCallId:e.toolCallId,toolName:e.toolName,result:void 0===e.result?"Error: tool is has no configured code to run":e.result,isError:e.isError??void 0===e.result})},getMessages:()=>n.content.length>0?[...e,t,n]:[...e,t]}}
7,ik=e=>Object.fromEntries(Object.entries(e).map(([e,t])=>[e,{...t.description?{description:t.description}:void 0,parameters:t.parameters instanceof tU.ZodType?ia(t.parameters):t.parameters}])),iS=class{constructor(e){this.options=e}async *run({messages:e,runConfig:t,abortSignal:n,context:r,unstable_assistantMessageId:i,unstable_getMessage:a}){let s=new Headers(this.options.headers);s.set("Content-Type","application/json");let o=await fetch(this.options.api,{method:"POST",headers:s,credentials:this.options.credentials??"same-origin",body:JSON.stringify({system:r.system,messages:this.options.unstable_AISDKInterop?function(e,t={}){let n=t.unstable_includeId??!1;return e.flatMap(e=>{let t=e.role;switch(t){case"system":return[{...n?{unstable_id:e.id}:{},role:"system",content:e.content[0].text}];case"user":{let t="attachments"in e?e.attachments:[],r=[...e.content,...t.map(e=>e.content).flat()];return[{...n?{unstable_id:e.id}:{},role:"user",content:r.map(e=>{let t=e.type;switch(t){case"text":return e;case"image":return{type:"image",image:new URL(e.image)};case"file":return{type:"file",data:new URL(e.data),mimeType:e.mimeType};default:throw Error(`Unspported content part type: ${t}`)}})}]}case"assistant":{let t=iw();for(let n of e.content){let e=n.type;switch(e){case"reasoning":case"source":break;case"text":t.addTextContentPart(n);break;case"tool-call":t.addToolCallPart(n);break;default:throw Error(`Unhandled content part type: ${e}`)}}return t.getMessages()}default:throw Error(`Unknown message role: ${t}`)}})}(e,{unstable_includeId:this.options.unstable_sendMessageIds||this.options.sendExtraMessageFields}):rP(e,{unstable_includeId:this.options.unstable_sendMessageIds||this.options.sendExtraMessageFields}),tools:r.tools?"v2"===this.options.unstable_AISDKInterop?ik(r.tools):is(r.tools):[],unstable_assistantMessageId:i,runConfig:t,...r.callSettings,...r.config,...this.options.body}),signal:n});await this.options.onResponse?.(o);try{var l;let e,t;if(!o.ok)throw Error(`Status ${o.status}: ${await o.text()}`);for await(e of(l=o.body.pipeThrough(function(){let e=new TransformStream({transform(e,t){t.enqueue(iu(e))}});return new il(t=>{let n;return t.pipeThrough(new TextDecoderStream).pipeThrough((n="",new TransformStream({transform(e,t){let r=(n+=e).split("\n");for(let e=0;e<r.length-1;e++)t.enqueue(r[e]);n=r[r.length-1]},flush(e){n&&e.enqueue(n)}}))).pipeThrough(e)})}()).pipeThrough(function(){let e;let t=new Map,n=t=>{e&&(t.enqueue({type:"tool-call",toolCallType:"function",toolCallId:e.id,toolName:e.name,args:e.argsText}),e=void 0)};return new TransformStream({transform({type:r,value:i},a){switch(r!==io.ToolCallDelta&&r!==io.Error&&n(a),r){case io.TextDelta:a.enqueue({type:"text-delta",textDelta:i});break;case io.ToolCallBegin:{let{toolCallId:n,toolName:r}=i;t.set(n,r),e={id:n,name:r,argsText:""},a.enqueue({type:"tool-call-delta",toolCallType:"function",toolCallId:n,toolName:r,argsTextDelta:""});break}case io.ToolCallDelta:{let{toolCallId:n,argsTextDelta:r}=i,s=t.get(n);e?.id===n&&(e.argsText+=r),a.enqueue({type:"tool-call-delta",toolCallType:"function",toolCallId:n,toolName:s,argsTextDelta:r});break}case io.ToolCallResult:a.enqueue({type:"tool-result",toolCallType:"function",toolCallId:i.toolCallId,toolName:t.get(i.toolCallId),result:i.result});break;case io.FinishMessage:a.enqueue({type:"finish",...i});break;case io.Error:a.enqueue({type:"error",error:i});break;case io.ToolCall:{let{toolCallId:e,toolName:n,args:r}=i;t.set(e,n);let s=JSON.stringify(r);a.enqueue({type:"tool-call-delta",toolCallType:"function",toolCallId:e,toolName:n,argsTextDelta:s}),a.enqueue({type:"tool-call",toolCallType:"function",toolCallId:e,toolName:n,args:s});break}case io.FinishStep:a.enqueue({type:"step-finish",...i});break;case io.Annotation:a.enqueue({type:"annotations",annotations:i});break;case io.Data:a.enqueue({type:"data",data:i});break;case io.Source:a.enqueue({type:"source",source:i});break;case io.ReasoningDelta:case io.StartStep:break;default:throw Error(`Unhandled chunk type: ${r}`)}},flush(e){n(e)}})}()).pipeThrough(function(e,t){let n=new Map;return new TransformStream({transform(r,i){i.enqueue(r);let a=r.type;switch(a){case"tool-call":{let a;let{toolCallId:s,toolCallType:o,toolName:l,args:u}=r,c=e?.[l];
7if(!c||!c.execute)return;try{a=tX.parse(u)}catch(e){i.enqueue({type:"tool-result",toolCallType:o,toolCallId:s,toolName:l,result:"Function parameter parsing failed. "+JSON.stringify(e.message),isError:!0});return}n.set(s,(async()=>{if(!c.execute)return;let e=c.execute;if(c.parameters instanceof tU.ZodType){let t=c.parameters.safeParse(a);t.success||(e=c.experimental_onSchemaValidationError??(()=>{throw"Function parameter validation failed. "+JSON.stringify(t.error.issues)}))}try{let n=await e(a,{toolCallId:s,abortSignal:t});i.enqueue({type:"tool-result",toolCallType:o,toolCallId:s,toolName:l,result:void 0===n?"<no result>":n})}catch(e){i.enqueue({type:"tool-result",toolCallType:o,toolCallId:s,toolName:l,result:"Error: "+e,isError:!0})}finally{n.delete(s)}})());break}case"text-delta":case"reasoning":case"source":case"tool-call-delta":case"tool-result":case"step-finish":case"finish":case"error":case"response-metadata":case"annotations":case"data":break;default:throw Error(`Unhandled chunk type: ${a}`)}},async flush(){await Promise.all(n.values())}})}(r.tools,n)).pipeThrough((t={content:[],status:{type:"running"}},new TransformStream({transform(e,n){let r=e.type;switch(r){case"reasoning":t=ic(t,e.textDelta),n.enqueue(t);break;case"text-delta":t=id(t,e.textDelta),n.enqueue(t);break;case"tool-call-delta":{let{toolCallId:r,toolName:i,argsTextDelta:a}=e;t=ih(t,r,i,a),n.enqueue(t);break}case"tool-call":case"response-metadata":break;case"annotations":t=im(t,e),n.enqueue(t);break;case"data":t=ig(t,e),n.enqueue(t);break;case"source":t=ib(t,e),n.enqueue(t);break;case"tool-result":t=ip(t,e.toolCallId,e.toolName,e.result),n.enqueue(t);break;case"step-finish":t=iy(t,e),n.enqueue(t);break;case"finish":t=iv(t,e),n.enqueue(t);break;case"error":if(e.error instanceof Error&&"AbortError"===e.error.name){t=i_(t),n.enqueue(t);break}throw e.error;default:throw Error(`Unhandled chunk type: ${r}`)}},flush(e){if(t.status?.type==="running"){let n=t.content?.at(-1)?.type==="tool-call";t=iv(t,{type:"finish",finishReason:n?"tool-calls":"unknown",usage:{promptTokens:0,completionTokens:0}}),e.enqueue(t)}}}))),{[Symbol.asyncIterator]:()=>{let e=l.getReader();return{async next(){let{done:t,value:n}=await e.read();return t?{done:!0,value:void 0}:{done:!1,value:n}}}}}))yield e;if(void 0===e)throw Error("No data received from Edge Runtime");this.options.onFinish?.(a())}catch(e){throw this.options.onError?.(e),e}}},iE=e=>{let{cloud:t,initialMessages:n,maxSteps:r,adapters:i,unstable_humanToolNames:a,...s}=e;return{localRuntimeOptions:{cloud:t,initialMessages:n,maxSteps:r,adapters:i,unstable_humanToolNames:a},otherOptions:s}},iT=e=>{let{localRuntimeOptions:t,otherOptions:n}=iE(e);return rF(new iS(n),t)},iI=(Symbol("internal-rsc-extras"),e=>new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(r.result),r.onerror=e=>n(e),r.readAsDataURL(e)})),iC=e=>iT({...e,unstable_AISDKInterop:"v2"})},95714:e=>{!function(){var t={675:function(e,t){"use strict";t.byteLength=function(e){var t=l(e),n=t[0],r=t[1];return(n+r)*3/4-r},t.toByteArray=function(e){var t,n,a=l(e),s=a[0],o=a[1],u=new i((s+o)*3/4-o),c=0,d=o>0?s-4:s;for(n=0;n<d;n+=4)t=r[e.charCodeAt(n)]<<18|r[e.charCodeAt(n+1)]<<12|r[e.charCodeAt(n+2)]<<6|r[e.charCodeAt(n+3)],u[c++]=t>>16&255,u[c++]=t>>8&255,u[c++]=255&t;return 2===o&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,u[c++]=255&t),1===o&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,u[c++]=t>>8&255,u[c++]=255&t),u},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,a=[],s=0,o=r-i;s<o;s+=16383)a.push(function(e,t,r){for(var i,a=[],s=t;s<r;s+=3)i=(e[s]<<16&0xff0000)+(e[s+1]<<8&65280)+(255&e[s+2]),a.push(n[i>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return a.join("")}(e,s,s+16383>o?o:s+16383));return 1===i?a.push(n[(t=e[r-1])>>2]+n[t<<4&63]+"=="):2===i&&a.push(n[(t=(e[r-2]<<8)+e[r-1])>>10]+n[t>>4&63]+n[t<<2&63]+"="),a.join("")};for(var n=[],r=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,o=a.length;s<o;++s)n[s]=a[s],r[a.charCodeAt(s)]=s;function l(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");-1===n&&(n=t);var r=n===t?0:4-n%4;return[n,r]}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},72:function(e,t,n){"use strict";var r=n(675),i=n(783),a="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function s(e){if(e>
70x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,o.prototype),t}function o(e,t,n){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return c(e)}return l(e,t,n)}function l(e,t,n){if("string"==typeof e)return function(e,t){if(("string"!=typeof t||""===t)&&(t="utf8"),!o.isEncoding(t))throw TypeError("Unknown encoding: "+t);var n=0|f(e,t),r=s(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}(e,t);if(ArrayBuffer.isView(e))return d(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(A(e,ArrayBuffer)||e&&A(e.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&(A(e,SharedArrayBuffer)||e&&A(e.buffer,SharedArrayBuffer)))return function(e,t,n){var r;if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),o.prototype),r}(e,t,n);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return o.from(r,t,n);var i=function(e){if(o.isBuffer(e)){var t=0|h(e.length),n=s(t);return 0===n.length||e.copy(n,0,0,t),n}return void 0!==e.length?"number"!=typeof e.length||function(e){return e!=e}(e.length)?s(0):d(e):"Buffer"===e.type&&Array.isArray(e.data)?d(e.data):void 0}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.from(e[Symbol.toPrimitive]("string"),t,n);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return u(e),s(e<0?0:0|h(e))}function d(e){for(var t=e.length<0?0:0|h(e.length),n=s(t),r=0;r<t;r+=1)n[r]=255&e[r];return n}t.Buffer=o,t.SlowBuffer=function(e){return+e!=e&&(e=0),o.alloc(+e)},t.INSPECT_MAX_BYTES=50,t.kMaxLength=0x7fffffff,o.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),o.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(e,t,n){return l(e,t,n)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(e,t,n){return(u(e),e<=0)?s(e):void 0!==t?"string"==typeof n?s(e).fill(t,n):s(e).fill(t):s(e)},o.allocUnsafe=function(e){return c(e)},o.allocUnsafeSlow=function(e){return c(e)};function h(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function f(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||A(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return E(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return I(e).length;default:if(i)return r?-1:E(e).length;t=(""+t).toLowerCase(),i=!0}}function p(e,t,n){var i,a,s,o=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===n||n>this.length)&&(n=this.length),n<=0||(n>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",a=t;a<n;
vendor: 14,101 bytes, line 7
7++a)i+=R[e[a]];return i}(this,t,n);case"utf8":case"utf-8":return v(this,t,n);case"ascii":return function(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}(this,t,n);case"latin1":case"binary":return function(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}(this,t,n);case"base64":return i=this,a=t,s=n,0===a&&s===i.length?r.fromByteArray(i):r.fromByteArray(i.slice(a,s));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,n){for(var r=e.slice(t,n),i="",a=0;a<r.length;a+=2)i+=String.fromCharCode(r[a]+256*r[a+1]);return i}(this,t,n);default:if(o)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0}}function m(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function g(e,t,n,r,i){var a;if(0===e.length)return -1;if("string"==typeof n?(r=n,n=0):n>0x7fffffff?n=0x7fffffff:n<-0x80000000&&(n=-0x80000000),(a=n*=1)!=a&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return -1;n=e.length-1}else if(n<0){if(!i)return -1;n=0}if("string"==typeof t&&(t=o.from(t,r)),o.isBuffer(t))return 0===t.length?-1:y(e,t,n,r,i);if("number"==typeof t)return(t&=255,"function"==typeof Uint8Array.prototype.indexOf)?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):y(e,[t],n,r,i);throw TypeError("val must be string, number or Buffer")}function y(e,t,n,r,i){var a,s=1,o=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return -1;s=2,o/=2,l/=2,n/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var c=-1;for(a=n;a<o;a++)if(u(e,a)===u(t,-1===c?0:a-c)){if(-1===c&&(c=a),a-c+1===l)return c*s}else -1!==c&&(a-=a-c),c=-1}else for(n+l>o&&(n=o-l),a=n;a>=0;a--){for(var d=!0,h=0;h<l;h++)if(u(e,a+h)!==u(t,h)){d=!1;break}if(d)return a}return -1}o.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==o.prototype},o.compare=function(e,t){if(A(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),A(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var n=e.length,r=t.length,i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},o.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return o.alloc(0);if(void 0===t)for(n=0,t=0;n<e.length;++n)t+=e[n].length;var n,r=o.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var a=e[n];if(A(a,Uint8Array)&&(a=o.from(a)),!o.isBuffer(a))throw TypeError('"list" argument must be an Array of Buffers');a.copy(r,i),i+=a.length}return r},o.byteLength=f,o.prototype._isBuffer=!0,o.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)m(this,t,t+1);return this},o.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},o.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},o.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?v(this,0,e):p.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(e){if(!o.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===o.compare(this,e)},o.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(e+=" ... "),"<Buffer "+e+">"},a&&(o.prototype[a]=o.prototype.inspect),o.prototype.compare=function(e,t,n,r,i){if(A(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return -1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;for(var a=i-r,s=n-t,l=Math.min(a,s),u=this.slice(r,i),c=e.slice(t,n),d=0;d<l;++d)if(u[d]!==c[d]){a=u[d],s=c[d];break}return a<s?-1:+(s<a)},o.prototype.includes=function(e,t,n){return -1!==this.indexOf(e,t,n)},o.prototype.indexOf=function(e,t,n){return g(this,e,t,n,!0)},o.prototype.lastIndexOf=function(e,t,n){return g(this,e,t,n,!1)};function v(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var a,s,o,l,u=e[i],c=null,d=u>239?4:u>223?3:u>191?2:1;if(i+d<=n)switch(d){case 1:u<128&&(c=u);break;case 2:(192&(a=e[i+1]))==128&&(l=(31&u)<<6|63&a)>127&&(c=l);break;case 3:a=e[i+1],s=e[i+2],(192&a)==128&&(192&s)==128&&(l=(15&u)<<12|(63&a)<<6|63&s)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:a=e[i+1],s=e[i+2],o=e[i+3],(192&a)==128&&(192&s)==128&&(192&o)==128&&(l=(15&u)<<18|(63&a)<<12|(63&s)<<6|63&o)>65535&&l<1114112&&(c=l)}null===c?(c=65533,d=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=d}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);for(var n="",r=0;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=4096));return n}(r)}function b(e,t,n){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>n)throw RangeError("Trying to access beyond buffer length")}function x(e,t,n,r,i,a){if(!o.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw RangeError('"value" argument is out of bounds');if(n+r>e.length)throw RangeError("Index out of range")}function _(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError("Index out of range")}function w(e,t,n,r,a){return t*=1,n>>>=0,a||_(e,t,n,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,n,r,23,4),n+4}function k(e,t,n,r,a){return t*=1,n>>>=0,a||_(e,t,n,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,n,r,52,8),n+8}o.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i,a,s,o,l,u,c,d,h=this.length-t;if((void 0===n||n>h)&&(n=h),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var f=!1;;)switch(r){case"hex":return function(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var a=t.length;r>a/2&&(r=a/2);for(var s=0;s<r;++s){var o,l=parseInt(t.substr(2*s,2),16);if((o=l)!=o)break;e[n+s]=l}return s}(this,e,t,n);case"utf8":case"utf-8":return i=t,a=n,C(E(e,this.length-i),this,i,a);case"ascii":return s=t,o=n,C(T(e),this,s,o);case"latin1":case"binary":return function(e,t,n,r){return C(T(t),e,n,r)}(this,e,t,n);case"base64":return l=t,u=n,C(I(e),this,l,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c=t,d=n,C(function(e,t){for(var n,r,i=[],a=0;a<e.length&&!((t-=2)<0);++a)r=(n=e.charCodeAt(a))>>8,i.push(n%256),i.push(r);return i}(e,this.length-c),this,c,d);default:if(f)throw TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),f=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},o.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,e<0?(e+=n)<0&&(e=0):e>n&&(e=n),t<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);var r=this.subarray(e,t);return Object.setPrototypeOf(r,o.prototype),r},o.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||b(e,t,this.length);for(var r=this[e],i=1,a=0;++a<t&&(i*=256);)r+=this[e+a]*i;return r},o.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||b(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},o.prototype.readUInt8=function(e,t){return e>>>=0,t||b(e,1,this.length),this[e]},o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},o.prototype.readUInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||b(e,t,this.length);for(var r=this[e],i=1,a=0;++a<t&&(i*=256);)r+=this[e+a]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},o.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||b(e,t,this.length);for(var r=t,i=1,a=this[e+--r];r>0&&(i*=256);)a+=this[e+--r]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},o.prototype.readInt8=function(e,t){return(e>>>=0,t||b(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||b(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?0xffff0000|n:n},o.prototype.readInt16BE=function(e,t){e>>>=0,t||b(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?0xffff0000|n:n},o.prototype.readInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readFloatLE=function(e,t){return e>>>=0,t||b(e,4,this.length),i.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e>>>=0,t||b(e,4,this.length),i.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e>>>=0,t||b(e,8,this.length),i.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e>>>=0,t||b(e,8,this.length),i.read(this,e,!1,52,8)},o.prototype.writeUIntLE=function(e,t,n,r){if(e*=1,t>>>=0,n>>>=0,!r){var i=Math.pow(2,8*n)-1;x(this,e,t,n,i,0)}var a=1,s=0;for(this[t]=255&e;++s<n&&(a*=256);)this[t+s]=e/a&255;return t+n},o.prototype.writeUIntBE=function(e,t,n,r){if(e*=1,t>>>=0,n>>>=0,!r){var i=Math.pow(2,8*n)-1;x(this,e,t,n,i,0)}var a=n-1,s=1;for(this[t+a]=255&e;--a>=0&&(s*=256);)this[t+a]=e/s&255;return t+n},o.prototype.writeUInt8=function(e,t,n){return e*=1,t>>>=0,n||x(this,e,t,1,255,0),this[t]=255&e,t+1},o.prototype.writeUInt16LE=function(e,t,n){return e*=1,t>>>=0,n||x(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeUInt16BE=function(e,t,n){return e*=1,t>>>=0,n||x(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeUInt32LE=function(e,t,n){return e*=1,t>>>=0,n||x(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},o.prototype.writeUInt32BE=function(e,t,n){return e*=1,t>>>=0,n||x(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeIntLE=function(e,t,n,r){if(e*=1,t>>>=0,!r){var i=Math.pow(2,8*n-1);x(this,e,t,n,i-1,-i)}var a=0,s=1,o=0;for(this[t]=255&e;++a<n&&(s*=256);)e<0&&0===o&&0!==this[t+a-1]&&(o=1),this[t+a]=(e/s>>0)-o&255;return t+n},o.prototype.writeIntBE=function(e,t,n,r){if(e*=1,t>>>=0,!r){var i=Math.pow(2,8*n-1);x(this,e,t,n,i-1,-i)}var a=n-1,s=1,o=0;for(this[t+a]=255&e;--a>=0&&(s*=256);)e<0&&0===o&&0!==this[t+a+1]&&(o=1),this[t+a]=(e/s>>0)-o&255;return t+n},o.prototype.writeInt8=function(e,t,n){return e*=1,t>>>=0,n||x(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,n){return e*=1,t>>>=0,n||x(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,n){return e*=1,t>>>=0,n||x(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeInt32LE=function(e,t,n){return e*=1,t>>>=0,n||x(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},o.prototype.writeInt32BE=function(e,t,n){return e*=1,t>>>=0,n||x(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeFloatLE=function(e,t,n){return w(this,e,t,!0,n)},o.prototype.writeFloatBE=function(e,t,n){return w(this,e,t,!1,n)},o.prototype.writeDoubleLE=function(e,t,n){return k(this,e,t,!0,n)},o.prototype.writeDoubleBE=function(e,t,n){return k(this,e,t,!1,n)},o.prototype.copy=function(e,t,n,r){if(!o.isBuffer(e))throw TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw RangeError("Index out of range");if(r<0)throw RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i=r-n;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,n,r);else if(this===e&&n<t&&t<r)for(var a=i-1;a>=0;--a)e[a+t]=this[a+n];else Uint8Array.prototype.set.call(e,this.subarray(n,r),t);return i},o.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw TypeError("encoding must be a string");if("string"==typeof r&&!o.isEncoding(r))throw TypeError("Unknown encoding: "+r);if(1===e.length){var i,a=e.charCodeAt(0);("utf8"===r&&a<128||"latin1"===r)&&(e=a)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError("Out of range index");if(n<=t)return this;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i<n;++i)this[i]=e;else{var s=o.isBuffer(e)?e:o.from(e,r),l=s.length;
7if(0===l)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<n-t;++i)this[i+t]=s[i%l]}return this};var S=/[^+/0-9A-Za-z-_]/g;function E(e,t){t=t||1/0;for(var n,r=e.length,i=null,a=[],s=0;s<r;++s){if((n=e.charCodeAt(s))>55295&&n<57344){if(!i){if(n>56319||s+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,63&n|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}else throw Error("Invalid code point")}return a}function T(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}function I(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(S,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function C(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length)&&!(i>=e.length);++i)t[i+n]=e[i];return i}function A(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var R=function(){for(var e="0123456789abcdef",t=Array(256),n=0;n<16;++n)for(var r=16*n,i=0;i<16;++i)t[r+i]=e[n]+e[i];return t}()},783:function(e,t){t.read=function(e,t,n,r,i){var a,s,o=8*i-r-1,l=(1<<o)-1,u=l>>1,c=-7,d=n?i-1:0,h=n?-1:1,f=e[t+d];for(d+=h,a=f&(1<<-c)-1,f>>=-c,c+=o;c>0;a=256*a+e[t+d],d+=h,c-=8);for(s=a&(1<<-c)-1,a>>=-c,c+=r;c>0;s=256*s+e[t+d],d+=h,c-=8);if(0===a)a=1-u;else{if(a===l)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,r),a-=u}return(f?-1:1)*s*Math.pow(2,a-r)},t.write=function(e,t,n,r,i,a){var s,o,l,u=8*a-i-1,c=(1<<u)-1,d=c>>1,h=5960464477539062e-23*(23===i),f=r?0:a-1,p=r?1:-1,m=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(o=+!!isNaN(t),s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+d>=1?t+=h/l:t+=h*Math.pow(2,1-d),t*l>=2&&(s++,l/=2),s+d>=c?(o=0,s=c):s+d>=1?(o=(t*l-1)*Math.pow(2,i),s+=d):(o=t*Math.pow(2,d-1)*Math.pow(2,i),s=0));i>=8;e[n+f]=255&o,f+=p,o/=256,i-=8);for(s=s<<i|o,u+=i;u>0;e[n+f]=255&s,f+=p,s/=256,u-=8);e[n+f-p]|=128*m}}},n={};function r(e){var i=n[e];if(void 0!==i)return i.exports;var a=n[e]={exports:{}},s=!0;try{t[e](a,a.exports,r),s=!1}finally{s&&delete n[e]}return a.exports}r.ab="//";var i=r(72);e.exports=i}()},96246:(e,t,n)=>{"use strict";function r(e,t){let n=String(e);if("string"!=typeof t)throw TypeError("Expected character");let r=0,i=n.indexOf(t);for(;-1!==i;)r++,i=n.indexOf(t,i+t.length);return r}n.d(t,{A:()=>eF});var i=n(29424),a=n(565),s=n(37795),o=n(27816);let l="phrasing",u=["autolink","link","image","label"];function c(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function d(e){this.config.enter.autolinkProtocol.call(this,e)}function h(e){this.config.exit.autolinkProtocol.call(this,e)}function f(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];(0,i.ok)("link"===t.type),t.url="http://"+this.sliceSerialize(e)}function p(e){this.config.exit.autolinkEmail.call(this,e)}function m(e){this.exit(e)}function g(e){!function(e,t,n){let r=(0,o.C)((n||{}).ignore||[]),i=function(e){let t=[];if(!Array.isArray(e))throw TypeError("Expected find and replace tuple or list of tuples");let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){var i;let e=n[r];t.push(["string"==typeof(i=e[0])?RegExp(function(e){if("string"!=typeof e)throw TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(i),"g"):i,function(e){return"function"==typeof e?e:function(){return e}}(e[1])])}return t}(t),a=-1;for(;++a<i.length;)(0,s.VG)(e,"text",l);function l(e,t){let n,s=-1;for(;++s<t.length;){let e=t[s],i=n?n.children:void 0;if(r(e,i?i.indexOf(e):void 0,n))return;n=e}if(n)return function(e,t){let n=t[t.length-1],r=i[a][0],s=i[a][1],o=0,l=n.children.indexOf(e),u=!1,c=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=s(...d,i);if("string"==typeof a&&(a=a.length>0?{type:"text",value:a}:void 0),!1===a?r.lastIndex=n+1:(o!==n&&c.push({type:"text",value:e.value.slice(o,n)}),Array.isArray(a)?c.push(...a):a&&c.push(a),o=n+d[0].length,u=!0),!r.global)break;d=r.exec(e.value)}return u?(o<e.value.length&&c.push({type:"text",value:e.value.slice(o)}),n.children.splice(l,1,...c)):c=[e],l+c.length}(e,t)}}(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,y],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,v]],{ignore:["link","linkReference"]})}function y(e,t,n,i,a){let s="";
7if(!b(a)||(/^w/i.test(t)&&(n=t+n,t="",s="http://"),!function(e){let t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}(n)))return!1;let o=function(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],i=n.indexOf(")"),a=r(e,"("),s=r(e,")");for(;-1!==i&&a>s;)e+=n.slice(0,i+1),i=(n=n.slice(i+1)).indexOf(")"),s++;return[e,n]}(n+i);if(!o[0])return!1;let l={type:"link",title:null,url:s+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[l,{type:"text",value:o[1]}]:l}function v(e,t,n,r){return!(!b(r,!0)||/[-\d_]$/.test(n))&&{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function b(e,t){let n=e.input.charCodeAt(e.index-1);return(0===e.index||(0,a.Ny)(n)||(0,a.es)(n))&&(!t||47!==n)}var x=n(48213);function _(){this.buffer()}function w(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function k(){this.buffer()}function S(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function E(e){let t=this.resume(),n=this.stack[this.stack.length-1];(0,i.ok)("footnoteReference"===n.type),n.identifier=(0,x.B)(this.sliceSerialize(e)).toLowerCase(),n.label=t}function T(e){this.exit(e)}function I(e){let t=this.resume(),n=this.stack[this.stack.length-1];(0,i.ok)("footnoteDefinition"===n.type),n.identifier=(0,x.B)(this.sliceSerialize(e)).toLowerCase(),n.label=t}function C(e){this.exit(e)}function A(e,t,n,r){let i=n.createTracker(r),a=i.move("[^"),s=n.enter("footnoteReference"),o=n.enter("reference");return a+=i.move(n.safe(n.associationId(e),{after:"]",before:a})),o(),s(),a+=i.move("]")}function R(e,t,n){return 0===t?e:P(e,t,n)}function P(e,t,n){return(n?"":"    ")+e}A.peek=function(){return"["};let O=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function M(e){this.enter({type:"delete",children:[]},e)}function N(e){this.exit(e)}function j(e,t,n,r){let i=n.createTracker(r),a=n.enter("strikethrough"),s=i.move("~~");return s+=n.containerPhrasing(e,{...i.current(),before:s,after:"~"}),s+=i.move("~~"),a(),s}function D(e){return e.length}function L(e){let t="string"==typeof e?e.codePointAt(0):0;return 67===t||99===t?99:76===t||108===t?108:114*(82===t||114===t)}j.peek=function(){return"~"};function B(e,t,n){if("string"==typeof t&&(t=[t]),!t||0===t.length)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function F(e){let t=e.options.quote||'"';if('"'!==t&&"'"!==t)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function z(e){return"&#x"+e.toString(16).toUpperCase()+";"}var U=n(97492);function Z(e,t,n){let r=(0,U.S)(e),i=(0,U.S)(t);return void 0===r?void 0===i?"_"===n?{inside:!0,outside:!0}:{inside:!1,outside:!1}:1===i?{inside:!0,outside:!0}:{inside:!1,outside:!0}:1===r?void 0===i?{inside:!1,outside:!1}:1===i?{inside:!0,outside:!0}:{inside:!1,outside:!1}:void 0===i?{inside:!1,outside:!1}:1===i?{inside:!0,outside:!1}:{inside:!1,outside:!1}}n(77885);var H=n(84737);function V(e,t,n){let r=e.value||"",i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++a<n.unsafe.length;){let e;let t=n.unsafe[a],i=n.compilePattern(t);if(t.atBreak)for(;e=i.exec(r);){let t=e.index;10===r.charCodeAt(t)&&13===r.charCodeAt(t-1)&&t--,r=r.slice(0,t)+" "+r.slice(e.index+1)}}return i+r+i}function $(e,t){let n=(0,H.d)(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&1===e.children.length&&"text"===e.children[0].type&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}V.peek=function(){return"`"};(0,o.C)(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);let q={inlineCode:V,listItem:function(e,t,n,r){let i=function(e){let t=e.options.listItemIndent||"one";if("tab"!==t&&"one"!==t&&"mixed"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}(n),a=n.bulletCurrent||function(e){let t=e.options.bullet||"*";if("*"!==t&&"+"!==t&&"-"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}(n);t&&"list"===t.type&&t.ordered&&(a=("number"==typeof t.start&&t.start>-1?t.start:1)+(!1===n.options.incrementListMarker?0:t.children.indexOf(e))+a);let s=a.length+1;("tab"===i||"mixed"===i&&(t&&"list"===t.type&&t.spread||e.spread))&&(s=4*Math.ceil(s/4));let o=n.createTracker(r);o.move(a+" ".repeat(s-a.length)),o.shift(s);let l=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,o.current()),function(e,t,n){return t?(n?"":" ".repeat(s))+e:(n?a:a+" ".repeat(s-a.length))+e});return l(),u}};function W(e){let t=e._align;(0,i.ok)(t,"expected `_align` on table"),this.enter({type:"table",align:t.map(function(e){return"none"===e?null:e}),children:[]},e),this.data.inTable=!0}function K(e){this.exit(e),this.data.inTable=void 0}function J(e){this.enter({type:"tableRow",children:[]},e)}function Y(e){this.exit(e)}function G(e){this.enter({type:"tableCell",children:[]},e)}function X(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Q));let n=this.stack[this.stack.length-1];(0,i.ok)("inlineCode"===n.type),n.value=t,this.exit(e)}function Q(e,t){return"|"===t?t:e}function ee(e){let t=this.stack[this.stack.length-2];(0,i.ok)("listItem"===t.type),t.checked="taskListCheckValueChecked"===e.type}function et(e){let t=this.stack[this.stack.length-2];if(t&&"listItem"===t.type&&"boolean"==typeof t.checked){let e=this.stack[this.stack.length-1];(0,i.ok)("paragraph"===e.type);let n=e.children[0];if(n&&"text"===n.type){let r;let i=t.children,a=-1;for(;++a<i.length;){let e=i[a];if("paragraph"===e.type){r=e;break}}r===e&&(n.value=n.value.slice(1),0===n.value.length?e.children.shift():e.position&&n.position&&"number"==typeof n.position.start.offset&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function en(e,t,n,r){let i=e.children[0],a="boolean"==typeof e.checked&&i&&"paragraph"===i.type,s="["+(e.checked?"x":" ")+"] ",o=n.createTracker(r);a&&o.move(s);let l=q.listItem(e,t,n,{...r,...o.current()});return a&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(e){return e+s})),l}var er=n(75234);let ei={tokenize:function(e,t,n){let r=0;return function t(a){return(87===a||119===a)&&r<3?(r++,e.consume(a),t):46===a&&3===r?(e.consume(a),i):n(a)};function i(e){return null===e?n(e):t(e)}},partial:!0},ea={tokenize:function(e,t,n){let r,i,s;return o;function o(t){return 46===t||95===t?e.check(eo,u,l)(t):null===t||(0,a.Ee)(t)||(0,a.Ny)(t)||45!==t&&(0,a.es)(t)?u(t):(s=!0,e.consume(t),o)}function l(t){return 95===t?r=!0:(i=r,r=void 0),e.consume(t),o}function u(e){return i||r||!s?n(e):t(e)}},partial:!0},es={tokenize:function(e,t){let n=0,r=0;return i;function i(o){return 40===o?(n++,e.consume(o),i):41===o&&r<n?s(o):33===o||34===o||38===o||39===o||41===o||42===o||44===o||46===o||58===o||59===o||60===o||63===o||93===o||95===o||126===o?e.check(eo,t,s)(o):null===o||(0,a.Ee)(o)||(0,a.Ny)(o)?t(o):(e.consume(o),i)}function s(t){return 41===t&&r++,e.consume(t),i}},partial:!0},eo={tokenize:function(e,t,n){return r;function r(o){return 33===o||34===o||39===o||41===o||42===o||44===o||46===o||58===o||59===o||63===o||95===o||126===o?(e.consume(o),r):38===o?(e.consume(o),s):93===o?(e.consume(o),i):60===o||null===o||(0,a.Ee)(o)||(0,a.Ny)(o)?t(o):n(o)}function i(e){return null===e||40===e||91===e||(0,a.Ee)(e)||(0,a.Ny)(e)?t(e):r(e)}function s(t){return(0,a.CW)(t)?function t(i){return 59===i?(e.consume(i),r):(0,a.CW)(i)?(e.consume(i),t):n(i)}(t):n(t)}},partial:!0},el={tokenize:function(e,t,n){return function(t){return e.consume(t),r};function r(e){return(0,a.lV)(e)?n(e):t(e)}},partial:!0},eu={name:"wwwAutolink",tokenize:function(e,t,n){let r=this;return function(t){return 87!==t&&119!==t||!ep.call(r,r.previous)||ev(r.events)?n(t):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(e
7i,e.attempt(ea,e.attempt(es,i),n),n)(t))};function i(n){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(n)}},previous:ep},ec={name:"protocolAutolink",tokenize:function(e,t,n){let r=this,i="",s=!1;return function(t){return(72===t||104===t)&&em.call(r,r.previous)&&!ev(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(t),e.consume(t),o):n(t)};function o(t){if((0,a.CW)(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),o;if(58===t){let n=i.toLowerCase();if("http"===n||"https"===n)return e.consume(t),l}return n(t)}function l(t){return 47===t?(e.consume(t),s)?u:(s=!0,l):n(t)}function u(t){return null===t||(0,a.JQ)(t)||(0,a.Ee)(t)||(0,a.Ny)(t)||(0,a.es)(t)?n(t):e.attempt(ea,e.attempt(es,c),n)(t)}function c(n){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(n)}},previous:em},ed={name:"emailAutolink",tokenize:function(e,t,n){let r,i;let s=this;return function(t){return!ey(t)||!eg.call(s,s.previous)||ev(s.events)?n(t):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),function t(r){return ey(r)?(e.consume(r),t):64===r?(e.consume(r),o):n(r)}(t))};function o(t){return 46===t?e.check(el,u,l)(t):45===t||95===t||(0,a.lV)(t)?(i=!0,e.consume(t),o):u(t)}function l(t){return e.consume(t),r=!0,o}function u(o){return i&&r&&(0,a.CW)(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(o)):n(o)}},previous:eg},eh={},ef=48;for(;ef<123;)eh[ef]=ed,58==++ef?ef=65:91===ef&&(ef=97);function ep(e){return null===e||40===e||42===e||95===e||91===e||93===e||126===e||(0,a.Ee)(e)}function em(e){return!(0,a.CW)(e)}function eg(e){return!(47===e||ey(e))}function ey(e){return 43===e||45===e||46===e||95===e||(0,a.lV)(e)}function ev(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if(("labelLink"===r.type||"labelImage"===r.type)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}eh[43]=ed,eh[45]=ed,eh[46]=ed,eh[95]=ed,eh[72]=[ed,ec],eh[104]=[ed,ec],eh[87]=[ed,eu],eh[119]=[ed,eu];var eb=n(18560),ex=n(18090);let e_={tokenize:function(e,t,n){let r=this;return(0,ex.N)(e,function(e){let i=r.events[r.events.length-1];return i&&"gfmFootnoteDefinitionIndent"===i[1].type&&4===i[2].sliceSerialize(i[1],!0).length?t(e):n(e)},"gfmFootnoteDefinitionIndent",5)},partial:!0};function ew(e,t,n){let r;let i=this,a=i.events.length,s=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);for(;a--;){let e=i.events[a][1];if("labelImage"===e.type){r=e;break}if("gfmFootnoteCall"===e.type||"labelLink"===e.type||"label"===e.type||"image"===e.type||"link"===e.type)break}return function(a){if(!r||!r._balanced)return n(a);let o=(0,x.B)(i.sliceSerialize({start:r.end,end:i.now()}));return 94===o.codePointAt(0)&&s.includes(o.slice(1))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(a),e.exit("gfmFootnoteCallLabelMarker"),t(a)):n(a)}}function ek(e,t){let n=e.length;for(;n--;)if("labelImage"===e[n][1].type&&"enter"===e[n][0]){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";let r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},o=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",a,t],["enter",s,t],["exit",s,t],["exit",a,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...o),e}function eS(e,t,n){let r;let i=this,s=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]),o=0;return function(t){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(t),e.exit("gfmFootnoteCallLabelMarker"),l};function l(t){return 94!==t?n(t):(e.enter("gfmFootnoteCallMarker"),e.consume(t),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(l){if(o>999||93===l&&!r||null===l||91===l||(0,a.Ee)(l))return n(l);if(93===l){e.exit("chunkString");let r=e.exit("gfmFootnoteCallString");return s.includes((0,x.B)(i.sliceSerialize(r)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(l)}return(0,a.Ee)(l)||(r=!0),o++,e.consume(l),92===l?c:u}function c(t){return 91===t||92===t||93===t?(e.consume(t),o++,u):u(t)}}
7function eE(e,t,n){let r,i;let s=this,o=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]),l=0;return function(t){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),u};function u(t){return 94===t?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",c):n(t)}function c(t){if(l>999||93===t&&!i||null===t||91===t||(0,a.Ee)(t))return n(t);if(93===t){e.exit("chunkString");let n=e.exit("gfmFootnoteDefinitionLabelString");return r=(0,x.B)(s.sliceSerialize(n)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return(0,a.Ee)(t)||(i=!0),l++,e.consume(t),92===t?d:c}function d(t){return 91===t||92===t||93===t?(e.consume(t),l++,c):c(t)}function h(t){return 58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),o.includes(r)||o.push(r),(0,ex.N)(e,f,"gfmFootnoteDefinitionWhitespace")):n(t)}function f(e){return t(e)}}function eT(e,t,n){return e.check(eb.B,t,e.attempt(e_,t,n))}function eI(e){e.exit("gfmFootnoteDefinition")}var eC=n(30938),eA=n(1028);class eR{constructor(){this.map=[]}add(e,t,n){!function(e,t,n,r){let i=0;if(0!==n||0!==r.length){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),0===this.map.length)return;let t=this.map.length,n=[];for(;t>0;)t-=1,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}}function eP(e,t,n){let r;let i=this,s=0,o=0;return function(e){let t=i.events.length-1;for(;t>-1;){let e=i.events[t][1].type;if("lineEnding"===e||"linePrefix"===e)t--;else break}let r=t>-1?i.events[t][1].type:null,a="tableHead"===r||"tableRow"===r?b:l;return a===b&&i.parser.lazy[i.now().line]?n(e):a(e)};function l(t){var n;return e.enter("tableHead"),e.enter("tableRow"),124===(n=t)||(r=!0,o+=1),u(n)}function u(t){return null===t?n(t):(0,a.HP)(t)?o>1?(o=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),h):n(t):(0,a.On)(t)?(0,ex.N)(e,u,"whitespace")(t):(o+=1,r&&(r=!1,s+=1),124===t)?(e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),r=!0,u):(e.enter("data"),c(t))}function c(t){return null===t||124===t||(0,a.Ee)(t)?(e.exit("data"),u(t)):(e.consume(t),92===t?d:c)}function d(t){return 92===t||124===t?(e.consume(t),c):c(t)}function h(t){return(i.interrupt=!1,i.parser.lazy[i.now().line])?n(t):(e.enter("tableDelimiterRow"),r=!1,(0,a.On)(t))?(0,ex.N)(e,f,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):f(t)}function f(t){return 45===t||58===t?m(t):124===t?(r=!0,e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),p):n(t)}function p(t){return(0,a.On)(t)?(0,ex.N)(e,m,"whitespace")(t):m(t)}function m(t){return 58===t?(o+=1,r=!0,e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),g):45===t?(o+=1,g(t)):null===t||(0,a.HP)(t)?v(t):n(t)}function g(t){return 45===t?(e.enter("tableDelimiterFiller"),function t(n){return 45===n?(e.consume(n),t):58===n?(r=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(n),e.exit("tableDelimiterMarker"),y):(e.exit("tableDelimiterFiller"),y(n))}(t)):n(t)}function y(t){return(0,a.On)(t)?(0,ex.N)(e,v,"whitespace")(t):v(t)}function v(i){if(124===i)return f(i);if(null===i||(0,a.HP)(i))return r&&s===o?(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(i)):n(i);return n(i)}function b(t){return e.enter("tableRow"),x(t)}function x(n){return 124===n?(e.enter("tableCellDivider"),e.consume(n),e.exit("tableCellDivider"),x):null===n||(0,a.HP)(n)?(e.exit("tableRow"),t(n)):(0,a.On)(n)?(0,ex.N)(e,x,"whitespace")(n):(e.enter("data"),_(n))}function _(t){return null===t||124===t||(0,a.Ee)(t)?(e.exit("data"),x(t)):(e.consume(t),92===t?w:_)}function w(t){return 92===t||124===t?(e.consume(t),_):_(t)}}function eO(e,t){let n,r,i,a=-1,s=!0,o=0,l=[0,0,0,0],u=[0,0,0,0],c=!1,d=0,h=new eR;for(;++a<e.length;){let f=e[a],p=f[1];"enter"===f[0]?"tableHead"===p.type?(c=!1,0!==d&&(eN(h,t,d,n,r),r=void 0,d=0),n={type:"table",start:Object.assign({},p.start),end:Object.assign({},p.end)},h.add(a,0,[["enter",n,t]])):"tableRow"===p.type||"tableDelimiterRow"===p.type?(s=!0,i=void 0,l=[0,0,0,0],u=[0,a+1,0,0],c&&(c=!1,r={type:"tableBody",start:Object.assign({},p.start),end:Object.assign({},p.end)},h.add(a,0,[["enter",r,t]])),o="tableDelimiterRow"===p.type?2:r?3:1):o&&("data"===p.type||"tableDelimiterMarker"===p.type||"tableDelimiterFiller"===p.type)?(s=!1,0===u[2]&&(0!==l[1]&&(u[0]=u[1],i=eM(h,t,l,o,void 0,i),l=[0,0,0,0]),u[2]=a)):"tableCellDivider"===p.type&&(s?s=!1:(0!==l[1]&&(u[0]=u[1],i=eM(h,t,l,o,void 0,i)),u=[(l=u)[1],a,0,0])):"tableHead"===p.type?(c=!0,d=a):"tableRow"===p.type||"tableDelimiterRow"===p.type?(d=a,0!==l[1]?(u[0]=u[1],i=eM(h,t,l,o,a,i)):0!==u[1]&&(i=eM(h,t,u,o,a,i)),o=0):o&&("data"===p.type||"tableDelimiterMarker"===p.type||"tableDelimiterFiller"===p.type)&&(u[3]=a)}for(0!==d&&eN(h,t,d,n,r),h.consume(t.events),a=-1;++a<t.events.length;){let e=t.events[a];"enter"===e[0]&&"table"===e[1].type&&(e[1]._align=function(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if("enter"===i[0])"tableContent"===i[1].type&&r.push("tableDelimiterMarker"===e[t+1][1].type?"left"
7:"none");else if("tableContent"===i[1].type){if("tableDelimiterMarker"===e[t-1][1].type){let e=r.length-1;r[e]="left"===r[e]?"center":"right"}}else if("tableDelimiterRow"===i[1].type)break}else"enter"===i[0]&&"tableDelimiterRow"===i[1].type&&(n=!0);t+=1}return r}(t.events,a))}return e}function eM(e,t,n,r,i,a){0!==n[0]&&(a.end=Object.assign({},ej(t.events,n[0])),e.add(n[0],0,[["exit",a,t]]));let s=ej(t.events,n[1]);if(a={type:1===r?"tableHeader":2===r?"tableDelimiter":"tableData",start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[["enter",a,t]]),0!==n[2]){let i=ej(t.events,n[2]),a=ej(t.events,n[3]),s={type:"tableContent",start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[["enter",s,t]]),2!==r){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type="chunkText",r[1].contentType="text",n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[["exit",s,t]])}return void 0!==i&&(a.end=Object.assign({},ej(t.events,i)),e.add(i,0,[["exit",a,t]]),a=void 0),a}function eN(e,t,n,r,i){let a=[],s=ej(t.events,n);i&&(i.end=Object.assign({},s),a.push(["exit",i,t])),r.end=Object.assign({},s),a.push(["exit",r,t]),e.add(n+1,0,a)}function ej(e,t){let n=e[t],r="enter"===n[0]?"start":"end";return n[1][r]}let eD={name:"tasklistCheck",tokenize:function(e,t,n){let r=this;return function(t){return null===r.previous&&r._gfmTasklistFirstContentOfListItem?(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),i):n(t)};function i(t){return(0,a.Ee)(t)?(e.enter("taskListCheckValueUnchecked"),e.consume(t),e.exit("taskListCheckValueUnchecked"),s):88===t||120===t?(e.enter("taskListCheckValueChecked"),e.consume(t),e.exit("taskListCheckValueChecked"),s):n(t)}function s(t){return 93===t?(e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):n(t)}function o(r){return(0,a.HP)(r)?t(r):(0,a.On)(r)?e.check({tokenize:eL},t,n)(r):n(r)}}};
7function eL(e,t,n){return(0,ex.N)(e,function(e){return null===e?n(e):t(e)},"whitespace")}let eB={};function eF(e){let t;let n=e||eB,r=this.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),a=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),s=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push((0,er.y)([{text:eh},{document:{91:{name:"gfmFootnoteDefinition",tokenize:eE,continuation:{tokenize:eT},exit:eI}},text:{91:{name:"gfmFootnoteCall",tokenize:eS},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:ew,resolveTo:ek}}},function(e){let t=(e||{}).singleTilde,n={name:"strikethrough",tokenize:function(e,n,r){let i=this.previous,a=this.events,s=0;return function(o){return 126===i&&"characterEscape"!==a[a.length-1][1].type?r(o):(e.enter("strikethroughSequenceTemporary"),function a(o){let l=(0,U.S)(i);if(126===o)return s>1?r(o):(e.consume(o),s++,a);if(s<2&&!t)return r(o);let u=e.exit("strikethroughSequenceTemporary"),c=(0,U.S)(o);return u._open=!c||2===c&&!!l,u._close=!l||2===l&&!!c,n(o)}(o))}},resolveAll:function(e,t){let n=-1;for(;++n<e.length;)if("enter"===e[n][0]&&"strikethroughSequenceTemporary"===e[n][1].type&&e[n][1]._close){let r=n;for(;r--;)if("exit"===e[r][0]&&"strikethroughSequenceTemporary"===e[r][1].type&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset==e[r][1].end.offset-e[r][1].start.offset){e[n][1].type="strikethroughSequence",e[r][1].type="strikethroughSequence";let i={type:"strikethrough",start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:"strikethroughText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},s=[["enter",i,t],["enter",e[r][1],t],["exit",e[r][1],t],["enter",a,t]],o=t.parser.constructs.insideSpan.null;o&&(0,eC.m)(s,s.length,0,(0,eA.W)(o,e.slice(r+1,n),t)),(0,eC.m)(s,s.length,0,[["exit",a,t],["enter",e[n][1],t],["exit",e[n][1],t],["exit",i,t]]),(0,eC.m)(e,r-1,n-r+3,s),n=r+s.length-2;break}}for(n=-1;++n<e.length;)"strikethroughSequenceTemporary"===e[n][1].type&&(e[n][1].type="data");return e}};return null==t&&(t=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}}}(n),{flow:{null:{name:"table",tokenize:eP,resolveAll:eO}}},{text:{91:eD}}])),a.push([{transforms:[g],enter:{literalAutolink:c,literalAutolinkEmail:d,literalAutolinkHttp:d,literalAutolinkWww:d},exit:{literalAutolink:m,literalAutolinkEmail:p,literalAutolinkHttp:h,literalAutolinkWww:f}},{enter:{gfmFootnoteCallString:_,gfmFootnoteCall:w,gfmFootnoteDefinitionLabelString:k,gfmFootnoteDefinition:S},exit:{gfmFootnoteCallString:E,gfmFootnoteCall:T,gfmFootnoteDefinitionLabelString:I,gfmFootnoteDefinition:C}},{canContainEols:["delete"],enter:{strikethrough:M},exit:{strikethrough:N}},{enter:{table:W,tableData:G,tableHeader:G,tableRow:J},exit:{codeText:X,table:K,tableData:Y,tableHeader:Y,tableRow:Y}},{exit:{taskListCheckValueChecked:ee,taskListCheckValueUnchecked:ee,paragraph:et}}]),s.push({extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:l,notInConstruct:u},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:l,notInConstruct:u},{character:":",before:"[ps]",after:"\\/",inConstruct:l,notInConstruct:u}]},(t=!1,n&&n.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:function(e,n,r,i){let a=r.createTracker(i),s=a.move("[^"),o=r.enter("footnoteDefinition"),l=r.enter("label");return s+=a.move(r.safe(r.associationId(e),{before:s,after:"]"})),l(),s+=a.move("]:"),e.children&&e.children.length>0&&(a.shift(4),s+=a.move((t?"\n":" ")+r.indentLines(r.containerFlow(e,a.current()),t?P:R))),o(),s},footnoteReference:A},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]}),{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:O}],handlers:{delete:j}},function(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[	 :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(e,t,n){let r=q.inlineCode(e,t,n);return n.stack.includes("tableCell")&&(r=r.replace(/\|/g,"\\$&")),r},table:function(e,t,n,r){return o(function(e,t,n){let r=e.children,i=-1,a=[],s=t.enter("table");for(;++i<r.length;)a[i]=l(r[i],t,n);return s(),a}(e,n,r),e.align)},tableCell:s,tableRow:function(e,t,n,r){let i=o([l(e,n,r)]);return i.slice(0,i.indexOf("\n"))}}};function s(e,t,n,r){let i=n.enter("tableCell"),s=n.enter("phrasing"),o=n.containerPhrasing(e,{...r,before:a,after:a});return s(),i(),o}function o(e,t){return function(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||D,a=[],s=[],o=[],l=[],u=0,c=-1;for(;++c<e.length;){let t=[],r=[],a=-1;for(e[c].length>u&&(u=e[c].length);++a<e[c].length;){var d;let s=null==(d=e[c][a])?"":String(d);if(!1!==n.alignDelimiters){let e=i(s);r[a]=e,(void 0===l[a]||e>l[a])&&(l[a]=e)}t.push(s)}s[c]=t,o[c]=r}let h=-1;if("object"==typeof r&&"length"in r)for(;
7++h<u;)a[h]=L(r[h]);else{let e=L(r);for(;++h<u;)a[h]=e}h=-1;let f=[],p=[];for(;++h<u;){let e=a[h],t="",r="";99===e?(t=":",r=":"):108===e?t=":":114===e&&(r=":");let i=!1===n.alignDelimiters?1:Math.max(1,l[h]-t.length-r.length),s=t+"-".repeat(i)+r;!1!==n.alignDelimiters&&((i=t.length+i+r.length)>l[h]&&(l[h]=i),p[h]=i),f[h]=s}s.splice(1,0,f),o.splice(1,0,p),c=-1;let m=[];for(;++c<s.length;){let e=s[c],t=o[c];h=-1;let r=[];for(;++h<u;){let i=e[h]||"",s="",o="";if(!1!==n.alignDelimiters){let e=l[h]-(t[h]||0),n=a[h];114===n?s=" ".repeat(e):99===n?e%2?(s=" ".repeat(e/2+.5),o=" ".repeat(e/2-.5)):o=s=" ".repeat(e/2):o=" ".repeat(e)}!1===n.delimiterStart||h||r.push("|"),!1!==n.padding&&(!1!==n.alignDelimiters||""!==i)&&(!1!==n.delimiterStart||h)&&r.push(" "),!1!==n.alignDelimiters&&r.push(s),r.push(i),!1!==n.alignDelimiters&&r.push(o),!1!==n.padding&&r.push(" "),(!1!==n.delimiterEnd||h!==u-1)&&r.push("|")}m.push(!1===n.delimiterEnd?r.join("").replace(/ +$/,""):r.join(""))}return m.join("\n")}(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function l(e,t,n){let r=e.children,i=-1,a=[],o=t.enter("tableRow");for(;++i<r.length;)a[i]=s(r[i],e,t,n);return o(),a}}(n),{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:en}}]})}},97492:(e,t,n)=>{"use strict";n.d(t,{S:()=>i});var r=n(565);function i(e){return null===e||(0,r.Ee)(e)||(0,r.Ny)(e)?1:(0,r.es)(e)?2:void 0}},98867:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});let r=(0,n(67401).A)("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},99723:(e,t,n)=>{"use strict";n.d(t,{Mp:()=>l,_W:()=>u,qm:()=>s});var r=n(12115),i=n(88804),a=n(88668),s=(0,r.createContext)(null),o=(0,i.h)(s,"AssistantRuntimeProvider");function l(e){let t=o(e);return t?t.useThreadRuntime():null}var u=(0,a.k)(l);(0,a.k)(e=>{var t,n;return null!==(n=null===(t=l(e))||void 0===t?void 0:t.composer)&&void 0!==n?n:null})},99827:(e,t,n)=>{"use strict";n.d(t,{v:()=>l});var r=n(12115);let i=e=>{let t;let n=new Set,r=(e,r)=>{let i="function"==typeof e?e(t):e;if(!Object.is(i,t)){let e=t;t=(null!=r?r:"object"!=typeof i||null===i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>s,subscribe:e=>(n.add(e),()=>n.delete(e))},s=t=e(r,i,a);return a},a=e=>e?i(e):i,s=e=>e,o=e=>{let t=a(e),n=e=>(function(e,t=s){let n=r.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getInitialState()));return r.useDebugValue(n),n})(t,e);return Object.assign(n,t),n},l=e=>e?o(e):o}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.