@docsearch/js 5.0.1 → 5.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/umd/index.js CHANGED
@@ -1,5 +1,5 @@
1
- /*! @docsearch/js 5.0.1 (UNRELEASED e9f932b) | MIT License | © Algolia, Inc. and contributors | https://docsearch.algolia.com */
2
- (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.docsearch=t())})(this,function(){var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},s=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),c=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},l=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},u=(n,r,a)=>(a=n==null?{}:e(i(n)),l(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),d=e=>a.call(e,`module.exports`)?e[`module.exports`]:l(t({},`__esModule`,{value:!0}),e);function f(e){"@babel/helpers - typeof";return f=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},f(e)}function p(e,t){if(f(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(f(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function m(e){var t=p(e,`string`);return f(t)==`symbol`?t:t+``}function h(e,t,n){return(t=m(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function g(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?g(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):g(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}let v={"Ctrl/Cmd+K":!0,"/":!0};function y(e){return _(_({},v),e)}let b=`Ctrl`;function x(){return/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)}function S(e){e&&e.parentNode&&e.remove()}function C(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`&&typeof e!=`function`?i=t[a]:o[a]=t[a];return arguments.length>2&&(o.children=arguments.length>3?Oe.call(arguments,2):n),w(e,o,r,i,null)}function w(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i==null?++he:i,__i:-1,__u:0};return i==null&&L.vnode!=null&&L.vnode(a),a}function T(){return{current:null}}function E(e){return e.children}function D(e,t){this.props=e,this.context=t,this.__g=0}function O(e,t){if(t==null)return e.__?O(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?O(e):null}function k(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=n.__e;break}return k(e)}}function A(e){(8&e.__g||!(e.__g|=8)||!ge.push(e)||ve++)&&_e==L.debounceRendering||((_e=L.debounceRendering)||queueMicrotask)(j)}function j(){for(var e,t,n,r,i,a,o,s,c=1;ge.length;)ge.length>c&&ge.sort(ye),e=ge.shift(),c=ge.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=ke({},r)).__v=r.__v+1,L.vnode&&L.vnode(n),ie(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i==null?O(r):i,!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,oe(a,n,o),n.__e!=i&&k(n)));ve=0}function M(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||Ee,b=t.length;for(c=N(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?Te:y[m.__i]||Te,m.__i=f,_=ie(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&I(p.ref,null,m),u.push(m.ref,m.__c||h,m)),g==null&&h!=null&&(g=h),(v=!!(4&m.__u))||p.__k===m.__k?c=P(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function N(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(c=a+f,(o=e.__k[a]=typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?w(null,o,null,null,null):De(o)?w(E,{children:o},null,null,null):o.constructor==null&&o.__b>0?w(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=e,o.__b=e.__b+1,s=null,(l=o.__i=te(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=O(s)),le(s,s));return r}function P(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=P(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=O(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function ee(e,t){return t=t||[],e==null||typeof e==`boolean`||(De(e)?e.some(function(e){ee(e,t)}):t.push(e)),t}function te(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&e.key==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function F(e,t,n){t[0]==`-`?e.setProperty(t,n==null?``:n):e[t]=n==null?``:n}function ne(e,t,n,r,i){var a;n:if(t==`style`)if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||F(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||F(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(be,`$1`)),(t=t.slice(2))[0].toLowerCase()!=t[0]&&(t=t.toLowerCase()),e.__l||(e.__l={}),e.__l[t+a]=n,n?r?n.l=r.l:(n.l=xe,e.addEventListener(t,a?Ce:Se,a)):e.removeEventListener(t,a?Ce:Se,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n==null?``:n;break n}catch(e){}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function re(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=xe++;else if(t.u<n.l)return;return n(L.event?L.event(t):t)}}}function ie(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,C,w,T,O,k,A,j,N,P,ee,te=t.type;if(t.constructor!=null)return null;128&n.__u&&(c=!!(32&n.__u),n.__c.__z&&(s=t.__e=n.__e=(a=n.__c.__z)[0],n.__c.__z=null)),(d=L.__b)&&d(t);n:if(typeof te==`function`)try{if(v=t.props,y=`prototype`in te&&te.prototype.render,b=(d=te.contextType)&&r[d.__c],x=d?b?b.props.value:d.__:r,n.__c?2&(f=t.__c=n.__c).__g&&(f.__g|=1,_=!0):(y?t.__c=f=new te(v,x):(t.__c=f=new D(v,x),f.constructor=te,f.render=ue),b&&b.sub(f),f.props=v,f.state||(f.state={}),f.context=x,f.__n=r,p=!0,f.__g|=8,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&te.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=ke({},f.__s)),ke(f.__s,te.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&te.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&te.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),!(4&f.__g)&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,x)||t.__v==n.__v){for(t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),C=0;C<f._sb.length;C++)f.__h.push(f._sb[C]);f._sb=[],f.__h.length&&o.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=x,f.props=v,f.__P=e,f.__g&=-5,w=L.__r,T=0,y){for(f.state=f.__s,f.__g&=-9,w&&w(t),d=f.render(f.props,f.state,f.context),O=0;O<f._sb.length;O++)f.__h.push(f._sb[O]);f._sb=[]}else do f.__g&=-9,w&&w(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(8&f.__g&&++T<25);f.state=f.__s,f.getChildContext!=null&&(r=ke({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),k=d,d!=null&&d.type===E&&d.key==null&&(k=se(d.props.children)),s=M(e,De(k)?k:[k],t,n,r,i,a,o,s,c,l,u),t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__g&=-4)}catch(e){if(t.__v=null,c||a!=null)if(e.then){for(A=0,j=!1,t.__u|=c?160:128,t.__c.__z=[],N=0;N<a.length;N++)(P=a[N])==null||j||(P.nodeType==8&&P.data==`$s`?(A>0&&t.__c.__z.push(P),A++,a[N]=null):P.nodeType==8&&P.data==`/$s`?(--A>0&&t.__c.__z.push(P),j=A===0,s=a[N],a[N]=null):A>0&&(t.__c.__z.push(P),a[N]=null));if(!j){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(ee=a.length;ee--;)S(a[ee]);ae(t)}else t.__e=n.__e,t.__k=n.__k,e.then||ae(t);L.__e(e,t,n)}else s=t.__e=ce(n.__e,t,n,r,i,a,o,c,l,u);return(d=L.diffed)&&d(t),128&t.__u?void 0:s}function ae(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(ae)}function oe(e,t,n){for(var r=0;r<n.length;r++)I(n[r],n[++r],n[++r]);L.__c&&L.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){L.__e(e,t.__v)}})}function se(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:De(e)?e.map(se):ke({},e)}function ce(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v=n.props,y=t.props,b=t.type;if(b==`svg`?i=`http://www.w3.org/2000/svg`:b==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||(i=`http://www.w3.org/1999/xhtml`),a!=null){for(u=0;u<a.length;u++)if((m=a[u])&&`setAttribute`in m==!!b&&(b?m.localName==b:m.nodeType==3)){e=m,a[u]=null;break}}if(e==null){if(b==null)return l.createTextNode(y);e=l.createElementNS(i,b,y.is&&y),s&&(L.__m&&L.__m(t,a),s=!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a=a&&Oe.call(e.childNodes),v=n.props||Te,!s&&a!=null)for(v={},u=0;u<e.attributes.length;u++)v[(m=e.attributes[u]).name]=m.value;for(u in v)if(m=v[u],u!=`children`){if(u==`dangerouslySetInnerHTML`)f=m;else if(!(u in y)){if(u==`value`&&`defaultValue`in y||u==`checked`&&`defaultChecked`in y)continue;ne(e,u,null,m,i)}}for(u in _=1&n.__u,y)m=y[u],u==`children`?p=m:u==`dangerouslySetInnerHTML`?d=m:u==`value`?h=m:u==`checked`?g=m:s&&typeof m!=`function`||v[u]===m&&!_||ne(e,u,m,v[u],i);if(d)s||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(f&&(e.innerHTML=``),M(b==`template`?e.content:e,De(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&O(n,0),s,c,l),a!=null)for(u=a.length;u--;)S(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||ne(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&ne(e,u,g,v[u],i))}return e}function I(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){L.__e(e,n)}}function le(e,t,n){var r,i;if(L.unmount&&L.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||I(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){L.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&le(r[i],t,n||typeof e.type!=`function`);n||S(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function ue(e,t,n){return this.constructor(e,n)}function de(e,t){var n,r,i,a;t==document&&(t=document.documentElement),L.__&&L.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=C(E,null,[e]),i=[],a=[],ie(t,e,r||Te,Te,t.namespaceURI,r?null:t.firstChild?Oe.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),oe(i,e,a)}function fe(e,t){e.__u|=32,de(e,t)}function pe(e,t,n){var r,i,a,o=ke({},e.props);for(a in t)a==`key`?r=t[a]:a==`ref`&&typeof e.type!=`function`?i=t[a]:o[a]=t[a];return arguments.length>2&&(o.children=arguments.length>3?Oe.call(arguments,2):n),w(e.type,o,r||e.key,i||e.ref,null)}function me(e){function t(e){var n,r;return this.getChildContext||(n=new Set,(r={})[t.__c]=this,this.getChildContext=function(){return r},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&n.forEach(function(e){e.__g|=4,A(e)})},this.sub=function(e){n.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),t&&t.call(e)}}),e.children}return t.__c=`__cC`+we++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t}var L,he,ge,_e,ve,ye,be,xe,Se,Ce,we,Te,Ee,De,Oe,ke,Ae=o((()=>{Te={},Ee=[],De=Array.isArray,Oe=Ee.slice,ke=Object.assign,L={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=8&i.__g),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=8&i.__g),o)return void(i.__g|=2)}catch(t){e=t}}throw ve=0,e}},he=0,D.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ke({},this.state);typeof e==`function`&&(e=e(ke({},n),this.props)),e&&ke(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),A(this))},D.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),A(this))},D.prototype.render=E,ge=[],ve=0,ye=function(e,t){return e.__v.__b-t.__v.__b},be=/(PointerCapture)$|Capture$/i,xe=0,Se=re(!1),Ce=re(!0),we=0}));function je(e,t){tt.__h&&tt.__h(Ye,e,$e||t),$e=0;var n=Ye.__H||(Ye.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Me(e){return $e=1,Ne(qe,e)}function Ne(e,t,n){var r=je(Je++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):qe(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);Qe(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=Ye,!Ye.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,Qe(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};Ye.__f=!0;var a=Ye.shouldComponentUpdate,o=Ye.componentWillUpdate;Ye.componentWillUpdate=function(e,t,n){if(4&this.__g){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},Ye.shouldComponentUpdate=i}return r.__N||r.__}function Pe(e,t){var n=je(Je++,3);!tt.__s&&Ke(n.__H,t)&&(n.__=e,n.u=t,Ye.__H.__h.push(n))}function Fe(e,t){var n=je(Je++,4);!tt.__s&&Ke(n.__H,t)&&(n.__=e,n.u=t,Ye.__h.push(n))}function R(e){return $e=5,z(function(){return{current:e}},[])}function Ie(e,t,n){$e=6,Fe(function(){if(typeof e==`function`){var n=e(t());return function(){e(null),n&&typeof n==`function`&&n()}}if(e)return e.current=t(),function(){return e.current=null}},n==null?n:n.concat(e))}function z(e,t){var n=je(Je++,7);return Ke(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Le(e,t){return $e=8,z(function(){return e},t)}function Re(e){var t=Ye.context[e.__c],n=je(Je++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(Ye)),t.props.value):e.__}function ze(e,t){tt.useDebugValue&&tt.useDebugValue(t?t(e):e)}function Be(e){var t=je(Je++,10),n=Me();return t.__=e,Ye.componentDidCatch||(Ye.componentDidCatch=function(e,r){t.__&&t.__(e,r),n[1](e)}),[n[0],function(){n[1](void 0)}]}function Ve(){var e=je(Je++,11);if(!e.__){for(var t=Ye.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__=`P`+n[0]+`-`+n[1]++}return e.__}function He(){for(var e;e=et.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(We),e.__H.__h.forEach(Ge),e.__H.__h=[]}catch(t){e.__H.__h=[],tt.__e(t,e.__v)}}function Ue(e){var t,n=function(){clearTimeout(r),ct&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);ct&&(t=requestAnimationFrame(n))}function We(e){var t=Ye,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),Ye=t}function Ge(e){var t=Ye;e.__c=e.__(),Ye=t}function Ke(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!Qe(t,e[n])})}function qe(e,t){return typeof t==`function`?t(e):t}var Je,Ye,Xe,Ze,Qe,$e,et,tt,nt,rt,it,at,ot,st,ct,lt=o((()=>{Ae(),Qe=Object.is,$e=0,et=[],tt=L,nt=tt.__b,rt=tt.__r,it=tt.diffed,at=tt.__c,ot=tt.unmount,st=tt.__,tt.__b=function(e){Ye=null,nt&&nt(e)},tt.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),st&&st(e,t)},tt.__r=function(e){rt&&rt(e),Je=0;var t=(Ye=e.__c).__H;t&&(Xe===Ye?(t.__h=[],Ye.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(We),t.__h.forEach(Ge),t.__h=[],Je=0)),Xe=Ye},tt.diffed=function(e){it&&it(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(et.push(t)!==1&&Ze===tt.requestAnimationFrame||((Ze=tt.requestAnimationFrame)||Ue)(He)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),Xe=Ye=null},tt.__c=function(e,t){t.some(function(e){try{e.__h.forEach(We),e.__h=e.__h.filter(function(e){return!e.__||Ge(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],tt.__e(n,e.__v)}}),at&&at(e,t)},tt.unmount=function(e){ot&&ot(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{We(e)}catch(e){t=e}}),n.__H=void 0,t&&tt.__e(t,n.__v))},ct=typeof requestAnimationFrame==`function`})),ut=c({Children:()=>Gt,Component:()=>D,Fragment:()=>E,PureComponent:()=>_t,StrictMode:()=>ln,Suspense:()=>St,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:()=>on,cloneElement:()=>It,createContext:()=>me,createElement:()=>C,createFactory:()=>Mt,createPortal:()=>Et,createRef:()=>T,default:()=>B,findDOMNode:()=>Rt,flushSync:()=>cn,forwardRef:()=>yt,hydrate:()=>Ot,isElement:()=>un,isFragment:()=>Pt,isMemo:()=>Ft,isValidElement:()=>Nt,lazy:()=>Ct,memo:()=>vt,render:()=>Dt,startTransition:()=>pt,unmountComponentAtNode:()=>Lt,unstable_batchedUpdates:()=>zt,useCallback:()=>Le,useContext:()=>Re,useDebugValue:()=>ze,useDeferredValue:()=>mt,useEffect:()=>Pe,useErrorBoundary:()=>Be,useId:()=>Ve,useImperativeHandle:()=>Ie,useInsertionEffect:()=>Bt,useLayoutEffect:()=>Fe,useMemo:()=>z,useReducer:()=>Ne,useRef:()=>R,useState:()=>Me,useSyncExternalStore:()=>dt,useTransition:()=>ht,version:()=>sn});function dt(e,t){var n=t(),r=Me({t:{__:n,u:t}}),i=r[0].t,a=r[1];return Fe(function(){i.__=n,i.u=t,ft(i)&&a({t:i})},[e,n,t]),Pe(function(){return ft(i)&&a({t:i}),e(function(){ft(i)&&a({t:i})})},[e]),n}function ft(e){var t=e.u,n=e.__;try{var r=t();return!Object.is(n,r)}catch(e){return!0}}function pt(e){e()}function mt(e){return e}function ht(){return[!1,pt]}function gt(e,t){for(var n in e)if(n!==`__source`&&!(n in t))return!0;for(var r in t)if(r!==`__source`&&e[r]!==t[r])return!0;return!1}function _t(e,t){this.props=e,this.context=t}function vt(e,t){function n(e){var n=this.props.ref,r=n==e.ref;return!r&&n&&(n.call?n(null):n.current=null),t?!t(this.props,e)||!r:gt(this.props,e)}function r(t){return this.shouldComponentUpdate=n,C(e,t)}return r.displayName=`Memo(`+(e.displayName||e.name)+`)`,r.prototype.isReactComponent=!0,r.type=e,r}function yt(e){function t(t){var n=Vt({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=Ut,t.render=e,t.prototype.isReactComponent=!0,t.displayName=`ForwardRef(`+(e.displayName||e.name)+`)`,t}function bt(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){typeof e.__c==`function`&&e.__c()}),e.__c.__H=null),(e=Vt({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__g|=4,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return bt(e,t,n)})),e}function xt(e,t,n){return e&&n&&(typeof e.type==`string`&&(e.__u|=1),e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return xt(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__g|=4,e.__c.__P=n)),e}function St(){this.__u=0,this.o=null,this.__b=null}function Ct(e){var t,n,r;function i(i){if(t||(t=e()).then(function(e){n=e.default||e},function(e){r=e}),r)throw r;if(!n)throw t;return C(n,i)}return i.displayName=`Lazy`,i}function wt(e){return this.getChildContext=function(){return e.context},e.children}function Tt(e){var t=this,n=e.i;if(t.componentWillUnmount=function(){de(null,t.l),t.l=null,t.i=null},t.i&&t.i!==n&&t.componentWillUnmount(),!t.l){for(var r=t.__v;r!==null&&!r.__m&&r.__!==null;)r=r.__;t.i=n,t.l={nodeType:1,parentNode:n,childNodes:[],__k:{__m:r.__m},ownerDocument:n.ownerDocument,insertBefore:function(e,n){this.childNodes.push(e),t.i.insertBefore(e,n)}}}de(C(wt,{context:t.context},e.__v),t.l)}function Et(e,t){var n=C(Tt,{__v:e,i:t});return n.containerInfo=t,n}function Dt(e,t,n){return t.__k==null&&(t.textContent=``),de(e,t),typeof n==`function`&&n(),e?e.__c:null}function Ot(e,t,n){return fe(e,t),typeof n==`function`&&n(),e?e.__c:null}function kt(){}function At(){return this.cancelBubble}function jt(){return this.defaultPrevented}function Mt(e){return C.bind(null,e)}function Nt(e){return!!e&&e.$$typeof===Jt}function Pt(e){return Nt(e)&&e.type===E}function Ft(e){return!!e&&!!e.displayName&&(typeof e.displayName==`string`||e.displayName instanceof String)&&e.displayName.startsWith(`Memo(`)}function It(e){return Nt(e)?pe.apply(null,arguments):e}function Lt(e){return!!e.__k&&(de(null,e),!0)}function Rt(e){return e&&(e.__v&&e.__v.__e||e.nodeType===1&&e)||null}function zt(e,t){return e(t)}var Bt,Vt,Ht,Ut,Wt,Gt,Kt,qt,Jt,Yt,Xt,Zt,Qt,$t,en,tn,nn,rn,an,on,sn,cn,ln,un,B,V=o((()=>{Ae(),lt(),lt(),Bt=Fe,Vt=Object.assign,Ht=/^(-|f[lo].*[^se]$|g.{5,}[^ps]$|z|o[pr]|(W.{5})?[lL]i.*(t|mp)$|an|(bo|s).{4}Im|sca|m.{6}[ds]|ta|c.*[st]$|wido|ini)/,(_t.prototype=new D).isPureReactComponent=!0,_t.prototype.shouldComponentUpdate=function(e,t){return gt(this.props,e)||gt(this.state,t)},Ut=Symbol.for(`react.forward_ref`),Wt=function(e,t,n){return e==null?null:ee(ee(e).map(t.bind(n)))},Gt={map:Wt,forEach:Wt,count:function(e){return e?ee(e).length:0},only:function(e){var t=ee(e);if(t.length!==1)throw`Children.only`;return t[0]},toArray:ee},Kt=L.__e,L.__e=function(e,t,n,r){if(e.then){for(var i,a=t;a=a.__;)if((i=a.__c)&&i.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k),i.__c(e,t)}Kt(e,t,n,r)},qt=L.unmount,L.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),qt&&qt(e)},(St.prototype=new D).__c=function(e,t){var n=t.__c,r=this;r.o==null&&(r.o=[]),r.o.push(n);var i=!1,a=function(){i||(i=!0,n.__R=null,o())};n.__R=a;var o=function(){if(!--r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=xt(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.o.pop();)t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(a,a)},St.prototype.componentWillUnmount=function(){this.o=[]},St.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement(`div`),r=this.__v.__k[0].__c;this.__v.__k[0]=bt(this.__b,n,r.__O=r.__P)}this.__b=null}return[C(E,null,t.__a?null:e.children),t.__a&&C(E,null,e.fallback)]},Jt=Symbol.for(`react.element`),Yt=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Xt=/[A-Z0-9]/g,Zt=typeof document<`u`,Qt=function(e){return/fil|che|rad/.test(e)},D.prototype.isReactComponent={},[`componentWillMount`,`componentWillReceiveProps`,`componentWillUpdate`].forEach(function(e){Object.defineProperty(D.prototype,e,{configurable:!0,get:function(){return this[`UNSAFE_`+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})}),$t=L.event,L.event=function(e){return $t&&(e=$t(e)),e.persist=kt,e.isPropagationStopped=At,e.isDefaultPrevented=jt,e.nativeEvent=e},tn={enumerable:!1,configurable:!0,get:function(){return this.class}},nn=L.vnode,L.vnode=function(e){if(typeof e.type==`string`)(function(e){var t=e.props,n=e.type,r={},i=n.indexOf(`-`)===-1;for(var a in t){var o=t[a];if(!(a===`value`&&`defaultValue`in t&&o==null||Zt&&a===`children`&&n===`noscript`||a===`class`||a===`className`)){if(a===`style`&&typeof o==`object`)for(var s in o)typeof o[s]!=`number`||Ht.test(s)||(o[s]+=`px`);else if(a===`defaultValue`&&`value`in t&&t.value==null)a=`value`;else if(a===`download`&&!0===o)o=``;else if(a===`translate`&&o===`no`)o=!1;else if(a[0]===`o`&&a[1]===`n`){var c=a.toLowerCase();c===`ondoubleclick`?a=`ondblclick`:c!==`onchange`||n!==`input`&&n!==`textarea`||Qt(t.type)?c===`onfocus`?a=`onfocusin`:c===`onblur`&&(a=`onfocusout`):c=a=`oninput`,c===`oninput`&&r[a=c]&&(a=`oninputCapture`)}else i&&Yt.test(a)?a=a.replace(Xt,`-$&`).toLowerCase():o===null&&(o=void 0);r[a]=o}}n==`select`&&r.multiple&&Array.isArray(r.value)&&(r.value=ee(t.children).forEach(function(e){e.props.selected=r.value.indexOf(e.props.value)!=-1})),n==`select`&&r.defaultValue!=null&&(r.value=ee(t.children).forEach(function(e){e.props.selected=r.multiple?r.defaultValue.indexOf(e.props.value)!=-1:r.defaultValue==e.props.value})),t.class&&!t.className?(r.class=t.class,Object.defineProperty(r,"className",tn)):(t.className&&!t.class||t.class&&t.className)&&(r.class=r.className=t.className),e.props=r})(e);else if(typeof e.type==`function`&&(`ref`in e.props&&`prototype`in e.type&&e.type.prototype.render&&(e.ref=e.props.ref,delete e.props.ref),e.type.defaultProps)){var t=Vt({},e.props);for(var n in e.type.defaultProps)t[n]===void 0&&(t[n]=e.type.defaultProps[n]);e.props=t}e.$$typeof=Jt,nn&&nn(e)},rn=L.__r,L.__r=function(e){rn&&rn(e),en=e.__c},an=L.diffed,L.diffed=function(e){an&&an(e);var t=e.props,n=e.__e;n!=null&&e.type===`textarea`&&`value`in t&&t.value!==n.value&&(n.value=t.value==null?``:t.value),en=null},on={ReactCurrentDispatcher:{current:{readContext:function(e){return en.__n[e.__c].props.value},useCallback:Le,useContext:Re,useDebugValue:ze,useDeferredValue:mt,useEffect:Pe,useId:Ve,useImperativeHandle:Ie,useInsertionEffect:Bt,useLayoutEffect:Fe,useMemo:z,useReducer:Ne,useRef:R,useState:Me,useSyncExternalStore:dt,useTransition:ht}}},sn=`18.3.1`,cn=function(e,t){return e(t)},ln=E,un=Nt,B={useState:Me,useId:Ve,useReducer:Ne,useEffect:Pe,useLayoutEffect:Fe,useInsertionEffect:Bt,useTransition:ht,useDeferredValue:mt,useSyncExternalStore:dt,startTransition:pt,useRef:R,useImperativeHandle:Ie,useMemo:z,useCallback:Le,useContext:Re,useDebugValue:ze,version:`18.3.1`,Children:Gt,render:Dt,hydrate:Ot,unmountComponentAtNode:Lt,createPortal:Et,createElement:C,createContext:me,createFactory:Mt,cloneElement:It,createRef:T,Fragment:E,isValidElement:Nt,isElement:un,isFragment:Pt,isMemo:Ft,findDOMNode:Rt,Component:D,PureComponent:_t,memo:vt,forwardRef:yt,flushSync:cn,unstable_batchedUpdates:zt,StrictMode:ln,Suspense:St,lazy:Ct,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:on}}));V();function dn({size:e=20,color:t=`currentColor`}){return B.createElement(`svg`,{width:e,height:e,className:`DocSearch-Search-Icon`,viewBox:`0 0 24 24`,"aria-hidden":`true`},B.createElement(`circle`,{cx:`11`,cy:`11`,r:`8`,stroke:t,fill:`none`,strokeWidth:`1.4`}),B.createElement(`path`,{d:`m21 21-4.3-4.3`,stroke:t,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`}))}function fn(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function pn(e,t){if(e==null)return{};var n,r,i=fn(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}V();let mn=({theme:e})=>{Pe(()=>{if(!e)return;let t=document.documentElement.dataset.theme;if(e!==t)return document.documentElement.dataset.theme=e,()=>{t===void 0?delete document.documentElement.dataset.theme:document.documentElement.dataset.theme=t}},[e])};V();function hn(){let[e,t]=Me(null);Pe(()=>{typeof navigator<`u`&&(x()?t(`⌘`):t(b))},[]);let[n,r,i]=e===`Ctrl`?[b,`Control`,`Ctrl`]:[`Meta`,`Meta`,`⌘`];return{actionKeyReactsTo:n,actionKeyAltText:r,actionKeyLabel:i,key:e}}let gn=[`translations`,`keyboardShortcuts`],_n=B.forwardRef((e,t)=>{let{translations:n={},keyboardShortcuts:r}=e,i=pn(e,gn),{buttonText:a=`Search`,buttonAriaLabel:o=`Search`}=n,s=y(r),{actionKeyReactsTo:c,actionKeyAltText:l,actionKeyLabel:u,key:d}=hn();mn({theme:i.theme});let f=s[`Ctrl/Cmd+K`],p=`${l}+k`;return B.createElement(`button`,_(_({type:`button`,className:`DocSearch DocSearch-Button`,"aria-label":f?`${o} (${p})`:o,"aria-keyshortcuts":f?p:void 0},i),{},{ref:t}),B.createElement(`span`,{className:`DocSearch-Button-Container`},B.createElement(dn,null),B.createElement(`span`,{className:`DocSearch-Button-Placeholder`},a)),B.createElement(`span`,{className:`DocSearch-Button-Keys`},d!==null&&f&&B.createElement(B.Fragment,null,B.createElement(vn,{reactsToKey:c},u),B.createElement(vn,{reactsToKey:`k`},`K`))))});function vn({reactsToKey:e,children:t}){let[n,r]=Me(!1);return Pe(()=>{if(!e)return;function t(t){t.key===e&&r(!0)}function n(t){(t.key===e||t.key===`Meta`)&&r(!1)}return window.addEventListener(`keydown`,t),window.addEventListener(`keyup`,n),()=>{window.removeEventListener(`keydown`,t),window.removeEventListener(`keyup`,n)}},[e]),B.createElement(`kbd`,{className:n?`DocSearch-Button-Key DocSearch-Button-Key--pressed`:`DocSearch-Button-Key`+(e===`Ctrl`?` DocSearch-Button-Key--ctrl`:``)},t)}let yn=`5.0.1`;function bn(e,t){this.v=e,this.k=t}function xn(e){return new bn(e,0)}function Sn(e){return function(){return new Cn(e.apply(this,arguments))}}function Cn(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof bn;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`?`return`:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(a.done?`return`:`normal`,n)},function(e){r(`throw`,e)})}catch(e){i(`throw`,e)}}function i(e,i){switch(e){case`return`:t.resolve({value:i,done:!0});break;case`throw`:t.reject(i);break;default:t.resolve({value:i,done:!1})}(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}Cn.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},Cn.prototype.next=function(e){return this._invoke(`next`,e)},Cn.prototype.throw=function(e){return this._invoke(`throw`,e)},Cn.prototype.return=function(e){return this._invoke(`return`,e)};function wn(e){var t,n,r,i=2;for(typeof Symbol<`u`&&(n=Symbol.asyncIterator,r=Symbol.iterator);i--;){if(n&&(t=e[n])!=null)return t.call(e);if(r&&(t=e[r])!=null)return new Tn(t.call(e));n=`@@asyncIterator`,r=`@@iterator`}throw TypeError(`Object is not async iterable`)}function Tn(e){function t(e){if(Object(e)!==e)return Promise.reject(TypeError(e+` is not an object.`));var t=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:t}})}return Tn=function(e){this.s=e,this.n=e.next},Tn.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var n=this.s.return;return n===void 0?Promise.resolve({value:e,done:!0}):t(n.apply(this.s,arguments))},throw:function(e){var n=this.s.return;return n===void 0?Promise.reject(e):t(n.apply(this.s,arguments))}},new Tn(e)}function En(e){"@babel/helpers - typeof";return En=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},En(e)}function Dn(e,t){if(En(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(En(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function On(e){var t=Dn(e,`string`);return En(t)==`symbol`?t:t+``}function H(e,t,n){return(t=On(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function kn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function U(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?kn(Object(n),!0).forEach(function(t){H(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function An(e){var t={},n=!1;function r(t,r){return n=!0,r=new Promise(function(n){n(e[t](r))}),{done:!1,value:new bn(r,1)}}return t[typeof Symbol<`u`&&Symbol.iterator||`@@iterator`]=function(){return this},t.next=function(e){return n?(n=!1,e):r(`next`,e)},typeof e.throw==`function`&&(t.throw=function(e){if(n)throw n=!1,e;return r(`throw`,e)}),typeof e.return==`function`&&(t.return=function(e){return n?(n=!1,e):r(`return`,e)}),t}function jn(e){let t,n=`algolia-client-js-${e.key}`;function r(){return t===void 0&&(t=e.localStorage||window.localStorage),t}function i(){return JSON.parse(r().getItem(n)||`{}`)}function a(e){r().setItem(n,JSON.stringify(e))}function o(){return new Promise(e=>setTimeout(e,0))}function s(){let t=e.timeToLive?e.timeToLive*1e3:null,n=i(),r=new Date().getTime(),a=!1;return{namespace:Object.fromEntries(Object.entries(n).filter(([,e])=>!e||e.timestamp===void 0||t&&e.timestamp+t<r?(a=!0,!1):!0)),changed:a}}return{get(e,t,n={miss:()=>Promise.resolve()}){return o().then(()=>{let{namespace:r,changed:i}=s(),o=r[JSON.stringify(e)];return i&&a(r),o?o.value:t().then(e=>n.miss(e).then(()=>e))})},set(e,t){return o().then(()=>{let a=i();return a[JSON.stringify(e)]={timestamp:new Date().getTime(),value:t},r().setItem(n,JSON.stringify(a)),t})},delete(e){return o().then(()=>{let t=i();delete t[JSON.stringify(e)],r().setItem(n,JSON.stringify(t))})},clear(){return Promise.resolve().then(()=>{r().removeItem(n)})}}}function Mn(){return{get(e,t,n={miss:()=>Promise.resolve()}){return t().then(e=>Promise.all([e,n.miss(e)])).then(([e])=>e)},set(e,t){return Promise.resolve(t)},delete(e){return Promise.resolve()},clear(){return Promise.resolve()}}}function Nn(e){let t=[...e.caches],n=t.shift();return n===void 0?Mn():{get(e,r,i={miss:()=>Promise.resolve()}){return n.get(e,r,i).catch(()=>Nn({caches:t}).get(e,r,i))},set(e,r){return n.set(e,r).catch(()=>Nn({caches:t}).set(e,r))},delete(e){return n.delete(e).catch(()=>Nn({caches:t}).delete(e))},clear(){return n.clear().catch(()=>Nn({caches:t}).clear())}}}function Pn(e={serializable:!0}){let t={};return{get(n,r,i={miss:()=>Promise.resolve()}){let a=JSON.stringify(n);if(a in t)return Promise.resolve(e.serializable?JSON.parse(t[a]):t[a]);let o=r();return o.then(e=>i.miss(e)).then(()=>o)},set(n,r){return t[JSON.stringify(n)]=e.serializable?JSON.stringify(r):r,Promise.resolve(r)},delete(e){return delete t[JSON.stringify(e)],Promise.resolve()},clear(){return t={},Promise.resolve()}}}function Fn(e){let t={value:`Algolia for JavaScript (${e})`,add(e){let n=`; ${e.segment}${e.version===void 0?``:` (${e.version})`}`;return t.value.indexOf(n)===-1&&(t.value=`${t.value}${n}`),t}};return t}function In(e,t,n=`WithinHeaders`){let r={"x-algolia-api-key":t,"x-algolia-application-id":e};return{headers(){return n===`WithinHeaders`?r:{}},queryParameters(){return n===`WithinQueryParameters`?r:{}}}}function Ln({algoliaAgents:e,client:t,version:n}){let r=Fn(n).add({segment:t,version:n});return e.forEach(e=>r.add(e)),r}function Rn(){return{debug(e,t){return Promise.resolve()},info(e,t){return Promise.resolve()},error(e,t){return Promise.resolve()}}}var zn=10*1024*1024;function Bn(e){return Vn.apply(this,arguments)}function Vn(){return Vn=Sn(function*(e){let t=e.getReader();try{for(;;){let{done:e,value:n}=yield xn(t.read());if(e)return;yield n}}finally{t.releaseLock()}}),Vn.apply(this,arguments)}function Hn(e){return Symbol.asyncIterator in e?e:Bn(e)}function Un(e){return Wn.apply(this,arguments)}function Wn(){return Wn=Sn(function*(e){let t=new TextDecoder(`utf-8`),n=[],r=0,i=!1,a=!0;var o=!1,s=!1,c;try{for(var l=wn(Hn(e)),u;o=!(u=yield xn(l.next())).done;o=!1){let e=u.value;{let o=t.decode(e,{stream:!0}),s=0;for(i&&(i=!1,o.length>0&&o[0]===`
1
+ /*! @docsearch/js 5.0.2 (UNRELEASED ad8e8d9) | MIT License | © Algolia, Inc. and contributors | https://docsearch.algolia.com */
2
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.docsearch=t())})(this,function(){var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},s=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),c=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},l=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},u=(n,r,a)=>(a=n==null?{}:e(i(n)),l(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),d=e=>a.call(e,`module.exports`)?e[`module.exports`]:l(t({},`__esModule`,{value:!0}),e);function f(e){"@babel/helpers - typeof";return f=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},f(e)}function p(e,t){if(f(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(f(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function m(e){var t=p(e,`string`);return f(t)==`symbol`?t:t+``}function h(e,t,n){return(t=m(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function g(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?g(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):g(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}let v={"Ctrl/Cmd+K":!0,"/":!0};function y(e){return _(_({},v),e)}let b=`Ctrl`;function x(){return/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)}function S(e){e&&e.parentNode&&e.remove()}function C(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`&&typeof e!=`function`?i=t[a]:o[a]=t[a];return arguments.length>2&&(o.children=arguments.length>3?Oe.call(arguments,2):n),w(e,o,r,i,null)}function w(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i==null?++he:i,__i:-1,__u:0};return i==null&&L.vnode!=null&&L.vnode(a),a}function T(){return{current:null}}function E(e){return e.children}function D(e,t){this.props=e,this.context=t,this.__g=0}function O(e,t){if(t==null)return e.__?O(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?O(e):null}function k(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=n.__e;break}return k(e)}}function A(e){(8&e.__g||!(e.__g|=8)||!ge.push(e)||ve++)&&_e==L.debounceRendering||((_e=L.debounceRendering)||queueMicrotask)(j)}function j(){for(var e,t,n,r,i,a,o,s,c=1;ge.length;)ge.length>c&&ge.sort(ye),e=ge.shift(),c=ge.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=ke({},r)).__v=r.__v+1,L.vnode&&L.vnode(n),ie(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i==null?O(r):i,!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,oe(a,n,o),n.__e!=i&&k(n)));ve=0}function M(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||Ee,b=t.length;for(c=N(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?Te:y[m.__i]||Te,m.__i=f,_=ie(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&I(p.ref,null,m),u.push(m.ref,m.__c||h,m)),g==null&&h!=null&&(g=h),(v=!!(4&m.__u))||p.__k===m.__k?c=P(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function N(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(c=a+f,(o=e.__k[a]=typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?w(null,o,null,null,null):De(o)?w(E,{children:o},null,null,null):o.constructor==null&&o.__b>0?w(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=e,o.__b=e.__b+1,s=null,(l=o.__i=te(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=O(s)),le(s,s));return r}function P(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=P(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=O(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function ee(e,t){return t=t||[],e==null||typeof e==`boolean`||(De(e)?e.some(function(e){ee(e,t)}):t.push(e)),t}function te(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&e.key==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function F(e,t,n){t[0]==`-`?e.setProperty(t,n==null?``:n):e[t]=n==null?``:n}function ne(e,t,n,r,i){var a;n:if(t==`style`)if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||F(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||F(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(be,`$1`)),(t=t.slice(2))[0].toLowerCase()!=t[0]&&(t=t.toLowerCase()),e.__l||(e.__l={}),e.__l[t+a]=n,n?r?n.l=r.l:(n.l=xe,e.addEventListener(t,a?Ce:Se,a)):e.removeEventListener(t,a?Ce:Se,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n==null?``:n;break n}catch(e){}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function re(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=xe++;else if(t.u<n.l)return;return n(L.event?L.event(t):t)}}}function ie(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,C,w,T,O,k,A,j,N,P,ee,te=t.type;if(t.constructor!=null)return null;128&n.__u&&(c=!!(32&n.__u),n.__c.__z&&(s=t.__e=n.__e=(a=n.__c.__z)[0],n.__c.__z=null)),(d=L.__b)&&d(t);n:if(typeof te==`function`)try{if(v=t.props,y=`prototype`in te&&te.prototype.render,b=(d=te.contextType)&&r[d.__c],x=d?b?b.props.value:d.__:r,n.__c?2&(f=t.__c=n.__c).__g&&(f.__g|=1,_=!0):(y?t.__c=f=new te(v,x):(t.__c=f=new D(v,x),f.constructor=te,f.render=ue),b&&b.sub(f),f.props=v,f.state||(f.state={}),f.context=x,f.__n=r,p=!0,f.__g|=8,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&te.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=ke({},f.__s)),ke(f.__s,te.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&te.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&te.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),!(4&f.__g)&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,x)||t.__v==n.__v){for(t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),C=0;C<f._sb.length;C++)f.__h.push(f._sb[C]);f._sb=[],f.__h.length&&o.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=x,f.props=v,f.__P=e,f.__g&=-5,w=L.__r,T=0,y){for(f.state=f.__s,f.__g&=-9,w&&w(t),d=f.render(f.props,f.state,f.context),O=0;O<f._sb.length;O++)f.__h.push(f._sb[O]);f._sb=[]}else do f.__g&=-9,w&&w(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(8&f.__g&&++T<25);f.state=f.__s,f.getChildContext!=null&&(r=ke({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),k=d,d!=null&&d.type===E&&d.key==null&&(k=se(d.props.children)),s=M(e,De(k)?k:[k],t,n,r,i,a,o,s,c,l,u),t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__g&=-4)}catch(e){if(t.__v=null,c||a!=null)if(e.then){for(A=0,j=!1,t.__u|=c?160:128,t.__c.__z=[],N=0;N<a.length;N++)(P=a[N])==null||j||(P.nodeType==8&&P.data==`$s`?(A>0&&t.__c.__z.push(P),A++,a[N]=null):P.nodeType==8&&P.data==`/$s`?(--A>0&&t.__c.__z.push(P),j=A===0,s=a[N],a[N]=null):A>0&&(t.__c.__z.push(P),a[N]=null));if(!j){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(ee=a.length;ee--;)S(a[ee]);ae(t)}else t.__e=n.__e,t.__k=n.__k,e.then||ae(t);L.__e(e,t,n)}else s=t.__e=ce(n.__e,t,n,r,i,a,o,c,l,u);return(d=L.diffed)&&d(t),128&t.__u?void 0:s}function ae(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(ae)}function oe(e,t,n){for(var r=0;r<n.length;r++)I(n[r],n[++r],n[++r]);L.__c&&L.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){L.__e(e,t.__v)}})}function se(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:De(e)?e.map(se):ke({},e)}function ce(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v=n.props,y=t.props,b=t.type;if(b==`svg`?i=`http://www.w3.org/2000/svg`:b==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||(i=`http://www.w3.org/1999/xhtml`),a!=null){for(u=0;u<a.length;u++)if((m=a[u])&&`setAttribute`in m==!!b&&(b?m.localName==b:m.nodeType==3)){e=m,a[u]=null;break}}if(e==null){if(b==null)return l.createTextNode(y);e=l.createElementNS(i,b,y.is&&y),s&&(L.__m&&L.__m(t,a),s=!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a=a&&Oe.call(e.childNodes),v=n.props||Te,!s&&a!=null)for(v={},u=0;u<e.attributes.length;u++)v[(m=e.attributes[u]).name]=m.value;for(u in v)if(m=v[u],u!=`children`){if(u==`dangerouslySetInnerHTML`)f=m;else if(!(u in y)){if(u==`value`&&`defaultValue`in y||u==`checked`&&`defaultChecked`in y)continue;ne(e,u,null,m,i)}}for(u in _=1&n.__u,y)m=y[u],u==`children`?p=m:u==`dangerouslySetInnerHTML`?d=m:u==`value`?h=m:u==`checked`?g=m:s&&typeof m!=`function`||v[u]===m&&!_||ne(e,u,m,v[u],i);if(d)s||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(f&&(e.innerHTML=``),M(b==`template`?e.content:e,De(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&O(n,0),s,c,l),a!=null)for(u=a.length;u--;)S(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||ne(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&ne(e,u,g,v[u],i))}return e}function I(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){L.__e(e,n)}}function le(e,t,n){var r,i;if(L.unmount&&L.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||I(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){L.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&le(r[i],t,n||typeof e.type!=`function`);n||S(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function ue(e,t,n){return this.constructor(e,n)}function de(e,t){var n,r,i,a;t==document&&(t=document.documentElement),L.__&&L.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=C(E,null,[e]),i=[],a=[],ie(t,e,r||Te,Te,t.namespaceURI,r?null:t.firstChild?Oe.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),oe(i,e,a)}function fe(e,t){e.__u|=32,de(e,t)}function pe(e,t,n){var r,i,a,o=ke({},e.props);for(a in t)a==`key`?r=t[a]:a==`ref`&&typeof e.type!=`function`?i=t[a]:o[a]=t[a];return arguments.length>2&&(o.children=arguments.length>3?Oe.call(arguments,2):n),w(e.type,o,r||e.key,i||e.ref,null)}function me(e){function t(e){var n,r;return this.getChildContext||(n=new Set,(r={})[t.__c]=this,this.getChildContext=function(){return r},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&n.forEach(function(e){e.__g|=4,A(e)})},this.sub=function(e){n.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),t&&t.call(e)}}),e.children}return t.__c=`__cC`+we++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t}var L,he,ge,_e,ve,ye,be,xe,Se,Ce,we,Te,Ee,De,Oe,ke,Ae=o((()=>{Te={},Ee=[],De=Array.isArray,Oe=Ee.slice,ke=Object.assign,L={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=8&i.__g),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=8&i.__g),o)return void(i.__g|=2)}catch(t){e=t}}throw ve=0,e}},he=0,D.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ke({},this.state);typeof e==`function`&&(e=e(ke({},n),this.props)),e&&ke(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),A(this))},D.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),A(this))},D.prototype.render=E,ge=[],ve=0,ye=function(e,t){return e.__v.__b-t.__v.__b},be=/(PointerCapture)$|Capture$/i,xe=0,Se=re(!1),Ce=re(!0),we=0}));function je(e,t){tt.__h&&tt.__h(Ye,e,$e||t),$e=0;var n=Ye.__H||(Ye.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Me(e){return $e=1,Ne(qe,e)}function Ne(e,t,n){var r=je(Je++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):qe(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);Qe(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=Ye,!Ye.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,Qe(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};Ye.__f=!0;var a=Ye.shouldComponentUpdate,o=Ye.componentWillUpdate;Ye.componentWillUpdate=function(e,t,n){if(4&this.__g){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},Ye.shouldComponentUpdate=i}return r.__N||r.__}function Pe(e,t){var n=je(Je++,3);!tt.__s&&Ke(n.__H,t)&&(n.__=e,n.u=t,Ye.__H.__h.push(n))}function Fe(e,t){var n=je(Je++,4);!tt.__s&&Ke(n.__H,t)&&(n.__=e,n.u=t,Ye.__h.push(n))}function R(e){return $e=5,z(function(){return{current:e}},[])}function Ie(e,t,n){$e=6,Fe(function(){if(typeof e==`function`){var n=e(t());return function(){e(null),n&&typeof n==`function`&&n()}}if(e)return e.current=t(),function(){return e.current=null}},n==null?n:n.concat(e))}function z(e,t){var n=je(Je++,7);return Ke(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Le(e,t){return $e=8,z(function(){return e},t)}function Re(e){var t=Ye.context[e.__c],n=je(Je++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(Ye)),t.props.value):e.__}function ze(e,t){tt.useDebugValue&&tt.useDebugValue(t?t(e):e)}function Be(e){var t=je(Je++,10),n=Me();return t.__=e,Ye.componentDidCatch||(Ye.componentDidCatch=function(e,r){t.__&&t.__(e,r),n[1](e)}),[n[0],function(){n[1](void 0)}]}function Ve(){var e=je(Je++,11);if(!e.__){for(var t=Ye.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__=`P`+n[0]+`-`+n[1]++}return e.__}function He(){for(var e;e=et.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(We),e.__H.__h.forEach(Ge),e.__H.__h=[]}catch(t){e.__H.__h=[],tt.__e(t,e.__v)}}function Ue(e){var t,n=function(){clearTimeout(r),ct&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);ct&&(t=requestAnimationFrame(n))}function We(e){var t=Ye,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),Ye=t}function Ge(e){var t=Ye;e.__c=e.__(),Ye=t}function Ke(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!Qe(t,e[n])})}function qe(e,t){return typeof t==`function`?t(e):t}var Je,Ye,Xe,Ze,Qe,$e,et,tt,nt,rt,it,at,ot,st,ct,lt=o((()=>{Ae(),Qe=Object.is,$e=0,et=[],tt=L,nt=tt.__b,rt=tt.__r,it=tt.diffed,at=tt.__c,ot=tt.unmount,st=tt.__,tt.__b=function(e){Ye=null,nt&&nt(e)},tt.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),st&&st(e,t)},tt.__r=function(e){rt&&rt(e),Je=0;var t=(Ye=e.__c).__H;t&&(Xe===Ye?(t.__h=[],Ye.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(We),t.__h.forEach(Ge),t.__h=[],Je=0)),Xe=Ye},tt.diffed=function(e){it&&it(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(et.push(t)!==1&&Ze===tt.requestAnimationFrame||((Ze=tt.requestAnimationFrame)||Ue)(He)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),Xe=Ye=null},tt.__c=function(e,t){t.some(function(e){try{e.__h.forEach(We),e.__h=e.__h.filter(function(e){return!e.__||Ge(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],tt.__e(n,e.__v)}}),at&&at(e,t)},tt.unmount=function(e){ot&&ot(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{We(e)}catch(e){t=e}}),n.__H=void 0,t&&tt.__e(t,n.__v))},ct=typeof requestAnimationFrame==`function`})),ut=c({Children:()=>Gt,Component:()=>D,Fragment:()=>E,PureComponent:()=>_t,StrictMode:()=>ln,Suspense:()=>St,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:()=>on,cloneElement:()=>It,createContext:()=>me,createElement:()=>C,createFactory:()=>Mt,createPortal:()=>Et,createRef:()=>T,default:()=>B,findDOMNode:()=>Rt,flushSync:()=>cn,forwardRef:()=>yt,hydrate:()=>Ot,isElement:()=>un,isFragment:()=>Pt,isMemo:()=>Ft,isValidElement:()=>Nt,lazy:()=>Ct,memo:()=>vt,render:()=>Dt,startTransition:()=>pt,unmountComponentAtNode:()=>Lt,unstable_batchedUpdates:()=>zt,useCallback:()=>Le,useContext:()=>Re,useDebugValue:()=>ze,useDeferredValue:()=>mt,useEffect:()=>Pe,useErrorBoundary:()=>Be,useId:()=>Ve,useImperativeHandle:()=>Ie,useInsertionEffect:()=>Bt,useLayoutEffect:()=>Fe,useMemo:()=>z,useReducer:()=>Ne,useRef:()=>R,useState:()=>Me,useSyncExternalStore:()=>dt,useTransition:()=>ht,version:()=>sn});function dt(e,t){var n=t(),r=Me({t:{__:n,u:t}}),i=r[0].t,a=r[1];return Fe(function(){i.__=n,i.u=t,ft(i)&&a({t:i})},[e,n,t]),Pe(function(){return ft(i)&&a({t:i}),e(function(){ft(i)&&a({t:i})})},[e]),n}function ft(e){var t=e.u,n=e.__;try{var r=t();return!Object.is(n,r)}catch(e){return!0}}function pt(e){e()}function mt(e){return e}function ht(){return[!1,pt]}function gt(e,t){for(var n in e)if(n!==`__source`&&!(n in t))return!0;for(var r in t)if(r!==`__source`&&e[r]!==t[r])return!0;return!1}function _t(e,t){this.props=e,this.context=t}function vt(e,t){function n(e){var n=this.props.ref,r=n==e.ref;return!r&&n&&(n.call?n(null):n.current=null),t?!t(this.props,e)||!r:gt(this.props,e)}function r(t){return this.shouldComponentUpdate=n,C(e,t)}return r.displayName=`Memo(`+(e.displayName||e.name)+`)`,r.prototype.isReactComponent=!0,r.type=e,r}function yt(e){function t(t){var n=Vt({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=Ut,t.render=e,t.prototype.isReactComponent=!0,t.displayName=`ForwardRef(`+(e.displayName||e.name)+`)`,t}function bt(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){typeof e.__c==`function`&&e.__c()}),e.__c.__H=null),(e=Vt({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__g|=4,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return bt(e,t,n)})),e}function xt(e,t,n){return e&&n&&(typeof e.type==`string`&&(e.__u|=1),e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return xt(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__g|=4,e.__c.__P=n)),e}function St(){this.__u=0,this.o=null,this.__b=null}function Ct(e){var t,n,r;function i(i){if(t||(t=e()).then(function(e){n=e.default||e},function(e){r=e}),r)throw r;if(!n)throw t;return C(n,i)}return i.displayName=`Lazy`,i}function wt(e){return this.getChildContext=function(){return e.context},e.children}function Tt(e){var t=this,n=e.i;if(t.componentWillUnmount=function(){de(null,t.l),t.l=null,t.i=null},t.i&&t.i!==n&&t.componentWillUnmount(),!t.l){for(var r=t.__v;r!==null&&!r.__m&&r.__!==null;)r=r.__;t.i=n,t.l={nodeType:1,parentNode:n,childNodes:[],__k:{__m:r.__m},ownerDocument:n.ownerDocument,insertBefore:function(e,n){this.childNodes.push(e),t.i.insertBefore(e,n)}}}de(C(wt,{context:t.context},e.__v),t.l)}function Et(e,t){var n=C(Tt,{__v:e,i:t});return n.containerInfo=t,n}function Dt(e,t,n){return t.__k==null&&(t.textContent=``),de(e,t),typeof n==`function`&&n(),e?e.__c:null}function Ot(e,t,n){return fe(e,t),typeof n==`function`&&n(),e?e.__c:null}function kt(){}function At(){return this.cancelBubble}function jt(){return this.defaultPrevented}function Mt(e){return C.bind(null,e)}function Nt(e){return!!e&&e.$$typeof===Jt}function Pt(e){return Nt(e)&&e.type===E}function Ft(e){return!!e&&!!e.displayName&&(typeof e.displayName==`string`||e.displayName instanceof String)&&e.displayName.startsWith(`Memo(`)}function It(e){return Nt(e)?pe.apply(null,arguments):e}function Lt(e){return!!e.__k&&(de(null,e),!0)}function Rt(e){return e&&(e.__v&&e.__v.__e||e.nodeType===1&&e)||null}function zt(e,t){return e(t)}var Bt,Vt,Ht,Ut,Wt,Gt,Kt,qt,Jt,Yt,Xt,Zt,Qt,$t,en,tn,nn,rn,an,on,sn,cn,ln,un,B,V=o((()=>{Ae(),lt(),lt(),Bt=Fe,Vt=Object.assign,Ht=/^(-|f[lo].*[^se]$|g.{5,}[^ps]$|z|o[pr]|(W.{5})?[lL]i.*(t|mp)$|an|(bo|s).{4}Im|sca|m.{6}[ds]|ta|c.*[st]$|wido|ini)/,(_t.prototype=new D).isPureReactComponent=!0,_t.prototype.shouldComponentUpdate=function(e,t){return gt(this.props,e)||gt(this.state,t)},Ut=Symbol.for(`react.forward_ref`),Wt=function(e,t,n){return e==null?null:ee(ee(e).map(t.bind(n)))},Gt={map:Wt,forEach:Wt,count:function(e){return e?ee(e).length:0},only:function(e){var t=ee(e);if(t.length!==1)throw`Children.only`;return t[0]},toArray:ee},Kt=L.__e,L.__e=function(e,t,n,r){if(e.then){for(var i,a=t;a=a.__;)if((i=a.__c)&&i.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k),i.__c(e,t)}Kt(e,t,n,r)},qt=L.unmount,L.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),qt&&qt(e)},(St.prototype=new D).__c=function(e,t){var n=t.__c,r=this;r.o==null&&(r.o=[]),r.o.push(n);var i=!1,a=function(){i||(i=!0,n.__R=null,o())};n.__R=a;var o=function(){if(!--r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=xt(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.o.pop();)t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(a,a)},St.prototype.componentWillUnmount=function(){this.o=[]},St.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement(`div`),r=this.__v.__k[0].__c;this.__v.__k[0]=bt(this.__b,n,r.__O=r.__P)}this.__b=null}return[C(E,null,t.__a?null:e.children),t.__a&&C(E,null,e.fallback)]},Jt=Symbol.for(`react.element`),Yt=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Xt=/[A-Z0-9]/g,Zt=typeof document<`u`,Qt=function(e){return/fil|che|rad/.test(e)},D.prototype.isReactComponent={},[`componentWillMount`,`componentWillReceiveProps`,`componentWillUpdate`].forEach(function(e){Object.defineProperty(D.prototype,e,{configurable:!0,get:function(){return this[`UNSAFE_`+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})}),$t=L.event,L.event=function(e){return $t&&(e=$t(e)),e.persist=kt,e.isPropagationStopped=At,e.isDefaultPrevented=jt,e.nativeEvent=e},tn={enumerable:!1,configurable:!0,get:function(){return this.class}},nn=L.vnode,L.vnode=function(e){if(typeof e.type==`string`)(function(e){var t=e.props,n=e.type,r={},i=n.indexOf(`-`)===-1;for(var a in t){var o=t[a];if(!(a===`value`&&`defaultValue`in t&&o==null||Zt&&a===`children`&&n===`noscript`||a===`class`||a===`className`)){if(a===`style`&&typeof o==`object`)for(var s in o)typeof o[s]!=`number`||Ht.test(s)||(o[s]+=`px`);else if(a===`defaultValue`&&`value`in t&&t.value==null)a=`value`;else if(a===`download`&&!0===o)o=``;else if(a===`translate`&&o===`no`)o=!1;else if(a[0]===`o`&&a[1]===`n`){var c=a.toLowerCase();c===`ondoubleclick`?a=`ondblclick`:c!==`onchange`||n!==`input`&&n!==`textarea`||Qt(t.type)?c===`onfocus`?a=`onfocusin`:c===`onblur`&&(a=`onfocusout`):c=a=`oninput`,c===`oninput`&&r[a=c]&&(a=`oninputCapture`)}else i&&Yt.test(a)?a=a.replace(Xt,`-$&`).toLowerCase():o===null&&(o=void 0);r[a]=o}}n==`select`&&r.multiple&&Array.isArray(r.value)&&(r.value=ee(t.children).forEach(function(e){e.props.selected=r.value.indexOf(e.props.value)!=-1})),n==`select`&&r.defaultValue!=null&&(r.value=ee(t.children).forEach(function(e){e.props.selected=r.multiple?r.defaultValue.indexOf(e.props.value)!=-1:r.defaultValue==e.props.value})),t.class&&!t.className?(r.class=t.class,Object.defineProperty(r,"className",tn)):(t.className&&!t.class||t.class&&t.className)&&(r.class=r.className=t.className),e.props=r})(e);else if(typeof e.type==`function`&&(`ref`in e.props&&`prototype`in e.type&&e.type.prototype.render&&(e.ref=e.props.ref,delete e.props.ref),e.type.defaultProps)){var t=Vt({},e.props);for(var n in e.type.defaultProps)t[n]===void 0&&(t[n]=e.type.defaultProps[n]);e.props=t}e.$$typeof=Jt,nn&&nn(e)},rn=L.__r,L.__r=function(e){rn&&rn(e),en=e.__c},an=L.diffed,L.diffed=function(e){an&&an(e);var t=e.props,n=e.__e;n!=null&&e.type===`textarea`&&`value`in t&&t.value!==n.value&&(n.value=t.value==null?``:t.value),en=null},on={ReactCurrentDispatcher:{current:{readContext:function(e){return en.__n[e.__c].props.value},useCallback:Le,useContext:Re,useDebugValue:ze,useDeferredValue:mt,useEffect:Pe,useId:Ve,useImperativeHandle:Ie,useInsertionEffect:Bt,useLayoutEffect:Fe,useMemo:z,useReducer:Ne,useRef:R,useState:Me,useSyncExternalStore:dt,useTransition:ht}}},sn=`18.3.1`,cn=function(e,t){return e(t)},ln=E,un=Nt,B={useState:Me,useId:Ve,useReducer:Ne,useEffect:Pe,useLayoutEffect:Fe,useInsertionEffect:Bt,useTransition:ht,useDeferredValue:mt,useSyncExternalStore:dt,startTransition:pt,useRef:R,useImperativeHandle:Ie,useMemo:z,useCallback:Le,useContext:Re,useDebugValue:ze,version:`18.3.1`,Children:Gt,render:Dt,hydrate:Ot,unmountComponentAtNode:Lt,createPortal:Et,createElement:C,createContext:me,createFactory:Mt,cloneElement:It,createRef:T,Fragment:E,isValidElement:Nt,isElement:un,isFragment:Pt,isMemo:Ft,findDOMNode:Rt,Component:D,PureComponent:_t,memo:vt,forwardRef:yt,flushSync:cn,unstable_batchedUpdates:zt,StrictMode:ln,Suspense:St,lazy:Ct,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:on}}));V();function dn({size:e=20,color:t=`currentColor`}){return B.createElement(`svg`,{width:e,height:e,className:`DocSearch-Search-Icon`,viewBox:`0 0 24 24`,"aria-hidden":`true`},B.createElement(`circle`,{cx:`11`,cy:`11`,r:`8`,stroke:t,fill:`none`,strokeWidth:`1.4`}),B.createElement(`path`,{d:`m21 21-4.3-4.3`,stroke:t,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`}))}function fn(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function pn(e,t){if(e==null)return{};var n,r,i=fn(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}V();let mn=({theme:e})=>{Pe(()=>{if(!e)return;let t=document.documentElement.dataset.theme;if(e!==t)return document.documentElement.dataset.theme=e,()=>{t===void 0?delete document.documentElement.dataset.theme:document.documentElement.dataset.theme=t}},[e])};V();function hn(){let[e,t]=Me(null);Pe(()=>{typeof navigator<`u`&&(x()?t(`⌘`):t(b))},[]);let[n,r,i]=e===`Ctrl`?[b,`Control`,`Ctrl`]:[`Meta`,`Meta`,`⌘`];return{actionKeyReactsTo:n,actionKeyAltText:r,actionKeyLabel:i,key:e}}let gn=[`translations`,`keyboardShortcuts`],_n=B.forwardRef((e,t)=>{let{translations:n={},keyboardShortcuts:r}=e,i=pn(e,gn),{buttonText:a=`Search`,buttonAriaLabel:o=`Search`}=n,s=y(r),{actionKeyReactsTo:c,actionKeyAltText:l,actionKeyLabel:u,key:d}=hn();mn({theme:i.theme});let f=s[`Ctrl/Cmd+K`],p=`${l}+k`;return B.createElement(`button`,_(_({type:`button`,className:`DocSearch DocSearch-Button`,"aria-label":f?`${o} (${p})`:o,"aria-keyshortcuts":f?p:void 0},i),{},{ref:t}),B.createElement(`span`,{className:`DocSearch-Button-Container`},B.createElement(dn,null),B.createElement(`span`,{className:`DocSearch-Button-Placeholder`},a)),B.createElement(`span`,{className:`DocSearch-Button-Keys`},d!==null&&f&&B.createElement(B.Fragment,null,B.createElement(vn,{reactsToKey:c},u),B.createElement(vn,{reactsToKey:`k`},`K`))))});function vn({reactsToKey:e,children:t}){let[n,r]=Me(!1);return Pe(()=>{if(!e)return;function t(t){t.key===e&&r(!0)}function n(t){(t.key===e||t.key===`Meta`)&&r(!1)}return window.addEventListener(`keydown`,t),window.addEventListener(`keyup`,n),()=>{window.removeEventListener(`keydown`,t),window.removeEventListener(`keyup`,n)}},[e]),B.createElement(`kbd`,{className:n?`DocSearch-Button-Key DocSearch-Button-Key--pressed`:`DocSearch-Button-Key`+(e===`Ctrl`?` DocSearch-Button-Key--ctrl`:``)},t)}let yn=`5.0.2`;function bn(e,t){this.v=e,this.k=t}function xn(e){return new bn(e,0)}function Sn(e){return function(){return new Cn(e.apply(this,arguments))}}function Cn(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof bn;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`?`return`:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(a.done?`return`:`normal`,n)},function(e){r(`throw`,e)})}catch(e){i(`throw`,e)}}function i(e,i){switch(e){case`return`:t.resolve({value:i,done:!0});break;case`throw`:t.reject(i);break;default:t.resolve({value:i,done:!1})}(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}Cn.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},Cn.prototype.next=function(e){return this._invoke(`next`,e)},Cn.prototype.throw=function(e){return this._invoke(`throw`,e)},Cn.prototype.return=function(e){return this._invoke(`return`,e)};function wn(e){var t,n,r,i=2;for(typeof Symbol<`u`&&(n=Symbol.asyncIterator,r=Symbol.iterator);i--;){if(n&&(t=e[n])!=null)return t.call(e);if(r&&(t=e[r])!=null)return new Tn(t.call(e));n=`@@asyncIterator`,r=`@@iterator`}throw TypeError(`Object is not async iterable`)}function Tn(e){function t(e){if(Object(e)!==e)return Promise.reject(TypeError(e+` is not an object.`));var t=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:t}})}return Tn=function(e){this.s=e,this.n=e.next},Tn.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var n=this.s.return;return n===void 0?Promise.resolve({value:e,done:!0}):t(n.apply(this.s,arguments))},throw:function(e){var n=this.s.return;return n===void 0?Promise.reject(e):t(n.apply(this.s,arguments))}},new Tn(e)}function En(e){"@babel/helpers - typeof";return En=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},En(e)}function Dn(e,t){if(En(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(En(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function On(e){var t=Dn(e,`string`);return En(t)==`symbol`?t:t+``}function H(e,t,n){return(t=On(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function kn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function U(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?kn(Object(n),!0).forEach(function(t){H(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function An(e){var t={},n=!1;function r(t,r){return n=!0,r=new Promise(function(n){n(e[t](r))}),{done:!1,value:new bn(r,1)}}return t[typeof Symbol<`u`&&Symbol.iterator||`@@iterator`]=function(){return this},t.next=function(e){return n?(n=!1,e):r(`next`,e)},typeof e.throw==`function`&&(t.throw=function(e){if(n)throw n=!1,e;return r(`throw`,e)}),typeof e.return==`function`&&(t.return=function(e){return n?(n=!1,e):r(`return`,e)}),t}function jn(e){let t,n=`algolia-client-js-${e.key}`;function r(){return t===void 0&&(t=e.localStorage||window.localStorage),t}function i(){return JSON.parse(r().getItem(n)||`{}`)}function a(e){r().setItem(n,JSON.stringify(e))}function o(){return new Promise(e=>setTimeout(e,0))}function s(){let t=e.timeToLive?e.timeToLive*1e3:null,n=i(),r=new Date().getTime(),a=!1;return{namespace:Object.fromEntries(Object.entries(n).filter(([,e])=>!e||e.timestamp===void 0||t&&e.timestamp+t<r?(a=!0,!1):!0)),changed:a}}return{get(e,t,n={miss:()=>Promise.resolve()}){return o().then(()=>{let{namespace:r,changed:i}=s(),o=r[JSON.stringify(e)];return i&&a(r),o?o.value:t().then(e=>n.miss(e).then(()=>e))})},set(e,t){return o().then(()=>{let a=i();return a[JSON.stringify(e)]={timestamp:new Date().getTime(),value:t},r().setItem(n,JSON.stringify(a)),t})},delete(e){return o().then(()=>{let t=i();delete t[JSON.stringify(e)],r().setItem(n,JSON.stringify(t))})},clear(){return Promise.resolve().then(()=>{r().removeItem(n)})}}}function Mn(){return{get(e,t,n={miss:()=>Promise.resolve()}){return t().then(e=>Promise.all([e,n.miss(e)])).then(([e])=>e)},set(e,t){return Promise.resolve(t)},delete(e){return Promise.resolve()},clear(){return Promise.resolve()}}}function Nn(e){let t=[...e.caches],n=t.shift();return n===void 0?Mn():{get(e,r,i={miss:()=>Promise.resolve()}){return n.get(e,r,i).catch(()=>Nn({caches:t}).get(e,r,i))},set(e,r){return n.set(e,r).catch(()=>Nn({caches:t}).set(e,r))},delete(e){return n.delete(e).catch(()=>Nn({caches:t}).delete(e))},clear(){return n.clear().catch(()=>Nn({caches:t}).clear())}}}function Pn(e={serializable:!0}){let t={};return{get(n,r,i={miss:()=>Promise.resolve()}){let a=JSON.stringify(n);if(a in t)return Promise.resolve(e.serializable?JSON.parse(t[a]):t[a]);let o=r();return o.then(e=>i.miss(e)).then(()=>o)},set(n,r){return t[JSON.stringify(n)]=e.serializable?JSON.stringify(r):r,Promise.resolve(r)},delete(e){return delete t[JSON.stringify(e)],Promise.resolve()},clear(){return t={},Promise.resolve()}}}function Fn(e){let t={value:`Algolia for JavaScript (${e})`,add(e){let n=`; ${e.segment}${e.version===void 0?``:` (${e.version})`}`;return t.value.indexOf(n)===-1&&(t.value=`${t.value}${n}`),t}};return t}function In(e,t,n=`WithinHeaders`){let r={"x-algolia-api-key":t,"x-algolia-application-id":e};return{headers(){return n===`WithinHeaders`?r:{}},queryParameters(){return n===`WithinQueryParameters`?r:{}}}}function Ln({algoliaAgents:e,client:t,version:n}){let r=Fn(n).add({segment:t,version:n});return e.forEach(e=>r.add(e)),r}function Rn(){return{debug(e,t){return Promise.resolve()},info(e,t){return Promise.resolve()},error(e,t){return Promise.resolve()}}}var zn=10*1024*1024;function Bn(e){return Vn.apply(this,arguments)}function Vn(){return Vn=Sn(function*(e){let t=e.getReader();try{for(;;){let{done:e,value:n}=yield xn(t.read());if(e)return;yield n}}finally{t.releaseLock()}}),Vn.apply(this,arguments)}function Hn(e){return Symbol.asyncIterator in e?e:Bn(e)}function Un(e){return Wn.apply(this,arguments)}function Wn(){return Wn=Sn(function*(e){let t=new TextDecoder(`utf-8`),n=[],r=0,i=!1,a=!0;var o=!1,s=!1,c;try{for(var l=wn(Hn(e)),u;o=!(u=yield xn(l.next())).done;o=!1){let e=u.value;{let o=t.decode(e,{stream:!0}),s=0;for(i&&(i=!1,o.length>0&&o[0]===`
3
3
  `&&(s=1));s<o.length;){let e=o.indexOf(`\r`,s),t=o.indexOf(`
4
4
  `,s);if(e===-1&&t===-1){let e=o.slice(s);if(n.push(e),r+=e.length,r>zn)throw Error(`SSE line buffer exceeded 10MB`);break}let c,l;e!==-1&&(t===-1||e<t)?(c=e,e+1<o.length?l=o[e+1]===`
5
5
  `?2:1:(i=!0,l=1)):(c=t,l=1);let u=o.slice(s,c);n.push(u);let d=n.length===1?n[0]:n.join(``);n.length=0,r=0,a&&(d.startsWith(``)&&(d=d.slice(1)),a=!1),yield d,s=c+l}}}}catch(e){s=!0,c=e}finally{try{o&&l.return!=null&&(yield xn(l.return()))}finally{if(s)throw c}}let d=t.decode();if(d&&n.push(d),n.length>0){let e=n.join(``);a&&e.startsWith(``)&&(e=e.slice(1)),yield e}}),Wn.apply(this,arguments)}var Gn=class{constructor(){H(this,`data`,[]),H(this,`eventType`,``),H(this,`lastEventId`,null),H(this,`retry`,null)}decode(e){if(e===``)return this.dispatch();if(e[0]===`:`)return null;let t=e.indexOf(`:`),n,r;switch(t===-1?(n=e,r=``):(n=e.slice(0,t),r=e.slice(t+1),r[0]===` `&&(r=r.slice(1))),n){case`data`:this.data.push(r);break;case`event`:this.eventType=r;break;case`id`:r.includes(`\0`)||(this.lastEventId=r);break;case`retry`:/^[0-9]+$/.test(r)&&(this.retry=parseInt(r,10));break}return null}dispatch(){let e=this.eventType;if(this.eventType=``,this.data.length===0)return null;let t={data:this.data.join(`
@@ -23,79 +23,20 @@ var Au=s((e=>{var t=(V(),d(ut));function n(e,t){return e===t&&(e!==0||1/e==1/t)|
23
23
  * This source code is licensed under the MIT license found in the
24
24
  * LICENSE file in the root directory of this source tree.
25
25
  */
26
- var t=(V(),d(ut)),n=ju();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),Nu=s(((e,t)=>{t.exports=Mu()}));V();let Pu=[],Fu;function Iu(){return Fu}function Lu(e){Pu.push(e)}function Ru(e){let t=(t,n)=>{let r=ei(Bu).current,i;try{Fu=r;for(let e of Pu)e.before(r);i=e(t,n);for(let e of Pu)e.after(r);r.didInitialize=!0}finally{Fu=void 0}return i};return t.displayName=e.displayName||e.name,t}function zu(e){return yt(Ru(e))}function Bu(){return{didInitialize:!1}}V();var Vu=ju(),Hu=Nu();let Uu=ci(19)?Ku:qu;function Wu(e,t,n,r,i){return Uu(e,t,n,r,i)}function Gu(e,t,n,r,i){let a=Le(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,Vu.useSyncExternalStore)(e.subscribe,a,a)}Lu({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,i)||(t=!0,r.value=i)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,Vu.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function Ku(e,t,n,r,i){let a=Iu();if(!a)return Gu(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.value=t(e.getSnapshot(),n,r,i))):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i)},a.syncHooks.push(s)),s.value}function qu(e,t,n,r,i){return(0,Hu.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var Ju=class{constructor(e){H(this,`subscribe`,e=>(this.listeners.add(e),()=>{this.listeners.delete(e)})),H(this,`getSnapshot`,()=>this.state),this.state=e,this.listeners=new Set,this.updateTick=0}setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState(U(U({},this.state),e));return}}set(e,t){Object.is(this.state[e],t)||this.setState(U(U({},this.state),{},{[e]:t}))}notifyAll(){let e=U({},this.state);this.setState(e)}use(e,t,n,r){return Wu(this,e,t,n,r)}};V();var Yu=class extends Ju{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){ze(e);let n=this;W(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;W(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;W(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){ze(e);let n=this,r=t!==void 0;W(()=>{r&&!Object.is(n.state[e],t)&&n.setState(U(U({},n.state),{},{[e]:t}))},[n,e,t,r])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return ze(e),Wu(this,this.selectors[e],t,n,r)}useContextCallback(e,t){ze(e);let n=La(t==null?di:t);this.context[e]=n}useStateSetter(e){let t=R(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}};let Xu=[`syncOnly`,`nested`,`onOpenChange`,`triggerElements`],Zu={open:G(e=>e.open),transitionStatus:G(e=>e.transitionStatus),domReferenceElement:G(e=>e.domReferenceElement),referenceElement:G(e=>{var t;return(t=e.positionReference)==null?e.referenceElement:t}),floatingElement:G(e=>e.floatingElement),floatingId:G(e=>e.floatingId)};var Qu=class extends Yu{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i}=e,a=vr(e,Xu);super(U(U({},a),{},{positionReference:a.referenceElement,domReferenceElement:a.referenceElement}),{onOpenChange:r,dataRef:{current:{}},events:Qc(),nested:n,triggerElements:i},Zu),H(this,`syncOpenEvent`,(e,t)=>{(!e||!this.state.open||t!=null&&qo(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)}),H(this,`dispatchOpenChange`,(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)}),H(this,`setOpen`,(e,t)=>{var n,r;if(this.syncOnly){var i,a;(i=(a=this.context).onOpenChange)==null||i.call(a,e,t);return}this.dispatchOpenChange(e,t),(n=(r=this.context).onOpenChange)==null||n.call(r,e,t)}),this.syncOnly=t}};V();function $u(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:i,nested:a,onOpenChange:o}=e,s=t.useState(`open`),c=t.useState(`activeTriggerElement`),l=t.useState(n?`popupElement`:`positionerElement`),u=t.context.triggerElements,d=o,f=R(null);r===void 0&&f.current===null&&(f.current=new Qu({open:s,transitionStatus:void 0,referenceElement:c,floatingElement:l,triggerElements:u,onOpenChange:d,floatingId:i,syncOnly:!0,nested:a}));let p=r==null?f.current:r;return t.useSyncedValue(`floatingId`,i),W(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};ma(c)&&(e.domReferenceElement=c),p.state.positionReference===p.state.referenceElement&&(e.positionReference=c),p.update(e)},[s,i,c,l,p]),p.context.onOpenChange=d,p.context.nested=a,p}V();let ed={tabIndex:-1,"data-base-ui-focusable":``};function td(e){return t=>t!==`touch`||e.current}function nd(e,t,n=!1){let r=bo(),i=nl()!=null,a=R(null);e===void 0&&a.current===null&&(a.current=t(r,i));let o=e==null?a.current:e;return $u({popupStore:o,treatPopupAsFloatingElement:n,floatingRootContext:o.state.floatingRootContext,floatingId:r,nested:i,onOpenChange:o.setOpen}),{store:o,internalStore:a.current}}function rd(e,t){let n=R(null),r=R(null);return Le(i=>{if(e===void 0)return;let a=!1;if(n.current!==null){let e=n.current,i=r.current,o=t.context.triggerElements.getById(e);i&&o===i&&(t.context.triggerElements.delete(e),a=!0),n.current=null,r.current=null}if(i!==null&&(n.current=e,r.current=i,t.context.triggerElements.add(e,i),a=!0),a){let e=t.context.triggerElements.size;t.select(`open`)&&t.state.triggerCount!==e&&t.set(`triggerCount`,e)}},[t,e])}function id(e,t,n,r=!1){var i;t?e.preventUnmountingOnClose=!1:r&&(e.preventUnmountingOnClose=!0);let a=(i=n==null?void 0:n.id)==null?null:i;(a||t)&&(e.activeTriggerId=a,e.activeTriggerElement=n==null?null:n)}function ad(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function od(e,t,n,r){ku(()=>{t===void 0&&e.state.open===!1&&n&&(e.state=U(U({},e.state),{},{open:!0,activeTriggerId:r,preventUnmountingOnClose:!1}))})}function sd(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=rd(e,n),o=La(t=>{if(a(t),!t)return;let i=n.select(`open`),o=n.select(`activeTriggerId`);if(o===e){n.update(U({activeTriggerElement:t},i?r:null));return}o==null&&i&&n.update(U({activeTriggerId:e,activeTriggerElement:t},r))});return W(()=>{i&&n.update(U({activeTriggerElement:t.current},r))},[i,n,t,...Object.values(r)]),{registerTrigger:o,isMountedByThisTrigger:i}}function cd(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=e.useState(`open`);W(()=>{if(!r){e.state.triggerCount!==0&&e.set(`triggerCount`,0);return}let t=e.context.triggerElements.size,i={};e.state.triggerCount!==t&&(i.triggerCount=t);let a=e.select(`activeTriggerId`),o=null;if(a){let t=e.context.triggerElements.getById(a);t?t!==e.state.activeTriggerElement&&(i.activeTriggerElement=t):o=a}if(!o&&!a&&t===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[e,n]=t.value;i.activeTriggerId=e,i.activeTriggerElement=n}}(i.triggerCount!==void 0||i.activeTriggerId!==void 0||i.activeTriggerElement!==void 0)&&e.update(i),o&&n&&queueMicrotask(()=>{if(e.select(`open`)&&e.select(`activeTriggerId`)===o&&!e.context.triggerElements.getById(o)){let t=wo(`none`);e.setOpen(!1,t),t.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[r,e,e.useState(`triggerCount`),n])}function ld(e,t,n){let{mounted:r,setMounted:i,transitionStatus:a}=Mo(e),o=t.useState(`preventUnmountingOnClose`),s=!e&&o;t.useSyncedValues({mounted:r,transitionStatus:a,preventUnmountingOnClose:s});let c=La(()=>{var e,r;i(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n==null||n(),(e=(r=t.context).onOpenChangeComplete)==null||e.call(r,!1)});return Fo({enabled:r&&!e&&!s,open:e,ref:t.context.popupRef,onComplete(){e||c()}}),{forceUnmount:c,transitionStatus:a}}function ud(e,t){e.useSyncedValues(t),W(()=>()=>{e.update({activeTriggerProps:pi,inactiveTriggerProps:pi,popupProps:pi})},[e])}function dd(e,t){W(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),W(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var fd=class{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(e,t){let n=this.idMap.get(e);n!==t&&(n!==void 0&&this.elementsSet.delete(n),this.elementsSet.add(t),this.idMap.set(e,t))}delete(e){let t=this.idMap.get(e);t&&(this.elementsSet.delete(t),this.idMap.delete(e))}hasElement(e){return this.elementsSet.has(e)}hasMatchingElement(e){for(let t of this.elementsSet)if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}};function pd(){return new Qu({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new fd,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function md(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:pd(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:pi,inactiveTriggerProps:pi,popupProps:pi}}function hd(e,t,n=!1){return new Qu({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0})}let gd=G(e=>{var t;return(t=e.triggerIdProp)==null?e.activeTriggerId:t}),_d=G(e=>{var t;return(t=e.openProp)==null?e.open:t}),vd=G(e=>{var t,n;return((t=(n=e.popupElement)==null?void 0:n.id)==null?e.floatingId:t)||void 0});function yd(e,t){return t!==void 0&&_d(e)&&gd(e)===t}function bd(e,t){return yd(e,t)?!0:t!==void 0&&_d(e)&&gd(e)==null&&e.triggerCount===1}let xd={open:_d,mounted:G(e=>e.mounted),transitionStatus:G(e=>e.transitionStatus),floatingRootContext:G(e=>e.floatingRootContext),triggerCount:G(e=>e.triggerCount),preventUnmountingOnClose:G(e=>e.preventUnmountingOnClose),payload:G(e=>e.payload),activeTriggerId:gd,activeTriggerElement:G(e=>e.mounted?e.activeTriggerElement:null),popupId:vd,isTriggerActive:G((e,t)=>t!==void 0&&gd(e)===t),isOpenedByTrigger:G((e,t)=>yd(e,t)),isMountedByTrigger:G((e,t)=>t!==void 0&&gd(e)===t&&e.mounted),triggerProps:G((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),triggerPopupId:G((e,t)=>bd(e,t)?vd(e):void 0),popupProps:G(e=>e.popupProps),popupElement:G(e=>e.popupElement),positionerElement:G(e=>e.positionerElement)};function Sd(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=bo(),a=nl()!=null,o=ei(()=>{var e,o;return new Qu({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:(e=r.reference)==null?null:e,floatingElement:(o=r.floating)==null?null:o,triggerElements:new fd,floatingId:i,syncOnly:!1,nested:a})}).current;return W(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=ma(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}V();function Cd(e={}){let{nodeId:t,externalTree:n}=e,r=Sd(e),i=e.rootContext||r,a=i.useState(`referenceElement`),o=i.useState(`floatingElement`),s=i.useState(`domReferenceElement`),c=i.useState(`open`),l=i.useState(`floatingId`),[u,d]=Me(null),[f,p]=Me(void 0),[m,h]=Me(void 0),g=R(null),_=rl(n),v=z(()=>({reference:a,floating:o,domReference:s}),[a,o,s]),y=Su(U(U({},e),{},{elements:U(U({},v),u&&{reference:u})})),b=ma(f)?f:null,x=m===void 0?i.state.floatingElement:m;i.useSyncedValue(`referenceElement`,f==null?null:f),i.useSyncedValue(`domReferenceElement`,f===void 0?s:b),i.useSyncedValue(`floatingElement`,x);let S=Le(e=>{let t=ma(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;d(t),y.refs.setReference(t)},[y.refs]),C=Le(e=>{(ma(e)||e===null)&&(g.current=e,p(e)),(ma(y.refs.reference.current)||y.refs.reference.current===null||e!==null&&!ma(e))&&y.refs.setReference(e)},[y.refs,p]),w=Le(e=>{h(e),y.refs.setFloating(e)},[y.refs]),T=z(()=>U(U({},y.refs),{},{setReference:C,setFloating:w,setPositionReference:S,domReference:g}),[y.refs,C,w,S]),E=z(()=>U(U({},y.elements),{},{domReference:s}),[y.elements,s]),D=z(()=>U(U({},y),{},{dataRef:i.context.dataRef,open:c,onOpenChange:i.setOpen,events:i.context.events,floatingId:l,refs:T,elements:E,nodeId:t,rootStore:i}),[y,T,E,t,i,c,l]);return W(()=>{s&&(g.current=s)},[s]),W(()=>{i.context.dataRef.current.floatingContext=D;let e=_==null?void 0:_.nodesRef.current.find(e=>e.id===t);e&&(e.context=D)}),z(()=>U(U({},y),{},{context:D,refs:T,elements:E,rootStore:i}),[y,T,E,D,i])}V();let wd=no&&oo;function Td(e,t={}){let{enabled:n=!0,delay:r}=t,i=`rootStore`in e?e.rootStore:e,{events:a,dataRef:o}=i.context,s=R(!1),c=R(null),l=R(!0),u=Vo();Pe(()=>{let e=i.select(`domReferenceElement`);if(!n)return;let t=da(e);function r(){let e=i.select(`domReferenceElement`);!i.select(`open`)&&ha(e)&&e===Xo(gs(e))&&(s.current=!0)}function a(){l.current=!0}function o(){l.current=!1}return ps(fs(t,`blur`,r),wd&&fs(t,`keydown`,a,!0),wd&&fs(t,`pointerdown`,o,!0))},[i,n]),Pe(()=>{if(!n)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=i.select(`domReferenceElement`);ma(e)&&(c.current=e,s.current=!0)}}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[a,n,i]);let d=z(()=>{function e(){s.current=!1,c.current=null}return{onMouseLeave(){e()},onFocus(t){let n=t.currentTarget;if(s.current){if(c.current===n)return;e()}let a=Qo(t.nativeEvent);if(ma(a)){if(wd&&!t.relatedTarget){if(!l.current&&!ns(a))return}else if(!as(a))return}let o=$o(t.relatedTarget,i.context.triggerElements),{nativeEvent:d,currentTarget:f}=t,p=typeof r==`function`?r():r;if(i.select(`open`)&&o||p===0||p===void 0){i.setOpen(!0,wo(na,d,f));return}u.start(p,()=>{s.current||i.setOpen(!0,wo(na,d,f))})},onBlur(t){e();let n=t.relatedTarget,r=t.nativeEvent,a=ma(n)&&n.hasAttribute(Dc(`focus-guard`))&&n.getAttribute(`data-type`)===`outside`;u.start(0,()=>{var e;let t=i.select(`domReferenceElement`),s=Xo(gs(t));!n&&s===t||Zo((e=o.current.floatingContext)==null?void 0:e.refs.floating.current,s)||Zo(t,s)||a||$o(n==null?s:n,i.context.triggerElements)||i.setOpen(!1,wo(na,r))})}}},[o,r,i,u]);return z(()=>n?{reference:d,trigger:d}:{},[n,d])}var Ed=class e{constructor(){H(this,`dispose`,()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()}),H(this,`disposeEffect`,()=>this.dispose),this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new Bo,this.restTimeout=new Bo,this.handleCloseOptions=void 0}static create(){return new e}};let Dd=new WeakMap;function Od(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;if(t&&Dd.get(t)===e){var n,r,i;(n=e.pointerEventsScopeElement)==null||n.style.removeProperty(`pointer-events`),(r=e.pointerEventsReferenceElement)==null||r.style.removeProperty(`pointer-events`),(i=e.pointerEventsFloatingElement)==null||i.style.removeProperty(`pointer-events`),Dd.delete(t)}e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function kd(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=Dd.get(n);a&&a!==e&&Od(a),Od(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,Dd.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function Ad(e){let t=e.context.dataRef.current,n=ei(()=>{var e;return(e=t.hoverInteractionState)==null?Ed.create():e}).current;return t.hoverInteractionState||(t.hoverInteractionState=n),Oo(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}V();function jd(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=`rootStore`in e?e.rootStore:e,o=a.useState(`open`),s=a.useState(`floatingElement`),c=a.useState(`domReferenceElement`),{dataRef:l}=a.context,u=rl(),d=nl(),f=Ad(a),p=Vo(),m=La(()=>{var e;return us((e=l.current.openEvent)==null?void 0:e.type,f.interactedInside)}),h=La(()=>{var e;return ds((e=l.current.openEvent)==null?void 0:e.type)}),g=La(()=>{Od(f)});W(()=>{o||(f.pointerType=void 0,f.restTimeoutPending=!1,f.interactedInside=!1,g())},[o,f,g]),Pe(()=>g,[g]),W(()=>{var e;if(n&&o&&(e=f.handleCloseOptions)!=null&&e.blockPointerEvents&&h()&&ma(c)&&s){var t,r,i,a,l,p,m;let e=c,n=s,o=gs(s),h=u==null||(t=u.nodesRef.current.find(e=>e.id===d))==null||(t=t.context)==null?void 0:t.elements.floating;h&&(h.style.pointerEvents=``);let _=f.pointerEventsScopeElement===n?null:f.pointerEventsScopeElement,v=h===n?null:h,y=(r=(i=(a=(l=(p=f.handleCloseOptions)==null||(m=p.getScope)==null?void 0:m.call(p))==null?_:l)==null?v:a)==null?e.closest(`[data-rootownerid]`):i)==null?o.body:r;return kd(f,{scopeElement:y,referenceElement:e,floatingElement:n}),()=>{g()}}},[n,o,c,s,f,h,u,d,g]),Pe(()=>{if(!n)return;function e(){return!!(u&&d&&Tc(u.nodesRef.current,d).length>0)}function t(e){let t=cs(r,`close`,f.pointerType),n=()=>{a.setOpen(!1,wo(ta,e)),u==null||u.events.emit(`floating.closed`,e)};t?f.openChangeTimeout.start(t,n):(f.openChangeTimeout.clear(),n())}function o(e){let t=Qo(e);if(!rs(t)){f.interactedInside=!1;return}f.interactedInside=(t==null?void 0:t.closest(`[aria-haspopup]`))!=null}function c(){f.openChangeTimeout.clear(),p.clear(),u==null||u.events.off(`floating.closed`,v),g()}function _(n){var r,o;if(e()&&u){u.events.on(`floating.closed`,v);return}if($o(n.relatedTarget,a.context.triggerElements))return;let s=(r=(o=l.current.floatingContext)==null?void 0:o.nodeId)==null?i:r,c=n.relatedTarget;if(!(u&&s&&ma(c)&&Tc(u.nodesRef.current,s,!1).some(e=>{var t;return Zo((t=e.context)==null?void 0:t.elements.floating,c)}))){if(f.handler){f.handler(n);return}g(),h()&&!m()&&t(n)}}function v(t){!u||!d||e()||p.start(0,()=>{u.events.off(`floating.closed`,v),a.setOpen(!1,wo(ta,t)),u.events.emit(`floating.closed`,t)})}let y=s;return ps(y&&fs(y,`mouseenter`,c),y&&fs(y,`mouseleave`,_),y&&fs(y,`pointerdown`,o,!0),()=>{u==null||u.events.off(`floating.closed`,v)})},[n,s,a,l,r,i,h,m,g,f,u,d,p])}V();let Md={current:null};function Nd(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=Md,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p}=t,m=`rootStore`in e?e.rootStore:e,{dataRef:h,events:g}=m.context,_=rl(l),v=Ad(m),y=R(!1),b=ms(i),x=ms(r),S=ms(o),C=ms(n),w=ms(p),T=ms(f),E=La(()=>{var e;return us((e=h.current.openEvent)==null?void 0:e.type,v.interactedInside)}),D=La(()=>{var e;return((e=w.current)==null?void 0:e.call(w))!==!1}),O=La((e,t,n)=>{let r=m.context.triggerElements;if(r.hasElement(t))return!e||!Zo(e,t);if(!ma(n))return!1;let i=n;return r.hasMatchingElement(e=>Zo(e,i))&&(!e||!Zo(e,i))}),k=La(()=>{v.handler&&(gs(m.select(`domReferenceElement`)).removeEventListener(`mousemove`,v.handler),v.handler=void 0)}),A=La(()=>{Od(v)});if(u){var j;v.handleCloseOptions=(j=b.current)==null?void 0:j.__options}return Pe(()=>k,[k]),Pe(()=>{if(!n)return;function e(e){e.open?y.current=!1:(y.current=e.reason===ta,k(),v.openChangeTimeout.clear(),v.restTimeout.clear(),v.blockMouseMove=!0,v.restTimeoutPending=!1)}return g.on(`openchange`,e),()=>{g.off(`openchange`,e)}},[n,g,v,k]),Pe(()=>{var e;if(!n)return;function t(e,t=!0){let n=cs(x.current,`close`,v.pointerType);n?v.openChangeTimeout.start(n,()=>{m.setOpen(!1,wo(ta,e)),_==null||_.events.emit(`floating.closed`,e)}):t&&(v.openChangeTimeout.clear(),m.setOpen(!1,wo(ta,e)),_==null||_.events.emit(`floating.closed`,e))}let r=(e=c.current)==null?u?m.select(`domReferenceElement`):null:e;if(!ma(r))return;function i(e){var t,n,r;if(v.openChangeTimeout.clear(),v.blockMouseMove=!1,a&&!Ko(v.pointerType))return;let i=ls(S.current),o=cs(x.current,`open`,v.pointerType),s=Qo(e),c=(t=e.currentTarget)==null?null:t,l=m.select(`domReferenceElement`),u=c;if(ma(s)&&!m.context.triggerElements.hasElement(s)){for(let e of m.context.triggerElements.elements())if(Zo(e,s)){u=e;break}}ma(c)&&ma(l)&&!m.context.triggerElements.hasElement(c)&&Zo(c,l)&&(u=l);let d=u!=null&&O(l,u,s),f=m.select(`open`),p=(n=(r=T.current)==null?void 0:r.call(T))==null?m.select(`transitionStatus`)===`ending`:n,h=!f&&p&&y.current,g=!d&&ma(u)&&ma(l)&&Zo(l,u)&&h,_=i>0&&!o,b=d&&(f||h)||g,C=!f||d;if(b){D()&&m.setOpen(!0,wo(ta,e,u));return}_||(o?v.openChangeTimeout.start(o,()=>{C&&D()&&m.setOpen(!0,wo(ta,e,u))}):C&&D()&&m.setOpen(!0,wo(ta,e,u)))}function o(e){var n;if(E()){A();return}k();let r=gs(m.select(`domReferenceElement`));v.restTimeout.clear(),v.restTimeoutPending=!1;let i=(n=h.current.floatingContext)==null?d==null?void 0:d():n;if(!$o(e.relatedTarget,m.context.triggerElements)){if(b.current&&i){m.select(`open`)||v.openChangeTimeout.clear();let n=c.current;v.handler=b.current(U(U({},i),{},{tree:_,x:e.clientX,y:e.clientY,onClose(){A(),k(),C.current&&!E()&&n===m.select(`domReferenceElement`)&&t(e,!0)}})),r.addEventListener(`mousemove`,v.handler),v.handler(e);return}(v.pointerType!==`touch`||!Zo(m.select(`floatingElement`),e.relatedTarget))&&t(e)}}return s?ps(fs(r,`mousemove`,i,{once:!0}),fs(r,`mouseenter`,i),fs(r,`mouseleave`,o)):ps(fs(r,`mouseenter`,i),fs(r,`mouseleave`,o))},[k,A,h,x,m,n,b,v,u,O,E,a,s,S,c,_,C,d,T,D]),z(()=>{if(!n)return;function e(e){v.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){var t;let{nativeEvent:n}=e,r=e.currentTarget,i=m.select(`domReferenceElement`),o=m.select(`open`),s=O(i,r,e.target);if(a&&!Ko(v.pointerType))return;if(o&&s&&(t=v.handleCloseOptions)!=null&&t.blockPointerEvents){let e=m.select(`floatingElement`);if(e){var c,l,u;let t=(c=(l=v.handleCloseOptions)==null||(u=l.getScope)==null?void 0:u.call(l))==null?r.ownerDocument.body:c;kd(v,{scopeElement:t,referenceElement:r,floatingElement:e})}}let d=ls(S.current);if(o&&!s||d===0||!s&&v.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;v.restTimeout.clear();function f(){if(v.restTimeoutPending=!1,E())return;let e=m.select(`open`);!v.blockMouseMove&&(!e||s)&&D()&&m.setOpen(!0,wo(ta,n,r))}v.pointerType===`touch`?cn(()=>{f()}):s&&o?f():(v.restTimeoutPending=!0,v.restTimeout.start(d,f))}}},[n,v,E,O,a,m,S,D])}V();function Pd(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function Fd(e,t){return Pd(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function Id(e,t,n){return Pd(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function Ld(e,t,n){return Pd(t,n?e===Jo:e===Yo,e===`ArrowDown`)}function Rd(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===`Escape`:Pd(t,n?e===Yo:e===Jo,e===`ArrowUp`)}function zd(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:a=!0,selectedIndex:o=null,allowEscape:s=!1,loopFocus:c=!1,nested:l=!1,rtl:u=!1,virtual:d=!1,focusItemOnOpen:f=`auto`,focusItemOnHover:p=!0,openOnArrowKeyDown:m=!0,disabledIndices:h=void 0,orientation:g=`vertical`,parentOrientation:_,id:v,resetOnPointerLeave:y=!0,externalTree:b,grid:x}=t,S=x!=null,C=`rootStore`in e?e.rootStore:e,w=C.useState(`open`),T=C.useState(`floatingElement`),E=C.useState(`domReferenceElement`),D=C.context.dataRef,O=os(T),k=is(E),A=ms(O),j=nl(),M=rl(b),N=R(f),P=R(o==null?-1:o),ee=R(null),te=R(!0),F=La(e=>{i(P.current===-1?null:P.current,e)}),ne=R(!!T),re=R(w),ie=R(!1),ae=R(!1),oe=R(null),se=ms(h),ce=ms(w),I=ms(o),le=ms(y),ue=jo(),de=jo(),fe=La(()=>{function e(e){d?M==null||M.events.emit(`virtualfocus`,e):oe.current=kc(e,{sync:ie.current,preventScroll:!0})}let t=n.current[P.current],r=ae.current;t&&e(t),(ie.current?e=>e():e=>ue.request(e))(()=>{let i=n.current[P.current]||t;if(i&&(t||e(i),_e&&(r||!te.current))){var a;(a=i.scrollIntoView)==null||a.call(i,{block:`nearest`,inline:`nearest`})}})});W(()=>{D.current.orientation=g},[D,g]),W(()=>{a&&(w&&T?(P.current=o==null?-1:o,N.current&&o!=null&&(ae.current=!0,F())):ne.current&&(P.current=-1,F()))},[a,w,T,o,F]),W(()=>{if(a){if(!w){ie.current=!1;return}if(T)if(r==null){if(ie.current=!1,I.current!=null)return;if(ne.current&&(P.current=-1,fe()),(!re.current||!ne.current)&&N.current&&(ee.current!=null||N.current===!0&&ee.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>de.request(e):queueMicrotask)(t),e+=1):(P.current=ee.current==null||Id(ee.current,g,u)||l?Ys(n):Xs(n),ee.current=null,F())};t()}}else Js(n.current,r)||(P.current=r,fe(),ae.current=!1)}},[a,w,T,r,I,l,n,g,u,F,fe,de]),W(()=>{var e,t;if(!a||T||!M||d||!ne.current)return;let n=M.nodesRef.current,r=(e=n.find(e=>e.id===j))==null||(e=e.context)==null?void 0:e.elements.floating,i=Xo(gs((t=E==null?r:E)==null?null:t)),o=n.some(e=>e.context&&Zo(e.context.elements.floating,i));r&&!o&&te.current&&r.focus({preventScroll:!0})},[a,T,E,M,j,d]),W(()=>{re.current=w,ne.current=!!T}),W(()=>{w||(ee.current=null,N.current=f)},[w,f]);let pe=r!=null,me=La(e=>{if(!ce.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(P.current!==t||r!==t)&&(P.current=t,F(e))}),L=La(()=>{var e;return _==null?M==null||(e=M.nodesRef.current.find(e=>e.id===j))==null||(e=e.context)==null||(e=e.dataRef)==null?void 0:e.current.orientation:_}),he=La(()=>Ys(n,se.current)),ge=La(e=>{if(te.current=!1,ie.current=!0,e.which===229||!ce.current&&e.currentTarget===A.current)return;if(l&&Rd(e.key,g,u,S)){Fd(e.key,L())||Ho(e),C.setOpen(!1,wo(aa,e.nativeEvent)),ha(E)&&(d?M==null||M.events.emit(`virtualfocus`,E):E.focus());return}let t=P.current,r=Ys(n,h),i=Xs(n,h);if(k||(e.key===`Home`&&(Ho(e),P.current=r,F(e)),e.key===`End`&&(Ho(e),P.current=i,F(e))),x!=null){let t=x(e,P.current,n,g,c,u,h,r,i);if(t!=null&&(P.current=t,F(e)),g===`both`)return}if(Fd(e.key,g)){if(Ho(e),w&&!d&&Xo(e.currentTarget.ownerDocument)===e.currentTarget){P.current=Id(e.key,g,u)?r:i,F(e);return}Id(e.key,g,u)?c?t>=i?s&&t!==n.current.length?P.current=-1:(ie.current=!1,P.current=r):P.current=Zs(n.current,{startingIndex:t,disabledIndices:h}):P.current=Math.min(i,Zs(n.current,{startingIndex:t,disabledIndices:h})):c?t<=r?s&&t!==-1?P.current=n.current.length:(ie.current=!1,P.current=i):P.current=Zs(n.current,{startingIndex:t,decrement:!0,disabledIndices:h}):P.current=Math.max(r,Zs(n.current,{startingIndex:t,decrement:!0,disabledIndices:h})),Js(n.current,P.current)&&(P.current=-1),F(e)}}),_e=z(()=>({onFocus(e){ie.current=!0,me(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){ie.current=!0,ae.current=!1,p&&me(e)},onPointerLeave(e){var t;if(!ce.current||!te.current||e.pointerType===`touch`)return;ie.current=!0;let r=e.relatedTarget;if(!(!p||n.current.includes(r))&&le.current&&((t=oe.current)==null||t.call(oe),oe.current=null,P.current=-1,F(e),!d)){let e=A.current,t=Xo(gs(e));e&&Zo(e,t)&&e.focus({preventScroll:!0})}}}),[me,ce,A,p,n,F,le,d]),ve=z(()=>d&&w&&pe&&{"aria-activedescendant":`${v}-${r}`},[d,w,pe,v,r]),ye=z(()=>U(U({"aria-orientation":g===`both`?void 0:g},k?{}:ve),{},{onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&w&&!d){let t=Qo(e.nativeEvent);if(t&&!Zo(A.current,t))return;Ho(e),C.setOpen(!1,wo(ia,e.nativeEvent)),ha(E)&&E.focus();return}ge(e)},onPointerMove(){te.current=!0}}),[ve,ge,A,g,k,C,w,d,E]),be=z(()=>{function e(e){C.setOpen(!0,wo(aa,e.nativeEvent,e.currentTarget))}function t(e){f===`auto`&&Wo(e.nativeEvent)&&(N.current=!d)}function n(e){N.current=f,f===`auto`&&Go(e.nativeEvent)&&(N.current=!0)}return{onKeyDown(t){let n=C.select(`open`);te.current=!1;let r=t.key.startsWith(`Arrow`),i=Ld(t.key,L(),u),a=Fd(t.key,g),o=(l?i:a)||t.key===`Enter`||t.key.trim()===``;if(d&&n)return ge(t);if(!(!n&&!m&&r)){if(o){let e=Fd(t.key,L());ee.current=l&&e?null:t.key}if(l){i&&(Ho(t),n?(P.current=he(),F(t)):e(t));return}a&&(I.current!=null&&(P.current=I.current),Ho(t),!n&&m?e(t):ge(t),n&&F(t))}},onFocus(e){C.select(`open`)&&!d&&(P.current=-1,F(e))},onPointerDown:n,onPointerEnter:n,onMouseDown:t,onClick:t}},[ge,f,he,l,F,C,m,g,L,u,I,d]),xe=z(()=>U(U({},ve),be),[ve,be]);return z(()=>a?{reference:xe,floating:ye,item:_e,trigger:be}:{},[a,xe,ye,be,_e])}V();function Bd(e,t){var n;let{listRef:r,elementsRef:i,activeIndex:a,onMatch:o,disabledIndices:s,onTyping:c,enabled:l=!0,resetMs:u=750,selectedIndex:d=null}=t,f=`rootStore`in e?e.rootStore:e,p=f.useState(`open`),m=Vo(),h=R(``),g=R((n=d==null?a:d)==null?-1:n),_=R(null),v=La(e=>{var t;function n(e){let t=i==null?void 0:i.current[e];return!t||ec(t)}function l(e){return n(e)?s==null||!Qs(fi,e,s):!1}function f(e,t,n=0){if(e.length===0)return-1;let r=(n%e.length+e.length)%e.length,i=t.toLowerCase();for(let t=0;t<e.length;t+=1){let n=(r+t)%e.length,a=e[n];if(!(!(a!=null&&a.toLowerCase().startsWith(i))||!l(n)))return n}return-1}let v=r.current;if(h.current.length>0&&e.key===` `&&(Ho(e),c==null||c(!0)),h.current.length>0&&h.current[0]!==` `&&f(v,h.current)===-1&&e.key!==` `&&(c==null||c(!1)),v==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;p&&e.key!==` `&&(Ho(e),c==null||c(!0));let y=h.current===``;if(y){var b;g.current=(b=d==null?a:d)==null?-1:b}v.every((e,t)=>{var n,r;return e&&l(t)?((n=e[0])==null?void 0:n.toLowerCase())!==((r=e[1])==null?void 0:r.toLowerCase()):!0})&&h.current===e.key&&(h.current=``,g.current=_.current),h.current+=e.key,m.start(u,()=>{h.current=``,g.current=_.current,c==null||c(!1)});let x=y?(t=d==null?a:d)==null?-1:t:g.current,S=(x==null?0:x)+1,C=f(v,h.current,S);C===-1?e.key!==` `&&(h.current=``,c==null||c(!1)):(o==null||o(C),_.current=C)}),y=La(e=>{let t=e.relatedTarget,n=f.select(`domReferenceElement`),r=f.select(`floatingElement`);Zo(n,t)||Zo(r,t)||(m.clear(),h.current=``,g.current=_.current,c==null||c(!1))});W(()=>{!p&&d!==null||(m.clear(),_.current=null,h.current!==``&&(h.current=``))},[p,d,m]),W(()=>{if(p&&h.current===``){var e;g.current=(e=d==null?a:d)==null?-1:e}},[p,d,a]);let b=z(()=>({onKeyDown:v,onBlur:y}),[v,y]);return z(()=>l?{reference:b,floating:b}:{},[l,b])}let Vd=.5;function Hd(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function Ud(e,t,n,r,i,a,o,s,c,l){let u=!1;return Hd(e,t,n,r,i,a)&&(u=!u),Hd(e,t,i,a,o,s)&&(u=!u),Hd(e,t,o,s,c,l)&&(u=!u),Hd(e,t,c,l,n,r)&&(u=!u),u}function Wd(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Gd(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function Kd(e={}){let{blockPointerEvents:t=!1}=e,n=new Bo,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r==null?void 0:r.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*.010000000000000002;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=Qo(r),g=r.type===`mouseleave`,_=Zo(u,h),v=Zo(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&ma(r.relatedTarget)&&Zo(u,r.relatedTarget))return;function y(){return!!(s&&Tc(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=Gd(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=Gd(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=Gd(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=Gd(d,f,x.right-1,A,S.left+1,k);break;default:}if(j)return;if(l&&!Wd(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?Vd/2:Vd*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+Vd+1,o=C||T?S.bottom-Vd:S.top,s=C?T?S.bottom-Vd:S.top:S.bottom-Vd;M=Ud(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?Vd/2:Vd*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-Vd,o=C||T?S.top+Vd:S.bottom,s=C?T?S.top+Vd:S.bottom:S.top+Vd;M=Ud(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?Vd/2:Vd*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+Vd+1,o=w||E?S.right-Vd:S.left,s=w?E?S.right-Vd:S.left:S.right-Vd;M=Ud(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?Vd/2:Vd*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-Vd,o=w||E?S.left+Vd:S.right,s=w?E?S.left+Vd:S.right:S.left+Vd;M=Ud(d,f,a,r,a,i,o,S.top,s,S.bottom);break}default:}M?l||n.start(40,b):b()}};return r.__options=U(U({},e),{},{blockPointerEvents:t}),r}V();let qd=me(void 0);function Jd(e){let t=Re(qd);if(t===void 0&&!e)throw Error(Jr(69));return t}let Yd=new Set([`ArrowLeft`,`ArrowRight`]),Xd=new Set([`ArrowUp`,`ArrowDown`]),Zd=new Set([...Yd,...Xd]),Qd=new Set([...Zd,`Home`,`End`]);function $d(e){return e===`starting`?Hc:pi}V();let ef=[`render`,`className`,`style`,`finalFocus`],tf=U(U({},Zi),Vi),nf=yt(function(e,t){let{render:n,className:r,style:i,finalFocus:a}=e,o=vr(e,ef),{store:s}=Qr(),{side:c,align:l}=Xr(),u=Jd(!0)!=null,d=s.useState(`open`),f=s.useState(`transitionStatus`),p=s.useState(`popupProps`),m=s.useState(`mounted`),h=s.useState(`instantType`),g=s.useState(`activeTriggerElement`),_=s.useState(`parent`),v=s.useState(`lastOpenChangeReason`),y=s.useState(`rootId`),b=s.useState(`floatingRootContext`),x=s.useState(`floatingTreeRoot`),S=s.useState(`closeDelay`),C=s.useState(`activeTriggerElement`),w=s.useState(`hoverEnabled`),T=s.useState(`disabled`),E=s.useState(`openMethod`),D=_.type===`context-menu`;Fo({open:d,ref:s.context.popupRef,onComplete(){if(d){var e,t;(e=(t=s.context).onOpenChangeComplete)==null||e.call(t,!0)}}}),Pe(()=>{function e(e){s.setOpen(!1,wo(e.reason,e.domEvent))}return x.events.on(`close`,e),()=>{x.events.off(`close`,e)}},[x.events,s]),jd(b,{enabled:w&&!T&&!D&&_.type!==`menubar`,closeDelay:S});let O=Le(e=>{s.set(`popupElement`,e)},[s]),k=Mi(`div`,e,{state:{transitionStatus:f,side:c,align:l,open:d,nested:_.type===`menu`,instant:h},ref:[t,s.context.popupRef,O],stateAttributesMapping:tf,props:[p,{onKeyDown(e){u&&Qd.has(e.key)&&e.stopPropagation()}},$d(f),o,{"data-rootownerid":y}]}),A=_.type===void 0||D;return(g||_.type===`menubar`&&v!==`outside-press`)&&(A=!0),Eo(ml,{context:b,openInteractionType:E,modal:D,disabled:!m,returnFocus:a===void 0?A:a,initialFocus:_.type!==`menu`,restoreFocus:!0,externalTree:_.type===`menubar`?void 0:x,previousFocusableElement:C,nextFocusableElement:_.type===void 0?s.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:_.type===void 0?s.context.beforeContentFocusGuardRef:void 0,children:k})});V();let rf=me(void 0);function af(){let e=Re(rf);if(e===void 0)throw Error(Jr(32));return e}V();let of=[`keepMounted`],sf=yt(function(e,t){let{keepMounted:n=!1}=e,r=vr(e,of),{store:i}=Qr();return i.useState(`mounted`)||n?Eo(rf.Provider,{value:n,children:Eo(Zc,U({ref:t},r))}):null});function cf(e){return ci(19)?e:e?`true`:void 0}V();let lf=me(void 0);function uf(){var e;let t=Re(lf);return(e=t==null?void 0:t.direction)==null?`ltr`:e}let df=e=>({name:`arrow`,options:e,async fn(t){var n,r;let{x:i,y:a,placement:o,rects:s,platform:c,elements:l,middlewareData:u}=t,{element:d,padding:f=0,offsetParent:p=`real`}=Os(e,t)||{};if(d==null)return{};let m=Ks(f),h={x:i,y:a},g=Ps(o),_=Ms(g),v=await c.getDimensions(d),y=g===`y`,b=y?`top`:`left`,x=y?`bottom`:`right`,S=y?`clientHeight`:`clientWidth`,C=s.reference[_]+s.reference[g]-h[g]-s.floating[_],w=h[g]-s.reference[g],T=p===`real`?await((n=c.getOffsetParent)==null?void 0:n.call(c,d)):l.floating,E=l.floating[S]||s.floating[_];(!E||!await((r=c.isElement)==null?void 0:r.call(c,T)))&&(E=l.floating[S]||s.floating[_]);let D=C/2-w/2,O=E/2-v[_]/2-1,k=Math.min(m[b],O),A=Math.min(m[x],O),j=k,M=E-v[_]-A,N=E/2-v[_]/2+D,P=Ds(j,N,M),ee=!u.arrow&&As(o)!=null&&N!==P&&s.reference[_]/2-(N<j?k:A)-v[_]/2<0,te=ee?N<j?N-j:N-M:0;return{[g]:h[g]+te,data:U({[g]:P,centerOffset:N-P-te},ee&&{alignmentOffset:te}),reset:ee}}}),ff=(e,t)=>U(U({},df(e)),{},{options:[e,t]}),pf=Ou().fn,mf={name:`hide`,async fn(e){var t;let{width:n,height:r,x:i,y:a}=e.rects.reference,o=n===0&&r===0&&i===0&&a===0;return{data:{referenceHidden:((t=(await pf(e)).data)==null?void 0:t.referenceHidden)||o}}}},hf={sideX:`left`,sideY:`top`},gf={name:`adaptiveOrigin`,async fn(e){var t,n;let{x:r,y:i,rects:{floating:a},elements:{floating:o},platform:s,strategy:c,placement:l}=e,u=da(o),d=u.getComputedStyle(o);if(!(d.transitionDuration!==`0s`&&d.transitionDuration!==``))return{x:r,y:i,data:hf};let f=await((t=s.getOffsetParent)==null?void 0:t.call(s,o)),p={width:0,height:0};if(c===`fixed`&&u!=null&&u.visualViewport)p={width:u.visualViewport.width,height:u.visualViewport.height};else if(f===u){let e=gs(o);p={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await((n=s.isElement)==null?void 0:n.call(s,f))&&(p=await s.getDimensions(f));let m=ks(l),h=r,g=i;m===`left`&&(h=p.width-(r+a.width)),m===`top`&&(g=p.height-(i+a.height));let _=m===`left`?`right`:hf.sideX,v=m===`top`?`bottom`:hf.sideY;return{x:h,y:g,data:{sideX:_,sideY:v}}}};V();function _f(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function vf(e,t,n){let{rects:r,placement:i}=e;return{side:_f(t,ks(i),n),align:As(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function yf(e){var t,n;let{anchor:r,positionMethod:i=`absolute`,side:a=`bottom`,sideOffset:o=0,align:s=`center`,alignOffset:c=0,collisionBoundary:l,collisionPadding:u=5,sticky:d=!1,arrowPadding:f=5,disableAnchorTracking:p=!1,inline:m,keepMounted:h=!1,floatingRootContext:g,mounted:_,collisionAvoidance:v,shiftCrossAxis:y=!1,nodeId:b,adaptiveOrigin:x,lazyFlip:S=!1,externalTree:C}=e,[w,T]=Me(null);!_&&w!==null&&T(null);let E=v.side||`flip`,D=v.align||`flip`,O=v.fallbackAxisSide||`end`,k=typeof r==`function`?r:void 0,A=La(k),j=k?A:r,M=ms(r),N=ms(_),P=uf()===`rtl`,ee=w||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":P?`left`:`right`,"inline-start":P?`right`:`left`}[a],te=s===`center`?ee:`${ee}-${s}`,F=u,ne=+(a===`bottom`),re=+(a===`top`),ie=+(a===`right`),ae=+(a===`left`);typeof F==`number`?F={top:F+ne,right:F+ae,bottom:F+re,left:F+ie}:F&&(F={top:(F.top||0)+ne,right:(F.right||0)+ae,bottom:(F.bottom||0)+re,left:(F.left||0)+ie});let oe={boundary:l===`clipping-ancestors`?`clippingAncestors`:l,padding:F},se=R(null),ce=ms(o),I=ms(c),le=typeof o==`function`?0:o,ue=typeof c==`function`?0:c,de=[];m&&de.push(m),de.push(Cu(e=>{let t=vf(e,a,P),n=typeof ce.current==`function`?ce.current(t):ce.current,r=typeof I.current==`function`?I.current(t):I.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[le,ue,P,a]));let fe=D===`none`&&E!==`shift`,pe=!fe&&(d||y||E===`shift`),me=E===`none`?null:Eu(U(U({},oe),{},{padding:{top:F.top+1,right:F.right+1,bottom:F.bottom+1,left:F.left+1},mainAxis:!y&&E===`flip`,crossAxis:D===`flip`&&`alignment`,fallbackAxisSideDirection:O})),L=fe?null:wu(e=>{let t=gs(e.elements.floating).documentElement;return U(U({},oe),{},{rootBoundary:y?{x:0,y:0,width:t.clientWidth,height:t.clientHeight}:void 0,mainAxis:D!==`none`,crossAxis:pe,limiter:d||y?void 0:Tu(e=>{if(!se.current)return{};let{width:t,height:n}=se.current.getBoundingClientRect(),r=Ns(ks(e.placement)),i=r===`y`?t:n,a=r===`y`?F.left+F.right:F.top+F.bottom;return{offset:i/2+a/2}})})},[oe,d,y,F,D]);E===`shift`||D===`shift`||s===`center`?de.push(L,me):de.push(me,L),de.push(Du(U(U({},oe),{},{apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!N.current)return;let i=e.style;i.setProperty(`--available-width`,`${t}px`),i.setProperty(`--available-height`,`${n}px`);let a=da(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(`--anchor-width`,`${u}px`),i.setProperty(`--anchor-height`,`${d}px`)}})),ff(e=>({element:se.current||gs(e.elements.floating).createElement(`div`),padding:f,offsetParent:`floating`}),[f]),{name:`transformOrigin`,fn(e){var t,n,r;let{elements:i,middlewareData:s,placement:c,rects:l,y:u}=e,d=ks(c),f=Ns(d),p=se.current,m=((t=s.arrow)==null?void 0:t.x)||0,h=((n=s.arrow)==null?void 0:n.y)||0,g=(p==null?void 0:p.clientWidth)||0,_=(p==null?void 0:p.clientHeight)||0,v=m+g/2,y=h+_/2,b=Math.abs(((r=s.shift)==null?void 0:r.y)||0),x=l.reference.height/2,S=typeof o==`function`?o(vf(e,a,P)):o,C=b>S,w={top:`${v}px calc(100% + ${S}px)`,bottom:`${v}px ${-S}px`,left:`calc(100% + ${S}px) ${y}px`,right:`${-S}px ${y}px`}[d],T=`${v}px ${l.reference.y+x-u}px`;return i.floating.style.setProperty(`--transform-origin`,pe&&f===`y`&&C?T:w),{}}},mf,x),W(()=>{!_&&g&&g.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[_,g]);let he=z(()=>({elementResize:!p&&typeof ResizeObserver<`u`,layoutShift:!p&&typeof IntersectionObserver<`u`}),[p]),{refs:ge,elements:_e,x:ve,y:ye,middlewareData:be,update:xe,placement:Se,context:Ce,isPositioned:we,floatingStyles:Te}=Cd({rootContext:g,open:h?_:void 0,placement:te,middleware:de,strategy:i,whileElementsMounted:h?void 0:(...e)=>lu(...e,he),nodeId:b,externalTree:C}),{sideX:Ee,sideY:De}=be.adaptiveOrigin||hf,Oe=we?i:`fixed`,ke=z(()=>{let e=x?{position:Oe,[Ee]:ve,[De]:ye}:U({position:Oe},Te);return we||(e.opacity=0),e},[x,Oe,Ee,ve,De,ye,Te,we]),Ae=R(null);W(()=>{if(!_)return;let e=M.current,t=typeof e==`function`?e():e,n=(bf(t)?t.current:t)||null;n!==Ae.current&&(ge.setPositionReference(n),Ae.current=n)},[_,ge,j,M]),Pe(()=>{if(!_)return;let e=M.current;typeof e!=`function`&&bf(e)&&e.current!==Ae.current&&(ge.setPositionReference(e.current),Ae.current=e.current)},[_,ge,j,M]),Pe(()=>{if(h&&_&&_e.reference&&_e.floating)return lu(_e.reference,_e.floating,xe,he)},[h,_,_e,xe,he]);let je=ks(Se),Ne=_f(a,je,P),Fe=As(Se)||`center`,Ie=!!((t=be.hide)!=null&&t.referenceHidden);W(()=>{S&&_&&we&&T(je)},[S,_,we,je]);let Le=z(()=>{var e,t;return{position:`absolute`,top:(e=be.arrow)==null?void 0:e.y,left:(t=be.arrow)==null?void 0:t.x}},[be.arrow]),Re=((n=be.arrow)==null?void 0:n.centerOffset)!==0;return z(()=>({positionerStyles:ke,arrowStyles:Le,arrowRef:se,arrowUncentered:Re,side:Ne,align:Fe,physicalSide:je,anchorHidden:Ie,refs:ge,context:Ce,isPositioned:we,update:xe}),[ke,Le,se,Re,Ne,Fe,je,Ie,ge,Ce,we,xe])}function bf(e){return e!=null&&`current`in e}V();function xf(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=La(i),o=R(0),s=ei(Cf).current,c=ei(Sf).current,[l,u]=Me(0),d=R(l),f=La((e,t)=>{c.set(e,t==null?null:t),d.current+=1,u(d.current)}),p=La(e=>{c.delete(e),d.current+=1,u(d.current)}),m=z(()=>{let e=new Map;return Array.from(c.keys()).filter(e=>e.isConnected).sort(wf).forEach((t,n)=>{var r;let i=(r=c.get(t))==null?{}:r;e.set(t,U(U({},i),{},{index:n}))}),e},[c,l]);W(()=>{if(typeof MutationObserver!=`function`||m.size===0)return;let e=new MutationObserver(e=>{let t=new Set,n=e=>t.has(e)?t.delete(e):t.add(e);e.forEach(e=>{e.removedNodes.forEach(n),e.addedNodes.forEach(n)}),t.size===0&&(d.current+=1,u(d.current))});return m.forEach((t,n)=>{n.parentElement&&e.observe(n.parentElement,{childList:!0})}),()=>{e.disconnect()}},[m]),W(()=>{d.current===l&&(n.current.length!==m.size&&(n.current.length=m.size),r&&r.current.length!==m.size&&(r.current.length=m.size),o.current=m.size),a(m)},[a,m,n,r,l]),W(()=>()=>{n.current=[]},[n]),W(()=>()=>{r&&(r.current=[])},[r]);let h=La(e=>(s.add(e),()=>{s.delete(e)}));W(()=>{s.forEach(e=>e(m))},[s,m]);let g=z(()=>({register:f,unregister:p,subscribeMapChange:h,elementsRef:n,labelsRef:r,nextIndexRef:o}),[f,p,h,n,r,o]);return Eo(po.Provider,{value:g,children:t})}function Sf(){return new Map}function Cf(){return new Set}function wf(e,t){let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}V();let Tf=[`cutout`],Ef=yt(function(e,t){let{cutout:n}=e,r=vr(e,Tf),i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return Eo(`div`,U(U({ref:t,role:`presentation`,"data-base-ui-inert":``},r),{},{style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}}))});function Df(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c=U({},n);return s&&(c.pointerEvents=`none`),Mi(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},$d(r),i],stateAttributesMapping:Zi})}let Of={},kf={},Af=``;function jf(e){if(typeof document>`u`)return!1;let t=gs(e);return da(t).innerWidth-t.documentElement.clientWidth>0}function Mf(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=gs(e),n=t.documentElement,r=t.body,i=_a(n)?n:r,a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function Nf(e){let t=gs(e),n=t.documentElement,r=t.body,i=_a(n)?n:r,a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function Pf(e){var t,n;let r=gs(e),i=r.documentElement,a=r.body,o=da(i),s=0,c=0,l=!1,u=Ao.create();if(oo&&((t=(n=o.visualViewport)==null?void 0:n.scale)==null?1:t)!==1)return()=>{};function d(){let t=o.getComputedStyle(i),n=o.getComputedStyle(a),r=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;s=i.scrollTop,c=i.scrollLeft,Of={scrollbarGutter:i.style.scrollbarGutter,overflowY:i.style.overflowY,overflowX:i.style.overflowX},Af=i.style.scrollBehavior,kf={position:a.style.position,height:a.style.height,width:a.style.width,boxSizing:a.style.boxSizing,overflowY:a.style.overflowY,overflowX:a.style.overflowX,scrollBehavior:a.style.scrollBehavior};let u=i.scrollHeight>i.clientHeight,d=i.scrollWidth>i.clientWidth,f=t.overflowY===`scroll`||n.overflowY===`scroll`,p=t.overflowX===`scroll`||n.overflowX===`scroll`,m=Math.max(0,o.innerWidth-a.clientWidth),h=Math.max(0,o.innerHeight-a.clientHeight),g=parseFloat(n.marginTop)+parseFloat(n.marginBottom),_=parseFloat(n.marginLeft)+parseFloat(n.marginRight),v=_a(i)?i:a;if(l=Mf(e),l){i.style.scrollbarGutter=r,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(i.style,{scrollbarGutter:r,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(i.style.overflowY=`scroll`),(d||p)&&(i.style.overflowX=`scroll`),Object.assign(a.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflow:`hidden`,scrollBehavior:`unset`}),a.scrollTop=s,a.scrollLeft=c,i.setAttribute(`data-base-ui-scroll-locked`,``),i.style.scrollBehavior=`unset`}function f(){Object.assign(i.style,Of),Object.assign(a.style,kf),l||(i.scrollTop=s,i.scrollLeft=c,i.removeAttribute(`data-base-ui-scroll-locked`),i.style.scrollBehavior=Af)}function p(){f(),u.request(d)}d();let m=fs(o,`resize`,p);return()=>{u.cancel(),f(),typeof o.removeEventListener==`function`&&m()}}let Ff=new class{constructor(){H(this,`lockCount`,0),H(this,`restore`,null),H(this,`timeoutLock`,Bo.create()),H(this,`timeoutUnlock`,Bo.create()),H(this,`release`,()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)}),H(this,`unlock`,()=>{if(this.lockCount===0&&this.restore){var e;(e=this.restore)==null||e.call(this),this.restore=null}})}acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}lock(e){if(this.lockCount===0||this.restore!==null)return;let t=gs(e).documentElement,n=da(t).getComputedStyle(t).overflowY;if(n===`hidden`||n===`clip`){this.restore=di;return}let r=$a||!jf(e);this.restore=r?Nf(e):Pf(e)}};function If(e=!0,t=null){W(()=>{if(e)return Ff.acquire(t)},[e,t])}V();function Lf(e,t,n,r){let[i,a]=Me(!1);W(()=>{if(!e||!t||n==null){a(!1);return}let r=gs(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-20)},[e,t,n]),If(e&&(!t||i),r)}V();let Rf=[`anchor`,`positionMethod`,`className`,`render`,`side`,`align`,`sideOffset`,`alignOffset`,`collisionBoundary`,`collisionPadding`,`arrowPadding`,`sticky`,`disableAnchorTracking`,`collisionAvoidance`,`style`],zf=yt(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=Uc,style:g}=e,_=vr(e,Rf),{store:v}=Qr(),y=af(),b=$i(!0),x=v.useState(`parent`),S=v.useState(`floatingRootContext`),C=v.useState(`floatingTreeRoot`),w=v.useState(`mounted`),T=v.useState(`open`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`activeTriggerElement`),k=v.useState(`transitionStatus`),A=v.useState(`positionerElement`),j=v.useState(`instantType`),M=v.useState(`hasViewport`),N=v.useState(`lastOpenChangeReason`),P=v.useState(`floatingNodeId`),ee=v.useState(`floatingParentNodeId`),te=S.useState(`domReferenceElement`),F=R(null),ne=Po(A,!1,!1),re=n,ie=c,ae=l,oe=s,se=h;if(x.type===`context-menu`){var ce,I;if(re=n==null?(ce=x.context)==null?void 0:ce.anchor:n,oe=(I=oe)==null?`start`:I,!o&&oe!==`center`){var le,ue;ae=(le=e.alignOffset)==null?2:le,ie=(ue=e.sideOffset)==null?-5:ue}}let de=o,fe=oe;if(x.type===`menu`){var pe,me,L;de=(pe=de)==null?`inline-end`:pe,fe=(me=fe)==null?`start`:me,se=(L=e.collisionAvoidance)==null?Wc:L}else if(x.type===`menubar`){var he,ge;de=(he=de)==null?x.context.orientation===`vertical`?`inline-end`:`bottom`:he,fe=(ge=fe)==null?`start`:ge}let _e=x.type===`context-menu`,ve=yf({anchor:re,floatingRootContext:S,positionMethod:b?`fixed`:r,mounted:w,side:de,sideOffset:ie,align:fe,alignOffset:ae,arrowPadding:_e?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:P,keepMounted:y,disableAnchorTracking:m,collisionAvoidance:se,shiftCrossAxis:_e&&!(`side`in se&&se.side===`flip`),externalTree:C,adaptiveOrigin:M?gf:void 0});Pe(()=>{function e(e){e.open&&(e.parentNodeId===P&&v.set(`hoverEnabled`,!1),e.nodeId!==P&&e.parentNodeId===v.select(`floatingParentNodeId`)&&v.setOpen(!1,wo(oa)))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[v,C.events,P]),Pe(()=>{if(v.select(`floatingParentNodeId`)==null)return;function e(e){var t;if(e.open||e.nodeId!==v.select(`floatingParentNodeId`))return;let n=(t=e.reason)==null?oa:t;v.setOpen(!1,wo(n))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[C.events,v]);let ye=Vo();Pe(()=>{T||ye.clear()},[T,ye]),Pe(()=>{function e(e){if(!(!T||e.nodeId!==v.select(`floatingParentNodeId`)))if(e.target&&O&&O!==e.target){let e=v.select(`closeDelay`);e>0?ye.isStarted()||ye.start(e,()=>{v.setOpen(!1,wo(oa))}):v.setOpen(!1,wo(oa))}else ye.clear()}return C.events.on(`itemhover`,e),()=>{C.events.off(`itemhover`,e)}},[C.events,T,O,v,ye]),Pe(()=>{let e={open:T,nodeId:P,parentNodeId:ee,reason:v.select(`lastOpenChangeReason`)};C.events.emit(`menuopenchange`,e)},[C.events,T,v,P,ee]),W(()=>{let e=te,t=F.current;if(e&&(F.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return ne(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[te,ne,v]);let be={open:T,side:ve.side,align:ve.align,anchorHidden:ve.anchorHidden,nested:x.type===`menu`,instant:j},xe=x.type===`menubar`&&x.context.modal;Lf(T&&(xe||E&&N!==`trigger-hover`),D===`touch`,A,O);let Se=Df(e,be,{styles:ve.positionerStyles,transitionStatus:k,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!w,inert:!T}),Ce=w&&x.type!==`menu`&&(x.type!==`menubar`&&E&&N!==`trigger-hover`||x.type===`menubar`&&x.context.modal),we=null;return x.type===`menubar`?we=x.context.contentElement:x.type===void 0&&(we=O),Eo(Yr.Provider,{value:ve,children:[Ce&&Eo(Ef,{ref:x.type===`context-menu`||x.type===`nested-context-menu`?x.context.internalBackdropRef:null,inert:cf(!T),cutout:we}),Eo(al,{id:P,children:Eo(xf,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:Se})})]})});V();let Bf=me(void 0);function Vf(){let e=Re(Bf);if(e===void 0)throw Error(Jr(34));return e}V();let Hf=[`render`,`className`,`value`,`defaultValue`,`onValueChange`,`disabled`,`style`,`aria-labelledby`],Uf=vt(yt(function(e,t){let{render:n,className:r,value:i,defaultValue:a,onValueChange:o,disabled:s=!1,style:c,"aria-labelledby":l}=e,u=vr(e,Hf),[d,f]=Me(void 0),[p,m]=ca({controlled:i,default:a,name:`MenuRadioGroup`}),h=La((e,t)=>{o==null||o(e,t),!t.isCanceled&&m(e)}),g=Mi(`div`,e,{state:{disabled:s},ref:t,props:U({role:`group`,"aria-labelledby":l==null?d:l,"aria-disabled":s||void 0},u)}),_=z(()=>({value:p,setValue:h,disabled:s}),[p,h,s]);return Eo(Io.Provider,{value:f,children:Eo(Bf.Provider,{value:_,children:g})})}));V();let Wf=me(void 0);function Gf(){let e=Re(Wf);if(e===void 0)throw Error(Jr(35));return e}V();let Kf=[`render`,`className`,`id`,`label`,`nativeButton`,`disabled`,`closeOnClick`,`value`,`style`],qf=yt(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,value:l,style:u}=e,d=vr(e,Kf),f=go({label:a}),p=Xr(!0),m=xo(i),{store:h}=Qr(),g=h.useState(`isActive`,f.index),_=h.useState(`itemProps`),{value:v,setValue:y,disabled:b}=Vf(),x=b||s,S=v===l,{getItemProps:C,itemRef:w}=fo({closeOnClick:c,disabled:x,highlighted:g,id:m,store:h,nativeButton:o,nodeId:p==null?void 0:p.context.nodeId,itemMetadata:uo}),T=z(()=>({disabled:x,highlighted:g,checked:S}),[x,g,S]);function E(e){let t=wo(ra,e.nativeEvent,void 0,{preventUnmountOnClose(){}});y(l,t)}let D=Mi(`div`,e,{state:T,stateAttributesMapping:Co,props:[_,{role:`menuitemradio`,"aria-checked":S,onClick:E},d,C],ref:[w,t,f.ref]});return Eo(Wf.Provider,{value:T,children:D})});V();let Jf=[`render`,`className`,`style`,`keepMounted`],Yf=yt(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1}=e,o=vr(e,Jf),s=Gf(),c=R(null),{transitionStatus:l,setMounted:u}=Mo(s.checked);return Fo({open:s.checked,ref:c,onComplete(){s.checked||u(!1)}}),Mi(`span`,e,{state:{checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l},stateAttributesMapping:Co,ref:[t,c],props:U({"aria-hidden":!0},o),enabled:a||s.checked})});V();let Xf=me(null);function Zf(e){let t=Re(Xf);if(t===null&&!e)throw Error(Jr(5));return t}V();function Qf(e){let t=R(``),n=Le(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:Le(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}V();function $f(e,t){let n=R(e),r=La(t);W(()=>{n.current!==e&&r(n.current)},[e,r]),W(()=>{n.current=e},[e])}V();function ep(e,t){let{onClick:n,onPointerDown:r}=Qf(La((n,r)=>{(typeof e==`function`?e():e)||t(r||($a?`touch`:``))}));return z(()=>({onClick:n,onPointerDown:r}),[n,r])}function tp(e){let[t,n]=Me(null),r=ep(e,n);return $f(e,t=>{t&&!e&&n(null)}),z(()=>({openMethod:t,triggerProps:r}),[t,r])}V();let np=U(U({},xd),{},{disabled:G(e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled),modal:G(e=>{var t;return(e.parent.type===void 0||e.parent.type===`context-menu`)&&((t=e.modal)==null||t)}),openMethod:G(e=>e.openMethod),allowMouseEnter:G(e=>e.allowMouseEnter),highlightItemOnHover:G(e=>e.highlightItemOnHover),stickIfOpen:G(e=>e.stickIfOpen),parent:G(e=>e.parent),rootId:G(e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId),activeIndex:G(e=>e.activeIndex),isActive:G((e,t)=>e.activeIndex===t),hoverEnabled:G(e=>e.hoverEnabled),instantType:G(e=>e.instantType),lastOpenChangeReason:G(e=>e.openChangeReason),floatingTreeRoot:G(e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot),floatingNodeId:G(e=>e.floatingNodeId),floatingParentNodeId:G(e=>e.floatingParentNodeId),itemProps:G(e=>e.itemProps),closeDelay:G(e=>e.closeDelay),hasViewport:G(e=>e.hasViewport),keyboardEventRelay:G(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)})});var rp=class e extends Yu{constructor(e){super(U(U({},ip()),e),{positionerRef:T(),popupRef:T(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:T(),beforeContentFocusGuardRef:T(),onOpenChangeComplete:void 0,triggerElements:new fd},np),H(this,`unsubscribeParentListener`,null),this.unsubscribeParentListener=this.observe(`parent`,e=>{var t;if((t=this.unsubscribeParentListener)==null||t.call(this),e.type===`menu`){let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);this.unsubscribeParentListener=e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);t===i&&n===a&&r===o||(t=i,n=a,r=o,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef;return}e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}static useStore(t,n){let r=ei(()=>new e(n)).current;return t==null?r:t}};function ip(){return U(U({},md()),{},{disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new $c,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:pi,keyboardEventRelay:void 0,closeDelay:0,hasViewport:!1})}V();let ap=me(void 0);function op(){return Re(ap)}V();let sp=Ru(function(e){var t;let{children:n,open:r,onOpenChange:i,onOpenChangeComplete:a,defaultOpen:o=!1,disabled:s=!1,modal:c,loopFocus:l=!0,orientation:u=`vertical`,actionsRef:d,closeParentOnEsc:f=!1,handle:p,triggerId:m,defaultTriggerId:h=null,highlightItemOnHover:g=!0}=e,_=$i(!0),v=Qr(!0),y=Zf(!0),b=op(),x=z(()=>b&&v?{type:`menu`,store:v.store}:y?{type:`menubar`,context:y}:_&&!v?{type:`context-menu`,context:_}:{type:void 0},[_,v,y,b]),S=rp.useStore(p==null?void 0:p.store,{open:o,openProp:r,activeTriggerId:h,triggerIdProp:m,parent:x});od(S,r,o,h),S.useControlledProp(`openProp`,r),S.useControlledProp(`triggerIdProp`,m),S.useContextCallback(`onOpenChangeComplete`,a);let C=bo(),w=bo(),T=S.useState(`floatingTreeRoot`),E=il(T),D=nl(),O=S.useState(`open`),k=S.useState(`activeTriggerElement`),A=S.useState(`positionerElement`),j=S.useState(`hoverEnabled`),M=S.useState(`disabled`),N=S.useState(`lastOpenChangeReason`),P=S.useState(`parent`),ee=S.useState(`activeIndex`),te=S.useState(`payload`),F=S.useState(`floatingParentNodeId`),ne=R(null),re=R(P.type!==`context-menu`),ie=Vo(),ae=R(!0),oe=Vo(),se=F!=null,{openMethod:ce,triggerProps:I}=tp(O);S.useSyncedValues({disabled:s,highlightItemOnHover:g,modal:P.type===void 0?c:void 0,openMethod:ce,rootId:C}),cd(S);let{forceUnmount:le}=ld(O,S,()=>{S.update({allowMouseEnter:!1,stickIfOpen:!0})});W(()=>{_&&!v?S.update({parent:{type:`context-menu`,context:_},floatingNodeId:E,floatingParentNodeId:D}):v&&S.update({floatingNodeId:E,floatingParentNodeId:D})},[_,v,E,D,S]),Pe(()=>{if(O||(ne.current=null),P.type===`context-menu`){if(!O){ie.clear(),re.current=!1;return}ie.start(500,()=>{re.current=!0})}},[ie,O,P.type]),W(()=>{!O&&!j&&S.set(`hoverEnabled`,!0)},[O,j,S]);let ue=La((e,t)=>{var n;let r=t.reason;if(O===e&&t.trigger===k&&N===r)return;let a=ad(t);if(!e&&t.trigger==null&&(t.trigger=k==null?void 0:k),i==null||i(e,t),t.isCanceled)return;S.state.floatingRootContext.dispatchOpenChange(e,t);let o=t.event;if(e===!1&&(o==null?void 0:o.type)===`click`&&o.pointerType===`touch`&&!ae.current)return;e&&r===`trigger-focus`?(ae.current=!1,oe.start(300,()=>{ae.current=!0})):(ae.current=!0,oe.clear());let s=(r===`trigger-press`||r===`item-press`)&&o.detail===0&&(o==null?void 0:o.isTrusted),c=!e&&(r===`escape-key`||r==null),l={open:e,openChangeReason:r};ne.current=(n=t.event)==null?null:n,id(l,e,t.trigger,a()),S.update(l),P.type===`menubar`&&(r===`trigger-focus`||r===`focus-out`||r===`trigger-hover`||r===`list-navigation`||r===`sibling-open`)?S.set(`instantType`,`group`):s||c?S.set(`instantType`,s?`click`:`dismiss`):S.set(`instantType`,void 0)}),de=$u({popupStore:S,floatingId:w,nested:D!=null,onOpenChange:ue}),fe=de.context.events;Pe(()=>{let e=({open:e,eventDetails:t})=>ue(e,t);return fe.on(`setOpen`,e),()=>{fe==null||fe.off(`setOpen`,e)}},[fe,ue]);let pe=Le(()=>{S.setOpen(!1,wo(sa))},[S]);Ie(d,()=>({unmount:le,close:pe}),[le,pe]);let me;P.type===`context-menu`&&(me=P.context),Ie(me==null?void 0:me.positionerRef,()=>A,[A]),Ie(me==null?void 0:me.actionsRef,()=>({setOpen:ue}),[ue]);let L=vl(de,{enabled:!M,bubbles:{escapeKey:f&&P.type===`menu`},outsidePress(){var e;return P.type!==`context-menu`||((e=ne.current)==null?void 0:e.type)===`contextmenu`||re.current},externalTree:se?T:void 0}),he=uf(),ge=Le(e=>{S.select(`activeIndex`)!==e&&S.set(`activeIndex`,e)},[S]),_e=zd(de,{enabled:!M,listRef:S.context.itemDomElements,activeIndex:ee,nested:P.type!==void 0,loopFocus:l,orientation:u,parentOrientation:P.type===`menubar`?P.context.orientation:void 0,rtl:he===`rtl`,disabledIndices:fi,onNavigate:ge,openOnArrowKeyDown:P.type!==`context-menu`,externalTree:se?T:void 0,focusItemOnHover:g}),ve=Le(e=>{S.context.typingRef.current=e},[S]),ye=Bd(de,{enabled:!M,listRef:S.context.itemLabels,elementsRef:S.context.itemDomElements,activeIndex:ee,resetMs:500,onMatch:e=>{O&&e!==ee&&S.set(`activeIndex`,e)},onTyping:ve});ud(S,{floatingRootContext:de,activeTriggerProps:z(()=>{let e=vi(ye.reference,_e.reference,L.reference,{onMouseMove(){S.set(`allowMouseEnter`,!0)}},I);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=O,e},[S,ye.reference,_e.reference,L.reference,I,O]),inactiveTriggerProps:z(()=>{let e=vi(_e.trigger,L.trigger,I);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[_e.trigger,L.trigger,I]),popupProps:z(()=>vi(ed,{id:w,role:`menu`,"aria-labelledby":k==null?void 0:k.id,onMouseMove(){S.set(`allowMouseEnter`,!0),P.type===`menu`&&S.set(`hoverEnabled`,!1)},onClick(){S.select(`hoverEnabled`)&&S.set(`hoverEnabled`,!1)},onKeyDown(e){let t=S.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},ye.floating,_e.floating,L.floating),[k,w,P.type,S,ye.floating,_e.floating,L.floating]),itemProps:(t=_e.item)==null?pi:t});let be=z(()=>({store:S,parent:x}),[S,x]),xe=Eo(Zr.Provider,{value:be,children:typeof n==`function`?n({payload:te}):n});return P.type===void 0||P.type===`context-menu`?Eo(ol,{externalTree:T,children:xe}):xe});function cp(e){let t=e.getBoundingClientRect(),n=da(e);if(co)return t;let r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(!(r.content!==`none`||i.content!==`none`))return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}V();function lp(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=Va(),{ref:i,index:a}=go(e),o=n===a,s=R(null),c=ti(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}let up=[`render`,`className`,`style`,`state`,`props`,`refs`,`metadata`,`stateAttributesMapping`,`tag`];function dp(e){let{render:t,className:n,style:r,state:i=pi,props:a=fi,refs:o=fi,metadata:s,stateAttributesMapping:c,tag:l=`div`}=e,u=vr(e,up),{compositeProps:d,compositeRef:f}=lp({metadata:s});return Mi(l,e,{state:i,ref:[...o,f],props:[d,...a,u],stateAttributesMapping:c})}function fp(e){if(ha(e)&&e.hasAttribute(`data-rootownerid`)){var t;return(t=e.getAttribute(`data-rootownerid`))==null?void 0:t}if(!Da(e))return fp(Aa(e))}V();function pp(e,t){let n=R(null);function r(t){cn(()=>{e.setOpen(!1,wo(ia,t.nativeEvent,t.currentTarget))});let r=xc(n.current);r==null||r.focus()}function i(n){let r=e.select(`positionerElement`);if(r&&Sc(n,r)){var i;(i=e.context.beforeContentFocusGuardRef.current)==null||i.focus()}else{cn(()=>{e.setOpen(!1,wo(ia,n.nativeEvent,n.currentTarget))});let i=bc(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&Zo(r,i);){let e=i;if(i=_c(i),i===e)break}i==null||i.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}V();function mp(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=R(!1);return z(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,gs(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:pi,[t,n,r])}V();let hp=[`render`,`className`,`style`,`disabled`,`nativeButton`,`id`,`openOnHover`,`delay`,`closeDelay`,`handle`,`payload`],gp=zu(function(e,t){var n;let{render:r,className:i,style:a,disabled:o=!1,nativeButton:s=!0,id:c,openOnHover:l,delay:u=100,closeDelay:d=0,handle:f,payload:p}=e,m=vr(e,hp),h=Qr(!0),g=(n=f==null?void 0:f.store)==null?h==null?void 0:h.store:n;if(!g)throw Error(Jr(85));let _=xo(c),v=g.useState(`isTriggerActive`,_),y=g.useState(`floatingRootContext`),b=g.useState(`isOpenedByTrigger`,_),x=g.useState(`triggerPopupId`,_),S=R(null),C=vp(),w=Va(!0),T=rl(),D=z(()=>T==null?new $c:T,[T]),{registerTrigger:O,isMountedByThisTrigger:k}=sd(_,S,g,{payload:p,closeDelay:d,parent:C,floatingTreeRoot:D,floatingNodeId:il(D),floatingParentNodeId:nl(),keyboardEventRelay:w==null?void 0:w.relayKeyboardEvent}),A=C.type===`menubar`,j=g.useState(`disabled`),M=o||j||A&&C.context.disabled,{getButtonProps:N,buttonRef:P}=Wa({disabled:M,native:s});Pe(()=>{!b&&C.type===void 0&&(g.context.allowMouseUpTriggerRef.current=!1)},[g,b,C.type]);let ee=R(null),te=Vo(),F=La(e=>{if(!ee.current)return;te.clear(),g.context.allowMouseUpTriggerRef.current=!1;let t=e.target;if(Zo(ee.current,t)||Zo(g.select(`positionerElement`),t)||t===ee.current||t!=null&&fp(t)===g.select(`rootId`))return;let n=cp(ee.current);e.clientX>=n.left-2&&e.clientX<=n.right+2&&e.clientY>=n.top-2&&e.clientY<=n.bottom+2||D.events.emit(`close`,{domEvent:e,reason:`cancel-open`})});Pe(()=>{b&&g.select(`lastOpenChangeReason`)===`trigger-hover`&&gs(ee.current).addEventListener(`mouseup`,F,{once:!0})},[b,F,g]);let ne=A&&C.context.hasSubmenuOpen,re=Nd(y,{enabled:(l==null?ne:l)&&!M&&C.type!==`context-menu`&&(!A||ne&&!k),handleClose:Kd({blockPointerEvents:!A}),mouseOnly:!0,move:!1,restMs:C.type===void 0?u:void 0,delay:{close:d},triggerElementRef:S,externalTree:D,isActiveTrigger:v,isClosing:()=>g.select(`transitionStatus`)===`ending`}),ie=_p(b,g.select(`lastOpenChangeReason`)),ae=hl(y,{enabled:!M&&C.type!==`context-menu`,event:b&&A?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:C.type===void 0&&ie}),oe=Td(y,{enabled:!M&&ne}),se=mp({open:b,enabled:A,mouseDownAction:`open`}),ce=z(()=>vi(oe.reference,ae.reference),[oe.reference,ae.reference]),I=g.useState(`triggerProps`,k),{preFocusGuardRef:le,handlePreFocusGuardFocus:ue,handleFocusTargetFocus:de}=pp(g,S),fe={disabled:M,open:b},pe=[ee,t,P,O,S],me=[ce,re==null?pi:re,I,{"aria-haspopup":`menu`,"aria-controls":x,id:_,onMouseDown:e=>{g.select(`open`)||(te.start(200,()=>{g.context.allowMouseUpTriggerRef.current=!0}),gs(e.currentTarget).addEventListener(`mouseup`,F,{once:!0}))}},A?{role:`menuitem`}:{},se,m,N],L=Mi(`button`,e,{enabled:!A,stateAttributesMapping:Xi,state:fe,ref:pe,props:me});return A?Eo(dp,{tag:`button`,render:r,className:i,style:a,state:fe,refs:pe,props:me,stateAttributesMapping:Xi}):b?Eo(E,{children:[Eo(ys,{ref:le,onFocus:ue},`${_}-pre-focus-guard`),Eo(E,{children:L},_),Eo(ys,{ref:g.context.triggerFocusTargetRef,onFocus:de},`${_}-post-focus-guard`)]}):Eo(E,{children:L},_)});function _p(e,t){let n=Vo(),[r,i]=Me(!1);return W(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function vp(){let e=$i(!0),t=Qr(!0),n=Zf(!0);return z(()=>n?{type:`menubar`,context:n}:e&&!t?{type:`context-menu`,context:e}:{type:void 0},[e,t,n])}V();function yp(e){return`${e.charAt(0).toLocaleUpperCase()}${e.substring(1)}`}let bp={askAI:`askAI`,favoriteSearches:`favoriteSearches`,recentConversations:`recentConversations`,recentSearches:`recentSearches`};function xp(e,t){return e.collections.find(e=>(e==null?void 0:e.source.sourceId)===t)}function Sp(e){return e.replace(/&lt;/g,`<`).replace(/&gt;/g,`>`).replace(/&quot;/g,`"`).replace(/&#039;/g,`'`).replace(/&amp;/g,`&`)}let Cp=[`lvl0`,`lvl1`,`lvl2`,`lvl3`,`lvl4`,`lvl5`,`lvl6`];function wp(e){let t=e.type===`content`||e.type===`askAI`?Cp.length:Cp.indexOf(e.type);return Cp.slice(0,t).map(t=>e.hierarchy[t]?Sp(e.hierarchy[t]):null).filter(Boolean).join(` > `)}let Tp=new Map;function Ep(e){let t=Tp.get(e);if(t)return t;let n=e.replace(/\[(\w+)\]/g,`.$1`).replace(/^\/./,``).split(`.`);return Tp.set(e,n),n}function Dp(e,t){return Ep(t).reduce((e,t)=>{if(e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,t))return e[t]},e)}function Op(e,t,n){return e.reduce((e,r)=>{let i=t(r);return e.hasOwnProperty(i)||(e[i]=[]),e[i].length<(n||5)&&e[i].push(r),e},{})}function kp(e){return e}function Ap(e){return e.button===1||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}function jp(e){return!e||e.trim().length===0}function Mp(...e){}let Np=/(<mark>|<\/mark>)/g,Pp=RegExp(Np.source);function Fp(e){var t,n;let r=e;if(!r.__docsearch_parent&&!e._highlightResult)return e.hierarchy.lvl0;let i=r.__docsearch_parent?(t=r.__docsearch_parent)==null||(t=t._highlightResult)==null||(t=t.hierarchy)==null?void 0:t.lvl0:(n=e._highlightResult)==null||(n=n.hierarchy)==null?void 0:n.lvl0;return i?i.value&&Pp.test(i.value)?i.value.replace(Np,``):i.value:e.hierarchy.lvl0}function Ip(e){typeof e.scrollTo==`function`?e.scrollTo({top:0,behavior:`smooth`}):e.scrollTop=0}function Lp(){return B.createElement(`svg`,{className:`DocSearch-Hit-Select-Icon`,width:`20`,height:`20`,viewBox:`0 0 20 20`},B.createElement(`g`,{stroke:`currentColor`,fill:`none`,fillRule:`evenodd`,strokeLinecap:`round`,strokeLinejoin:`round`},B.createElement(`path`,{d:`M18 3v4c0 2-2 4-4 4H2`}),B.createElement(`path`,{d:`M8 17l-6-6 6-6`})))}function Rp(){return B.createElement(`svg`,{width:`40`,height:`40`,viewBox:`0 0 20 20`,fill:`none`,fillRule:`evenodd`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`},B.createElement(`path`,{d:`M19 4.8a16 16 0 00-2-1.2m-3.3-1.2A16 16 0 001.1 4.7M16.7 8a12 12 0 00-2.8-1.4M10 6a12 12 0 00-6.7 2M12.3 14.7a4 4 0 00-4.5 0M14.5 11.4A8 8 0 0010 10M3 16L18 2M10 18h0`}))}function zp(){return B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`64`,height:`64`,viewBox:`0 0 24 24`,fill:`none`,stroke:`#5a5e9a`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},B.createElement(`path`,{d:`m13.5 8.5-5 5`}),B.createElement(`path`,{d:`m8.5 8.5 5 5`}),B.createElement(`circle`,{cx:`11`,cy:`11`,r:`8`}),B.createElement(`path`,{d:`m21 21-4.3-4.3`}))}function Bp(){return B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},B.createElement(`path`,{d:`M12 17v5`}),B.createElement(`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`}))}function Vp(){return B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`},B.createElement(`polyline`,{points:`6 9 12 15 18 9`}))}function Hp(){return B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`},B.createElement(`polyline`,{points:`20 6 9 17 4 12`}))}function Up(e=[]){let t=new Map;for(let n of e){let e=n.key.trim().toLowerCase();if(!(e.length===0||t.has(e))){if(t.size>=5)break;t.set(e,n)}}return Array.from(t.values())}function Wp(e){return e.label?e.label:e.key.replace(/[._-]+/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function Gp(e){let t={};for(let r of e){var n;let e=(n=r.searchParameters)==null?void 0:n.facetFilters;for(let n of Array.isArray(e)?e:[e]){if(typeof n!=`string`)continue;let e=n.indexOf(`:`);if(e<=0)continue;let r=n.slice(0,e),i=n.slice(e+1);r&&i&&(t[r]=i)}}return t}let Kp=[`className`,`type`];function qp({children:e}){return B.createElement(`div`,{className:`DocSearch-Chip`},e)}function Jp(e){let{className:t,type:n=`button`}=e,r=pn(e,Kp),i=`DocSearch-Chip-Dismiss${t?` ${t}`:``}`;return B.createElement(`button`,_({type:n,className:i,tabIndex:0},r),B.createElement(jr,{"aria-hidden":`true`}))}qp.Dismiss=Jp;let Yp=[`className`],Xp=[`align`,`alignOffset`,`side`,`sideOffset`,`collisionBoundary`,`container`],Zp=[`className`,`children`],Qp=[`className`];function $p(e){let t=Ar({},(kr(e),e));return B.createElement(sp,t)}$p.Trigger=B.forwardRef((e,t)=>{let{className:n}=e,r=pn(e,Yp),i=`DocSearch-Menu-Trigger${n?` ${n}`:``}`;return B.createElement(gp,_({className:i,ref:t},r))});function em(e){let{align:t=`start`,alignOffset:n=0,side:r=`bottom`,sideOffset:i=4,collisionBoundary:a=`clipping-ancestors`,container:o}=e,s=pn(e,Xp);return B.createElement(sf,{container:o},B.createElement(zf,{className:`DocSearch-Menu-Positioner`,align:t,alignOffset:n,side:r,sideOffset:i,collisionBoundary:a},B.createElement(nf,_({className:`DocSearch-Menu-Popup`},s))))}$p.Popup=em;function tm(e){let t=Ar({},(kr(e),e));return B.createElement(Uf,t)}$p.RadioGroup=tm;function nm(e){let{className:t,children:n}=e,r=pn(e,Zp),i=`DocSearch-Menu-Item DocSearch-Menu-RadioItem${t?` ${t}`:``}`;return B.createElement(qf,_({className:i,closeOnClick:!0},r),B.createElement(`span`,{className:`DocSearch-Menu-RadioItem-Indicator`},B.createElement(Yf,null,B.createElement(Hp,null))),n)}$p.RadioItem=nm;function rm(e){let{className:t}=e,n=pn(e,Qp),r=`DocSearch-Menu-GroupLabel${t?` ${t}`:``}`;return B.createElement(zo,_({className:r},n))}$p.GroupLabel=rm;let im=B.memo(function({facet:e,selectedValue:t,defaultValueLabel:n,onSelectionChange:r,registerTrigger:i,menuTriggerSelectedAriaLabel:a}){let o=Wp(e),s=B.useCallback(t=>{r(e.key,t)},[e.key,r]),c=B.useCallback(t=>{i(e.key,t)},[e.key,i]);return B.createElement($p,null,B.createElement($p.Trigger,{ref:c,"data-has-selection":!!t,"aria-label":t?`${o}, ${t} ${a}`:o},B.createElement(`span`,null,yp(o)),B.createElement(Vp,null)),B.createElement($p.Popup,null,B.createElement($p.RadioGroup,{value:t,onValueChange:s},B.createElement($p.RadioItem,{value:``,label:`${n} ${o}`},n),e.values.map(e=>B.createElement($p.RadioItem,{key:e,value:e,label:e},yp(e))))))}),am=B.memo(function({facetKey:e,facetLabel:t,value:n,dismissAriaLabel:r,onDismiss:i}){let a=B.useCallback(t=>{i(e,t)},[e,i]);return B.createElement(qp,null,yp(n),B.createElement(qp.Dismiss,{"aria-label":`${r} ${yp(n)} (${t})`,onClick:a}))}),om=B.memo(function({facets:e,selections:t,onSelectionChange:n,clearSelections:r,translations:i={}}){let{defaultValueLabel:a=`All`,facetMenuTriggerAriaLabel:o=`selected`,clearAllLabel:s=`Clear all`,facetsAriaLabel:c=`Search filters`,selectedFacetsAriaLabel:l=`Selected search filters`,clearFacetAriaLabel:u=`Clear filter:`}=i,d=B.useMemo(()=>new Set(e.map(e=>e.key)),[e]),f=B.useMemo(()=>Object.entries(t).filter(([e,t])=>!!t&&d.has(e)),[t,d]),p=B.useRef(new Map),m=B.useCallback((e,t)=>{t?p.current.set(e,t):p.current.delete(e)},[]),h=B.useCallback((e,t)=>{let r=t.currentTarget,i=r.closest(`.DocSearch-FacetSelectionBar`);if(i){var a,o;let t=Array.from(i.querySelectorAll(`.DocSearch-Chip-Dismiss`)),n=t.indexOf(r),s=(a=(o=t[n+1])==null?t[n-1]:o)==null?p.current.get(e):a;s==null||s.focus()}n(e,``)},[n]),g=B.useCallback(()=>{var e;(e=p.current.values().next().value)==null||e.focus(),r()},[r]),_=B.useMemo(()=>new Map(e.map(e=>[e.key,Wp(e)])),[e]);return e.length===0?null:B.createElement(B.Fragment,null,B.createElement(`div`,{className:`DocSearch-FacetBar`,role:`group`,"aria-label":c},e.map(e=>{var r;let i=(r=t[e.key])==null?``:r;return B.createElement(im,{key:e.key,facet:e,selectedValue:i,defaultValueLabel:a,registerTrigger:m,menuTriggerSelectedAriaLabel:o,onSelectionChange:n})})),f.length>0&&B.createElement(`div`,{className:`DocSearch-FacetSelectionBar`,role:`group`,"aria-label":l},f.map(([e,t])=>{var n;return B.createElement(am,{key:e,facetKey:e,facetLabel:(n=_.get(e))==null?e:n,value:t,dismissAriaLabel:u,onDismiss:h})}),B.createElement(`button`,{type:`button`,className:`DocSearch-FacetSelectionBar-Action`,onClick:g},s)))}),sm=[`actionsBeforeClose`,`autoFocus`,`clearButtonAriaLabel`,`clearButtonTitle`,`closeButtonAriaLabel`,`closeButtonText`,`hideInput`,`inputOverlay`,`inputProps`,`inputRef`,`isFromSelection`,`leadingElement`,`onClose`,`placeholder`,`searchInputLabel`,`state`];function cm(e){let{actionsBeforeClose:t,autoFocus:n,clearButtonAriaLabel:r,clearButtonTitle:i,closeButtonAriaLabel:a,closeButtonText:o,hideInput:s,inputOverlay:c,inputProps:l,inputRef:u,isFromSelection:d,leadingElement:f,onClose:p,placeholder:m,searchInputLabel:h,state:g}=e,v=pn(e,sm),{onReset:y}=v.getFormProps({inputElement:u.current});B.useEffect(()=>{n&&u.current&&u.current.focus()},[n,u]),B.useEffect(()=>{d&&u.current&&u.current.select()},[d,u]);let b=v.getInputProps({inputElement:u.current,autoFocus:n,maxLength:512}),x=g.status===`stalled`;return B.createElement(`form`,{className:`DocSearch-Form`,onSubmit:e=>{e.preventDefault()},onReset:y},f||(x?B.createElement(`div`,{className:`DocSearch-LoadingIndicator`},B.createElement(Er,null)):B.createElement(`label`,_({className:`DocSearch-MagnifierLabel`},v.getLabelProps()),B.createElement(dn,null),B.createElement(`span`,{className:`DocSearch-VisuallyHiddenForAccessibility`},h))),c,B.createElement(`input`,_(_(_({className:`DocSearch-Input`,ref:u},b),l),{},{placeholder:m,hidden:s})),B.createElement(`div`,{className:`DocSearch-Actions`},t,B.createElement(`button`,{type:`button`,title:o,className:`DocSearch-Action DocSearch-Close`,"aria-label":a,onClick:p},B.createElement(jr,null))))}function lm({state:e,containerRef:t,modalRef:n,formElementRef:r,dropdownRef:i,getRootProps:a,onClose:o,showDropdown:s,searchBox:c,filterBar:l,screenState:u,footer:d}){return B.createElement(`div`,_(_({ref:t},a({"aria-expanded":!0})),{},{className:[`DocSearch`,`DocSearch-Container`,e.status===`stalled`&&`DocSearch-Container--Stalled`,e.status===`error`&&`DocSearch-Container--Errored`].filter(Boolean).join(` `),role:`button`,tabIndex:0,onMouseDown:e=>{e.target===e.currentTarget&&o()}}),B.createElement(`div`,{className:`DocSearch-Modal`,ref:n},B.createElement(`header`,{className:`DocSearch-SearchBar`,ref:r},c),l,s&&B.createElement(`div`,{className:`DocSearch-Dropdown`,ref:i},u),B.createElement(`footer`,{className:`DocSearch-Footer`},d)))}function um(e){return B.createElement(`svg`,{width:`20`,height:`20`,"aria-label":e.ariaLabel,viewBox:`0 0 24 24`,role:`img`},B.createElement(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.4`},e.children))}function dm({translations:e={},isAskAiActive:t=!1,footerAction:n}){let{selectText:r=`Select`,selectKeyAriaLabel:i=`Enter key`,submitQuestionText:a=`Submit question`,navigateText:o=`Navigate`,navigateUpKeyAriaLabel:s=`Arrow up`,navigateDownKeyAriaLabel:c=`Arrow down`,closeText:l=`Close`,backToSearchText:u=`Back to search`,closeKeyAriaLabel:d=`Escape key`,poweredByText:f=`Powered by`}=e,p=n!=null&&typeof n!=`boolean`;return B.createElement(B.Fragment,null,B.createElement(`ul`,{className:`DocSearch-Commands`},B.createElement(`li`,null,B.createElement(`kbd`,{className:`DocSearch-Commands-Key`},B.createElement(um,{ariaLabel:c},B.createElement(`path`,{d:`M12 5v14`}),B.createElement(`path`,{d:`m19 12-7 7-7-7`}))),B.createElement(`kbd`,{className:`DocSearch-Commands-Key`},B.createElement(um,{ariaLabel:s},B.createElement(`path`,{d:`m5 12 7-7 7 7`}),B.createElement(`path`,{d:`M12 19V5`}))),B.createElement(`span`,{className:`DocSearch-Label`},o)),B.createElement(`li`,null,B.createElement(`kbd`,{className:`DocSearch-Commands-Key`},B.createElement(um,{ariaLabel:i},B.createElement(`polyline`,{points:`9 10 4 15 9 20`}),B.createElement(`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`}))),B.createElement(`span`,{className:`DocSearch-Label`},t?a:r)),B.createElement(`li`,null,B.createElement(`kbd`,{className:`DocSearch-Commands-Key`},B.createElement(`span`,{className:`DocSearch-Escape-Key`},`ESC`)),B.createElement(`span`,{className:`DocSearch-Label`,"aria-label":d},t?u:l))),B.createElement(`div`,{className:`DocSearch-Footer-Actions`},p&&B.createElement(`div`,{className:`DocSearch-Footer-Action`},n),B.createElement(`div`,{className:`DocSearch-Logo`},B.createElement(Ir,{translations:{poweredByText:f}}))))}function fm({hit:e,children:t}){return B.createElement(`a`,{href:e.url},t)}function pm({facets:e,indexes:t,searchClient:n}){let[r,i]=B.useState({}),a=e.map(e=>e.key).join(`,`),o=JSON.stringify(t.map(e=>{var t;return[e.name,(t=e.searchParameters)==null?null:t]}));return B.useEffect(()=>{let e=!0,r=a?a.split(`,`):[];return r.length===0||t.length===0||n.search({requests:t.map(e=>({indexName:e.name,query:``,hitsPerPage:0,facets:r}))}).then(({results:t})=>{if(!e)return;let n=r.reduce((e,t)=>(e[t]=[],e),{});t.forEach(e=>{var t;Object.entries((t=e.facets)==null?{}:t).forEach(([e,t])=>{n[e]&&(n[e]=Array.from(new Set([...n[e],...Object.keys(t)])).sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`})))})}),i(n)}).catch(()=>{e&&i({})}),()=>{e=!1}},[a,o,n]),r}function mm({facets:e,indexes:t,searchClient:n,onSelectionsChange:r}){let i=B.useMemo(()=>Up(e),[e]),a=B.useRef(i),o=pm({facets:i,indexes:t,searchClient:n}),[s,c]=B.useState(()=>Gp(t)),l=B.useRef(s),u=B.useRef(r),d=B.useMemo(()=>i.map(e=>{var t;return _(_({},e),{},{values:(t=o[e.key])==null?[]:t})}).filter(e=>e.values.length>0),[o,i]);B.useLayoutEffect(()=>{a.current=i,u.current=r});let f=B.useCallback(e=>{var t;l.current=e,c(e),(t=u.current)==null||t.call(u)},[]);return{visibleFacets:d,facetSelections:s,facetSelectionsRef:l,handleFacetSelectionChange:B.useCallback((e,t)=>{if(l.current[e]===t)return;let n=_({},l.current);n[e]=t,f(n)},[f]),clearFacetSelections:B.useCallback(()=>{if(Object.keys(l.current).length===0)return;let e={};for(let t of a.current)l.current[t.key]&&(e[t.key]=``);f(e)},[f])}}function hm(e){return B.useCallback(t=>{if(!e.context.algoliaInsightsPlugin||!t.__autocomplete_id)return;let n=t;e.context.algoliaInsightsPlugin.insights.clickedObjectIDsAfterSearch({eventName:`Item Selected`,index:n.__autocomplete_indexName,items:[n],positions:[t.__autocomplete_id],queryID:n.__autocomplete_queryID})},[e.context.algoliaInsightsPlugin])}function gm(e){let t=B.useRef(typeof window<`u`?window.getSelection().toString().slice(0,512):``).current;return{initialQuery:B.useRef(e||t).current,initialQueryFromSelection:t}}function _m({getEnvironmentProps:e,panelElement:t,formElement:n,inputElement:r}){B.useEffect(()=>{if(!(t&&n&&r))return;let{onTouchStart:i,onTouchMove:a}=e({panelElement:t,formElement:n,inputElement:r});return window.addEventListener(`touchstart`,i),window.addEventListener(`touchmove`,a),()=>{window.removeEventListener(`touchstart`,i),window.removeEventListener(`touchmove`,a)}},[e,t,n,r])}function vm({container:e}){B.useEffect(()=>{if(!e)return;let t=e.querySelectorAll(`a[href]:not([disabled]), button:not([disabled]), input:not([disabled])`),n=t[0],r=t[t.length-1];function i(e){e.key===`Tab`&&(e.shiftKey?document.activeElement===n&&(e.preventDefault(),r.focus()):document.activeElement===r&&(e.preventDefault(),n.focus()))}return e.addEventListener(`keydown`,i),()=>{e.removeEventListener(`keydown`,i)}},[e])}function ym({initialScrollY:e,modalRef:t,theme:n}){mn({theme:n}),B.useEffect(()=>(document.body.classList.add(`DocSearch--active`),()=>{var t,n;document.body.classList.remove(`DocSearch--active`),(t=(n=window).scrollTo)==null||t.call(n,0,e)}),[e]),B.useEffect(()=>{Br()},[]),B.useLayoutEffect(()=>{let e=window.innerWidth-document.body.clientWidth;return document.body.style.marginInlineEnd=`${e}px`,()=>{document.body.style.marginInlineEnd=`0px`}},[]),B.useEffect(()=>{function e(){if(t.current){let e=window.innerHeight*.01;t.current.style.setProperty(`--docsearch-vh`,`${e}px`)}}return e(),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`resize`,e)}},[t])}function bm({getEnvironmentProps:e,containerRef:t,dropdownRef:n,formElementRef:r,inputRef:i,initialScrollY:a,modalRef:o,theme:s}){_m({getEnvironmentProps:e,panelElement:n.current,formElement:r.current,inputElement:i.current}),vm({container:t.current}),ym({initialScrollY:a,modalRef:o,theme:s})}function xm(){return{containerRef:B.useRef(null),modalRef:B.useRef(null),formElementRef:B.useRef(null),dropdownRef:B.useRef(null),inputRef:B.useRef(null)}}function Sm({initialQuery:e,inputRef:t,refresh:n}){B.useEffect(()=>{e.length>0&&(n(),t.current&&t.current.focus())},[e,t,n])}function Cm(e){let t=e.hierarchy,n=[`lvl6`,`lvl5`,`lvl4`,`lvl3`,`lvl2`,`lvl1`,`lvl0`].find(e=>t[e]);return _(_({},e),{},{type:n||`lvl0`,content:null})}function wm({favoriteSearches:e,recentSearches:t,disableUserPersonalization:n}){return B.useCallback(function(r){if(n)return;let i=r.type===`content`?r.__docsearch_parent||Cm(r):r;i&&e.getAll().findIndex(e=>e.objectID===i.objectID)===-1&&t.add(i)},[e,t,n])}function Tm({defaultIndexName:e,recentSearchesLimit:t,recentSearchesWithFavoritesLimit:n}){let r=B.useRef(Wr({key:`__DOCSEARCH_FAVORITE_SEARCHES__${e}`,limit:10})).current;return{favoriteSearches:r,recentSearches:B.useRef(Wr({key:`__DOCSEARCH_RECENT_SEARCHES__${e}`,limit:r.getAll().length===0?t:n})).current}}function Em({title:e,subText:t}){return B.createElement(`div`,{className:`DocSearch-Hit-content-wrapper`},B.createElement(`span`,{className:`DocSearch-Hit-title`},e),B.createElement(`span`,{className:`DocSearch-Hit-path`},t))}let Dm=1e3,Om=Dm*60,km=Om*60,Am=[[km*24,`day`],[km,`hour`],[Om,`minute`],[Dm,`second`]];function jm(e,t=Date.now()){let[n]=Me(()=>{var n;let r=Math.abs(Number(t)-Number(e)),[i,a]=(n=Am.find(([e])=>r>=e))==null?Am[Am.length-1]:n;return[Math.floor(r/i),a]}),r=z(()=>{let e=typeof navigator<`u`?navigator.language:void 0,[t,r]=n;return new Intl.RelativeTimeFormat(e,{style:`long`}).format(t*-1,r)},[n]);return e?r:null}let Mm=[`hit`,`attribute`,`tagName`];function Nm(e,t){return t.split(`.`).reduce((e,t)=>e!=null&&e[t]?e[t]:null,e)}function Pm(e){let{hit:t,attribute:n,tagName:r=`span`}=e;return C(r,_(_({},pn(e,Mm)),{},{dangerouslySetInnerHTML:{__html:Nm(t,`_snippetResult.${n}.value`)||Nm(t,n)}}))}function Fm(e){var t;let{askAiResultsTitle:n=`Ask AI Assistant`}=e.translations||{},r=B.useId(),i=B.useMemo(()=>e.title?Sp(e.title):null,[e.title]);return!e.collection||e.collection.items.length===0?null:e.collection.source.sourceId===bp.askAI?B.createElement(`section`,{className:`DocSearch-Hits`},B.createElement(`h2`,{id:r,className:`DocSearch-Hit-source`},n),B.createElement(`ul`,_(_({className:`DocSearch-Hits-padded`},e.getListProps({source:e.collection.source})),{},{"aria-labelledby":r}),e.collection.items.map(t=>B.createElement(Rm,_({key:t.objectID,item:t,translations:e.translations},e))))):e.collection.source.sourceId===bp.recentConversations?B.createElement(`section`,{className:`DocSearch-Hits`},B.createElement(`div`,{className:`DocSearch-Hit-source`},B.createElement(Dr,null),i),B.createElement(`ul`,_({className:`DocSearch-Hits-padded`},e.getListProps({source:e.collection.source})),e.collection.items.map((t,n)=>B.createElement(Im,_({key:[e.title,t.objectID].join(`:`),item:t,index:n},e))))):B.createElement(`section`,{className:`DocSearch-Hits`},B.createElement(`div`,{className:`DocSearch-Hit-source`},(t=e.sourceIcon)==null?null:t,i),B.createElement(`ul`,_({className:`DocSearch-Hits-padded`},e.getListProps({source:e.collection.source})),e.collection.items.map((t,n)=>B.createElement(Im,_({key:[e.title,t.objectID].join(`:`),item:t,index:n},e)))))}function Im({item:e,index:t,renderIcon:n,renderAction:r,getItemProps:i,onItemClick:a,collection:o,hitComponent:s,translations:c={},renderResultBadge:l}){let u=s,{recentConversationTimestampFallback:d=`A while ago`}=c,f=e.type===`content`?`content`:`hierarchy.${e.type}`,p=wp(e);return B.createElement(`li`,_({className:[`DocSearch-Hit`,e.__docsearch_parent&&`DocSearch-Hit--Child`].filter(Boolean).join(` `)},i({item:e,source:o.source,onClick(t){a(e,t)}})),B.createElement(u,{hit:e},B.createElement(`div`,{className:`DocSearch-Hit-Container`},n({item:e,index:t}),e.type===`lvl0`&&B.createElement(Em,{title:B.createElement(Pm,{hit:e,attribute:`hierarchy.lvl0`}),subText:B.createElement(Pm,{hit:e,attribute:`content`})}),e.type===`askAI`?B.createElement(Lm,{item:e,relativeDateFallbackText:d}):B.createElement(Em,{title:B.createElement(Pm,{hit:e,attribute:f}),subText:p}),l==null?void 0:l({item:e}),r({item:e}))))}function Lm({item:e,relativeDateFallbackText:t}){let n=jm(e.hierarchy.lvl2?new Date(e.hierarchy.lvl2):null);return B.createElement(Em,{title:Sp(e.hierarchy.lvl1||``),subText:n||t})}function Rm({item:e,getItemProps:t,onItemClick:n,collection:r}){return e.query?B.createElement(`li`,_({className:`DocSearch-Hit`},t({item:e,source:r.source,onClick(t){n(e,t)}})),B.createElement(`div`,{className:`DocSearch-Hit--AskAI`},B.createElement(`div`,{className:`DocSearch-Hit-AskAIButton DocSearch-Hit-Container`},B.createElement(`div`,{className:` DocSearch-Hit-AskAIButton-icon DocSearch-Hit-icon`},B.createElement(Dr,null)),B.createElement(`div`,{className:`DocSearch-Hit-AskAIButton-title`},B.createElement(`span`,{className:`DocSearch-Hit-AskAIButton-title-query`},e.query))))):null}let zm=[`translations`];function Bm(e){let{translations:t={}}=e,n=pn(e,zm),{recentSearchesTitle:r=`Recently viewed docs`,saveRecentSearchButtonTitle:i=`Pin this search`,removeRecentSearchButtonTitle:a=`Remove this search from history`,favoriteSearchesTitle:o=`Pinned`,removeFavoriteSearchButtonTitle:s=`Remove this saved search`}=t,c=xp(n.state,`favoriteSearches`),l=xp(n.state,`recentSearches`);return B.createElement(B.Fragment,null,c&&B.createElement(Fm,_(_({},n),{},{title:o,collection:c,sourceIcon:B.createElement(Bp,null),renderIcon:({item:e})=>B.createElement(`div`,{className:`DocSearch-Hit-icon`},B.createElement(Nr,{type:e.type})),renderAction:({item:e})=>B.createElement(`div`,{className:`DocSearch-Hit-action`},B.createElement(`button`,{className:`DocSearch-Hit-action-button`,title:s,type:`submit`,onClick:t=>{t.preventDefault(),t.stopPropagation(),n.favoriteSearches.remove(e),n.refresh()}},B.createElement(jr,null)))})),l&&B.createElement(Fm,_(_({},n),{},{title:r,collection:l,sourceIcon:B.createElement(Or,null),renderIcon:({item:e})=>B.createElement(`div`,{className:`DocSearch-Hit-icon`},B.createElement(Nr,{type:e.type})),renderAction:({item:e})=>B.createElement(B.Fragment,null,B.createElement(`div`,{className:`DocSearch-Hit-action`},B.createElement(`button`,{className:`DocSearch-Hit-action-button DocSearch-Hit-action-button--pin`,title:i,type:`submit`,onClick:t=>{t.preventDefault(),t.stopPropagation(),n.favoriteSearches.add(e),n.recentSearches.remove(e),n.refresh()}},B.createElement(Bp,null))),B.createElement(`div`,{className:`DocSearch-Hit-action`},B.createElement(`button`,{className:`DocSearch-Hit-action-button`,title:a,type:`submit`,onClick:t=>{t.preventDefault(),t.stopPropagation(),n.recentSearches.remove(e),n.refresh()}},B.createElement(jr,null))))})))}function Vm({translations:e={}}){let{titleText:t=`Unable to fetch results`,helpText:n=`You might want to check your network connection.`}=e;return B.createElement(`div`,{className:`DocSearch-ErrorScreen`},B.createElement(`div`,{className:`DocSearch-Screen-Icon`},B.createElement(Rp,null)),B.createElement(`p`,{className:`DocSearch-Title`},t),B.createElement(`p`,{className:`DocSearch-Help`},n))}let Hm=[`translations`];function Um(e){let{translations:t={}}=e,n=pn(e,Hm),{noResultsText:r=`No results found for`,suggestedQueryText:i=`Try searching for`,reportMissingResultsText:a=`Believe this query should return results?`,reportMissingResultsLinkText:o=`Let us know.`}=t,s=n.state.context.searchSuggestions;return B.createElement(`div`,{className:`DocSearch-NoResults ${n.canHandleAskAi?`DocSearch-NoResults--withAskAi`:``}`},B.createElement(`div`,{className:`DocSearch-Screen-Icon`},B.createElement(zp,null)),B.createElement(`p`,{className:`DocSearch-Title`},r,` "`,B.createElement(`strong`,null,n.state.query),`"`),s&&s.length>0&&B.createElement(`div`,{className:`DocSearch-NoResults-Prefill-List`},B.createElement(`p`,{className:`DocSearch-Help`},i,`:`),B.createElement(`div`,{className:`DocSearch-NoResults-Prefill-List-Items`},s.slice(0,3).reduce((e,t)=>[...e,B.createElement(`p`,{key:t},B.createElement(dn,{size:16}),B.createElement(`button`,{className:`DocSearch-Prefill`,key:t,type:`button`,onClick:()=>{n.setQuery(t.toLowerCase()+` `),n.refresh(),n.inputRef.current.focus()}},t))],[]))),n.getMissingResultsUrl&&B.createElement(`p`,{className:`DocSearch-Help`},`${a} `,B.createElement(`a`,{href:n.getMissingResultsUrl({query:n.state.query}),target:`_blank`,rel:`noopener noreferrer`},o)))}function Wm(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`}function Gm({item:e,resultBadgeKey:t,translations:n={}}){if(!t)return null;let r=Dp(e,t);if(r==null)return null;let{resultBadgeLabelText:i=`Category`}=n,a=null;if(Wm(r))a=String(r).trim();else if(Array.isArray(r)){let e=r.filter(Wm).map(e=>String(e).trim());a=e.length>0?e.join(`, `):null}return a===null||a.length===0?null:B.createElement(`div`,{className:`DocSearch-Hit-badge`},B.createElement(`span`,{className:`DocSearch-VisuallyHiddenForAccessibility`},`${i}: ${a}`),B.createElement(`span`,{"aria-hidden":`true`},a))}let Km=[`translations`,`resultBadgeKey`];function qm(e){let{translations:t={},resultBadgeKey:n}=e,r=pn(e,Km),i=B.useCallback(()=>B.createElement(`div`,{className:`DocSearch-Hit-action`},B.createElement(Lp,null)),[]),a=B.useCallback(({item:e})=>B.createElement(Gm,{item:e,resultBadgeKey:n,translations:{resultBadgeLabelText:t.resultBadgeLabelText}}),[n,t.resultBadgeLabelText]);return B.createElement(`div`,{className:`DocSearch-Dropdown-Container`},r.state.collections.map(e=>{if(e.items.length===0)return null;let n=Fp(e.items[0]);return B.createElement(Fm,_(_({},r),{},{key:e.source.sourceId,translations:t,title:n,collection:e,renderIcon:({item:t,index:n})=>{var r;return B.createElement(B.Fragment,null,t.__docsearch_parent&&B.createElement(`svg`,{className:`DocSearch-Hit-Tree`,viewBox:`0 0 24 54`},B.createElement(`g`,{stroke:`currentColor`,fill:`none`,fillRule:`evenodd`,strokeLinecap:`round`,strokeLinejoin:`round`},t.__docsearch_parent===((r=e.items[n+1])==null?void 0:r.__docsearch_parent)?B.createElement(`path`,{d:`M8 6v42M20 27H8.3`}):B.createElement(`path`,{d:`M8 6v21M20 27H8.3`}))),B.createElement(`div`,{className:`DocSearch-Hit-icon`},B.createElement(Nr,{type:t.type})))},renderAction:i,renderResultBadge:a}))}),r.resultsFooterComponent&&B.createElement(`section`,{className:`DocSearch-HitsFooter`},B.createElement(r.resultsFooterComponent,{state:r.state})))}function Jm(e,t){let n=Object.entries(t),r=new Set(n.map(([e])=>e)),i=[];for(let[e,t]of n)t!==``&&i.push(`${e}:${t}`);if(r.size===0)return e;let a=[];return e&&Array.isArray(e)?a=e:e&&(a=[e]),[...a.filter(e=>{if(typeof e!=`string`)return!0;let t=e.indexOf(`:`),n=e.slice(0,t);return t<=0||!r.has(n)}),...i]}function Ym({recentSearches:e,favoriteSearches:t,saveRecentSearch:n,onClose:r,disableUserPersonalization:i}){return i?[]:[{sourceId:bp.favoriteSearches,onSelect({item:e,event:t}){n(e),Ap(t)||r()},getItemUrl({item:e}){return e.url},getItems(){return t.getAll()}},{sourceId:bp.recentSearches,onSelect({item:e,event:t}){n(e),Ap(t)||r()},getItemUrl({item:e}){return e.url},getItems(){return e.getAll()}}]}async function Xm({query:e,state:t,setContext:n,setStatus:r,searchClient:i,indexes:a,insights:o,appId:s,apiKey:c,maxResultsPerGroup:l,transformItems:u=kp,saveRecentSearch:d,onClose:f,facetSelections:p}){let m=o;try{let{results:r}=await i.search({requests:a.map(t=>{var n,r,i,a,o,s,c;let l=t.name,u=t.searchParameters,d=Jm(u==null?void 0:u.facetFilters,p.current);return _(_({query:e,indexName:l,attributesToRetrieve:(n=u==null?void 0:u.attributesToRetrieve)==null?[`hierarchy.lvl0`,`hierarchy.lvl1`,`hierarchy.lvl2`,`hierarchy.lvl3`,`hierarchy.lvl4`,`hierarchy.lvl5`,`hierarchy.lvl6`,`content`,`type`,`url`]:n,attributesToSnippet:(r=u==null?void 0:u.attributesToSnippet)==null?[`hierarchy.lvl1:15`,`hierarchy.lvl2:15`,`hierarchy.lvl3:15`,`hierarchy.lvl4:15`,`hierarchy.lvl5:15`,`hierarchy.lvl6:15`,`content:15`]:r,snippetEllipsisText:(i=u==null?void 0:u.snippetEllipsisText)==null?`…`:i,highlightPreTag:(a=u==null?void 0:u.highlightPreTag)==null?`<mark>`:a,highlightPostTag:(o=u==null?void 0:u.highlightPostTag)==null?`</mark>`:o,hitsPerPage:(s=u==null?void 0:u.hitsPerPage)==null?20:s,clickAnalytics:(c=u==null?void 0:u.clickAnalytics)==null?m:c},u),d?{facetFilters:d}:{})})});return r.flatMap(e=>{let r=e,{hits:i,nbHits:a}=r,o=Op(u(i),e=>Fp(e),l);if(t.context.searchSuggestions.length<Object.keys(o).length){var p;n({searchSuggestions:_(_({},(p=t.context.searchSuggestions)==null?[]:p),Object.keys(o))})}if(a){let e=t.context.nbHits;n({nbHits:(e==null?0:e)+a})}let h={};return m&&(h={__autocomplete_indexName:r.index,__autocomplete_queryID:r.queryID,__autocomplete_algoliaCredentials:{appId:s,apiKey:c}}),Object.values(o).map((e,t)=>({sourceId:`hits_${r.index}_${t}`,onSelect({item:e,event:t}){d(e),Ap(t)||f()},getItemUrl({item:e}){return e.url},getItems(){return Object.values(Op(e,e=>e.hierarchy.lvl1,l)).map(e=>e.map(t=>{let n=null,r=e.find(e=>e.type===`lvl1`&&e.hierarchy.lvl1===t.hierarchy.lvl1);return t.type!==`lvl1`&&r&&(n=r),_(_({},t),{},{__docsearch_parent:n},h)})).flat()}}))})}catch(e){throw e.name===`RetryError`&&r(`error`),e}}function Zm({indices:e}){if(!Array.isArray(e)||e.length<1)throw Error("Must supply at least one `indices` entry for DocSearch");return e.map(e=>typeof e==`string`?{name:e}:e)}V();let Qm=me(void 0);function $m(e){let t=Re(Qm);if(t===void 0&&!e)throw Error(Jr(47));return t}V();function eh(){return U(U({},md()),{},{disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1})}let th=U(U({},xd),{},{disabled:G(e=>e.disabled),instantType:G(e=>e.instantType),openMethod:G(e=>e.openMethod),openChangeReason:G(e=>e.openChangeReason),modal:G(e=>e.modal),focusManagerModal:G(e=>e.focusManagerModal),stickIfOpen:G(e=>e.stickIfOpen),titleElementId:G(e=>e.titleElementId),descriptionElementId:G(e=>e.descriptionElementId),openOnHover:G(e=>e.openOnHover),closeDelay:G(e=>e.closeDelay),hasViewport:G(e=>e.hasViewport)});var nh=class e extends Yu{constructor(e,t,n=!1){let r=U(U({},eh()),e),i=new fd;r.open&&(e==null?void 0:e.mounted)===void 0&&(r.mounted=!0),r.floatingRootContext=hd(i,t,n),super(r,{popupRef:T(),backdropRef:T(),internalBackdropRef:T(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:T(),beforeContentFocusGuardRef:T(),stickIfOpenTimeout:new Bo,triggerElements:i},th),H(this,`setOpen`,(e,t)=>{var n,r;let i=t.reason===ta,a=t.reason===`trigger-press`&&t.event.detail===0,o=!e&&(t.reason===`escape-key`||t.reason==null),s=ad(t),c=this.select(`activeTriggerId`);if(!e&&t.reason===`close-press`&&t.trigger==null&&c!=null){var l,u;t.trigger=(l=(u=this.context.triggerElements.getById(c))==null?this.select(`activeTriggerElement`):u)==null?void 0:l}if((n=(r=this.context).onOpenChange)==null||n.call(r,e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let d=()=>{let n={open:e,openChangeReason:t.reason};id(n,e,t.trigger,s()),this.update(n)};i?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),cn(d)):d(),a||o?this.set(`instantType`,a?`click`:`dismiss`):t.reason===`focus-out`?this.set(`instantType`,`focus`):this.set(`instantType`,void 0)}),H(this,`disposeEffect`,()=>this.context.stickIfOpenTimeout.disposeEffect())}static useStore(t,n){let{store:r,internalStore:i}=nd(t,(t,r)=>new e(n,t,r));return Pe(()=>i==null?void 0:i.disposeEffect(),[i]),r}};V();function rh({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=nh.useStore(s==null?void 0:s.store,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});od(u,n,r,l),u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`mounted`),p=u.useState(`payload`),m=nl()!=null;u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a),dd(u,d),cd(u);let{forceUnmount:h}=ld(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});u.useSyncedValues({modal:o,nested:m}),Pe(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]);let g=Le(()=>{u.setOpen(!1,wo(sa))},[u]);Ie(e.actionsRef,()=>({unmount:h,close:g}),[h,g]);let _=d||f,v=z(()=>({store:u}),[u]);return Eo(Qm.Provider,{value:v,children:[_&&Eo(ah,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})}function ih(e){return $m(!0)?Eo(rh,{props:e}):Eo(ol,{children:Eo(rh,{props:e})})}function ah({store:e,modal:t}){var n,r;let i=vl(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}});return ud(e,{activeTriggerProps:(n=i.reference)==null?pi:n,inactiveTriggerProps:(r=i.trigger)==null?pi:r,popupProps:z(()=>vi(ed,i.floating),[i.floating])}),null}V();let oh=[`render`,`className`,`style`,`disabled`,`nativeButton`,`handle`,`payload`,`openOnHover`,`delay`,`closeDelay`,`id`],sh=yt(function(e,t){var n;let{render:r,className:i,style:a,disabled:o=!1,nativeButton:s=!0,handle:c,payload:l,openOnHover:u=!1,delay:d=300,closeDelay:f=0,id:p}=e,m=vr(e,oh),h=$m(!0),g=(n=c==null?void 0:c.store)==null?h==null?void 0:h.store:n;if(!g)throw Error(Jr(74));let _=xo(p),v=g.useState(`isTriggerActive`,_),y=g.useState(`floatingRootContext`),b=g.useState(`isOpenedByTrigger`,_),x=g.useState(`triggerPopupId`,_),S=R(null),{registerTrigger:C,isMountedByThisTrigger:w}=sd(_,S,g,{payload:l,disabled:o,openOnHover:u,closeDelay:f}),T=g.useState(`openChangeReason`),D=g.useState(`stickIfOpen`),O=g.useState(`openMethod`),k=g.useState(`focusManagerModal`),A=Nd(y,{enabled:!o&&y!=null&&u&&(O!==`touch`||T!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:Kd(),restMs:d,delay:{close:f},triggerElementRef:S,isActiveTrigger:v,isClosing:()=>g.select(`transitionStatus`)===`ending`}),j=hl(y,{enabled:y!=null,stickIfOpen:D}),M=ep(()=>g.select(`open`),e=>{g.set(`openMethod`,e)}),N=g.useState(`triggerProps`,w),{getButtonProps:P,buttonRef:ee}=Wa({disabled:o,native:s}),te={open(e){return e&&T===`trigger-press`?Xi.open(e):Yi.open(e)}},{preFocusGuardRef:F,handlePreFocusGuardFocus:ne,handleFocusTargetFocus:re}=pp(g,S),ie=Mi(`button`,e,{state:{disabled:o,open:b},ref:[ee,t,C,S],props:[j.reference,A,N,M,{"data-base-ui-click-trigger":``,id:_,"aria-haspopup":`dialog`,"aria-expanded":b,"aria-controls":x},m,P],stateAttributesMapping:te});return w&&!k?Eo(E,{children:[Eo(ys,{ref:F,onFocus:ne}),Eo(E,{children:ie},_),Eo(ys,{ref:g.context.triggerFocusTargetRef,onFocus:re})]}):Eo(E,{children:ie},_)});V();let ch=me(void 0);function lh(){let e=Re(ch);if(e===void 0)throw Error(Jr(45));return e}V();let uh=[`keepMounted`],dh=yt(function(e,t){let{keepMounted:n=!1}=e,r=vr(e,uh),{store:i}=$m();return i.useState(`mounted`)||n?Eo(ch.Provider,{value:n,children:Eo(Zc,U({ref:t},r))}):null});V();let fh=me(void 0);function ph(){let e=Re(fh);if(!e)throw Error(Jr(46));return e}V();let mh=[`render`,`className`,`style`,`anchor`,`positionMethod`,`side`,`align`,`sideOffset`,`alignOffset`,`collisionBoundary`,`collisionPadding`,`arrowPadding`,`sticky`,`disableAnchorTracking`,`collisionAvoidance`],hh=yt(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o=`absolute`,side:s=`bottom`,align:c=`center`,sideOffset:l=0,alignOffset:u=0,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f=5,arrowPadding:p=5,sticky:m=!1,disableAnchorTracking:h=!1,collisionAvoidance:g=Wc}=e,_=vr(e,mh),{store:v}=$m(),y=lh(),b=il(),x=v.useState(`floatingRootContext`),S=v.useState(`mounted`),C=v.useState(`open`),w=v.useState(`openChangeReason`),T=v.useState(`activeTriggerElement`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`positionerElement`),k=v.useState(`instantType`),A=v.useState(`transitionStatus`),j=v.useState(`hasViewport`),M=R(null),N=Po(O,!1,!1),P=yf({anchor:a,floatingRootContext:x,positionMethod:o,mounted:S,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:y,nodeId:b,collisionAvoidance:g,adaptiveOrigin:j?gf:void 0}),ee=x.useState(`domReferenceElement`);W(()=>{let e=ee,t=M.current;if(e&&(M.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return N(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[ee,N,v]),Lf(C&&E===!0&&w!==`trigger-hover`,D===`touch`,O,T);let te=Le(e=>{v.set(`positionerElement`,e)},[v]),F=Df(e,{open:C,side:P.side,align:P.align,anchorHidden:P.anchorHidden,instant:k},{styles:P.positionerStyles,transitionStatus:A,props:_,refs:[t,te],hidden:!S,inert:!C});return Eo(fh.Provider,{value:P,children:[S&&E===!0&&w!==`trigger-hover`&&Eo(Ef,{ref:v.context.internalBackdropRef,inert:cf(!C),cutout:T}),Eo(al,{id:b,children:F})]})});V();let gh=me(void 0);function _h(){let[e,t]=Me(0),n=La(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:z(()=>({register:n}),[n]),hasClosePart:e>0}}function vh(e){let{value:t,children:n}=e;return Eo(gh.Provider,{value:t,children:n})}function yh(){let e=Re(gh);W(()=>e==null?void 0:e.register(),[e])}V();let bh=[`render`,`className`,`style`,`initialFocus`,`finalFocus`],xh=U(U({},Zi),Vi),Sh=yt(function(e,t){var n;let{render:r,className:i,style:a,initialFocus:o,finalFocus:s}=e,c=vr(e,bh),{store:l}=$m(),u=ph(),d=Jd(!0)!=null,{context:f,hasClosePart:p}=_h(),m=l.useState(`open`),h=l.useState(`openMethod`),g=l.useState(`instantType`),_=l.useState(`transitionStatus`),v=l.useState(`popupProps`),y=l.useState(`titleElementId`),b=l.useState(`descriptionElementId`),x=l.useState(`modal`),S=l.useState(`mounted`),C=l.useState(`openChangeReason`),w=l.useState(`activeTriggerElement`),T=l.useState(`floatingRootContext`),E=T.useState(`floatingId`),D=l.useState(`disabled`),O=l.useState(`openOnHover`),k=l.useState(`closeDelay`),A=(n=c.id)==null?E:n;Fo({open:m,ref:l.context.popupRef,onComplete(){if(m){var e,t;(e=(t=l.context).onOpenChangeComplete)==null||e.call(t,!0)}}}),jd(T,{enabled:O&&!D,closeDelay:k});let j=o===void 0?td(l.context.popupRef):o,M=x!==!1&&p;l.useSyncedValue(`focusManagerModal`,M);let N=Le(e=>{l.set(`popupElement`,e)},[l]),P=Mi(`div`,e,{state:{open:m,side:u.side,align:u.align,instant:g,transitionStatus:_},ref:[t,l.context.popupRef,N],props:[v,U(U({id:A,role:`dialog`},ed),{},{"aria-labelledby":y,"aria-describedby":b,onKeyDown(e){d&&Qd.has(e.key)&&e.stopPropagation()}}),$d(_),c],stateAttributesMapping:xh});return Eo(ml,{context:T,openInteractionType:h,modal:M,disabled:!S||C===`trigger-hover`,initialFocus:j,returnFocus:s,restoreFocus:`popup`,previousFocusableElement:ha(w)?w:void 0,nextFocusableElement:l.context.triggerFocusTargetRef,beforeContentFocusGuardRef:l.context.beforeContentFocusGuardRef,children:Eo(vh,{value:f,children:P})})});V();let Ch=[`render`,`className`,`style`],wh=yt(function(e,t){let{render:n,className:r,style:i}=e,a=vr(e,Ch),{store:o}=$m(),s=o.useState(`open`),{arrowRef:c,side:l,align:u,arrowUncentered:d,arrowStyles:f}=ph();return Mi(`div`,e,{state:{open:s,side:l,align:u,uncentered:d},ref:[t,c],props:[{style:f,"aria-hidden":!0},a],stateAttributesMapping:Zi})});V();let Th=[`render`,`className`,`style`],Eh=yt(function(e,t){let{render:n,className:r,style:i}=e,a=vr(e,Th),{store:o}=$m(),s=xo(a.id);return o.useSyncedValueWithCleanup(`titleElementId`,s),Mi(`h2`,e,{ref:t,props:[{id:s},a]})});V();let Dh=[`render`,`className`,`style`,`disabled`,`nativeButton`],Oh=yt(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0}=e,s=vr(e,Dh),{buttonRef:c,getButtonProps:l}=Wa({disabled:a,focusableWhenDisabled:!1,native:o}),{store:u}=$m();return yh(),Mi(`button`,e,{ref:[t,c],props:[{onClick(e){u.setOpen(!1,wo(`close-press`,e.nativeEvent))}},s,l]})});var kh;function Ah(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var jh=Ah();function Mh(e){jh=e}var Nh={exec:()=>null};function Ph(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(Ih.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var Fh=(()=>{try{return!0}catch(e){return!1}})(),Ih={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:RegExp(`[\\p{L}\\p{N}]`,`u`),escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,`i`)},Lh=/^(?:[ \t]*(?:\n|$))+/,Rh=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,zh=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Bh=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Vh=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Hh=/(?:[*+-]|\d{1,9}[.)])/,Uh=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Wh=Ph(Uh).replace(/bull/g,Hh).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),Gh=Ph(Uh).replace(/bull/g,Hh).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Kh=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,qh=/^[^\n]+/,Jh=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Yh=Ph(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,Jh).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Xh=Ph(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Hh).getRegex(),Zh=`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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,Qh=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,$h=Ph(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,Qh).replace(`tag`,Zh).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),eg=Ph(Kh).replace(`hr`,Bh).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Zh).getRegex(),tg={blockquote:Ph(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,eg).getRegex(),code:Rh,def:Yh,fences:zh,heading:Vh,hr:Bh,html:$h,lheading:Wh,list:Xh,newline:Lh,paragraph:eg,table:Nh,text:qh},ng=Ph(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,Bh).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Zh).getRegex(),rg=U(U({},tg),{},{lheading:Gh,table:ng,paragraph:Ph(Kh).replace(`hr`,Bh).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,ng).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Zh).getRegex()}),ig=U(U({},tg),{},{html:Ph(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,Qh).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Nh,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Ph(Kh).replace(`hr`,Bh).replace(`heading`,` *#{1,6} *[^
27
- ]`).replace(`lheading`,Wh).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()}),ag=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,og=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,sg=/^( {2,}|\\)\n(?!\s*$)/,cg=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,lg=RegExp(`[\\p{P}\\p{S}]`,`u`),ug=RegExp(`[\\s\\p{P}\\p{S}]`,`u`),dg=RegExp(`[^\\s\\p{P}\\p{S}]`,`u`),fg=Ph(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,ug).getRegex(),pg=RegExp(`(?!~)[\\p{P}\\p{S}]`,`u`),mg=RegExp(`(?!~)[\\s\\p{P}\\p{S}]`,`u`),hg=RegExp(`(?:[^\\s\\p{P}\\p{S}]|~)`,`u`),gg=Ph(/link|precode-code|html/,`g`).replace(`link`,RegExp("\\[(?:[^\\[\\]`]|(?<a>`+)[^`]+\\k<a>(?!`))*?\\]\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)]|\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)])*\\))*\\)",``)).replace(`precode-`,Fh?"(?<!`)()":"(^^|[^`])").replace(`code`,RegExp("(?<b>`+)[^`]+\\k<b>(?!`)",``)).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),_g=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,vg=Ph(_g,`u`).replace(/punct/g,lg).getRegex(),yg=Ph(_g,`u`).replace(/punct/g,pg).getRegex(),bg=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,xg=Ph(bg,`gu`).replace(/notPunctSpace/g,dg).replace(/punctSpace/g,ug).replace(/punct/g,lg).getRegex(),Sg=Ph(bg,`gu`).replace(/notPunctSpace/g,hg).replace(/punctSpace/g,mg).replace(/punct/g,pg).getRegex(),Cg=Ph(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,dg).replace(/punctSpace/g,ug).replace(/punct/g,lg).getRegex(),wg=Ph(/\\(punct)/,`gu`).replace(/punct/g,lg).getRegex(),Tg=Ph(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Eg=Ph(Qh).replace(`(?:-->|$)`,`-->`).getRegex(),Dg=Ph(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,Eg).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Og=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,kg=Ph(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace(`label`,Og).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ag=Ph(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Og).replace(`ref`,Jh).getRegex(),jg=Ph(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,Jh).getRegex(),Mg=Ph(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,Ag).replace(`nolink`,jg).getRegex(),Ng=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Pg={_backpedal:Nh,anyPunctuation:wg,autolink:Tg,blockSkip:gg,br:sg,code:og,del:Nh,emStrongLDelim:vg,emStrongRDelimAst:xg,emStrongRDelimUnd:Cg,escape:ag,link:kg,nolink:jg,punctuation:fg,reflink:Ag,reflinkSearch:Mg,tag:Dg,text:cg,url:Nh},Fg=U(U({},Pg),{},{link:Ph(/^!?\[(label)\]\((.*?)\)/).replace(`label`,Og).getRegex(),reflink:Ph(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,Og).getRegex()}),Ig=U(U({},Pg),{},{emStrongRDelimAst:Sg,emStrongLDelim:yg,url:Ph(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,Ng).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Ph(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,Ng).getRegex()}),Lg=U(U({},Ig),{},{br:Ph(sg).replace(`{2,}`,`*`).getRegex(),text:Ph(Ig.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()}),Rg={normal:tg,gfm:rg,pedantic:ig},zg={normal:Pg,gfm:Ig,breaks:Lg,pedantic:Fg},Bg={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},Vg=e=>Bg[e];function Hg(e,t){if(t){if(Ih.escapeTest.test(e))return e.replace(Ih.escapeReplace,Vg)}else if(Ih.escapeTestNoEncode.test(e))return e.replace(Ih.escapeReplaceNoEncode,Vg);return e}function Ug(e){try{e=encodeURI(e).replace(Ih.percentDecode,`%`)}catch(e){return null}return e}function Wg(e,t){var n;let r=e.replace(Ih.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(Ih.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!((n=r.at(-1))!=null&&n.trim())&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push(``);for(;i<r.length;i++)r[i]=r[i].trim().replace(Ih.slashPipe,`|`);return r}function Gg(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function Kg(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function qg(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function Jg(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
28
- `).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
29
- `)}var Yg=class{constructor(e){H(this,`options`,void 0),H(this,`rules`,void 0),H(this,`lexer`,void 0),this.options=e||jh}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,``);return{type:`code`,raw:t[0],codeBlockStyle:`indented`,text:this.options.pedantic?e:Gg(e,`
30
- `)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=Jg(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=Gg(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:Gg(t[0],`
31
- `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=Gg(t[0],`
32
- `).split(`
33
- `),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o;for(o=0;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
34
- `),c=s.replace(this.rules.other.blockquoteSetextReplace,`
35
- $1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
36
- ${s}`:s,r=r?`${r}
37
- ${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if((u==null?void 0:u.type)===`code`)break;if((u==null?void 0:u.type)===`blockquote`){let t=u,a=t.raw+`
38
- `+e.join(`
39
- `),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}else if((u==null?void 0:u.type)===`list`){let t=u,a=t.raw+`
40
- `+e.join(`
41
- `),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
42
- `);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=t[2].split(`
43
- `,1)[0].replace(this.rules.other.listReplaceTabs,e=>` `.repeat(3*e.length)),l=e.split(`
44
- `,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=t[2].search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
45
- `,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d);for(;e;){let f=e.split(`
46
- `,1)[0],p;if(l=f,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),p=l):p=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||t.test(l)||n.test(l))break;if(p.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
47
- `+p.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
48
- `+l}!u&&!l.trim()&&(u=!0),r+=f+`
49
- `,e=e.substring(f.length+1),c=p.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0));let f=null,p;this.options.gfm&&(f=this.rules.other.listIsTask.exec(s),f&&(p=f[0]!==`[ ] `,s=s.replace(this.rules.other.listReplaceTask,``))),i.items.push({type:`list_item`,raw:r,task:!!f,checked:p,loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e=0;e<i.items.length;e++)if(this.lexer.state.top=!1,i.items[e].tokens=this.lexer.blockTokens(i.items[e].text,[]),!i.loose){let t=i.items[e].tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}if(i.loose)for(let e=0;e<i.items.length;e++)i.items[e].loose=!0;return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:`html`,block:!0,raw:t[0],pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:t[0],href:n,title:r}}}table(e){var t;let n=this.rules.block.table.exec(e);if(!n||!this.rules.other.tableDelimiter.test(n[2]))return;let r=Wg(n[1]),i=n[2].replace(this.rules.other.tableAlignChars,``).split(`|`),a=(t=n[3])!=null&&t.trim()?n[3].replace(this.rules.other.tableRowBlankLine,``).split(`
50
- `):[],o={type:`table`,raw:n[0],header:[],align:[],rows:[]};if(r.length===i.length){for(let e of i)this.rules.other.tableAlignRight.test(e)?o.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?o.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?o.align.push(`left`):o.align.push(null);for(let e=0;e<r.length;e++)o.header.push({text:r[e],tokens:this.lexer.inline(r[e]),header:!0,align:o.align[e]});for(let e of a)o.rows.push(Wg(e,o.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:o.align[t]})));return o}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:`heading`,raw:t[0],depth:t[2].charAt(0)===`=`?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
51
- `?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=Gg(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=Kg(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),qg(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return qg(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[2])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!=null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}else if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:`del`,raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,i;if(t[2]===`@`)e=t[0],i=`mailto:`+e;else{var n,r;let a;do a=t[0],t[0]=(n=(r=this.rules.inline._backpedal.exec(t[0]))==null?void 0:r[0])==null?``:n;while(a!==t[0]);e=t[0],i=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:i,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},Xg=class e{constructor(e){H(this,`tokens`,void 0),H(this,`options`,void 0),H(this,`state`,void 0),H(this,`tokenizer`,void 0),H(this,`inlineQueue`,void 0),this.tokens=[],this.tokens.links=Object.create(null),this.options=e||jh,this.options.tokenizer=this.options.tokenizer||new Yg,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:Ih,block:Rg.normal,inline:zg.normal};this.options.pedantic?(t.block=Rg.pedantic,t.inline=zg.pedantic):this.options.gfm&&(t.block=Rg.gfm,this.options.breaks?t.inline=zg.breaks:t.inline=zg.gfm),this.tokenizer.rules=t}static get rules(){return{block:Rg,inline:zg}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(Ih.carriageReturn,`
52
- `),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.options.pedantic&&(e=e.replace(Ih.tabCharGlobal,` `).replace(Ih.spaceLine,``));e;){var r,i;let a;if(!((r=this.options.extensions)==null||(r=r.block)==null)&&r.some(n=>(a=n.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.space(e)){e=e.substring(a.raw.length);let n=t.at(-1);a.raw.length===1&&n!==void 0?n.raw+=`
53
- `:t.push(a);continue}if(a=this.tokenizer.code(e)){e=e.substring(a.raw.length);let n=t.at(-1);(n==null?void 0:n.type)===`paragraph`||(n==null?void 0:n.type)===`text`?(n.raw+=(n.raw.endsWith(`
54
- `)?``:`
55
- `)+a.raw,n.text+=`
56
- `+a.text,this.inlineQueue.at(-1).src=n.text):t.push(a);continue}if(a=this.tokenizer.fences(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.heading(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.hr(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.blockquote(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.list(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.html(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.def(e)){e=e.substring(a.raw.length);let n=t.at(-1);(n==null?void 0:n.type)===`paragraph`||(n==null?void 0:n.type)===`text`?(n.raw+=(n.raw.endsWith(`
57
- `)?``:`
58
- `)+a.raw,n.text+=`
59
- `+a.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[a.tag]||(this.tokens.links[a.tag]={href:a.href,title:a.title},t.push(a));continue}if(a=this.tokenizer.table(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.lheading(e)){e=e.substring(a.raw.length),t.push(a);continue}let o=e;if((i=this.options.extensions)!=null&&i.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(o=e.substring(0,t+1))}if(this.state.top&&(a=this.tokenizer.paragraph(o))){let r=t.at(-1);n&&(r==null?void 0:r.type)===`paragraph`?(r.raw+=(r.raw.endsWith(`
60
- `)?``:`
61
- `)+a.raw,r.text+=`
62
- `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(a),n=o.length!==e.length,e=e.substring(a.raw.length);continue}if(a=this.tokenizer.text(e)){e=e.substring(a.raw.length);let n=t.at(-1);(n==null?void 0:n.type)===`text`?(n.raw+=(n.raw.endsWith(`
63
- `)?``:`
64
- `)+a.raw,n.text+=`
65
- `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(a);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}else throw Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var n,r;let i=e,a=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(a=this.tokenizer.rules.inline.reflinkSearch.exec(i))!=null;)e.includes(a[0].slice(a[0].lastIndexOf(`[`)+1,-1))&&(i=i.slice(0,a.index)+`[`+`a`.repeat(a[0].length-2)+`]`+i.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(a=this.tokenizer.rules.inline.anyPunctuation.exec(i))!=null;)i=i.slice(0,a.index)+`++`+i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let o;for(;(a=this.tokenizer.rules.inline.blockSkip.exec(i))!=null;)o=a[2]?a[2].length:0,i=i.slice(0,a.index+o)+`[`+`a`.repeat(a[0].length-o-2)+`]`+i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);i=(n=(r=this.options.hooks)==null||(r=r.emStrongMask)==null?void 0:r.call({lexer:this},i))==null?i:n;let s=!1,c=``;for(;e;){var l,u;s||(c=``),s=!1;let n;if(!((l=this.options.extensions)==null||(l=l.inline)==null)&&l.some(r=>(n=r.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))continue;if(n=this.tokenizer.escape(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.tag(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.link(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(n.raw.length);let r=t.at(-1);n.type===`text`&&(r==null?void 0:r.type)===`text`?(r.raw+=n.raw,r.text+=n.text):t.push(n);continue}if(n=this.tokenizer.emStrong(e,i,c)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.codespan(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.br(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.del(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.autolink(e)){e=e.substring(n.raw.length),t.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(e))){e=e.substring(n.raw.length),t.push(n);continue}let r=e;if((u=this.options.extensions)!=null&&u.startInline){let t=1/0,n=e.slice(1),i;this.options.extensions.startInline.forEach(e=>{i=e.call({lexer:this},n),typeof i==`number`&&i>=0&&(t=Math.min(t,i))}),t<1/0&&t>=0&&(r=e.substring(0,t+1))}if(n=this.tokenizer.inlineText(r)){e=e.substring(n.raw.length),n.raw.slice(-1)!==`_`&&(c=n.raw.slice(-1)),s=!0;let r=t.at(-1);(r==null?void 0:r.type)===`text`?(r.raw+=n.raw,r.text+=n.text):t.push(n);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}else throw Error(t)}}return t}},Zg=class{constructor(e){H(this,`options`,void 0),H(this,`parser`,void 0),this.options=e||jh}space(e){return``}code({text:e,lang:t,escaped:n}){var r;let i=(r=(t||``).match(Ih.notSpaceStart))==null?void 0:r[0],a=e.replace(Ih.endingNewline,``)+`
66
- `;return i?`<pre><code class="language-`+Hg(i)+`">`+(n?a:Hg(a,!0))+`</code></pre>
67
- `:`<pre><code>`+(n?a:Hg(a,!0))+`</code></pre>
68
- `}blockquote({tokens:e}){return`<blockquote>
69
- ${this.parser.parse(e)}</blockquote>
70
- `}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
71
- `}hr(e){return`<hr>
72
- `}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
73
- `+r+`</`+i+`>
74
- `}listitem(e){let t=``;if(e.task){var n;let r=this.checkbox({checked:!!e.checked});e.loose?((n=e.tokens[0])==null?void 0:n.type)===`paragraph`?(e.tokens[0].text=r+` `+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type===`text`&&(e.tokens[0].tokens[0].text=r+` `+Hg(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:`text`,raw:r+` `,text:r+` `,escaped:!0}):t+=r+` `}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
75
- `}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox">`}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
76
- `}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
77
- <thead>
78
- `+t+`</thead>
79
- `+r+`</table>
80
- `}tablerow({text:e}){return`<tr>
81
- ${e}</tr>
82
- `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
83
- `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Hg(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=Ug(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+Hg(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Ug(e);if(i===null)return Hg(n);e=i;let a=`<img src="${e}" alt="${n}"`;return t&&(a+=` title="${Hg(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:Hg(e.text)}},Qg=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}},$g=class e{constructor(e){H(this,`options`,void 0),H(this,`renderer`,void 0),H(this,`textRenderer`,void 0),this.options=e||jh,this.options.renderer=this.options.renderer||new Zg,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Qg}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e,t=!0){let n=``;for(let i=0;i<e.length;i++){var r;let a=e[i];if(!((r=this.options.extensions)==null||(r=r.renderers)==null)&&r[a.type]){let e=a,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(t!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){n+=t||``;continue}}let o=a;switch(o.type){case`space`:n+=this.renderer.space(o);continue;case`hr`:n+=this.renderer.hr(o);continue;case`heading`:n+=this.renderer.heading(o);continue;case`code`:n+=this.renderer.code(o);continue;case`table`:n+=this.renderer.table(o);continue;case`blockquote`:n+=this.renderer.blockquote(o);continue;case`list`:n+=this.renderer.list(o);continue;case`html`:n+=this.renderer.html(o);continue;case`def`:n+=this.renderer.def(o);continue;case`paragraph`:n+=this.renderer.paragraph(o);continue;case`text`:{let r=o,a=this.renderer.text(r);for(;i+1<e.length&&e[i+1].type===`text`;)r=e[++i],a+=`
84
- `+this.renderer.text(r);t?n+=this.renderer.paragraph({type:`paragraph`,raw:a,text:a,tokens:[{type:`text`,raw:a,text:a,escaped:!0}]}):n+=a;continue}default:{let e=`Token with "`+o.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}parseInline(e,t=this.renderer){let n=``;for(let i=0;i<e.length;i++){var r;let a=e[i];if(!((r=this.options.extensions)==null||(r=r.renderers)==null)&&r[a.type]){let e=this.options.extensions.renderers[a.type].call({parser:this},a);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(a.type)){n+=e||``;continue}}let o=a;switch(o.type){case`escape`:n+=t.text(o);break;case`html`:n+=t.html(o);break;case`link`:n+=t.link(o);break;case`image`:n+=t.image(o);break;case`strong`:n+=t.strong(o);break;case`em`:n+=t.em(o);break;case`codespan`:n+=t.codespan(o);break;case`br`:n+=t.br(o);break;case`del`:n+=t.del(o);break;case`text`:n+=t.text(o);break;default:{let e=`Token with "`+o.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},e_=(kh=class{constructor(e){H(this,`options`,void 0),H(this,`block`,void 0),this.options=e||jh}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?Xg.lex:Xg.lexInline}provideParser(){return this.block?$g.parse:$g.parseInline}},H(kh,`passThroughHooks`,new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`])),H(kh,`passThroughHooksRespectAsync`,new Set([`preprocess`,`postprocess`,`processAllTokens`])),kh),t_=new class{constructor(...e){H(this,`defaults`,Ah()),H(this,`options`,this.setOptions),H(this,`parse`,this.parseMarkdown(!0)),H(this,`parseInline`,this.parseMarkdown(!1)),H(this,`Parser`,$g),H(this,`Renderer`,Zg),H(this,`TextRenderer`,Qg),H(this,`Lexer`,Xg),H(this,`Tokenizer`,Yg),H(this,`Hooks`,e_),this.use(...e)}walkTokens(e,t){let n=[];for(let i of e)switch(n=n.concat(t.call(this,i)),i.type){case`table`:{let e=i;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=i;n=n.concat(this.walkTokens(e.items,t));break}default:{var r;let e=i;!((r=this.defaults.extensions)==null||(r=r.childTokens)==null)&&r[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n=U({},e);if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new Zg(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new Yg(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new e_;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];e_.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&e_.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults=U(U({},this.defaults),n)}),this}setOptions(e){return this.defaults=U(U({},this.defaults),e),this}lexer(e,t){return Xg.lex(e,t==null?this.defaults:t)}parser(e,t){return $g.parse(e,t==null?this.defaults:t)}parseMarkdown(e){var t=this;return(n,r)=>{let i=U({},r),a=U(U({},this.defaults),i),o=this.onError(!!a.silent,!!a.async);if(this.defaults.async===!0&&i.async===!1)return o(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof n>`u`||n===null)return o(Error(`marked(): input parameter is undefined or null`));if(typeof n!=`string`)return o(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(n)+`, string expected`));if(a.hooks&&(a.hooks.options=a,a.hooks.block=e),a.async)return(async()=>{let r=a.hooks?await a.hooks.preprocess(n):n,i=await(a.hooks?await a.hooks.provideLexer():e?Xg.lex:Xg.lexInline)(r,a),o=a.hooks?await a.hooks.processAllTokens(i):i;a.walkTokens&&await Promise.all(t.walkTokens(o,a.walkTokens));let s=await(a.hooks?await a.hooks.provideParser():e?$g.parse:$g.parseInline)(o,a);return a.hooks?await a.hooks.postprocess(s):s})().catch(o);try{a.hooks&&(n=a.hooks.preprocess(n));let t=(a.hooks?a.hooks.provideLexer():e?Xg.lex:Xg.lexInline)(n,a);a.hooks&&(t=a.hooks.processAllTokens(t)),a.walkTokens&&this.walkTokens(t,a.walkTokens);let r=(a.hooks?a.hooks.provideParser():e?$g.parse:$g.parseInline)(t,a);return a.hooks&&(r=a.hooks.postprocess(r)),r}catch(e){return o(e)}}}onError(e,t){return n=>{if(n.message+=`
85
- Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+Hg(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function n_(e,t){return t_.parse(e,t)}n_.options=n_.setOptions=function(e){return t_.setOptions(e),n_.defaults=t_.defaults,Mh(n_.defaults),n_},n_.getDefaults=Ah,n_.defaults=jh,n_.use=function(...e){return t_.use(...e),n_.defaults=t_.defaults,Mh(n_.defaults),n_},n_.walkTokens=function(e,t){return t_.walkTokens(e,t)},n_.parseInline=t_.parseInline,n_.Parser=$g,n_.parser=$g.parse,n_.Renderer=Zg,n_.TextRenderer=Qg,n_.Lexer=Xg,n_.lexer=Xg.lex,n_.Tokenizer=Yg,n_.Hooks=e_,n_.parse=n_,n_.options,n_.setOptions,n_.use,n_.walkTokens,n_.parseInline,$g.parse,Xg.lex;var r_=`vercel.ai.error`,i_=Symbol.for(r_),a_,o_,s_=class e extends (o_=Error,a_=i_,o_){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,r_)}static hasMarker(e,t){let n=Symbol.for(t);return typeof e==`object`&&!!e&&n in e&&typeof e[n]==`boolean`&&e[n]===!0}};function c_(e){return e==null?`unknown error`:typeof e==`string`?e:e instanceof Error?e.message:JSON.stringify(e)}var l_=`AI_InvalidArgumentError`,u_=`vercel.ai.error.${l_}`,d_=Symbol.for(u_),f_,p_,m_=class extends (p_=s_,f_=d_,p_){constructor({message:e,cause:t,argument:n}){super({name:l_,message:e,cause:t}),this[f_]=!0,this.argument=n}static isInstance(e){return s_.hasMarker(e,u_)}},h_=`AI_JSONParseError`,g_=`vercel.ai.error.${h_}`,__=Symbol.for(g_),v_,y_,b_=class extends (y_=s_,v_=__,y_){constructor({text:e,cause:t}){super({name:h_,message:`JSON parsing failed: Text: ${e}.
86
- Error message: ${c_(t)}`,cause:t}),this[v_]=!0,this.text=e}static isInstance(e){return s_.hasMarker(e,g_)}},x_=`AI_TypeValidationError`,S_=`vercel.ai.error.${x_}`,C_=Symbol.for(S_),w_,T_,E_=class e extends (T_=s_,w_=C_,T_){constructor({value:e,cause:t}){super({name:x_,message:`Type validation failed: Value: ${JSON.stringify(e)}.
87
- Error message: ${c_(t)}`,cause:t}),this[w_]=!0,this.value=e}static isInstance(e){return s_.hasMarker(e,S_)}static wrap({value:t,cause:n}){return e.isInstance(n)&&n.value===t?n:new e({value:t,cause:n})}},D_=class extends Error{constructor(e,t){super(e),this.name=`ParseError`,this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}};function O_(e){}function k_(e){if(typeof e==`function`)throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");let{onEvent:t=O_,onError:n=O_,onRetry:r=O_,onComment:i,maxBufferSize:a}=e,o=[],s=0,c=!0,l,u=``,d=0,f,p=!1;function m(e){if(p)throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(c&&(c=!1,e.charCodeAt(0)===239&&e.charCodeAt(1)===187&&e.charCodeAt(2)===191&&(e=e.slice(3))),o.length===0){let t=g(e);t!==``&&(o.push(t),s=t.length),h();return}if(e.indexOf(`
88
- `)===-1&&e.indexOf(`\r`)===-1){o.push(e),s+=e.length,h();return}o.push(e);let t=o.join(``);o.length=0,s=0;let n=g(t);n!==``&&(o.push(n),s=n.length),h()}function h(){a!==void 0&&(s+u.length<=a||(p=!0,o.length=0,s=0,l=void 0,u=``,d=0,f=void 0,n(new D_(`Buffered data exceeded max buffer size of ${a} characters`,{type:`max-buffer-size-exceeded`}))))}function g(e){let n=0;if(e.indexOf(`\r`)===-1){let r=e.indexOf(`
26
+ var t=(V(),d(ut)),n=ju();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),Nu=s(((e,t)=>{t.exports=Mu()}));V();let Pu=[],Fu;function Iu(){return Fu}function Lu(e){Pu.push(e)}function Ru(e){let t=(t,n)=>{let r=ei(Bu).current,i;try{Fu=r;for(let e of Pu)e.before(r);i=e(t,n);for(let e of Pu)e.after(r);r.didInitialize=!0}finally{Fu=void 0}return i};return t.displayName=e.displayName||e.name,t}function zu(e){return yt(Ru(e))}function Bu(){return{didInitialize:!1}}V();var Vu=ju(),Hu=Nu();let Uu=ci(19)?Ku:qu;function Wu(e,t,n,r,i){return Uu(e,t,n,r,i)}function Gu(e,t,n,r,i){let a=Le(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,Vu.useSyncExternalStore)(e.subscribe,a,a)}Lu({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,i)||(t=!0,r.value=i)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,Vu.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function Ku(e,t,n,r,i){let a=Iu();if(!a)return Gu(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.value=t(e.getSnapshot(),n,r,i))):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i)},a.syncHooks.push(s)),s.value}function qu(e,t,n,r,i){return(0,Hu.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var Ju=class{constructor(e){H(this,`subscribe`,e=>(this.listeners.add(e),()=>{this.listeners.delete(e)})),H(this,`getSnapshot`,()=>this.state),this.state=e,this.listeners=new Set,this.updateTick=0}setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState(U(U({},this.state),e));return}}set(e,t){Object.is(this.state[e],t)||this.setState(U(U({},this.state),{},{[e]:t}))}notifyAll(){let e=U({},this.state);this.setState(e)}use(e,t,n,r){return Wu(this,e,t,n,r)}};V();var Yu=class extends Ju{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){ze(e);let n=this;W(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;W(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;W(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){ze(e);let n=this,r=t!==void 0;W(()=>{r&&!Object.is(n.state[e],t)&&n.setState(U(U({},n.state),{},{[e]:t}))},[n,e,t,r])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return ze(e),Wu(this,this.selectors[e],t,n,r)}useContextCallback(e,t){ze(e);let n=La(t==null?di:t);this.context[e]=n}useStateSetter(e){let t=R(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}};let Xu=[`syncOnly`,`nested`,`onOpenChange`,`triggerElements`],Zu={open:G(e=>e.open),transitionStatus:G(e=>e.transitionStatus),domReferenceElement:G(e=>e.domReferenceElement),referenceElement:G(e=>{var t;return(t=e.positionReference)==null?e.referenceElement:t}),floatingElement:G(e=>e.floatingElement),floatingId:G(e=>e.floatingId)};var Qu=class extends Yu{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i}=e,a=vr(e,Xu);super(U(U({},a),{},{positionReference:a.referenceElement,domReferenceElement:a.referenceElement}),{onOpenChange:r,dataRef:{current:{}},events:Qc(),nested:n,triggerElements:i},Zu),H(this,`syncOpenEvent`,(e,t)=>{(!e||!this.state.open||t!=null&&qo(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)}),H(this,`dispatchOpenChange`,(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)}),H(this,`setOpen`,(e,t)=>{var n,r;if(this.syncOnly){var i,a;(i=(a=this.context).onOpenChange)==null||i.call(a,e,t);return}this.dispatchOpenChange(e,t),(n=(r=this.context).onOpenChange)==null||n.call(r,e,t)}),this.syncOnly=t}};V();function $u(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:i,nested:a,onOpenChange:o}=e,s=t.useState(`open`),c=t.useState(`activeTriggerElement`),l=t.useState(n?`popupElement`:`positionerElement`),u=t.context.triggerElements,d=o,f=R(null);r===void 0&&f.current===null&&(f.current=new Qu({open:s,transitionStatus:void 0,referenceElement:c,floatingElement:l,triggerElements:u,onOpenChange:d,floatingId:i,syncOnly:!0,nested:a}));let p=r==null?f.current:r;return t.useSyncedValue(`floatingId`,i),W(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};ma(c)&&(e.domReferenceElement=c),p.state.positionReference===p.state.referenceElement&&(e.positionReference=c),p.update(e)},[s,i,c,l,p]),p.context.onOpenChange=d,p.context.nested=a,p}V();let ed={tabIndex:-1,"data-base-ui-focusable":``};function td(e){return t=>t!==`touch`||e.current}function nd(e,t,n=!1){let r=bo(),i=nl()!=null,a=R(null);e===void 0&&a.current===null&&(a.current=t(r,i));let o=e==null?a.current:e;return $u({popupStore:o,treatPopupAsFloatingElement:n,floatingRootContext:o.state.floatingRootContext,floatingId:r,nested:i,onOpenChange:o.setOpen}),{store:o,internalStore:a.current}}function rd(e,t){let n=R(null),r=R(null);return Le(i=>{if(e===void 0)return;let a=!1;if(n.current!==null){let e=n.current,i=r.current,o=t.context.triggerElements.getById(e);i&&o===i&&(t.context.triggerElements.delete(e),a=!0),n.current=null,r.current=null}if(i!==null&&(n.current=e,r.current=i,t.context.triggerElements.add(e,i),a=!0),a){let e=t.context.triggerElements.size;t.select(`open`)&&t.state.triggerCount!==e&&t.set(`triggerCount`,e)}},[t,e])}function id(e,t,n,r=!1){var i;t?e.preventUnmountingOnClose=!1:r&&(e.preventUnmountingOnClose=!0);let a=(i=n==null?void 0:n.id)==null?null:i;(a||t)&&(e.activeTriggerId=a,e.activeTriggerElement=n==null?null:n)}function ad(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function od(e,t,n,r){ku(()=>{t===void 0&&e.state.open===!1&&n&&(e.state=U(U({},e.state),{},{open:!0,activeTriggerId:r,preventUnmountingOnClose:!1}))})}function sd(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=rd(e,n),o=La(t=>{if(a(t),!t)return;let i=n.select(`open`),o=n.select(`activeTriggerId`);if(o===e){n.update(U({activeTriggerElement:t},i?r:null));return}o==null&&i&&n.update(U({activeTriggerId:e,activeTriggerElement:t},r))});return W(()=>{i&&n.update(U({activeTriggerElement:t.current},r))},[i,n,t,...Object.values(r)]),{registerTrigger:o,isMountedByThisTrigger:i}}function cd(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=e.useState(`open`);W(()=>{if(!r){e.state.triggerCount!==0&&e.set(`triggerCount`,0);return}let t=e.context.triggerElements.size,i={};e.state.triggerCount!==t&&(i.triggerCount=t);let a=e.select(`activeTriggerId`),o=null;if(a){let t=e.context.triggerElements.getById(a);t?t!==e.state.activeTriggerElement&&(i.activeTriggerElement=t):o=a}if(!o&&!a&&t===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[e,n]=t.value;i.activeTriggerId=e,i.activeTriggerElement=n}}(i.triggerCount!==void 0||i.activeTriggerId!==void 0||i.activeTriggerElement!==void 0)&&e.update(i),o&&n&&queueMicrotask(()=>{if(e.select(`open`)&&e.select(`activeTriggerId`)===o&&!e.context.triggerElements.getById(o)){let t=wo(`none`);e.setOpen(!1,t),t.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[r,e,e.useState(`triggerCount`),n])}function ld(e,t,n){let{mounted:r,setMounted:i,transitionStatus:a}=Mo(e),o=t.useState(`preventUnmountingOnClose`),s=!e&&o;t.useSyncedValues({mounted:r,transitionStatus:a,preventUnmountingOnClose:s});let c=La(()=>{var e,r;i(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n==null||n(),(e=(r=t.context).onOpenChangeComplete)==null||e.call(r,!1)});return Fo({enabled:r&&!e&&!s,open:e,ref:t.context.popupRef,onComplete(){e||c()}}),{forceUnmount:c,transitionStatus:a}}function ud(e,t){e.useSyncedValues(t),W(()=>()=>{e.update({activeTriggerProps:pi,inactiveTriggerProps:pi,popupProps:pi})},[e])}function dd(e,t){W(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),W(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var fd=class{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(e,t){let n=this.idMap.get(e);n!==t&&(n!==void 0&&this.elementsSet.delete(n),this.elementsSet.add(t),this.idMap.set(e,t))}delete(e){let t=this.idMap.get(e);t&&(this.elementsSet.delete(t),this.idMap.delete(e))}hasElement(e){return this.elementsSet.has(e)}hasMatchingElement(e){for(let t of this.elementsSet)if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}};function pd(){return new Qu({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new fd,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function md(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:pd(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:pi,inactiveTriggerProps:pi,popupProps:pi}}function hd(e,t,n=!1){return new Qu({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0})}let gd=G(e=>{var t;return(t=e.triggerIdProp)==null?e.activeTriggerId:t}),_d=G(e=>{var t;return(t=e.openProp)==null?e.open:t}),vd=G(e=>{var t,n;return((t=(n=e.popupElement)==null?void 0:n.id)==null?e.floatingId:t)||void 0});function yd(e,t){return t!==void 0&&_d(e)&&gd(e)===t}function bd(e,t){return yd(e,t)?!0:t!==void 0&&_d(e)&&gd(e)==null&&e.triggerCount===1}let xd={open:_d,mounted:G(e=>e.mounted),transitionStatus:G(e=>e.transitionStatus),floatingRootContext:G(e=>e.floatingRootContext),triggerCount:G(e=>e.triggerCount),preventUnmountingOnClose:G(e=>e.preventUnmountingOnClose),payload:G(e=>e.payload),activeTriggerId:gd,activeTriggerElement:G(e=>e.mounted?e.activeTriggerElement:null),popupId:vd,isTriggerActive:G((e,t)=>t!==void 0&&gd(e)===t),isOpenedByTrigger:G((e,t)=>yd(e,t)),isMountedByTrigger:G((e,t)=>t!==void 0&&gd(e)===t&&e.mounted),triggerProps:G((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),triggerPopupId:G((e,t)=>bd(e,t)?vd(e):void 0),popupProps:G(e=>e.popupProps),popupElement:G(e=>e.popupElement),positionerElement:G(e=>e.positionerElement)};function Sd(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=bo(),a=nl()!=null,o=ei(()=>{var e,o;return new Qu({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:(e=r.reference)==null?null:e,floatingElement:(o=r.floating)==null?null:o,triggerElements:new fd,floatingId:i,syncOnly:!1,nested:a})}).current;return W(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=ma(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}V();function Cd(e={}){let{nodeId:t,externalTree:n}=e,r=Sd(e),i=e.rootContext||r,a=i.useState(`referenceElement`),o=i.useState(`floatingElement`),s=i.useState(`domReferenceElement`),c=i.useState(`open`),l=i.useState(`floatingId`),[u,d]=Me(null),[f,p]=Me(void 0),[m,h]=Me(void 0),g=R(null),_=rl(n),v=z(()=>({reference:a,floating:o,domReference:s}),[a,o,s]),y=Su(U(U({},e),{},{elements:U(U({},v),u&&{reference:u})})),b=ma(f)?f:null,x=m===void 0?i.state.floatingElement:m;i.useSyncedValue(`referenceElement`,f==null?null:f),i.useSyncedValue(`domReferenceElement`,f===void 0?s:b),i.useSyncedValue(`floatingElement`,x);let S=Le(e=>{let t=ma(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;d(t),y.refs.setReference(t)},[y.refs]),C=Le(e=>{(ma(e)||e===null)&&(g.current=e,p(e)),(ma(y.refs.reference.current)||y.refs.reference.current===null||e!==null&&!ma(e))&&y.refs.setReference(e)},[y.refs,p]),w=Le(e=>{h(e),y.refs.setFloating(e)},[y.refs]),T=z(()=>U(U({},y.refs),{},{setReference:C,setFloating:w,setPositionReference:S,domReference:g}),[y.refs,C,w,S]),E=z(()=>U(U({},y.elements),{},{domReference:s}),[y.elements,s]),D=z(()=>U(U({},y),{},{dataRef:i.context.dataRef,open:c,onOpenChange:i.setOpen,events:i.context.events,floatingId:l,refs:T,elements:E,nodeId:t,rootStore:i}),[y,T,E,t,i,c,l]);return W(()=>{s&&(g.current=s)},[s]),W(()=>{i.context.dataRef.current.floatingContext=D;let e=_==null?void 0:_.nodesRef.current.find(e=>e.id===t);e&&(e.context=D)}),z(()=>U(U({},y),{},{context:D,refs:T,elements:E,rootStore:i}),[y,T,E,D,i])}V();let wd=no&&oo;function Td(e,t={}){let{enabled:n=!0,delay:r}=t,i=`rootStore`in e?e.rootStore:e,{events:a,dataRef:o}=i.context,s=R(!1),c=R(null),l=R(!0),u=Vo();Pe(()=>{let e=i.select(`domReferenceElement`);if(!n)return;let t=da(e);function r(){let e=i.select(`domReferenceElement`);!i.select(`open`)&&ha(e)&&e===Xo(gs(e))&&(s.current=!0)}function a(){l.current=!0}function o(){l.current=!1}return ps(fs(t,`blur`,r),wd&&fs(t,`keydown`,a,!0),wd&&fs(t,`pointerdown`,o,!0))},[i,n]),Pe(()=>{if(!n)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=i.select(`domReferenceElement`);ma(e)&&(c.current=e,s.current=!0)}}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[a,n,i]);let d=z(()=>{function e(){s.current=!1,c.current=null}return{onMouseLeave(){e()},onFocus(t){let n=t.currentTarget;if(s.current){if(c.current===n)return;e()}let a=Qo(t.nativeEvent);if(ma(a)){if(wd&&!t.relatedTarget){if(!l.current&&!ns(a))return}else if(!as(a))return}let o=$o(t.relatedTarget,i.context.triggerElements),{nativeEvent:d,currentTarget:f}=t,p=typeof r==`function`?r():r;if(i.select(`open`)&&o||p===0||p===void 0){i.setOpen(!0,wo(na,d,f));return}u.start(p,()=>{s.current||i.setOpen(!0,wo(na,d,f))})},onBlur(t){e();let n=t.relatedTarget,r=t.nativeEvent,a=ma(n)&&n.hasAttribute(Dc(`focus-guard`))&&n.getAttribute(`data-type`)===`outside`;u.start(0,()=>{var e;let t=i.select(`domReferenceElement`),s=Xo(gs(t));!n&&s===t||Zo((e=o.current.floatingContext)==null?void 0:e.refs.floating.current,s)||Zo(t,s)||a||$o(n==null?s:n,i.context.triggerElements)||i.setOpen(!1,wo(na,r))})}}},[o,r,i,u]);return z(()=>n?{reference:d,trigger:d}:{},[n,d])}var Ed=class e{constructor(){H(this,`dispose`,()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()}),H(this,`disposeEffect`,()=>this.dispose),this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new Bo,this.restTimeout=new Bo,this.handleCloseOptions=void 0}static create(){return new e}};let Dd=new WeakMap;function Od(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;if(t&&Dd.get(t)===e){var n,r,i;(n=e.pointerEventsScopeElement)==null||n.style.removeProperty(`pointer-events`),(r=e.pointerEventsReferenceElement)==null||r.style.removeProperty(`pointer-events`),(i=e.pointerEventsFloatingElement)==null||i.style.removeProperty(`pointer-events`),Dd.delete(t)}e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function kd(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=Dd.get(n);a&&a!==e&&Od(a),Od(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,Dd.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function Ad(e){let t=e.context.dataRef.current,n=ei(()=>{var e;return(e=t.hoverInteractionState)==null?Ed.create():e}).current;return t.hoverInteractionState||(t.hoverInteractionState=n),Oo(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}V();function jd(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=`rootStore`in e?e.rootStore:e,o=a.useState(`open`),s=a.useState(`floatingElement`),c=a.useState(`domReferenceElement`),{dataRef:l}=a.context,u=rl(),d=nl(),f=Ad(a),p=Vo(),m=La(()=>{var e;return us((e=l.current.openEvent)==null?void 0:e.type,f.interactedInside)}),h=La(()=>{var e;return ds((e=l.current.openEvent)==null?void 0:e.type)}),g=La(()=>{Od(f)});W(()=>{o||(f.pointerType=void 0,f.restTimeoutPending=!1,f.interactedInside=!1,g())},[o,f,g]),Pe(()=>g,[g]),W(()=>{var e;if(n&&o&&(e=f.handleCloseOptions)!=null&&e.blockPointerEvents&&h()&&ma(c)&&s){var t,r,i,a,l,p,m;let e=c,n=s,o=gs(s),h=u==null||(t=u.nodesRef.current.find(e=>e.id===d))==null||(t=t.context)==null?void 0:t.elements.floating;h&&(h.style.pointerEvents=``);let _=f.pointerEventsScopeElement===n?null:f.pointerEventsScopeElement,v=h===n?null:h,y=(r=(i=(a=(l=(p=f.handleCloseOptions)==null||(m=p.getScope)==null?void 0:m.call(p))==null?_:l)==null?v:a)==null?e.closest(`[data-rootownerid]`):i)==null?o.body:r;return kd(f,{scopeElement:y,referenceElement:e,floatingElement:n}),()=>{g()}}},[n,o,c,s,f,h,u,d,g]),Pe(()=>{if(!n)return;function e(){return!!(u&&d&&Tc(u.nodesRef.current,d).length>0)}function t(e){let t=cs(r,`close`,f.pointerType),n=()=>{a.setOpen(!1,wo(ta,e)),u==null||u.events.emit(`floating.closed`,e)};t?f.openChangeTimeout.start(t,n):(f.openChangeTimeout.clear(),n())}function o(e){let t=Qo(e);if(!rs(t)){f.interactedInside=!1;return}f.interactedInside=(t==null?void 0:t.closest(`[aria-haspopup]`))!=null}function c(){f.openChangeTimeout.clear(),p.clear(),u==null||u.events.off(`floating.closed`,v),g()}function _(n){var r,o;if(e()&&u){u.events.on(`floating.closed`,v);return}if($o(n.relatedTarget,a.context.triggerElements))return;let s=(r=(o=l.current.floatingContext)==null?void 0:o.nodeId)==null?i:r,c=n.relatedTarget;if(!(u&&s&&ma(c)&&Tc(u.nodesRef.current,s,!1).some(e=>{var t;return Zo((t=e.context)==null?void 0:t.elements.floating,c)}))){if(f.handler){f.handler(n);return}g(),h()&&!m()&&t(n)}}function v(t){!u||!d||e()||p.start(0,()=>{u.events.off(`floating.closed`,v),a.setOpen(!1,wo(ta,t)),u.events.emit(`floating.closed`,t)})}let y=s;return ps(y&&fs(y,`mouseenter`,c),y&&fs(y,`mouseleave`,_),y&&fs(y,`pointerdown`,o,!0),()=>{u==null||u.events.off(`floating.closed`,v)})},[n,s,a,l,r,i,h,m,g,f,u,d,p])}V();let Md={current:null};function Nd(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=Md,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p}=t,m=`rootStore`in e?e.rootStore:e,{dataRef:h,events:g}=m.context,_=rl(l),v=Ad(m),y=R(!1),b=ms(i),x=ms(r),S=ms(o),C=ms(n),w=ms(p),T=ms(f),E=La(()=>{var e;return us((e=h.current.openEvent)==null?void 0:e.type,v.interactedInside)}),D=La(()=>{var e;return((e=w.current)==null?void 0:e.call(w))!==!1}),O=La((e,t,n)=>{let r=m.context.triggerElements;if(r.hasElement(t))return!e||!Zo(e,t);if(!ma(n))return!1;let i=n;return r.hasMatchingElement(e=>Zo(e,i))&&(!e||!Zo(e,i))}),k=La(()=>{v.handler&&(gs(m.select(`domReferenceElement`)).removeEventListener(`mousemove`,v.handler),v.handler=void 0)}),A=La(()=>{Od(v)});if(u){var j;v.handleCloseOptions=(j=b.current)==null?void 0:j.__options}return Pe(()=>k,[k]),Pe(()=>{if(!n)return;function e(e){e.open?y.current=!1:(y.current=e.reason===ta,k(),v.openChangeTimeout.clear(),v.restTimeout.clear(),v.blockMouseMove=!0,v.restTimeoutPending=!1)}return g.on(`openchange`,e),()=>{g.off(`openchange`,e)}},[n,g,v,k]),Pe(()=>{var e;if(!n)return;function t(e,t=!0){let n=cs(x.current,`close`,v.pointerType);n?v.openChangeTimeout.start(n,()=>{m.setOpen(!1,wo(ta,e)),_==null||_.events.emit(`floating.closed`,e)}):t&&(v.openChangeTimeout.clear(),m.setOpen(!1,wo(ta,e)),_==null||_.events.emit(`floating.closed`,e))}let r=(e=c.current)==null?u?m.select(`domReferenceElement`):null:e;if(!ma(r))return;function i(e){var t,n,r;if(v.openChangeTimeout.clear(),v.blockMouseMove=!1,a&&!Ko(v.pointerType))return;let i=ls(S.current),o=cs(x.current,`open`,v.pointerType),s=Qo(e),c=(t=e.currentTarget)==null?null:t,l=m.select(`domReferenceElement`),u=c;if(ma(s)&&!m.context.triggerElements.hasElement(s)){for(let e of m.context.triggerElements.elements())if(Zo(e,s)){u=e;break}}ma(c)&&ma(l)&&!m.context.triggerElements.hasElement(c)&&Zo(c,l)&&(u=l);let d=u!=null&&O(l,u,s),f=m.select(`open`),p=(n=(r=T.current)==null?void 0:r.call(T))==null?m.select(`transitionStatus`)===`ending`:n,h=!f&&p&&y.current,g=!d&&ma(u)&&ma(l)&&Zo(l,u)&&h,_=i>0&&!o,b=d&&(f||h)||g,C=!f||d;if(b){D()&&m.setOpen(!0,wo(ta,e,u));return}_||(o?v.openChangeTimeout.start(o,()=>{C&&D()&&m.setOpen(!0,wo(ta,e,u))}):C&&D()&&m.setOpen(!0,wo(ta,e,u)))}function o(e){var n;if(E()){A();return}k();let r=gs(m.select(`domReferenceElement`));v.restTimeout.clear(),v.restTimeoutPending=!1;let i=(n=h.current.floatingContext)==null?d==null?void 0:d():n;if(!$o(e.relatedTarget,m.context.triggerElements)){if(b.current&&i){m.select(`open`)||v.openChangeTimeout.clear();let n=c.current;v.handler=b.current(U(U({},i),{},{tree:_,x:e.clientX,y:e.clientY,onClose(){A(),k(),C.current&&!E()&&n===m.select(`domReferenceElement`)&&t(e,!0)}})),r.addEventListener(`mousemove`,v.handler),v.handler(e);return}(v.pointerType!==`touch`||!Zo(m.select(`floatingElement`),e.relatedTarget))&&t(e)}}return s?ps(fs(r,`mousemove`,i,{once:!0}),fs(r,`mouseenter`,i),fs(r,`mouseleave`,o)):ps(fs(r,`mouseenter`,i),fs(r,`mouseleave`,o))},[k,A,h,x,m,n,b,v,u,O,E,a,s,S,c,_,C,d,T,D]),z(()=>{if(!n)return;function e(e){v.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){var t;let{nativeEvent:n}=e,r=e.currentTarget,i=m.select(`domReferenceElement`),o=m.select(`open`),s=O(i,r,e.target);if(a&&!Ko(v.pointerType))return;if(o&&s&&(t=v.handleCloseOptions)!=null&&t.blockPointerEvents){let e=m.select(`floatingElement`);if(e){var c,l,u;let t=(c=(l=v.handleCloseOptions)==null||(u=l.getScope)==null?void 0:u.call(l))==null?r.ownerDocument.body:c;kd(v,{scopeElement:t,referenceElement:r,floatingElement:e})}}let d=ls(S.current);if(o&&!s||d===0||!s&&v.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;v.restTimeout.clear();function f(){if(v.restTimeoutPending=!1,E())return;let e=m.select(`open`);!v.blockMouseMove&&(!e||s)&&D()&&m.setOpen(!0,wo(ta,n,r))}v.pointerType===`touch`?cn(()=>{f()}):s&&o?f():(v.restTimeoutPending=!0,v.restTimeout.start(d,f))}}},[n,v,E,O,a,m,S,D])}V();function Pd(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function Fd(e,t){return Pd(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function Id(e,t,n){return Pd(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function Ld(e,t,n){return Pd(t,n?e===Jo:e===Yo,e===`ArrowDown`)}function Rd(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===`Escape`:Pd(t,n?e===Yo:e===Jo,e===`ArrowUp`)}function zd(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:a=!0,selectedIndex:o=null,allowEscape:s=!1,loopFocus:c=!1,nested:l=!1,rtl:u=!1,virtual:d=!1,focusItemOnOpen:f=`auto`,focusItemOnHover:p=!0,openOnArrowKeyDown:m=!0,disabledIndices:h=void 0,orientation:g=`vertical`,parentOrientation:_,id:v,resetOnPointerLeave:y=!0,externalTree:b,grid:x}=t,S=x!=null,C=`rootStore`in e?e.rootStore:e,w=C.useState(`open`),T=C.useState(`floatingElement`),E=C.useState(`domReferenceElement`),D=C.context.dataRef,O=os(T),k=is(E),A=ms(O),j=nl(),M=rl(b),N=R(f),P=R(o==null?-1:o),ee=R(null),te=R(!0),F=La(e=>{i(P.current===-1?null:P.current,e)}),ne=R(!!T),re=R(w),ie=R(!1),ae=R(!1),oe=R(null),se=ms(h),ce=ms(w),I=ms(o),le=ms(y),ue=jo(),de=jo(),fe=La(()=>{function e(e){d?M==null||M.events.emit(`virtualfocus`,e):oe.current=kc(e,{sync:ie.current,preventScroll:!0})}let t=n.current[P.current],r=ae.current;t&&e(t),(ie.current?e=>e():e=>ue.request(e))(()=>{let i=n.current[P.current]||t;if(i&&(t||e(i),_e&&(r||!te.current))){var a;(a=i.scrollIntoView)==null||a.call(i,{block:`nearest`,inline:`nearest`})}})});W(()=>{D.current.orientation=g},[D,g]),W(()=>{a&&(w&&T?(P.current=o==null?-1:o,N.current&&o!=null&&(ae.current=!0,F())):ne.current&&(P.current=-1,F()))},[a,w,T,o,F]),W(()=>{if(a){if(!w){ie.current=!1;return}if(T)if(r==null){if(ie.current=!1,I.current!=null)return;if(ne.current&&(P.current=-1,fe()),(!re.current||!ne.current)&&N.current&&(ee.current!=null||N.current===!0&&ee.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>de.request(e):queueMicrotask)(t),e+=1):(P.current=ee.current==null||Id(ee.current,g,u)||l?Ys(n):Xs(n),ee.current=null,F())};t()}}else Js(n.current,r)||(P.current=r,fe(),ae.current=!1)}},[a,w,T,r,I,l,n,g,u,F,fe,de]),W(()=>{var e,t;if(!a||T||!M||d||!ne.current)return;let n=M.nodesRef.current,r=(e=n.find(e=>e.id===j))==null||(e=e.context)==null?void 0:e.elements.floating,i=Xo(gs((t=E==null?r:E)==null?null:t)),o=n.some(e=>e.context&&Zo(e.context.elements.floating,i));r&&!o&&te.current&&r.focus({preventScroll:!0})},[a,T,E,M,j,d]),W(()=>{re.current=w,ne.current=!!T}),W(()=>{w||(ee.current=null,N.current=f)},[w,f]);let pe=r!=null,me=La(e=>{if(!ce.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(P.current!==t||r!==t)&&(P.current=t,F(e))}),L=La(()=>{var e;return _==null?M==null||(e=M.nodesRef.current.find(e=>e.id===j))==null||(e=e.context)==null||(e=e.dataRef)==null?void 0:e.current.orientation:_}),he=La(()=>Ys(n,se.current)),ge=La(e=>{if(te.current=!1,ie.current=!0,e.which===229||!ce.current&&e.currentTarget===A.current)return;if(l&&Rd(e.key,g,u,S)){Fd(e.key,L())||Ho(e),C.setOpen(!1,wo(aa,e.nativeEvent)),ha(E)&&(d?M==null||M.events.emit(`virtualfocus`,E):E.focus());return}let t=P.current,r=Ys(n,h),i=Xs(n,h);if(k||(e.key===`Home`&&(Ho(e),P.current=r,F(e)),e.key===`End`&&(Ho(e),P.current=i,F(e))),x!=null){let t=x(e,P.current,n,g,c,u,h,r,i);if(t!=null&&(P.current=t,F(e)),g===`both`)return}if(Fd(e.key,g)){if(Ho(e),w&&!d&&Xo(e.currentTarget.ownerDocument)===e.currentTarget){P.current=Id(e.key,g,u)?r:i,F(e);return}Id(e.key,g,u)?c?t>=i?s&&t!==n.current.length?P.current=-1:(ie.current=!1,P.current=r):P.current=Zs(n.current,{startingIndex:t,disabledIndices:h}):P.current=Math.min(i,Zs(n.current,{startingIndex:t,disabledIndices:h})):c?t<=r?s&&t!==-1?P.current=n.current.length:(ie.current=!1,P.current=i):P.current=Zs(n.current,{startingIndex:t,decrement:!0,disabledIndices:h}):P.current=Math.max(r,Zs(n.current,{startingIndex:t,decrement:!0,disabledIndices:h})),Js(n.current,P.current)&&(P.current=-1),F(e)}}),_e=z(()=>({onFocus(e){ie.current=!0,me(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){ie.current=!0,ae.current=!1,p&&me(e)},onPointerLeave(e){var t;if(!ce.current||!te.current||e.pointerType===`touch`)return;ie.current=!0;let r=e.relatedTarget;if(!(!p||n.current.includes(r))&&le.current&&((t=oe.current)==null||t.call(oe),oe.current=null,P.current=-1,F(e),!d)){let e=A.current,t=Xo(gs(e));e&&Zo(e,t)&&e.focus({preventScroll:!0})}}}),[me,ce,A,p,n,F,le,d]),ve=z(()=>d&&w&&pe&&{"aria-activedescendant":`${v}-${r}`},[d,w,pe,v,r]),ye=z(()=>U(U({"aria-orientation":g===`both`?void 0:g},k?{}:ve),{},{onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&w&&!d){let t=Qo(e.nativeEvent);if(t&&!Zo(A.current,t))return;Ho(e),C.setOpen(!1,wo(ia,e.nativeEvent)),ha(E)&&E.focus();return}ge(e)},onPointerMove(){te.current=!0}}),[ve,ge,A,g,k,C,w,d,E]),be=z(()=>{function e(e){C.setOpen(!0,wo(aa,e.nativeEvent,e.currentTarget))}function t(e){f===`auto`&&Wo(e.nativeEvent)&&(N.current=!d)}function n(e){N.current=f,f===`auto`&&Go(e.nativeEvent)&&(N.current=!0)}return{onKeyDown(t){let n=C.select(`open`);te.current=!1;let r=t.key.startsWith(`Arrow`),i=Ld(t.key,L(),u),a=Fd(t.key,g),o=(l?i:a)||t.key===`Enter`||t.key.trim()===``;if(d&&n)return ge(t);if(!(!n&&!m&&r)){if(o){let e=Fd(t.key,L());ee.current=l&&e?null:t.key}if(l){i&&(Ho(t),n?(P.current=he(),F(t)):e(t));return}a&&(I.current!=null&&(P.current=I.current),Ho(t),!n&&m?e(t):ge(t),n&&F(t))}},onFocus(e){C.select(`open`)&&!d&&(P.current=-1,F(e))},onPointerDown:n,onPointerEnter:n,onMouseDown:t,onClick:t}},[ge,f,he,l,F,C,m,g,L,u,I,d]),xe=z(()=>U(U({},ve),be),[ve,be]);return z(()=>a?{reference:xe,floating:ye,item:_e,trigger:be}:{},[a,xe,ye,be,_e])}V();function Bd(e,t){var n;let{listRef:r,elementsRef:i,activeIndex:a,onMatch:o,disabledIndices:s,onTyping:c,enabled:l=!0,resetMs:u=750,selectedIndex:d=null}=t,f=`rootStore`in e?e.rootStore:e,p=f.useState(`open`),m=Vo(),h=R(``),g=R((n=d==null?a:d)==null?-1:n),_=R(null),v=La(e=>{var t;function n(e){let t=i==null?void 0:i.current[e];return!t||ec(t)}function l(e){return n(e)?s==null||!Qs(fi,e,s):!1}function f(e,t,n=0){if(e.length===0)return-1;let r=(n%e.length+e.length)%e.length,i=t.toLowerCase();for(let t=0;t<e.length;t+=1){let n=(r+t)%e.length,a=e[n];if(!(!(a!=null&&a.toLowerCase().startsWith(i))||!l(n)))return n}return-1}let v=r.current;if(h.current.length>0&&e.key===` `&&(Ho(e),c==null||c(!0)),h.current.length>0&&h.current[0]!==` `&&f(v,h.current)===-1&&e.key!==` `&&(c==null||c(!1)),v==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;p&&e.key!==` `&&(Ho(e),c==null||c(!0));let y=h.current===``;if(y){var b;g.current=(b=d==null?a:d)==null?-1:b}v.every((e,t)=>{var n,r;return e&&l(t)?((n=e[0])==null?void 0:n.toLowerCase())!==((r=e[1])==null?void 0:r.toLowerCase()):!0})&&h.current===e.key&&(h.current=``,g.current=_.current),h.current+=e.key,m.start(u,()=>{h.current=``,g.current=_.current,c==null||c(!1)});let x=y?(t=d==null?a:d)==null?-1:t:g.current,S=(x==null?0:x)+1,C=f(v,h.current,S);C===-1?e.key!==` `&&(h.current=``,c==null||c(!1)):(o==null||o(C),_.current=C)}),y=La(e=>{let t=e.relatedTarget,n=f.select(`domReferenceElement`),r=f.select(`floatingElement`);Zo(n,t)||Zo(r,t)||(m.clear(),h.current=``,g.current=_.current,c==null||c(!1))});W(()=>{!p&&d!==null||(m.clear(),_.current=null,h.current!==``&&(h.current=``))},[p,d,m]),W(()=>{if(p&&h.current===``){var e;g.current=(e=d==null?a:d)==null?-1:e}},[p,d,a]);let b=z(()=>({onKeyDown:v,onBlur:y}),[v,y]);return z(()=>l?{reference:b,floating:b}:{},[l,b])}let Vd=.5;function Hd(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function Ud(e,t,n,r,i,a,o,s,c,l){let u=!1;return Hd(e,t,n,r,i,a)&&(u=!u),Hd(e,t,i,a,o,s)&&(u=!u),Hd(e,t,o,s,c,l)&&(u=!u),Hd(e,t,c,l,n,r)&&(u=!u),u}function Wd(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Gd(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function Kd(e={}){let{blockPointerEvents:t=!1}=e,n=new Bo,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r==null?void 0:r.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*.010000000000000002;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=Qo(r),g=r.type===`mouseleave`,_=Zo(u,h),v=Zo(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&ma(r.relatedTarget)&&Zo(u,r.relatedTarget))return;function y(){return!!(s&&Tc(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=Gd(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=Gd(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=Gd(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=Gd(d,f,x.right-1,A,S.left+1,k);break;default:}if(j)return;if(l&&!Wd(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?Vd/2:Vd*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+Vd+1,o=C||T?S.bottom-Vd:S.top,s=C?T?S.bottom-Vd:S.top:S.bottom-Vd;M=Ud(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?Vd/2:Vd*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-Vd,o=C||T?S.top+Vd:S.bottom,s=C?T?S.top+Vd:S.bottom:S.top+Vd;M=Ud(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?Vd/2:Vd*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+Vd+1,o=w||E?S.right-Vd:S.left,s=w?E?S.right-Vd:S.left:S.right-Vd;M=Ud(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?Vd/2:Vd*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-Vd,o=w||E?S.left+Vd:S.right,s=w?E?S.left+Vd:S.right:S.left+Vd;M=Ud(d,f,a,r,a,i,o,S.top,s,S.bottom);break}default:}M?l||n.start(40,b):b()}};return r.__options=U(U({},e),{},{blockPointerEvents:t}),r}V();let qd=me(void 0);function Jd(e){let t=Re(qd);if(t===void 0&&!e)throw Error(Jr(69));return t}let Yd=new Set([`ArrowLeft`,`ArrowRight`]),Xd=new Set([`ArrowUp`,`ArrowDown`]),Zd=new Set([...Yd,...Xd]),Qd=new Set([...Zd,`Home`,`End`]);function $d(e){return e===`starting`?Hc:pi}V();let ef=[`render`,`className`,`style`,`finalFocus`],tf=U(U({},Zi),Vi),nf=yt(function(e,t){let{render:n,className:r,style:i,finalFocus:a}=e,o=vr(e,ef),{store:s}=Qr(),{side:c,align:l}=Xr(),u=Jd(!0)!=null,d=s.useState(`open`),f=s.useState(`transitionStatus`),p=s.useState(`popupProps`),m=s.useState(`mounted`),h=s.useState(`instantType`),g=s.useState(`activeTriggerElement`),_=s.useState(`parent`),v=s.useState(`lastOpenChangeReason`),y=s.useState(`rootId`),b=s.useState(`floatingRootContext`),x=s.useState(`floatingTreeRoot`),S=s.useState(`closeDelay`),C=s.useState(`activeTriggerElement`),w=s.useState(`hoverEnabled`),T=s.useState(`disabled`),E=s.useState(`openMethod`),D=_.type===`context-menu`;Fo({open:d,ref:s.context.popupRef,onComplete(){if(d){var e,t;(e=(t=s.context).onOpenChangeComplete)==null||e.call(t,!0)}}}),Pe(()=>{function e(e){s.setOpen(!1,wo(e.reason,e.domEvent))}return x.events.on(`close`,e),()=>{x.events.off(`close`,e)}},[x.events,s]),jd(b,{enabled:w&&!T&&!D&&_.type!==`menubar`,closeDelay:S});let O=Le(e=>{s.set(`popupElement`,e)},[s]),k=Mi(`div`,e,{state:{transitionStatus:f,side:c,align:l,open:d,nested:_.type===`menu`,instant:h},ref:[t,s.context.popupRef,O],stateAttributesMapping:tf,props:[p,{onKeyDown(e){u&&Qd.has(e.key)&&e.stopPropagation()}},$d(f),o,{"data-rootownerid":y}]}),A=_.type===void 0||D;return(g||_.type===`menubar`&&v!==`outside-press`)&&(A=!0),Eo(ml,{context:b,openInteractionType:E,modal:D,disabled:!m,returnFocus:a===void 0?A:a,initialFocus:_.type!==`menu`,restoreFocus:!0,externalTree:_.type===`menubar`?void 0:x,previousFocusableElement:C,nextFocusableElement:_.type===void 0?s.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:_.type===void 0?s.context.beforeContentFocusGuardRef:void 0,children:k})});V();let rf=me(void 0);function af(){let e=Re(rf);if(e===void 0)throw Error(Jr(32));return e}V();let of=[`keepMounted`],sf=yt(function(e,t){let{keepMounted:n=!1}=e,r=vr(e,of),{store:i}=Qr();return i.useState(`mounted`)||n?Eo(rf.Provider,{value:n,children:Eo(Zc,U({ref:t},r))}):null});function cf(e){return ci(19)?e:e?`true`:void 0}V();let lf=me(void 0);function uf(){var e;let t=Re(lf);return(e=t==null?void 0:t.direction)==null?`ltr`:e}let df=e=>({name:`arrow`,options:e,async fn(t){var n,r;let{x:i,y:a,placement:o,rects:s,platform:c,elements:l,middlewareData:u}=t,{element:d,padding:f=0,offsetParent:p=`real`}=Os(e,t)||{};if(d==null)return{};let m=Ks(f),h={x:i,y:a},g=Ps(o),_=Ms(g),v=await c.getDimensions(d),y=g===`y`,b=y?`top`:`left`,x=y?`bottom`:`right`,S=y?`clientHeight`:`clientWidth`,C=s.reference[_]+s.reference[g]-h[g]-s.floating[_],w=h[g]-s.reference[g],T=p===`real`?await((n=c.getOffsetParent)==null?void 0:n.call(c,d)):l.floating,E=l.floating[S]||s.floating[_];(!E||!await((r=c.isElement)==null?void 0:r.call(c,T)))&&(E=l.floating[S]||s.floating[_]);let D=C/2-w/2,O=E/2-v[_]/2-1,k=Math.min(m[b],O),A=Math.min(m[x],O),j=k,M=E-v[_]-A,N=E/2-v[_]/2+D,P=Ds(j,N,M),ee=!u.arrow&&As(o)!=null&&N!==P&&s.reference[_]/2-(N<j?k:A)-v[_]/2<0,te=ee?N<j?N-j:N-M:0;return{[g]:h[g]+te,data:U({[g]:P,centerOffset:N-P-te},ee&&{alignmentOffset:te}),reset:ee}}}),ff=(e,t)=>U(U({},df(e)),{},{options:[e,t]}),pf=Ou().fn,mf={name:`hide`,async fn(e){var t;let{width:n,height:r,x:i,y:a}=e.rects.reference,o=n===0&&r===0&&i===0&&a===0;return{data:{referenceHidden:((t=(await pf(e)).data)==null?void 0:t.referenceHidden)||o}}}},hf={sideX:`left`,sideY:`top`},gf={name:`adaptiveOrigin`,async fn(e){var t,n;let{x:r,y:i,rects:{floating:a},elements:{floating:o},platform:s,strategy:c,placement:l}=e,u=da(o),d=u.getComputedStyle(o);if(!(d.transitionDuration!==`0s`&&d.transitionDuration!==``))return{x:r,y:i,data:hf};let f=await((t=s.getOffsetParent)==null?void 0:t.call(s,o)),p={width:0,height:0};if(c===`fixed`&&u!=null&&u.visualViewport)p={width:u.visualViewport.width,height:u.visualViewport.height};else if(f===u){let e=gs(o);p={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await((n=s.isElement)==null?void 0:n.call(s,f))&&(p=await s.getDimensions(f));let m=ks(l),h=r,g=i;m===`left`&&(h=p.width-(r+a.width)),m===`top`&&(g=p.height-(i+a.height));let _=m===`left`?`right`:hf.sideX,v=m===`top`?`bottom`:hf.sideY;return{x:h,y:g,data:{sideX:_,sideY:v}}}};V();function _f(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function vf(e,t,n){let{rects:r,placement:i}=e;return{side:_f(t,ks(i),n),align:As(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function yf(e){var t,n;let{anchor:r,positionMethod:i=`absolute`,side:a=`bottom`,sideOffset:o=0,align:s=`center`,alignOffset:c=0,collisionBoundary:l,collisionPadding:u=5,sticky:d=!1,arrowPadding:f=5,disableAnchorTracking:p=!1,inline:m,keepMounted:h=!1,floatingRootContext:g,mounted:_,collisionAvoidance:v,shiftCrossAxis:y=!1,nodeId:b,adaptiveOrigin:x,lazyFlip:S=!1,externalTree:C}=e,[w,T]=Me(null);!_&&w!==null&&T(null);let E=v.side||`flip`,D=v.align||`flip`,O=v.fallbackAxisSide||`end`,k=typeof r==`function`?r:void 0,A=La(k),j=k?A:r,M=ms(r),N=ms(_),P=uf()===`rtl`,ee=w||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":P?`left`:`right`,"inline-start":P?`right`:`left`}[a],te=s===`center`?ee:`${ee}-${s}`,F=u,ne=+(a===`bottom`),re=+(a===`top`),ie=+(a===`right`),ae=+(a===`left`);typeof F==`number`?F={top:F+ne,right:F+ae,bottom:F+re,left:F+ie}:F&&(F={top:(F.top||0)+ne,right:(F.right||0)+ae,bottom:(F.bottom||0)+re,left:(F.left||0)+ie});let oe={boundary:l===`clipping-ancestors`?`clippingAncestors`:l,padding:F},se=R(null),ce=ms(o),I=ms(c),le=typeof o==`function`?0:o,ue=typeof c==`function`?0:c,de=[];m&&de.push(m),de.push(Cu(e=>{let t=vf(e,a,P),n=typeof ce.current==`function`?ce.current(t):ce.current,r=typeof I.current==`function`?I.current(t):I.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[le,ue,P,a]));let fe=D===`none`&&E!==`shift`,pe=!fe&&(d||y||E===`shift`),me=E===`none`?null:Eu(U(U({},oe),{},{padding:{top:F.top+1,right:F.right+1,bottom:F.bottom+1,left:F.left+1},mainAxis:!y&&E===`flip`,crossAxis:D===`flip`&&`alignment`,fallbackAxisSideDirection:O})),L=fe?null:wu(e=>{let t=gs(e.elements.floating).documentElement;return U(U({},oe),{},{rootBoundary:y?{x:0,y:0,width:t.clientWidth,height:t.clientHeight}:void 0,mainAxis:D!==`none`,crossAxis:pe,limiter:d||y?void 0:Tu(e=>{if(!se.current)return{};let{width:t,height:n}=se.current.getBoundingClientRect(),r=Ns(ks(e.placement)),i=r===`y`?t:n,a=r===`y`?F.left+F.right:F.top+F.bottom;return{offset:i/2+a/2}})})},[oe,d,y,F,D]);E===`shift`||D===`shift`||s===`center`?de.push(L,me):de.push(me,L),de.push(Du(U(U({},oe),{},{apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!N.current)return;let i=e.style;i.setProperty(`--available-width`,`${t}px`),i.setProperty(`--available-height`,`${n}px`);let a=da(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(`--anchor-width`,`${u}px`),i.setProperty(`--anchor-height`,`${d}px`)}})),ff(e=>({element:se.current||gs(e.elements.floating).createElement(`div`),padding:f,offsetParent:`floating`}),[f]),{name:`transformOrigin`,fn(e){var t,n,r;let{elements:i,middlewareData:s,placement:c,rects:l,y:u}=e,d=ks(c),f=Ns(d),p=se.current,m=((t=s.arrow)==null?void 0:t.x)||0,h=((n=s.arrow)==null?void 0:n.y)||0,g=(p==null?void 0:p.clientWidth)||0,_=(p==null?void 0:p.clientHeight)||0,v=m+g/2,y=h+_/2,b=Math.abs(((r=s.shift)==null?void 0:r.y)||0),x=l.reference.height/2,S=typeof o==`function`?o(vf(e,a,P)):o,C=b>S,w={top:`${v}px calc(100% + ${S}px)`,bottom:`${v}px ${-S}px`,left:`calc(100% + ${S}px) ${y}px`,right:`${-S}px ${y}px`}[d],T=`${v}px ${l.reference.y+x-u}px`;return i.floating.style.setProperty(`--transform-origin`,pe&&f===`y`&&C?T:w),{}}},mf,x),W(()=>{!_&&g&&g.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[_,g]);let he=z(()=>({elementResize:!p&&typeof ResizeObserver<`u`,layoutShift:!p&&typeof IntersectionObserver<`u`}),[p]),{refs:ge,elements:_e,x:ve,y:ye,middlewareData:be,update:xe,placement:Se,context:Ce,isPositioned:we,floatingStyles:Te}=Cd({rootContext:g,open:h?_:void 0,placement:te,middleware:de,strategy:i,whileElementsMounted:h?void 0:(...e)=>lu(...e,he),nodeId:b,externalTree:C}),{sideX:Ee,sideY:De}=be.adaptiveOrigin||hf,Oe=we?i:`fixed`,ke=z(()=>{let e=x?{position:Oe,[Ee]:ve,[De]:ye}:U({position:Oe},Te);return we||(e.opacity=0),e},[x,Oe,Ee,ve,De,ye,Te,we]),Ae=R(null);W(()=>{if(!_)return;let e=M.current,t=typeof e==`function`?e():e,n=(bf(t)?t.current:t)||null;n!==Ae.current&&(ge.setPositionReference(n),Ae.current=n)},[_,ge,j,M]),Pe(()=>{if(!_)return;let e=M.current;typeof e!=`function`&&bf(e)&&e.current!==Ae.current&&(ge.setPositionReference(e.current),Ae.current=e.current)},[_,ge,j,M]),Pe(()=>{if(h&&_&&_e.reference&&_e.floating)return lu(_e.reference,_e.floating,xe,he)},[h,_,_e,xe,he]);let je=ks(Se),Ne=_f(a,je,P),Fe=As(Se)||`center`,Ie=!!((t=be.hide)!=null&&t.referenceHidden);W(()=>{S&&_&&we&&T(je)},[S,_,we,je]);let Le=z(()=>{var e,t;return{position:`absolute`,top:(e=be.arrow)==null?void 0:e.y,left:(t=be.arrow)==null?void 0:t.x}},[be.arrow]),Re=((n=be.arrow)==null?void 0:n.centerOffset)!==0;return z(()=>({positionerStyles:ke,arrowStyles:Le,arrowRef:se,arrowUncentered:Re,side:Ne,align:Fe,physicalSide:je,anchorHidden:Ie,refs:ge,context:Ce,isPositioned:we,update:xe}),[ke,Le,se,Re,Ne,Fe,je,Ie,ge,Ce,we,xe])}function bf(e){return e!=null&&`current`in e}V();function xf(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=La(i),o=R(0),s=ei(Cf).current,c=ei(Sf).current,[l,u]=Me(0),d=R(l),f=La((e,t)=>{c.set(e,t==null?null:t),d.current+=1,u(d.current)}),p=La(e=>{c.delete(e),d.current+=1,u(d.current)}),m=z(()=>{let e=new Map;return Array.from(c.keys()).filter(e=>e.isConnected).sort(wf).forEach((t,n)=>{var r;let i=(r=c.get(t))==null?{}:r;e.set(t,U(U({},i),{},{index:n}))}),e},[c,l]);W(()=>{if(typeof MutationObserver!=`function`||m.size===0)return;let e=new MutationObserver(e=>{let t=new Set,n=e=>t.has(e)?t.delete(e):t.add(e);e.forEach(e=>{e.removedNodes.forEach(n),e.addedNodes.forEach(n)}),t.size===0&&(d.current+=1,u(d.current))});return m.forEach((t,n)=>{n.parentElement&&e.observe(n.parentElement,{childList:!0})}),()=>{e.disconnect()}},[m]),W(()=>{d.current===l&&(n.current.length!==m.size&&(n.current.length=m.size),r&&r.current.length!==m.size&&(r.current.length=m.size),o.current=m.size),a(m)},[a,m,n,r,l]),W(()=>()=>{n.current=[]},[n]),W(()=>()=>{r&&(r.current=[])},[r]);let h=La(e=>(s.add(e),()=>{s.delete(e)}));W(()=>{s.forEach(e=>e(m))},[s,m]);let g=z(()=>({register:f,unregister:p,subscribeMapChange:h,elementsRef:n,labelsRef:r,nextIndexRef:o}),[f,p,h,n,r,o]);return Eo(po.Provider,{value:g,children:t})}function Sf(){return new Map}function Cf(){return new Set}function wf(e,t){let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}V();let Tf=[`cutout`],Ef=yt(function(e,t){let{cutout:n}=e,r=vr(e,Tf),i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return Eo(`div`,U(U({ref:t,role:`presentation`,"data-base-ui-inert":``},r),{},{style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}}))});function Df(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c=U({},n);return s&&(c.pointerEvents=`none`),Mi(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},$d(r),i],stateAttributesMapping:Zi})}let Of={},kf={},Af=``;function jf(e){if(typeof document>`u`)return!1;let t=gs(e);return da(t).innerWidth-t.documentElement.clientWidth>0}function Mf(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=gs(e),n=t.documentElement,r=t.body,i=_a(n)?n:r,a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function Nf(e){let t=gs(e),n=t.documentElement,r=t.body,i=_a(n)?n:r,a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function Pf(e){var t,n;let r=gs(e),i=r.documentElement,a=r.body,o=da(i),s=0,c=0,l=!1,u=Ao.create();if(oo&&((t=(n=o.visualViewport)==null?void 0:n.scale)==null?1:t)!==1)return()=>{};function d(){let t=o.getComputedStyle(i),n=o.getComputedStyle(a),r=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;s=i.scrollTop,c=i.scrollLeft,Of={scrollbarGutter:i.style.scrollbarGutter,overflowY:i.style.overflowY,overflowX:i.style.overflowX},Af=i.style.scrollBehavior,kf={position:a.style.position,height:a.style.height,width:a.style.width,boxSizing:a.style.boxSizing,overflowY:a.style.overflowY,overflowX:a.style.overflowX,scrollBehavior:a.style.scrollBehavior};let u=i.scrollHeight>i.clientHeight,d=i.scrollWidth>i.clientWidth,f=t.overflowY===`scroll`||n.overflowY===`scroll`,p=t.overflowX===`scroll`||n.overflowX===`scroll`,m=Math.max(0,o.innerWidth-a.clientWidth),h=Math.max(0,o.innerHeight-a.clientHeight),g=parseFloat(n.marginTop)+parseFloat(n.marginBottom),_=parseFloat(n.marginLeft)+parseFloat(n.marginRight),v=_a(i)?i:a;if(l=Mf(e),l){i.style.scrollbarGutter=r,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(i.style,{scrollbarGutter:r,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(i.style.overflowY=`scroll`),(d||p)&&(i.style.overflowX=`scroll`),Object.assign(a.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflow:`hidden`,scrollBehavior:`unset`}),a.scrollTop=s,a.scrollLeft=c,i.setAttribute(`data-base-ui-scroll-locked`,``),i.style.scrollBehavior=`unset`}function f(){Object.assign(i.style,Of),Object.assign(a.style,kf),l||(i.scrollTop=s,i.scrollLeft=c,i.removeAttribute(`data-base-ui-scroll-locked`),i.style.scrollBehavior=Af)}function p(){f(),u.request(d)}d();let m=fs(o,`resize`,p);return()=>{u.cancel(),f(),typeof o.removeEventListener==`function`&&m()}}let Ff=new class{constructor(){H(this,`lockCount`,0),H(this,`restore`,null),H(this,`timeoutLock`,Bo.create()),H(this,`timeoutUnlock`,Bo.create()),H(this,`release`,()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)}),H(this,`unlock`,()=>{if(this.lockCount===0&&this.restore){var e;(e=this.restore)==null||e.call(this),this.restore=null}})}acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}lock(e){if(this.lockCount===0||this.restore!==null)return;let t=gs(e).documentElement,n=da(t).getComputedStyle(t).overflowY;if(n===`hidden`||n===`clip`){this.restore=di;return}let r=$a||!jf(e);this.restore=r?Nf(e):Pf(e)}};function If(e=!0,t=null){W(()=>{if(e)return Ff.acquire(t)},[e,t])}V();function Lf(e,t,n,r){let[i,a]=Me(!1);W(()=>{if(!e||!t||n==null){a(!1);return}let r=gs(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-20)},[e,t,n]),If(e&&(!t||i),r)}V();let Rf=[`anchor`,`positionMethod`,`className`,`render`,`side`,`align`,`sideOffset`,`alignOffset`,`collisionBoundary`,`collisionPadding`,`arrowPadding`,`sticky`,`disableAnchorTracking`,`collisionAvoidance`,`style`],zf=yt(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=Uc,style:g}=e,_=vr(e,Rf),{store:v}=Qr(),y=af(),b=$i(!0),x=v.useState(`parent`),S=v.useState(`floatingRootContext`),C=v.useState(`floatingTreeRoot`),w=v.useState(`mounted`),T=v.useState(`open`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`activeTriggerElement`),k=v.useState(`transitionStatus`),A=v.useState(`positionerElement`),j=v.useState(`instantType`),M=v.useState(`hasViewport`),N=v.useState(`lastOpenChangeReason`),P=v.useState(`floatingNodeId`),ee=v.useState(`floatingParentNodeId`),te=S.useState(`domReferenceElement`),F=R(null),ne=Po(A,!1,!1),re=n,ie=c,ae=l,oe=s,se=h;if(x.type===`context-menu`){var ce,I;if(re=n==null?(ce=x.context)==null?void 0:ce.anchor:n,oe=(I=oe)==null?`start`:I,!o&&oe!==`center`){var le,ue;ae=(le=e.alignOffset)==null?2:le,ie=(ue=e.sideOffset)==null?-5:ue}}let de=o,fe=oe;if(x.type===`menu`){var pe,me,L;de=(pe=de)==null?`inline-end`:pe,fe=(me=fe)==null?`start`:me,se=(L=e.collisionAvoidance)==null?Wc:L}else if(x.type===`menubar`){var he,ge;de=(he=de)==null?x.context.orientation===`vertical`?`inline-end`:`bottom`:he,fe=(ge=fe)==null?`start`:ge}let _e=x.type===`context-menu`,ve=yf({anchor:re,floatingRootContext:S,positionMethod:b?`fixed`:r,mounted:w,side:de,sideOffset:ie,align:fe,alignOffset:ae,arrowPadding:_e?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:P,keepMounted:y,disableAnchorTracking:m,collisionAvoidance:se,shiftCrossAxis:_e&&!(`side`in se&&se.side===`flip`),externalTree:C,adaptiveOrigin:M?gf:void 0});Pe(()=>{function e(e){e.open&&(e.parentNodeId===P&&v.set(`hoverEnabled`,!1),e.nodeId!==P&&e.parentNodeId===v.select(`floatingParentNodeId`)&&v.setOpen(!1,wo(oa)))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[v,C.events,P]),Pe(()=>{if(v.select(`floatingParentNodeId`)==null)return;function e(e){var t;if(e.open||e.nodeId!==v.select(`floatingParentNodeId`))return;let n=(t=e.reason)==null?oa:t;v.setOpen(!1,wo(n))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[C.events,v]);let ye=Vo();Pe(()=>{T||ye.clear()},[T,ye]),Pe(()=>{function e(e){if(!(!T||e.nodeId!==v.select(`floatingParentNodeId`)))if(e.target&&O&&O!==e.target){let e=v.select(`closeDelay`);e>0?ye.isStarted()||ye.start(e,()=>{v.setOpen(!1,wo(oa))}):v.setOpen(!1,wo(oa))}else ye.clear()}return C.events.on(`itemhover`,e),()=>{C.events.off(`itemhover`,e)}},[C.events,T,O,v,ye]),Pe(()=>{let e={open:T,nodeId:P,parentNodeId:ee,reason:v.select(`lastOpenChangeReason`)};C.events.emit(`menuopenchange`,e)},[C.events,T,v,P,ee]),W(()=>{let e=te,t=F.current;if(e&&(F.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return ne(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[te,ne,v]);let be={open:T,side:ve.side,align:ve.align,anchorHidden:ve.anchorHidden,nested:x.type===`menu`,instant:j},xe=x.type===`menubar`&&x.context.modal;Lf(T&&(xe||E&&N!==`trigger-hover`),D===`touch`,A,O);let Se=Df(e,be,{styles:ve.positionerStyles,transitionStatus:k,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!w,inert:!T}),Ce=w&&x.type!==`menu`&&(x.type!==`menubar`&&E&&N!==`trigger-hover`||x.type===`menubar`&&x.context.modal),we=null;return x.type===`menubar`?we=x.context.contentElement:x.type===void 0&&(we=O),Eo(Yr.Provider,{value:ve,children:[Ce&&Eo(Ef,{ref:x.type===`context-menu`||x.type===`nested-context-menu`?x.context.internalBackdropRef:null,inert:cf(!T),cutout:we}),Eo(al,{id:P,children:Eo(xf,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:Se})})]})});V();let Bf=me(void 0);function Vf(){let e=Re(Bf);if(e===void 0)throw Error(Jr(34));return e}V();let Hf=[`render`,`className`,`value`,`defaultValue`,`onValueChange`,`disabled`,`style`,`aria-labelledby`],Uf=vt(yt(function(e,t){let{render:n,className:r,value:i,defaultValue:a,onValueChange:o,disabled:s=!1,style:c,"aria-labelledby":l}=e,u=vr(e,Hf),[d,f]=Me(void 0),[p,m]=ca({controlled:i,default:a,name:`MenuRadioGroup`}),h=La((e,t)=>{o==null||o(e,t),!t.isCanceled&&m(e)}),g=Mi(`div`,e,{state:{disabled:s},ref:t,props:U({role:`group`,"aria-labelledby":l==null?d:l,"aria-disabled":s||void 0},u)}),_=z(()=>({value:p,setValue:h,disabled:s}),[p,h,s]);return Eo(Io.Provider,{value:f,children:Eo(Bf.Provider,{value:_,children:g})})}));V();let Wf=me(void 0);function Gf(){let e=Re(Wf);if(e===void 0)throw Error(Jr(35));return e}V();let Kf=[`render`,`className`,`id`,`label`,`nativeButton`,`disabled`,`closeOnClick`,`value`,`style`],qf=yt(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,value:l,style:u}=e,d=vr(e,Kf),f=go({label:a}),p=Xr(!0),m=xo(i),{store:h}=Qr(),g=h.useState(`isActive`,f.index),_=h.useState(`itemProps`),{value:v,setValue:y,disabled:b}=Vf(),x=b||s,S=v===l,{getItemProps:C,itemRef:w}=fo({closeOnClick:c,disabled:x,highlighted:g,id:m,store:h,nativeButton:o,nodeId:p==null?void 0:p.context.nodeId,itemMetadata:uo}),T=z(()=>({disabled:x,highlighted:g,checked:S}),[x,g,S]);function E(e){let t=wo(ra,e.nativeEvent,void 0,{preventUnmountOnClose(){}});y(l,t)}let D=Mi(`div`,e,{state:T,stateAttributesMapping:Co,props:[_,{role:`menuitemradio`,"aria-checked":S,onClick:E},d,C],ref:[w,t,f.ref]});return Eo(Wf.Provider,{value:T,children:D})});V();let Jf=[`render`,`className`,`style`,`keepMounted`],Yf=yt(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1}=e,o=vr(e,Jf),s=Gf(),c=R(null),{transitionStatus:l,setMounted:u}=Mo(s.checked);return Fo({open:s.checked,ref:c,onComplete(){s.checked||u(!1)}}),Mi(`span`,e,{state:{checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l},stateAttributesMapping:Co,ref:[t,c],props:U({"aria-hidden":!0},o),enabled:a||s.checked})});V();let Xf=me(null);function Zf(e){let t=Re(Xf);if(t===null&&!e)throw Error(Jr(5));return t}V();function Qf(e){let t=R(``),n=Le(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:Le(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}V();function $f(e,t){let n=R(e),r=La(t);W(()=>{n.current!==e&&r(n.current)},[e,r]),W(()=>{n.current=e},[e])}V();function ep(e,t){let{onClick:n,onPointerDown:r}=Qf(La((n,r)=>{(typeof e==`function`?e():e)||t(r||($a?`touch`:``))}));return z(()=>({onClick:n,onPointerDown:r}),[n,r])}function tp(e){let[t,n]=Me(null),r=ep(e,n);return $f(e,t=>{t&&!e&&n(null)}),z(()=>({openMethod:t,triggerProps:r}),[t,r])}V();let np=U(U({},xd),{},{disabled:G(e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled),modal:G(e=>{var t;return(e.parent.type===void 0||e.parent.type===`context-menu`)&&((t=e.modal)==null||t)}),openMethod:G(e=>e.openMethod),allowMouseEnter:G(e=>e.allowMouseEnter),highlightItemOnHover:G(e=>e.highlightItemOnHover),stickIfOpen:G(e=>e.stickIfOpen),parent:G(e=>e.parent),rootId:G(e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId),activeIndex:G(e=>e.activeIndex),isActive:G((e,t)=>e.activeIndex===t),hoverEnabled:G(e=>e.hoverEnabled),instantType:G(e=>e.instantType),lastOpenChangeReason:G(e=>e.openChangeReason),floatingTreeRoot:G(e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot),floatingNodeId:G(e=>e.floatingNodeId),floatingParentNodeId:G(e=>e.floatingParentNodeId),itemProps:G(e=>e.itemProps),closeDelay:G(e=>e.closeDelay),hasViewport:G(e=>e.hasViewport),keyboardEventRelay:G(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)})});var rp=class e extends Yu{constructor(e){super(U(U({},ip()),e),{positionerRef:T(),popupRef:T(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:T(),beforeContentFocusGuardRef:T(),onOpenChangeComplete:void 0,triggerElements:new fd},np),H(this,`unsubscribeParentListener`,null),this.unsubscribeParentListener=this.observe(`parent`,e=>{var t;if((t=this.unsubscribeParentListener)==null||t.call(this),e.type===`menu`){let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);this.unsubscribeParentListener=e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);t===i&&n===a&&r===o||(t=i,n=a,r=o,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef;return}e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}static useStore(t,n){let r=ei(()=>new e(n)).current;return t==null?r:t}};function ip(){return U(U({},md()),{},{disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new $c,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:pi,keyboardEventRelay:void 0,closeDelay:0,hasViewport:!1})}V();let ap=me(void 0);function op(){return Re(ap)}V();let sp=Ru(function(e){var t;let{children:n,open:r,onOpenChange:i,onOpenChangeComplete:a,defaultOpen:o=!1,disabled:s=!1,modal:c,loopFocus:l=!0,orientation:u=`vertical`,actionsRef:d,closeParentOnEsc:f=!1,handle:p,triggerId:m,defaultTriggerId:h=null,highlightItemOnHover:g=!0}=e,_=$i(!0),v=Qr(!0),y=Zf(!0),b=op(),x=z(()=>b&&v?{type:`menu`,store:v.store}:y?{type:`menubar`,context:y}:_&&!v?{type:`context-menu`,context:_}:{type:void 0},[_,v,y,b]),S=rp.useStore(p==null?void 0:p.store,{open:o,openProp:r,activeTriggerId:h,triggerIdProp:m,parent:x});od(S,r,o,h),S.useControlledProp(`openProp`,r),S.useControlledProp(`triggerIdProp`,m),S.useContextCallback(`onOpenChangeComplete`,a);let C=bo(),w=bo(),T=S.useState(`floatingTreeRoot`),E=il(T),D=nl(),O=S.useState(`open`),k=S.useState(`activeTriggerElement`),A=S.useState(`positionerElement`),j=S.useState(`hoverEnabled`),M=S.useState(`disabled`),N=S.useState(`lastOpenChangeReason`),P=S.useState(`parent`),ee=S.useState(`activeIndex`),te=S.useState(`payload`),F=S.useState(`floatingParentNodeId`),ne=R(null),re=R(P.type!==`context-menu`),ie=Vo(),ae=R(!0),oe=Vo(),se=F!=null,{openMethod:ce,triggerProps:I}=tp(O);S.useSyncedValues({disabled:s,highlightItemOnHover:g,modal:P.type===void 0?c:void 0,openMethod:ce,rootId:C}),cd(S);let{forceUnmount:le}=ld(O,S,()=>{S.update({allowMouseEnter:!1,stickIfOpen:!0})});W(()=>{_&&!v?S.update({parent:{type:`context-menu`,context:_},floatingNodeId:E,floatingParentNodeId:D}):v&&S.update({floatingNodeId:E,floatingParentNodeId:D})},[_,v,E,D,S]),Pe(()=>{if(O||(ne.current=null),P.type===`context-menu`){if(!O){ie.clear(),re.current=!1;return}ie.start(500,()=>{re.current=!0})}},[ie,O,P.type]),W(()=>{!O&&!j&&S.set(`hoverEnabled`,!0)},[O,j,S]);let ue=La((e,t)=>{var n;let r=t.reason;if(O===e&&t.trigger===k&&N===r)return;let a=ad(t);if(!e&&t.trigger==null&&(t.trigger=k==null?void 0:k),i==null||i(e,t),t.isCanceled)return;S.state.floatingRootContext.dispatchOpenChange(e,t);let o=t.event;if(e===!1&&(o==null?void 0:o.type)===`click`&&o.pointerType===`touch`&&!ae.current)return;e&&r===`trigger-focus`?(ae.current=!1,oe.start(300,()=>{ae.current=!0})):(ae.current=!0,oe.clear());let s=(r===`trigger-press`||r===`item-press`)&&o.detail===0&&(o==null?void 0:o.isTrusted),c=!e&&(r===`escape-key`||r==null),l={open:e,openChangeReason:r};ne.current=(n=t.event)==null?null:n,id(l,e,t.trigger,a()),S.update(l),P.type===`menubar`&&(r===`trigger-focus`||r===`focus-out`||r===`trigger-hover`||r===`list-navigation`||r===`sibling-open`)?S.set(`instantType`,`group`):s||c?S.set(`instantType`,s?`click`:`dismiss`):S.set(`instantType`,void 0)}),de=$u({popupStore:S,floatingId:w,nested:D!=null,onOpenChange:ue}),fe=de.context.events;Pe(()=>{let e=({open:e,eventDetails:t})=>ue(e,t);return fe.on(`setOpen`,e),()=>{fe==null||fe.off(`setOpen`,e)}},[fe,ue]);let pe=Le(()=>{S.setOpen(!1,wo(sa))},[S]);Ie(d,()=>({unmount:le,close:pe}),[le,pe]);let me;P.type===`context-menu`&&(me=P.context),Ie(me==null?void 0:me.positionerRef,()=>A,[A]),Ie(me==null?void 0:me.actionsRef,()=>({setOpen:ue}),[ue]);let L=vl(de,{enabled:!M,bubbles:{escapeKey:f&&P.type===`menu`},outsidePress(){var e;return P.type!==`context-menu`||((e=ne.current)==null?void 0:e.type)===`contextmenu`||re.current},externalTree:se?T:void 0}),he=uf(),ge=Le(e=>{S.select(`activeIndex`)!==e&&S.set(`activeIndex`,e)},[S]),_e=zd(de,{enabled:!M,listRef:S.context.itemDomElements,activeIndex:ee,nested:P.type!==void 0,loopFocus:l,orientation:u,parentOrientation:P.type===`menubar`?P.context.orientation:void 0,rtl:he===`rtl`,disabledIndices:fi,onNavigate:ge,openOnArrowKeyDown:P.type!==`context-menu`,externalTree:se?T:void 0,focusItemOnHover:g}),ve=Le(e=>{S.context.typingRef.current=e},[S]),ye=Bd(de,{enabled:!M,listRef:S.context.itemLabels,elementsRef:S.context.itemDomElements,activeIndex:ee,resetMs:500,onMatch:e=>{O&&e!==ee&&S.set(`activeIndex`,e)},onTyping:ve});ud(S,{floatingRootContext:de,activeTriggerProps:z(()=>{let e=vi(ye.reference,_e.reference,L.reference,{onMouseMove(){S.set(`allowMouseEnter`,!0)}},I);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=O,e},[S,ye.reference,_e.reference,L.reference,I,O]),inactiveTriggerProps:z(()=>{let e=vi(_e.trigger,L.trigger,I);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[_e.trigger,L.trigger,I]),popupProps:z(()=>vi(ed,{id:w,role:`menu`,"aria-labelledby":k==null?void 0:k.id,onMouseMove(){S.set(`allowMouseEnter`,!0),P.type===`menu`&&S.set(`hoverEnabled`,!1)},onClick(){S.select(`hoverEnabled`)&&S.set(`hoverEnabled`,!1)},onKeyDown(e){let t=S.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},ye.floating,_e.floating,L.floating),[k,w,P.type,S,ye.floating,_e.floating,L.floating]),itemProps:(t=_e.item)==null?pi:t});let be=z(()=>({store:S,parent:x}),[S,x]),xe=Eo(Zr.Provider,{value:be,children:typeof n==`function`?n({payload:te}):n});return P.type===void 0||P.type===`context-menu`?Eo(ol,{externalTree:T,children:xe}):xe});function cp(e){let t=e.getBoundingClientRect(),n=da(e);if(co)return t;let r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(!(r.content!==`none`||i.content!==`none`))return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}V();function lp(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=Va(),{ref:i,index:a}=go(e),o=n===a,s=R(null),c=ti(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}let up=[`render`,`className`,`style`,`state`,`props`,`refs`,`metadata`,`stateAttributesMapping`,`tag`];function dp(e){let{render:t,className:n,style:r,state:i=pi,props:a=fi,refs:o=fi,metadata:s,stateAttributesMapping:c,tag:l=`div`}=e,u=vr(e,up),{compositeProps:d,compositeRef:f}=lp({metadata:s});return Mi(l,e,{state:i,ref:[...o,f],props:[d,...a,u],stateAttributesMapping:c})}function fp(e){if(ha(e)&&e.hasAttribute(`data-rootownerid`)){var t;return(t=e.getAttribute(`data-rootownerid`))==null?void 0:t}if(!Da(e))return fp(Aa(e))}V();function pp(e,t){let n=R(null);function r(t){cn(()=>{e.setOpen(!1,wo(ia,t.nativeEvent,t.currentTarget))});let r=xc(n.current);r==null||r.focus()}function i(n){let r=e.select(`positionerElement`);if(r&&Sc(n,r)){var i;(i=e.context.beforeContentFocusGuardRef.current)==null||i.focus()}else{cn(()=>{e.setOpen(!1,wo(ia,n.nativeEvent,n.currentTarget))});let i=bc(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&Zo(r,i);){let e=i;if(i=_c(i),i===e)break}i==null||i.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}V();function mp(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=R(!1);return z(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,gs(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:pi,[t,n,r])}V();let hp=[`render`,`className`,`style`,`disabled`,`nativeButton`,`id`,`openOnHover`,`delay`,`closeDelay`,`handle`,`payload`],gp=zu(function(e,t){var n;let{render:r,className:i,style:a,disabled:o=!1,nativeButton:s=!0,id:c,openOnHover:l,delay:u=100,closeDelay:d=0,handle:f,payload:p}=e,m=vr(e,hp),h=Qr(!0),g=(n=f==null?void 0:f.store)==null?h==null?void 0:h.store:n;if(!g)throw Error(Jr(85));let _=xo(c),v=g.useState(`isTriggerActive`,_),y=g.useState(`floatingRootContext`),b=g.useState(`isOpenedByTrigger`,_),x=g.useState(`triggerPopupId`,_),S=R(null),C=vp(),w=Va(!0),T=rl(),D=z(()=>T==null?new $c:T,[T]),{registerTrigger:O,isMountedByThisTrigger:k}=sd(_,S,g,{payload:p,closeDelay:d,parent:C,floatingTreeRoot:D,floatingNodeId:il(D),floatingParentNodeId:nl(),keyboardEventRelay:w==null?void 0:w.relayKeyboardEvent}),A=C.type===`menubar`,j=g.useState(`disabled`),M=o||j||A&&C.context.disabled,{getButtonProps:N,buttonRef:P}=Wa({disabled:M,native:s});Pe(()=>{!b&&C.type===void 0&&(g.context.allowMouseUpTriggerRef.current=!1)},[g,b,C.type]);let ee=R(null),te=Vo(),F=La(e=>{if(!ee.current)return;te.clear(),g.context.allowMouseUpTriggerRef.current=!1;let t=e.target;if(Zo(ee.current,t)||Zo(g.select(`positionerElement`),t)||t===ee.current||t!=null&&fp(t)===g.select(`rootId`))return;let n=cp(ee.current);e.clientX>=n.left-2&&e.clientX<=n.right+2&&e.clientY>=n.top-2&&e.clientY<=n.bottom+2||D.events.emit(`close`,{domEvent:e,reason:`cancel-open`})});Pe(()=>{b&&g.select(`lastOpenChangeReason`)===`trigger-hover`&&gs(ee.current).addEventListener(`mouseup`,F,{once:!0})},[b,F,g]);let ne=A&&C.context.hasSubmenuOpen,re=Nd(y,{enabled:(l==null?ne:l)&&!M&&C.type!==`context-menu`&&(!A||ne&&!k),handleClose:Kd({blockPointerEvents:!A}),mouseOnly:!0,move:!1,restMs:C.type===void 0?u:void 0,delay:{close:d},triggerElementRef:S,externalTree:D,isActiveTrigger:v,isClosing:()=>g.select(`transitionStatus`)===`ending`}),ie=_p(b,g.select(`lastOpenChangeReason`)),ae=hl(y,{enabled:!M&&C.type!==`context-menu`,event:b&&A?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:C.type===void 0&&ie}),oe=Td(y,{enabled:!M&&ne}),se=mp({open:b,enabled:A,mouseDownAction:`open`}),ce=z(()=>vi(oe.reference,ae.reference),[oe.reference,ae.reference]),I=g.useState(`triggerProps`,k),{preFocusGuardRef:le,handlePreFocusGuardFocus:ue,handleFocusTargetFocus:de}=pp(g,S),fe={disabled:M,open:b},pe=[ee,t,P,O,S],me=[ce,re==null?pi:re,I,{"aria-haspopup":`menu`,"aria-controls":x,id:_,onMouseDown:e=>{g.select(`open`)||(te.start(200,()=>{g.context.allowMouseUpTriggerRef.current=!0}),gs(e.currentTarget).addEventListener(`mouseup`,F,{once:!0}))}},A?{role:`menuitem`}:{},se,m,N],L=Mi(`button`,e,{enabled:!A,stateAttributesMapping:Xi,state:fe,ref:pe,props:me});return A?Eo(dp,{tag:`button`,render:r,className:i,style:a,state:fe,refs:pe,props:me,stateAttributesMapping:Xi}):b?Eo(E,{children:[Eo(ys,{ref:le,onFocus:ue},`${_}-pre-focus-guard`),Eo(E,{children:L},_),Eo(ys,{ref:g.context.triggerFocusTargetRef,onFocus:de},`${_}-post-focus-guard`)]}):Eo(E,{children:L},_)});function _p(e,t){let n=Vo(),[r,i]=Me(!1);return W(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function vp(){let e=$i(!0),t=Qr(!0),n=Zf(!0);return z(()=>n?{type:`menubar`,context:n}:e&&!t?{type:`context-menu`,context:e}:{type:void 0},[e,t,n])}V();function yp(e){return`${e.charAt(0).toLocaleUpperCase()}${e.substring(1)}`}let bp={askAI:`askAI`,favoriteSearches:`favoriteSearches`,recentConversations:`recentConversations`,recentSearches:`recentSearches`};function xp(e,t){return e.collections.find(e=>(e==null?void 0:e.source.sourceId)===t)}function Sp(e){return e.replace(/&lt;/g,`<`).replace(/&gt;/g,`>`).replace(/&quot;/g,`"`).replace(/&#039;/g,`'`).replace(/&amp;/g,`&`)}let Cp=[`lvl0`,`lvl1`,`lvl2`,`lvl3`,`lvl4`,`lvl5`,`lvl6`];function wp(e){let t=e.type===`content`||e.type===`askAI`?Cp.length:Cp.indexOf(e.type);return Cp.slice(0,t).map(t=>e.hierarchy[t]?Sp(e.hierarchy[t]):null).filter(Boolean).join(` > `)}let Tp=new Map;function Ep(e){let t=Tp.get(e);if(t)return t;let n=e.replace(/\[(\w+)\]/g,`.$1`).replace(/^\/./,``).split(`.`);return Tp.set(e,n),n}function Dp(e,t){return Ep(t).reduce((e,t)=>{if(e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,t))return e[t]},e)}function Op(e,t,n){return e.reduce((e,r)=>{let i=t(r);return e.hasOwnProperty(i)||(e[i]=[]),e[i].length<(n||5)&&e[i].push(r),e},{})}function kp(e){return e}function Ap(e){return e.button===1||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}function jp(e){return!e||e.trim().length===0}function Mp(...e){}let Np=/(<mark>|<\/mark>)/g,Pp=RegExp(Np.source);function Fp(e){var t,n;let r=e;if(!r.__docsearch_parent&&!e._highlightResult)return e.hierarchy.lvl0;let i=r.__docsearch_parent?(t=r.__docsearch_parent)==null||(t=t._highlightResult)==null||(t=t.hierarchy)==null?void 0:t.lvl0:(n=e._highlightResult)==null||(n=n.hierarchy)==null?void 0:n.lvl0;return i?i.value&&Pp.test(i.value)?i.value.replace(Np,``):i.value:e.hierarchy.lvl0}function Ip(e){typeof e.scrollTo==`function`?e.scrollTo({top:0,behavior:`smooth`}):e.scrollTop=0}function Lp(){return B.createElement(`svg`,{className:`DocSearch-Hit-Select-Icon`,width:`20`,height:`20`,viewBox:`0 0 20 20`},B.createElement(`g`,{stroke:`currentColor`,fill:`none`,fillRule:`evenodd`,strokeLinecap:`round`,strokeLinejoin:`round`},B.createElement(`path`,{d:`M18 3v4c0 2-2 4-4 4H2`}),B.createElement(`path`,{d:`M8 17l-6-6 6-6`})))}function Rp(){return B.createElement(`svg`,{width:`40`,height:`40`,viewBox:`0 0 20 20`,fill:`none`,fillRule:`evenodd`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`},B.createElement(`path`,{d:`M19 4.8a16 16 0 00-2-1.2m-3.3-1.2A16 16 0 001.1 4.7M16.7 8a12 12 0 00-2.8-1.4M10 6a12 12 0 00-6.7 2M12.3 14.7a4 4 0 00-4.5 0M14.5 11.4A8 8 0 0010 10M3 16L18 2M10 18h0`}))}function zp(){return B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`64`,height:`64`,viewBox:`0 0 24 24`,fill:`none`,stroke:`#5a5e9a`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},B.createElement(`path`,{d:`m13.5 8.5-5 5`}),B.createElement(`path`,{d:`m8.5 8.5 5 5`}),B.createElement(`circle`,{cx:`11`,cy:`11`,r:`8`}),B.createElement(`path`,{d:`m21 21-4.3-4.3`}))}function Bp(){return B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},B.createElement(`path`,{d:`M12 17v5`}),B.createElement(`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`}))}function Vp(){return B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`},B.createElement(`polyline`,{points:`6 9 12 15 18 9`}))}function Hp(){return B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`},B.createElement(`polyline`,{points:`20 6 9 17 4 12`}))}function Up(e=[]){let t=new Map;for(let n of e){let e=n.key.trim().toLowerCase();if(!(e.length===0||t.has(e))){if(t.size>=5)break;t.set(e,n)}}return Array.from(t.values())}function Wp(e){return e.label?e.label:e.key.replace(/[._-]+/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function Gp(e){let t={};for(let r of e){var n;let e=(n=r.searchParameters)==null?void 0:n.facetFilters;for(let n of Array.isArray(e)?e:[e]){if(typeof n!=`string`)continue;let e=n.indexOf(`:`);if(e<=0)continue;let r=n.slice(0,e),i=n.slice(e+1);r&&i&&(t[r]=i)}}return t}let Kp=[`className`,`type`];function qp({children:e}){return B.createElement(`div`,{className:`DocSearch-Chip`},e)}function Jp(e){let{className:t,type:n=`button`}=e,r=pn(e,Kp),i=`DocSearch-Chip-Dismiss${t?` ${t}`:``}`;return B.createElement(`button`,_({type:n,className:i,tabIndex:0},r),B.createElement(jr,{"aria-hidden":`true`}))}qp.Dismiss=Jp;let Yp=[`className`],Xp=[`align`,`alignOffset`,`side`,`sideOffset`,`collisionBoundary`,`container`],Zp=[`className`,`children`],Qp=[`className`];function $p(e){let t=Ar({},(kr(e),e));return B.createElement(sp,t)}$p.Trigger=B.forwardRef((e,t)=>{let{className:n}=e,r=pn(e,Yp),i=`DocSearch-Menu-Trigger${n?` ${n}`:``}`;return B.createElement(gp,_({className:i,ref:t},r))});function em(e){let{align:t=`start`,alignOffset:n=0,side:r=`bottom`,sideOffset:i=4,collisionBoundary:a=`clipping-ancestors`,container:o}=e,s=pn(e,Xp);return B.createElement(sf,{container:o},B.createElement(zf,{className:`DocSearch-Menu-Positioner`,align:t,alignOffset:n,side:r,sideOffset:i,collisionBoundary:a},B.createElement(nf,_({className:`DocSearch-Menu-Popup`},s))))}$p.Popup=em;function tm(e){let t=Ar({},(kr(e),e));return B.createElement(Uf,t)}$p.RadioGroup=tm;function nm(e){let{className:t,children:n}=e,r=pn(e,Zp),i=`DocSearch-Menu-Item DocSearch-Menu-RadioItem${t?` ${t}`:``}`;return B.createElement(qf,_({className:i,closeOnClick:!0},r),B.createElement(`span`,{className:`DocSearch-Menu-RadioItem-Indicator`},B.createElement(Yf,null,B.createElement(Hp,null))),n)}$p.RadioItem=nm;function rm(e){let{className:t}=e,n=pn(e,Qp),r=`DocSearch-Menu-GroupLabel${t?` ${t}`:``}`;return B.createElement(zo,_({className:r},n))}$p.GroupLabel=rm;let im=B.memo(function({facet:e,selectedValue:t,defaultValueLabel:n,onSelectionChange:r,registerTrigger:i,menuTriggerSelectedAriaLabel:a}){let o=Wp(e),s=B.useCallback(t=>{r(e.key,t)},[e.key,r]),c=B.useCallback(t=>{i(e.key,t)},[e.key,i]);return B.createElement($p,null,B.createElement($p.Trigger,{ref:c,"data-has-selection":!!t,"aria-label":t?`${o}, ${t} ${a}`:o},B.createElement(`span`,null,yp(o)),B.createElement(Vp,null)),B.createElement($p.Popup,null,B.createElement($p.RadioGroup,{value:t,onValueChange:s},B.createElement($p.RadioItem,{value:``,label:`${n} ${o}`},n),e.values.map(e=>B.createElement($p.RadioItem,{key:e,value:e,label:e},yp(e))))))}),am=B.memo(function({facetKey:e,facetLabel:t,value:n,dismissAriaLabel:r,onDismiss:i}){let a=B.useCallback(t=>{i(e,t)},[e,i]);return B.createElement(qp,null,yp(n),B.createElement(qp.Dismiss,{"aria-label":`${r} ${yp(n)} (${t})`,onClick:a}))}),om=B.memo(function({facets:e,selections:t,onSelectionChange:n,clearSelections:r,translations:i={}}){let{defaultValueLabel:a=`All`,facetMenuTriggerAriaLabel:o=`selected`,clearAllLabel:s=`Clear all`,facetsAriaLabel:c=`Search filters`,selectedFacetsAriaLabel:l=`Selected search filters`,clearFacetAriaLabel:u=`Clear filter:`}=i,d=B.useMemo(()=>new Set(e.map(e=>e.key)),[e]),f=B.useMemo(()=>Object.entries(t).filter(([e,t])=>!!t&&d.has(e)),[t,d]),p=B.useRef(new Map),m=B.useCallback((e,t)=>{t?p.current.set(e,t):p.current.delete(e)},[]),h=B.useCallback((e,t)=>{let r=t.currentTarget,i=r.closest(`.DocSearch-FacetSelectionBar`);if(i){var a,o;let t=Array.from(i.querySelectorAll(`.DocSearch-Chip-Dismiss`)),n=t.indexOf(r),s=(a=(o=t[n+1])==null?t[n-1]:o)==null?p.current.get(e):a;s==null||s.focus()}n(e,``)},[n]),g=B.useCallback(()=>{var e;(e=p.current.values().next().value)==null||e.focus(),r()},[r]),_=B.useMemo(()=>new Map(e.map(e=>[e.key,Wp(e)])),[e]);return e.length===0?null:B.createElement(B.Fragment,null,B.createElement(`div`,{className:`DocSearch-FacetBar`,role:`group`,"aria-label":c},e.map(e=>{var r;let i=(r=t[e.key])==null?``:r;return B.createElement(im,{key:e.key,facet:e,selectedValue:i,defaultValueLabel:a,registerTrigger:m,menuTriggerSelectedAriaLabel:o,onSelectionChange:n})})),f.length>0&&B.createElement(`div`,{className:`DocSearch-FacetSelectionBar`,role:`group`,"aria-label":l},f.map(([e,t])=>{var n;return B.createElement(am,{key:e,facetKey:e,facetLabel:(n=_.get(e))==null?e:n,value:t,dismissAriaLabel:u,onDismiss:h})}),B.createElement(`button`,{type:`button`,className:`DocSearch-FacetSelectionBar-Action`,onClick:g},s)))}),sm=[`actionsBeforeClose`,`autoFocus`,`clearButtonAriaLabel`,`clearButtonTitle`,`closeButtonAriaLabel`,`closeButtonText`,`hideInput`,`inputOverlay`,`inputProps`,`inputRef`,`isFromSelection`,`leadingElement`,`onClose`,`placeholder`,`searchInputLabel`,`state`];function cm(e){let{actionsBeforeClose:t,autoFocus:n,clearButtonAriaLabel:r,clearButtonTitle:i,closeButtonAriaLabel:a,closeButtonText:o,hideInput:s,inputOverlay:c,inputProps:l,inputRef:u,isFromSelection:d,leadingElement:f,onClose:p,placeholder:m,searchInputLabel:h,state:g}=e,v=pn(e,sm),{onReset:y}=v.getFormProps({inputElement:u.current});B.useEffect(()=>{n&&u.current&&u.current.focus()},[n,u]),B.useEffect(()=>{d&&u.current&&u.current.select()},[d,u]);let b=v.getInputProps({inputElement:u.current,autoFocus:n,maxLength:512}),x=g.status===`stalled`;return B.createElement(`form`,{className:`DocSearch-Form`,onSubmit:e=>{e.preventDefault()},onReset:y},f||(x?B.createElement(`div`,{className:`DocSearch-LoadingIndicator`},B.createElement(Er,null)):B.createElement(`label`,_({className:`DocSearch-MagnifierLabel`},v.getLabelProps()),B.createElement(dn,null),B.createElement(`span`,{className:`DocSearch-VisuallyHiddenForAccessibility`},h))),c,B.createElement(`input`,_(_(_({className:`DocSearch-Input`,ref:u},b),l),{},{placeholder:m,hidden:s})),B.createElement(`div`,{className:`DocSearch-Actions`},t,B.createElement(`button`,{type:`button`,title:o,className:`DocSearch-Action DocSearch-Close`,"aria-label":a,onClick:p},B.createElement(jr,null))))}function lm({state:e,containerRef:t,modalRef:n,formElementRef:r,dropdownRef:i,getRootProps:a,onClose:o,showDropdown:s,searchBox:c,filterBar:l,screenState:u,footer:d}){return B.createElement(`div`,_(_({ref:t},a({"aria-expanded":!0})),{},{className:[`DocSearch`,`DocSearch-Container`,e.status===`stalled`&&`DocSearch-Container--Stalled`,e.status===`error`&&`DocSearch-Container--Errored`].filter(Boolean).join(` `),role:`button`,tabIndex:0,onMouseDown:e=>{e.target===e.currentTarget&&o()}}),B.createElement(`div`,{className:`DocSearch-Modal`,ref:n},B.createElement(`header`,{className:`DocSearch-SearchBar`,ref:r},c),l,s&&B.createElement(`div`,{className:`DocSearch-Dropdown`,ref:i},u),B.createElement(`footer`,{className:`DocSearch-Footer`},d)))}function um(e){return B.createElement(`svg`,{width:`20`,height:`20`,"aria-label":e.ariaLabel,viewBox:`0 0 24 24`,role:`img`},B.createElement(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.4`},e.children))}function dm({translations:e={},isAskAiActive:t=!1,footerAction:n}){let{selectText:r=`Select`,selectKeyAriaLabel:i=`Enter key`,submitQuestionText:a=`Submit question`,navigateText:o=`Navigate`,navigateUpKeyAriaLabel:s=`Arrow up`,navigateDownKeyAriaLabel:c=`Arrow down`,closeText:l=`Close`,backToSearchText:u=`Back to search`,closeKeyAriaLabel:d=`Escape key`,poweredByText:f=`Powered by`}=e,p=n!=null&&typeof n!=`boolean`;return B.createElement(B.Fragment,null,B.createElement(`ul`,{className:`DocSearch-Commands`},B.createElement(`li`,null,B.createElement(`kbd`,{className:`DocSearch-Commands-Key`},B.createElement(um,{ariaLabel:c},B.createElement(`path`,{d:`M12 5v14`}),B.createElement(`path`,{d:`m19 12-7 7-7-7`}))),B.createElement(`kbd`,{className:`DocSearch-Commands-Key`},B.createElement(um,{ariaLabel:s},B.createElement(`path`,{d:`m5 12 7-7 7 7`}),B.createElement(`path`,{d:`M12 19V5`}))),B.createElement(`span`,{className:`DocSearch-Label`},o)),B.createElement(`li`,null,B.createElement(`kbd`,{className:`DocSearch-Commands-Key`},B.createElement(um,{ariaLabel:i},B.createElement(`polyline`,{points:`9 10 4 15 9 20`}),B.createElement(`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`}))),B.createElement(`span`,{className:`DocSearch-Label`},t?a:r)),B.createElement(`li`,null,B.createElement(`kbd`,{className:`DocSearch-Commands-Key`},B.createElement(`span`,{className:`DocSearch-Escape-Key`},`ESC`)),B.createElement(`span`,{className:`DocSearch-Label`,"aria-label":d},t?u:l))),B.createElement(`div`,{className:`DocSearch-Footer-Actions`},p&&B.createElement(`div`,{className:`DocSearch-Footer-Action`},n),B.createElement(`div`,{className:`DocSearch-Logo`},B.createElement(Ir,{translations:{poweredByText:f}}))))}function fm({hit:e,children:t}){return B.createElement(`a`,{href:e.url},t)}function pm({facets:e,indexes:t,searchClient:n}){let[r,i]=B.useState({}),a=e.map(e=>e.key).join(`,`),o=JSON.stringify(t.map(e=>{var t;return[e.name,(t=e.searchParameters)==null?null:t]}));return B.useEffect(()=>{let e=!0,r=a?a.split(`,`):[];return r.length===0||t.length===0||n.search({requests:t.map(e=>({indexName:e.name,query:``,hitsPerPage:0,facets:r}))}).then(({results:t})=>{if(!e)return;let n=r.reduce((e,t)=>(e[t]=[],e),{});t.forEach(e=>{var t;Object.entries((t=e.facets)==null?{}:t).forEach(([e,t])=>{n[e]&&(n[e]=Array.from(new Set([...n[e],...Object.keys(t)])).sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`})))})}),i(n)}).catch(()=>{e&&i({})}),()=>{e=!1}},[a,o,n]),r}function mm({facets:e,indexes:t,searchClient:n,onSelectionsChange:r}){let i=B.useMemo(()=>Up(e),[e]),a=B.useRef(i),o=pm({facets:i,indexes:t,searchClient:n}),[s,c]=B.useState(()=>Gp(t)),l=B.useRef(s),u=B.useRef(r),d=B.useMemo(()=>i.map(e=>{var t;return _(_({},e),{},{values:(t=o[e.key])==null?[]:t})}).filter(e=>e.values.length>0),[o,i]);B.useLayoutEffect(()=>{a.current=i,u.current=r});let f=B.useCallback(e=>{var t;l.current=e,c(e),(t=u.current)==null||t.call(u)},[]);return{visibleFacets:d,facetSelections:s,facetSelectionsRef:l,handleFacetSelectionChange:B.useCallback((e,t)=>{if(l.current[e]===t)return;let n=_({},l.current);n[e]=t,f(n)},[f]),clearFacetSelections:B.useCallback(()=>{if(Object.keys(l.current).length===0)return;let e={};for(let t of a.current)l.current[t.key]&&(e[t.key]=``);f(e)},[f])}}function hm(e){return B.useCallback(t=>{if(!e.context.algoliaInsightsPlugin||!t.__autocomplete_id)return;let n=t;e.context.algoliaInsightsPlugin.insights.clickedObjectIDsAfterSearch({eventName:`Item Selected`,index:n.__autocomplete_indexName,items:[n],positions:[t.__autocomplete_id],queryID:n.__autocomplete_queryID})},[e.context.algoliaInsightsPlugin])}function gm(e){let t=B.useRef(typeof window<`u`?window.getSelection().toString().slice(0,512):``).current;return{initialQuery:B.useRef(e||t).current,initialQueryFromSelection:t}}function _m({getEnvironmentProps:e,panelElement:t,formElement:n,inputElement:r}){B.useEffect(()=>{if(!(t&&n&&r))return;let{onTouchStart:i,onTouchMove:a}=e({panelElement:t,formElement:n,inputElement:r});return window.addEventListener(`touchstart`,i),window.addEventListener(`touchmove`,a),()=>{window.removeEventListener(`touchstart`,i),window.removeEventListener(`touchmove`,a)}},[e,t,n,r])}function vm({container:e}){B.useEffect(()=>{if(!e)return;let t=e.querySelectorAll(`a[href]:not([disabled]), button:not([disabled]), input:not([disabled])`),n=t[0],r=t[t.length-1];function i(e){e.key===`Tab`&&(e.shiftKey?document.activeElement===n&&(e.preventDefault(),r.focus()):document.activeElement===r&&(e.preventDefault(),n.focus()))}return e.addEventListener(`keydown`,i),()=>{e.removeEventListener(`keydown`,i)}},[e])}function ym({initialScrollY:e,modalRef:t,theme:n}){mn({theme:n}),B.useEffect(()=>(document.body.classList.add(`DocSearch--active`),()=>{var t,n;document.body.classList.remove(`DocSearch--active`),(t=(n=window).scrollTo)==null||t.call(n,0,e)}),[e]),B.useEffect(()=>{Br()},[]),B.useLayoutEffect(()=>{let e=window.innerWidth-document.body.clientWidth;return document.body.style.marginInlineEnd=`${e}px`,()=>{document.body.style.marginInlineEnd=`0px`}},[]),B.useEffect(()=>{function e(){if(t.current){let e=window.innerHeight*.01;t.current.style.setProperty(`--docsearch-vh`,`${e}px`)}}return e(),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`resize`,e)}},[t])}function bm({getEnvironmentProps:e,containerRef:t,dropdownRef:n,formElementRef:r,inputRef:i,initialScrollY:a,modalRef:o,theme:s}){_m({getEnvironmentProps:e,panelElement:n.current,formElement:r.current,inputElement:i.current}),vm({container:t.current}),ym({initialScrollY:a,modalRef:o,theme:s})}function xm(){return{containerRef:B.useRef(null),modalRef:B.useRef(null),formElementRef:B.useRef(null),dropdownRef:B.useRef(null),inputRef:B.useRef(null)}}function Sm({initialQuery:e,inputRef:t,refresh:n}){B.useEffect(()=>{e.length>0&&(n(),t.current&&t.current.focus())},[e,t,n])}function Cm(e){let t=e.hierarchy,n=[`lvl6`,`lvl5`,`lvl4`,`lvl3`,`lvl2`,`lvl1`,`lvl0`].find(e=>t[e]);return _(_({},e),{},{type:n||`lvl0`,content:null})}function wm({favoriteSearches:e,recentSearches:t,disableUserPersonalization:n}){return B.useCallback(function(r){if(n)return;let i=r.type===`content`?r.__docsearch_parent||Cm(r):r;i&&e.getAll().findIndex(e=>e.objectID===i.objectID)===-1&&t.add(i)},[e,t,n])}function Tm({defaultIndexName:e,recentSearchesLimit:t,recentSearchesWithFavoritesLimit:n}){let r=B.useRef(Wr({key:`__DOCSEARCH_FAVORITE_SEARCHES__${e}`,limit:10})).current;return{favoriteSearches:r,recentSearches:B.useRef(Wr({key:`__DOCSEARCH_RECENT_SEARCHES__${e}`,limit:r.getAll().length===0?t:n})).current}}function Em({title:e,subText:t}){return B.createElement(`div`,{className:`DocSearch-Hit-content-wrapper`},B.createElement(`span`,{className:`DocSearch-Hit-title`},e),B.createElement(`span`,{className:`DocSearch-Hit-path`},t))}let Dm=1e3,Om=Dm*60,km=Om*60,Am=[[km*24,`day`],[km,`hour`],[Om,`minute`],[Dm,`second`]];function jm(e,t=Date.now()){let[n]=Me(()=>{var n;let r=Math.abs(Number(t)-Number(e)),[i,a]=(n=Am.find(([e])=>r>=e))==null?Am[Am.length-1]:n;return[Math.floor(r/i),a]}),r=z(()=>{let e=typeof navigator<`u`?navigator.language:void 0,[t,r]=n;return new Intl.RelativeTimeFormat(e,{style:`long`}).format(t*-1,r)},[n]);return e?r:null}let Mm=[`hit`,`attribute`,`tagName`];function Nm(e,t){return t.split(`.`).reduce((e,t)=>e!=null&&e[t]?e[t]:null,e)}function Pm(e){let{hit:t,attribute:n,tagName:r=`span`}=e;return C(r,_(_({},pn(e,Mm)),{},{dangerouslySetInnerHTML:{__html:Nm(t,`_snippetResult.${n}.value`)||Nm(t,n)}}))}function Fm(e){var t;let{askAiResultsTitle:n=`Ask AI Assistant`}=e.translations||{},r=B.useId(),i=B.useMemo(()=>e.title?Sp(e.title):null,[e.title]);return!e.collection||e.collection.items.length===0?null:e.collection.source.sourceId===bp.askAI?B.createElement(`section`,{className:`DocSearch-Hits`},B.createElement(`h2`,{id:r,className:`DocSearch-Hit-source`},n),B.createElement(`ul`,_(_({className:`DocSearch-Hits-padded`},e.getListProps({source:e.collection.source})),{},{"aria-labelledby":r}),e.collection.items.map(t=>B.createElement(Rm,_({key:t.objectID,item:t,translations:e.translations},e))))):e.collection.source.sourceId===bp.recentConversations?B.createElement(`section`,{className:`DocSearch-Hits`},B.createElement(`div`,{className:`DocSearch-Hit-source`},B.createElement(Dr,null),i),B.createElement(`ul`,_({className:`DocSearch-Hits-padded`},e.getListProps({source:e.collection.source})),e.collection.items.map((t,n)=>B.createElement(Im,_({key:[e.title,t.objectID].join(`:`),item:t,index:n},e))))):B.createElement(`section`,{className:`DocSearch-Hits`},B.createElement(`div`,{className:`DocSearch-Hit-source`},(t=e.sourceIcon)==null?null:t,i),B.createElement(`ul`,_({className:`DocSearch-Hits-padded`},e.getListProps({source:e.collection.source})),e.collection.items.map((t,n)=>B.createElement(Im,_({key:[e.title,t.objectID].join(`:`),item:t,index:n},e)))))}function Im({item:e,index:t,renderIcon:n,renderAction:r,getItemProps:i,onItemClick:a,collection:o,hitComponent:s,translations:c={},renderResultBadge:l}){let u=s,{recentConversationTimestampFallback:d=`A while ago`}=c,f=e.type===`content`?`content`:`hierarchy.${e.type}`,p=wp(e);return B.createElement(`li`,_({className:[`DocSearch-Hit`,e.__docsearch_parent&&`DocSearch-Hit--Child`].filter(Boolean).join(` `)},i({item:e,source:o.source,onClick(t){a(e,t)}})),B.createElement(u,{hit:e},B.createElement(`div`,{className:`DocSearch-Hit-Container`},n({item:e,index:t}),e.type===`lvl0`&&B.createElement(Em,{title:B.createElement(Pm,{hit:e,attribute:`hierarchy.lvl0`}),subText:B.createElement(Pm,{hit:e,attribute:`content`})}),e.type===`askAI`?B.createElement(Lm,{item:e,relativeDateFallbackText:d}):B.createElement(Em,{title:B.createElement(Pm,{hit:e,attribute:f}),subText:p}),l==null?void 0:l({item:e}),r({item:e}))))}function Lm({item:e,relativeDateFallbackText:t}){let n=jm(e.hierarchy.lvl2?new Date(e.hierarchy.lvl2):null);return B.createElement(Em,{title:Sp(e.hierarchy.lvl1||``),subText:n||t})}function Rm({item:e,getItemProps:t,onItemClick:n,collection:r}){return e.query?B.createElement(`li`,_({className:`DocSearch-Hit`},t({item:e,source:r.source,onClick(t){n(e,t)}})),B.createElement(`div`,{className:`DocSearch-Hit--AskAI`},B.createElement(`div`,{className:`DocSearch-Hit-AskAIButton DocSearch-Hit-Container`},B.createElement(`div`,{className:` DocSearch-Hit-AskAIButton-icon DocSearch-Hit-icon`},B.createElement(Dr,null)),B.createElement(`div`,{className:`DocSearch-Hit-AskAIButton-title`},B.createElement(`span`,{className:`DocSearch-Hit-AskAIButton-title-query`},e.query))))):null}let zm=[`translations`];function Bm(e){let{translations:t={}}=e,n=pn(e,zm),{recentSearchesTitle:r=`Recently viewed docs`,saveRecentSearchButtonTitle:i=`Pin this search`,removeRecentSearchButtonTitle:a=`Remove this search from history`,favoriteSearchesTitle:o=`Pinned`,removeFavoriteSearchButtonTitle:s=`Remove this saved search`}=t,c=xp(n.state,`favoriteSearches`),l=xp(n.state,`recentSearches`);return B.createElement(B.Fragment,null,c&&B.createElement(Fm,_(_({},n),{},{title:o,collection:c,sourceIcon:B.createElement(Bp,null),renderIcon:({item:e})=>B.createElement(`div`,{className:`DocSearch-Hit-icon`},B.createElement(Nr,{type:e.type})),renderAction:({item:e})=>B.createElement(`div`,{className:`DocSearch-Hit-action`},B.createElement(`button`,{className:`DocSearch-Hit-action-button`,title:s,type:`submit`,onClick:t=>{t.preventDefault(),t.stopPropagation(),n.favoriteSearches.remove(e),n.refresh()}},B.createElement(jr,null)))})),l&&B.createElement(Fm,_(_({},n),{},{title:r,collection:l,sourceIcon:B.createElement(Or,null),renderIcon:({item:e})=>B.createElement(`div`,{className:`DocSearch-Hit-icon`},B.createElement(Nr,{type:e.type})),renderAction:({item:e})=>B.createElement(B.Fragment,null,B.createElement(`div`,{className:`DocSearch-Hit-action`},B.createElement(`button`,{className:`DocSearch-Hit-action-button DocSearch-Hit-action-button--pin`,title:i,type:`submit`,onClick:t=>{t.preventDefault(),t.stopPropagation(),n.favoriteSearches.add(e),n.recentSearches.remove(e),n.refresh()}},B.createElement(Bp,null))),B.createElement(`div`,{className:`DocSearch-Hit-action`},B.createElement(`button`,{className:`DocSearch-Hit-action-button`,title:a,type:`submit`,onClick:t=>{t.preventDefault(),t.stopPropagation(),n.recentSearches.remove(e),n.refresh()}},B.createElement(jr,null))))})))}function Vm({translations:e={}}){let{titleText:t=`Unable to fetch results`,helpText:n=`You might want to check your network connection.`}=e;return B.createElement(`div`,{className:`DocSearch-ErrorScreen`},B.createElement(`div`,{className:`DocSearch-Screen-Icon`},B.createElement(Rp,null)),B.createElement(`p`,{className:`DocSearch-Title`},t),B.createElement(`p`,{className:`DocSearch-Help`},n))}let Hm=[`translations`];function Um(e){let{translations:t={}}=e,n=pn(e,Hm),{noResultsText:r=`No results found for`,suggestedQueryText:i=`Try searching for`,reportMissingResultsText:a=`Believe this query should return results?`,reportMissingResultsLinkText:o=`Let us know.`}=t,s=n.state.context.searchSuggestions;return B.createElement(`div`,{className:`DocSearch-NoResults ${n.canHandleAskAi?`DocSearch-NoResults--withAskAi`:``}`},B.createElement(`div`,{className:`DocSearch-Screen-Icon`},B.createElement(zp,null)),B.createElement(`p`,{className:`DocSearch-Title`},r,` "`,B.createElement(`strong`,null,n.state.query),`"`),s&&s.length>0&&B.createElement(`div`,{className:`DocSearch-NoResults-Prefill-List`},B.createElement(`p`,{className:`DocSearch-Help`},i,`:`),B.createElement(`div`,{className:`DocSearch-NoResults-Prefill-List-Items`},s.slice(0,3).reduce((e,t)=>[...e,B.createElement(`p`,{key:t},B.createElement(dn,{size:16}),B.createElement(`button`,{className:`DocSearch-Prefill`,key:t,type:`button`,onClick:()=>{n.setQuery(t.toLowerCase()+` `),n.refresh(),n.inputRef.current.focus()}},t))],[]))),n.getMissingResultsUrl&&B.createElement(`p`,{className:`DocSearch-Help`},`${a} `,B.createElement(`a`,{href:n.getMissingResultsUrl({query:n.state.query}),target:`_blank`,rel:`noopener noreferrer`},o)))}function Wm(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`}function Gm({item:e,resultBadgeKey:t,translations:n={}}){if(!t)return null;let r=Dp(e,t);if(r==null)return null;let{resultBadgeLabelText:i=`Category`}=n,a=null;if(Wm(r))a=String(r).trim();else if(Array.isArray(r)){let e=r.filter(Wm).map(e=>String(e).trim());a=e.length>0?e.join(`, `):null}return a===null||a.length===0?null:B.createElement(`div`,{className:`DocSearch-Hit-badge`},B.createElement(`span`,{className:`DocSearch-VisuallyHiddenForAccessibility`},`${i}: ${a}`),B.createElement(`span`,{"aria-hidden":`true`},a))}let Km=[`translations`,`resultBadgeKey`];function qm(e){let{translations:t={},resultBadgeKey:n}=e,r=pn(e,Km),i=B.useCallback(()=>B.createElement(`div`,{className:`DocSearch-Hit-action`},B.createElement(Lp,null)),[]),a=B.useCallback(({item:e})=>B.createElement(Gm,{item:e,resultBadgeKey:n,translations:{resultBadgeLabelText:t.resultBadgeLabelText}}),[n,t.resultBadgeLabelText]);return B.createElement(`div`,{className:`DocSearch-Dropdown-Container`},r.state.collections.map(e=>{if(e.items.length===0)return null;let n=Fp(e.items[0]);return B.createElement(Fm,_(_({},r),{},{key:e.source.sourceId,translations:t,title:n,collection:e,renderIcon:({item:t,index:n})=>{var r;return B.createElement(B.Fragment,null,t.__docsearch_parent&&B.createElement(`svg`,{className:`DocSearch-Hit-Tree`,viewBox:`0 0 24 54`},B.createElement(`g`,{stroke:`currentColor`,fill:`none`,fillRule:`evenodd`,strokeLinecap:`round`,strokeLinejoin:`round`},t.__docsearch_parent===((r=e.items[n+1])==null?void 0:r.__docsearch_parent)?B.createElement(`path`,{d:`M8 6v42M20 27H8.3`}):B.createElement(`path`,{d:`M8 6v21M20 27H8.3`}))),B.createElement(`div`,{className:`DocSearch-Hit-icon`},B.createElement(Nr,{type:t.type})))},renderAction:i,renderResultBadge:a}))}),r.resultsFooterComponent&&B.createElement(`section`,{className:`DocSearch-HitsFooter`},B.createElement(r.resultsFooterComponent,{state:r.state})))}function Jm(e,t){let n=Object.entries(t),r=new Set(n.map(([e])=>e)),i=[];for(let[e,t]of n)t!==``&&i.push(`${e}:${t}`);if(r.size===0)return e;let a=[];return e&&Array.isArray(e)?a=e:e&&(a=[e]),[...a.filter(e=>{if(typeof e!=`string`)return!0;let t=e.indexOf(`:`),n=e.slice(0,t);return t<=0||!r.has(n)}),...i]}function Ym({recentSearches:e,favoriteSearches:t,saveRecentSearch:n,onClose:r,disableUserPersonalization:i}){return i?[]:[{sourceId:bp.favoriteSearches,onSelect({item:e,event:t}){n(e),Ap(t)||r()},getItemUrl({item:e}){return e.url},getItems(){return t.getAll()}},{sourceId:bp.recentSearches,onSelect({item:e,event:t}){n(e),Ap(t)||r()},getItemUrl({item:e}){return e.url},getItems(){return e.getAll()}}]}async function Xm({query:e,state:t,setContext:n,setStatus:r,searchClient:i,indexes:a,insights:o,appId:s,apiKey:c,maxResultsPerGroup:l,transformItems:u=kp,saveRecentSearch:d,onClose:f,facetSelections:p}){let m=o;try{let{results:r}=await i.search({requests:a.map(t=>{var n,r,i,a,o,s,c;let l=t.name,u=t.searchParameters,d=Jm(u==null?void 0:u.facetFilters,p.current);return _(_({query:e,indexName:l,attributesToRetrieve:(n=u==null?void 0:u.attributesToRetrieve)==null?[`hierarchy.lvl0`,`hierarchy.lvl1`,`hierarchy.lvl2`,`hierarchy.lvl3`,`hierarchy.lvl4`,`hierarchy.lvl5`,`hierarchy.lvl6`,`content`,`type`,`url`]:n,attributesToSnippet:(r=u==null?void 0:u.attributesToSnippet)==null?[`hierarchy.lvl1:15`,`hierarchy.lvl2:15`,`hierarchy.lvl3:15`,`hierarchy.lvl4:15`,`hierarchy.lvl5:15`,`hierarchy.lvl6:15`,`content:15`]:r,snippetEllipsisText:(i=u==null?void 0:u.snippetEllipsisText)==null?`…`:i,highlightPreTag:(a=u==null?void 0:u.highlightPreTag)==null?`<mark>`:a,highlightPostTag:(o=u==null?void 0:u.highlightPostTag)==null?`</mark>`:o,hitsPerPage:(s=u==null?void 0:u.hitsPerPage)==null?20:s,clickAnalytics:(c=u==null?void 0:u.clickAnalytics)==null?m:c},u),d?{facetFilters:d}:{})})});return r.flatMap(e=>{let r=e,{hits:i,nbHits:a}=r,o=Op(u(i),e=>Fp(e),l);if(t.context.searchSuggestions.length<Object.keys(o).length){var p;n({searchSuggestions:_(_({},(p=t.context.searchSuggestions)==null?[]:p),Object.keys(o))})}if(a){let e=t.context.nbHits;n({nbHits:(e==null?0:e)+a})}let h={};return m&&(h={__autocomplete_indexName:r.index,__autocomplete_queryID:r.queryID,__autocomplete_algoliaCredentials:{appId:s,apiKey:c}}),Object.values(o).map((e,t)=>({sourceId:`hits_${r.index}_${t}`,onSelect({item:e,event:t}){d(e),Ap(t)||f()},getItemUrl({item:e}){return e.url},getItems(){return Object.values(Op(e,e=>e.hierarchy.lvl1,l)).map(e=>e.map(t=>{let n=null,r=e.find(e=>e.type===`lvl1`&&e.hierarchy.lvl1===t.hierarchy.lvl1);return t.type!==`lvl1`&&r&&(n=r),_(_({},t),{},{__docsearch_parent:n},h)})).flat()}}))})}catch(e){throw e.name===`RetryError`&&r(`error`),e}}function Zm({indices:e}){if(!Array.isArray(e)||e.length<1)throw Error("Must supply at least one `indices` entry for DocSearch");return e.map(e=>typeof e==`string`?{name:e}:e)}V();let Qm=me(void 0);function $m(e){let t=Re(Qm);if(t===void 0&&!e)throw Error(Jr(47));return t}V();function eh(){return U(U({},md()),{},{disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1})}let th=U(U({},xd),{},{disabled:G(e=>e.disabled),instantType:G(e=>e.instantType),openMethod:G(e=>e.openMethod),openChangeReason:G(e=>e.openChangeReason),modal:G(e=>e.modal),focusManagerModal:G(e=>e.focusManagerModal),stickIfOpen:G(e=>e.stickIfOpen),titleElementId:G(e=>e.titleElementId),descriptionElementId:G(e=>e.descriptionElementId),openOnHover:G(e=>e.openOnHover),closeDelay:G(e=>e.closeDelay),hasViewport:G(e=>e.hasViewport)});var nh=class e extends Yu{constructor(e,t,n=!1){let r=U(U({},eh()),e),i=new fd;r.open&&(e==null?void 0:e.mounted)===void 0&&(r.mounted=!0),r.floatingRootContext=hd(i,t,n),super(r,{popupRef:T(),backdropRef:T(),internalBackdropRef:T(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:T(),beforeContentFocusGuardRef:T(),stickIfOpenTimeout:new Bo,triggerElements:i},th),H(this,`setOpen`,(e,t)=>{var n,r;let i=t.reason===ta,a=t.reason===`trigger-press`&&t.event.detail===0,o=!e&&(t.reason===`escape-key`||t.reason==null),s=ad(t),c=this.select(`activeTriggerId`);if(!e&&t.reason===`close-press`&&t.trigger==null&&c!=null){var l,u;t.trigger=(l=(u=this.context.triggerElements.getById(c))==null?this.select(`activeTriggerElement`):u)==null?void 0:l}if((n=(r=this.context).onOpenChange)==null||n.call(r,e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let d=()=>{let n={open:e,openChangeReason:t.reason};id(n,e,t.trigger,s()),this.update(n)};i?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),cn(d)):d(),a||o?this.set(`instantType`,a?`click`:`dismiss`):t.reason===`focus-out`?this.set(`instantType`,`focus`):this.set(`instantType`,void 0)}),H(this,`disposeEffect`,()=>this.context.stickIfOpenTimeout.disposeEffect())}static useStore(t,n){let{store:r,internalStore:i}=nd(t,(t,r)=>new e(n,t,r));return Pe(()=>i==null?void 0:i.disposeEffect(),[i]),r}};V();function rh({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=nh.useStore(s==null?void 0:s.store,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});od(u,n,r,l),u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`mounted`),p=u.useState(`payload`),m=nl()!=null;u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a),dd(u,d),cd(u);let{forceUnmount:h}=ld(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});u.useSyncedValues({modal:o,nested:m}),Pe(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]);let g=Le(()=>{u.setOpen(!1,wo(sa))},[u]);Ie(e.actionsRef,()=>({unmount:h,close:g}),[h,g]);let _=d||f,v=z(()=>({store:u}),[u]);return Eo(Qm.Provider,{value:v,children:[_&&Eo(ah,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})}function ih(e){return $m(!0)?Eo(rh,{props:e}):Eo(ol,{children:Eo(rh,{props:e})})}function ah({store:e,modal:t}){var n,r;let i=vl(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}});return ud(e,{activeTriggerProps:(n=i.reference)==null?pi:n,inactiveTriggerProps:(r=i.trigger)==null?pi:r,popupProps:z(()=>vi(ed,i.floating),[i.floating])}),null}V();let oh=[`render`,`className`,`style`,`disabled`,`nativeButton`,`handle`,`payload`,`openOnHover`,`delay`,`closeDelay`,`id`],sh=yt(function(e,t){var n;let{render:r,className:i,style:a,disabled:o=!1,nativeButton:s=!0,handle:c,payload:l,openOnHover:u=!1,delay:d=300,closeDelay:f=0,id:p}=e,m=vr(e,oh),h=$m(!0),g=(n=c==null?void 0:c.store)==null?h==null?void 0:h.store:n;if(!g)throw Error(Jr(74));let _=xo(p),v=g.useState(`isTriggerActive`,_),y=g.useState(`floatingRootContext`),b=g.useState(`isOpenedByTrigger`,_),x=g.useState(`triggerPopupId`,_),S=R(null),{registerTrigger:C,isMountedByThisTrigger:w}=sd(_,S,g,{payload:l,disabled:o,openOnHover:u,closeDelay:f}),T=g.useState(`openChangeReason`),D=g.useState(`stickIfOpen`),O=g.useState(`openMethod`),k=g.useState(`focusManagerModal`),A=Nd(y,{enabled:!o&&y!=null&&u&&(O!==`touch`||T!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:Kd(),restMs:d,delay:{close:f},triggerElementRef:S,isActiveTrigger:v,isClosing:()=>g.select(`transitionStatus`)===`ending`}),j=hl(y,{enabled:y!=null,stickIfOpen:D}),M=ep(()=>g.select(`open`),e=>{g.set(`openMethod`,e)}),N=g.useState(`triggerProps`,w),{getButtonProps:P,buttonRef:ee}=Wa({disabled:o,native:s}),te={open(e){return e&&T===`trigger-press`?Xi.open(e):Yi.open(e)}},{preFocusGuardRef:F,handlePreFocusGuardFocus:ne,handleFocusTargetFocus:re}=pp(g,S),ie=Mi(`button`,e,{state:{disabled:o,open:b},ref:[ee,t,C,S],props:[j.reference,A,N,M,{"data-base-ui-click-trigger":``,id:_,"aria-haspopup":`dialog`,"aria-expanded":b,"aria-controls":x},m,P],stateAttributesMapping:te});return w&&!k?Eo(E,{children:[Eo(ys,{ref:F,onFocus:ne}),Eo(E,{children:ie},_),Eo(ys,{ref:g.context.triggerFocusTargetRef,onFocus:re})]}):Eo(E,{children:ie},_)});V();let ch=me(void 0);function lh(){let e=Re(ch);if(e===void 0)throw Error(Jr(45));return e}V();let uh=[`keepMounted`],dh=yt(function(e,t){let{keepMounted:n=!1}=e,r=vr(e,uh),{store:i}=$m();return i.useState(`mounted`)||n?Eo(ch.Provider,{value:n,children:Eo(Zc,U({ref:t},r))}):null});V();let fh=me(void 0);function ph(){let e=Re(fh);if(!e)throw Error(Jr(46));return e}V();let mh=[`render`,`className`,`style`,`anchor`,`positionMethod`,`side`,`align`,`sideOffset`,`alignOffset`,`collisionBoundary`,`collisionPadding`,`arrowPadding`,`sticky`,`disableAnchorTracking`,`collisionAvoidance`],hh=yt(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o=`absolute`,side:s=`bottom`,align:c=`center`,sideOffset:l=0,alignOffset:u=0,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f=5,arrowPadding:p=5,sticky:m=!1,disableAnchorTracking:h=!1,collisionAvoidance:g=Wc}=e,_=vr(e,mh),{store:v}=$m(),y=lh(),b=il(),x=v.useState(`floatingRootContext`),S=v.useState(`mounted`),C=v.useState(`open`),w=v.useState(`openChangeReason`),T=v.useState(`activeTriggerElement`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`positionerElement`),k=v.useState(`instantType`),A=v.useState(`transitionStatus`),j=v.useState(`hasViewport`),M=R(null),N=Po(O,!1,!1),P=yf({anchor:a,floatingRootContext:x,positionMethod:o,mounted:S,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:y,nodeId:b,collisionAvoidance:g,adaptiveOrigin:j?gf:void 0}),ee=x.useState(`domReferenceElement`);W(()=>{let e=ee,t=M.current;if(e&&(M.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return N(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[ee,N,v]),Lf(C&&E===!0&&w!==`trigger-hover`,D===`touch`,O,T);let te=Le(e=>{v.set(`positionerElement`,e)},[v]),F=Df(e,{open:C,side:P.side,align:P.align,anchorHidden:P.anchorHidden,instant:k},{styles:P.positionerStyles,transitionStatus:A,props:_,refs:[t,te],hidden:!S,inert:!C});return Eo(fh.Provider,{value:P,children:[S&&E===!0&&w!==`trigger-hover`&&Eo(Ef,{ref:v.context.internalBackdropRef,inert:cf(!C),cutout:T}),Eo(al,{id:b,children:F})]})});V();let gh=me(void 0);function _h(){let[e,t]=Me(0),n=La(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:z(()=>({register:n}),[n]),hasClosePart:e>0}}function vh(e){let{value:t,children:n}=e;return Eo(gh.Provider,{value:t,children:n})}function yh(){let e=Re(gh);W(()=>e==null?void 0:e.register(),[e])}V();let bh=[`render`,`className`,`style`,`initialFocus`,`finalFocus`],xh=U(U({},Zi),Vi),Sh=yt(function(e,t){var n;let{render:r,className:i,style:a,initialFocus:o,finalFocus:s}=e,c=vr(e,bh),{store:l}=$m(),u=ph(),d=Jd(!0)!=null,{context:f,hasClosePart:p}=_h(),m=l.useState(`open`),h=l.useState(`openMethod`),g=l.useState(`instantType`),_=l.useState(`transitionStatus`),v=l.useState(`popupProps`),y=l.useState(`titleElementId`),b=l.useState(`descriptionElementId`),x=l.useState(`modal`),S=l.useState(`mounted`),C=l.useState(`openChangeReason`),w=l.useState(`activeTriggerElement`),T=l.useState(`floatingRootContext`),E=T.useState(`floatingId`),D=l.useState(`disabled`),O=l.useState(`openOnHover`),k=l.useState(`closeDelay`),A=(n=c.id)==null?E:n;Fo({open:m,ref:l.context.popupRef,onComplete(){if(m){var e,t;(e=(t=l.context).onOpenChangeComplete)==null||e.call(t,!0)}}}),jd(T,{enabled:O&&!D,closeDelay:k});let j=o===void 0?td(l.context.popupRef):o,M=x!==!1&&p;l.useSyncedValue(`focusManagerModal`,M);let N=Le(e=>{l.set(`popupElement`,e)},[l]),P=Mi(`div`,e,{state:{open:m,side:u.side,align:u.align,instant:g,transitionStatus:_},ref:[t,l.context.popupRef,N],props:[v,U(U({id:A,role:`dialog`},ed),{},{"aria-labelledby":y,"aria-describedby":b,onKeyDown(e){d&&Qd.has(e.key)&&e.stopPropagation()}}),$d(_),c],stateAttributesMapping:xh});return Eo(ml,{context:T,openInteractionType:h,modal:M,disabled:!S||C===`trigger-hover`,initialFocus:j,returnFocus:s,restoreFocus:`popup`,previousFocusableElement:ha(w)?w:void 0,nextFocusableElement:l.context.triggerFocusTargetRef,beforeContentFocusGuardRef:l.context.beforeContentFocusGuardRef,children:Eo(vh,{value:f,children:P})})});V();let Ch=[`render`,`className`,`style`],wh=yt(function(e,t){let{render:n,className:r,style:i}=e,a=vr(e,Ch),{store:o}=$m(),s=o.useState(`open`),{arrowRef:c,side:l,align:u,arrowUncentered:d,arrowStyles:f}=ph();return Mi(`div`,e,{state:{open:s,side:l,align:u,uncentered:d},ref:[t,c],props:[{style:f,"aria-hidden":!0},a],stateAttributesMapping:Zi})});V();let Th=[`render`,`className`,`style`],Eh=yt(function(e,t){let{render:n,className:r,style:i}=e,a=vr(e,Th),{store:o}=$m(),s=xo(a.id);return o.useSyncedValueWithCleanup(`titleElementId`,s),Mi(`h2`,e,{ref:t,props:[{id:s},a]})});V();let Dh=[`render`,`className`,`style`,`disabled`,`nativeButton`],Oh=yt(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0}=e,s=vr(e,Dh),{buttonRef:c,getButtonProps:l}=Wa({disabled:a,focusableWhenDisabled:!1,native:o}),{store:u}=$m();return yh(),Mi(`button`,e,{ref:[t,c],props:[{onClick(e){u.setOpen(!1,wo(`close-press`,e.nativeEvent))}},s,l]})});var kh=`vercel.ai.error`,Ah=Symbol.for(kh),jh,Mh,Nh=class e extends (Mh=Error,jh=Ah,Mh){constructor({name:e,message:t,cause:n}){super(t),this[jh]=!0,this.name=e,this.cause=n}static isInstance(t){return e.hasMarker(t,kh)}static hasMarker(e,t){let n=Symbol.for(t);return typeof e==`object`&&!!e&&n in e&&typeof e[n]==`boolean`&&e[n]===!0}};function Ph(e){return e==null?`unknown error`:typeof e==`string`?e:e instanceof Error?e.message:JSON.stringify(e)}var Fh=`AI_InvalidArgumentError`,Ih=`vercel.ai.error.${Fh}`,Lh=Symbol.for(Ih),Rh,zh,Bh=class extends (zh=Nh,Rh=Lh,zh){constructor({message:e,cause:t,argument:n}){super({name:Fh,message:e,cause:t}),this[Rh]=!0,this.argument=n}static isInstance(e){return Nh.hasMarker(e,Ih)}},Vh=`AI_JSONParseError`,Hh=`vercel.ai.error.${Vh}`,Uh=Symbol.for(Hh),Wh,Gh,Kh=class extends (Gh=Nh,Wh=Uh,Gh){constructor({text:e,cause:t}){super({name:Vh,message:`JSON parsing failed: Text: ${e}.
27
+ Error message: ${Ph(t)}`,cause:t}),this[Wh]=!0,this.text=e}static isInstance(e){return Nh.hasMarker(e,Hh)}},qh=`AI_TypeValidationError`,Jh=`vercel.ai.error.${qh}`,Yh=Symbol.for(Jh),Xh,Zh,Qh=class e extends (Zh=Nh,Xh=Yh,Zh){constructor({value:e,cause:t}){super({name:qh,message:`Type validation failed: Value: ${JSON.stringify(e)}.
28
+ Error message: ${Ph(t)}`,cause:t}),this[Xh]=!0,this.value=e}static isInstance(e){return Nh.hasMarker(e,Jh)}static wrap({value:t,cause:n}){return e.isInstance(n)&&n.value===t?n:new e({value:t,cause:n})}},$h=class extends Error{constructor(e,t){super(e),this.name=`ParseError`,this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}};function eg(e){}function tg(e){if(typeof e==`function`)throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");let{onEvent:t=eg,onError:n=eg,onRetry:r=eg,onComment:i,maxBufferSize:a}=e,o=[],s=0,c=!0,l,u=``,d=0,f,p=!1;function m(e){if(p)throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(c&&(c=!1,e.charCodeAt(0)===239&&e.charCodeAt(1)===187&&e.charCodeAt(2)===191&&(e=e.slice(3))),o.length===0){let t=g(e);t!==``&&(o.push(t),s=t.length),h();return}if(e.indexOf(`
29
+ `)===-1&&e.indexOf(`\r`)===-1){o.push(e),s+=e.length,h();return}o.push(e);let t=o.join(``);o.length=0,s=0;let n=g(t);n!==``&&(o.push(n),s=n.length),h()}function h(){a!==void 0&&(s+u.length<=a||(p=!0,o.length=0,s=0,l=void 0,u=``,d=0,f=void 0,n(new $h(`Buffered data exceeded max buffer size of ${a} characters`,{type:`max-buffer-size-exceeded`}))))}function g(e){let n=0;if(e.indexOf(`\r`)===-1){let r=e.indexOf(`
89
30
  `,n);for(;r!==-1;){if(n===r){d>0&&t({id:l,event:f,data:u}),l=void 0,u=``,d=0,f=void 0,n=r+1,r=e.indexOf(`
90
- `,n);continue}let i=e.charCodeAt(n);if(A_(e,n,i)){let i=e.charCodeAt(n+5)===32?n+6:n+5,a=e.slice(i,r);if(d===0&&e.charCodeAt(r+1)===10){t({id:l,event:f,data:a}),l=void 0,u=``,f=void 0,n=r+2,r=e.indexOf(`
31
+ `,n);continue}let i=e.charCodeAt(n);if(ng(e,n,i)){let i=e.charCodeAt(n+5)===32?n+6:n+5,a=e.slice(i,r);if(d===0&&e.charCodeAt(r+1)===10){t({id:l,event:f,data:a}),l=void 0,u=``,f=void 0,n=r+2,r=e.indexOf(`
91
32
  `,n);continue}u=d===0?a:`${u}
92
- ${a}`,d++}else j_(e,n,i)?f=e.slice(e.charCodeAt(n+6)===32?n+7:n+6,r)||void 0:_(e,n,r);n=r+1,r=e.indexOf(`
33
+ ${a}`,d++}else rg(e,n,i)?f=e.slice(e.charCodeAt(n+6)===32?n+7:n+6,r)||void 0:_(e,n,r);n=r+1,r=e.indexOf(`
93
34
  `,n)}return e.slice(n)}for(;n<e.length;){let t=e.indexOf(`\r`,n),r=e.indexOf(`
94
- `,n),i=-1;if(t!==-1&&r!==-1?i=t<r?t:r:t===-1?r!==-1&&(i=r):i=t===e.length-1?-1:t,i===-1)break;_(e,n,i),n=i+1,e.charCodeAt(n-1)===13&&e.charCodeAt(n)===10&&n++}return e.slice(n)}function _(e,t,n){if(t===n){y();return}let r=e.charCodeAt(t);if(A_(e,t,r)){let r=e.charCodeAt(t+5)===32?t+6:t+5,i=e.slice(r,n);u=d===0?i:`${u}
95
- ${i}`,d++;return}if(j_(e,t,r)){f=e.slice(e.charCodeAt(t+6)===32?t+7:t+6,n)||void 0;return}if(r===105&&e.charCodeAt(t+1)===100&&e.charCodeAt(t+2)===58){let r=e.slice(e.charCodeAt(t+3)===32?t+4:t+3,n);l=r.includes(`\0`)?void 0:r;return}if(r===58){if(i){let r=e.slice(t,n);i(r.slice(e.charCodeAt(t+1)===32?2:1))}return}let a=e.slice(t,n),o=a.indexOf(`:`);if(o===-1){v(a,``,a);return}let s=a.slice(0,o),c=a.charCodeAt(o+1)===32?2:1;v(s,a.slice(o+c),a)}function v(e,t,i){switch(e){case`event`:f=t||void 0;break;case`data`:u=d===0?t:`${u}
96
- ${t}`,d++;break;case`id`:l=t.includes(`\0`)?void 0:t;break;case`retry`:/^\d+$/.test(t)?r(parseInt(t,10)):n(new D_(`Invalid \`retry\` value: "${t}"`,{type:`invalid-retry`,value:t,line:i}));break;default:n(new D_(`Unknown field "${e.length>20?`${e.slice(0,20)}\u2026`:e}"`,{type:`unknown-field`,field:e,value:t,line:i}));break}}function y(){d>0&&t({id:l,event:f,data:u}),l=void 0,u=``,d=0,f=void 0}function b(e={}){if(e.consume&&o.length>0){let e=o.join(``);_(e,0,e.length)}c=!0,l=void 0,u=``,d=0,f=void 0,o.length=0,s=0,p=!1}return{feed:m,reset:b}}function A_(e,t,n){return n===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function j_(e,t,n){return n===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}var M_=class extends TransformStream{constructor({onError:e,onRetry:t,onComment:n,maxBufferSize:r}={}){let i;super({start(a){i=k_({onEvent:e=>{a.enqueue(e)},onError(t){typeof e==`function`&&e(t),(e===`terminate`||t.type===`max-buffer-size-exceeded`)&&a.error(t)},onRetry:t,onComment:n,maxBufferSize:r})},transform(e){i.feed(e)}})}},N_;function K(e,t,n){var r;function i(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:s,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=s.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let a=(r=n==null?void 0:n.Parent)==null?Object:r;class o extends a{}Object.defineProperty(o,"name",{value:e});function s(e){var t;let r=n!=null&&n.Parent?new o:this;i(r,e),(t=r._zod).deferred!=null||(t.deferred=[]);for(let e of r._zod.deferred)e();return r}return Object.defineProperty(s,"init",{value:i}),Object.defineProperty(s,Symbol.hasInstance,{value:t=>{var r;return n!=null&&n.Parent&&t instanceof n.Parent?!0:t==null||(r=t._zod)==null||(r=r.traits)==null?void 0:r.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}var P_=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},F_=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(N_=globalThis).__zod_globalConfig!=null||(N_.__zod_globalConfig={});let I_=globalThis.__zod_globalConfig;function L_(e){return e&&Object.assign(I_,e),I_}let R_=[`inst`,`continue`,`input`];function z_(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function B_(e,t){return typeof t==`bigint`?t.toString():t}function V_(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function H_(e){return e==null}function U_(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function W_(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}let G_=Symbol(`evaluating`);function K_(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==G_)return r===void 0&&(r=G_,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function q_(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function J_(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Y_(e){return JSON.stringify(e)}function X_(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}let Z_=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Q_(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}let $_=V_(()=>{var e;if(I_.jitless||typeof navigator<`u`&&!((e=navigator)==null||(e=e.userAgent)==null)&&e.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch(e){return!1}});function ev(e){if(Q_(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(Q_(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function tv(e){return ev(e)?U({},e):Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}let nv=new Set([`string`,`number`,`symbol`]);function rv(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function iv(e,t,n){let r=new e._zod.constr(t==null?e._zod.def:t);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function q(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?U(U({},t),{},{error:()=>t.error}):t}function av(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}let ov={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function sv(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return iv(e,J_(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return q_(this,`shape`,e),e},checks:[]}))}function cv(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return iv(e,J_(e._zod.def,{get shape(){let r=U({},e._zod.def.shape);for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return q_(this,`shape`,r),r},checks:[]}))}function lv(e,t){if(!ev(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return iv(e,J_(e._zod.def,{get shape(){let n=U(U({},e._zod.def.shape),t);return q_(this,`shape`,n),n}}))}function uv(e,t){if(!ev(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return iv(e,J_(e._zod.def,{get shape(){let n=U(U({},e._zod.def.shape),t);return q_(this,`shape`,n),n}}))}function dv(e,t){var n,r;if((n=e._zod.def.checks)!=null&&n.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return iv(e,J_(e._zod.def,{get shape(){let n=U(U({},e._zod.def.shape),t._zod.def.shape);return q_(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:(r=t._zod.def.checks)==null?[]:r}))}function fv(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return iv(t,J_(t._zod.def,{get shape(){let r=t._zod.def.shape,i=U({},r);if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return q_(this,`shape`,i),i},checks:[]}))}function pv(e,t,n){return iv(t,J_(t._zod.def,{get shape(){let r=t._zod.def.shape,i=U({},r);if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return q_(this,`shape`,i),i}}))}function mv(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++){var n;if(((n=e.issues[r])==null?void 0:n.continue)!==!0)return!0}return!1}function hv(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++){var n;if(((n=e.issues[r])==null?void 0:n.continue)===!1)return!0}return!1}function gv(e,t){return t.map(t=>{var n;return(n=t).path!=null||(n.path=[]),t.path.unshift(e),t})}function _v(e){return typeof e==`string`?e:e==null?void 0:e.message}function vv(e,t,n){var r,i,a,o,s,c,l,u,d;let f=e.message?e.message:(r=(i=(a=(o=_v((s=e.inst)==null||(s=s._zod.def)==null||(c=s.error)==null?void 0:c.call(s,e)))==null?_v(t==null||(l=t.error)==null?void 0:l.call(t,e)):o)==null?_v((u=n.customError)==null?void 0:u.call(n,e)):a)==null?_v((d=n.localeError)==null?void 0:d.call(n,e)):i)==null?`Invalid input`:r,{inst:p,continue:m,input:h}=e,g=vr(e,R_);return g.path!=null||(g.path=[]),g.message=f,t!=null&&t.reportInput&&(g.input=h),g}function yv(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function bv(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:U({},t)}let xv=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,B_,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Sv=K(`$ZodError`,xv),Cv=K(`$ZodError`,xv,{Parent:Error});function wv(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Tv(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}let Ev=e=>(t,n,r,i)=>{let a=r?U(U({},r),{},{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new P_;if(o.issues.length){var s;let t=new((s=i==null?void 0:i.Err)==null?e:s)(o.issues.map(e=>vv(e,a,L_())));throw Z_(t,i==null?void 0:i.callee),t}return o.value},Dv=e=>async(t,n,r,i)=>{let a=r?U(U({},r),{},{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){var s;let t=new((s=i==null?void 0:i.Err)==null?e:s)(o.issues.map(e=>vv(e,a,L_())));throw Z_(t,i==null?void 0:i.callee),t}return o.value},Ov=e=>(t,n,r)=>{let i=r?U(U({},r),{},{async:!1}):{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new P_;return a.issues.length?{success:!1,error:new(e==null?Sv:e)(a.issues.map(e=>vv(e,i,L_())))}:{success:!0,data:a.value}},kv=Ov(Cv),Av=e=>async(t,n,r)=>{let i=r?U(U({},r),{},{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>vv(e,i,L_())))}:{success:!0,data:a.value}},jv=Av(Cv),Mv=e=>(t,n,r)=>{let i=r?U(U({},r),{},{direction:`backward`}):{direction:`backward`};return Ev(e)(t,n,i)},Nv=e=>(t,n,r)=>Ev(e)(t,n,r),Pv=e=>async(t,n,r)=>{let i=r?U(U({},r),{},{direction:`backward`}):{direction:`backward`};return Dv(e)(t,n,i)},Fv=e=>async(t,n,r)=>Dv(e)(t,n,r),Iv=e=>(t,n,r)=>{let i=r?U(U({},r),{},{direction:`backward`}):{direction:`backward`};return Ov(e)(t,n,i)},Lv=e=>(t,n,r)=>Ov(e)(t,n,r),Rv=e=>async(t,n,r)=>{let i=r?U(U({},r),{},{direction:`backward`}):{direction:`backward`};return Av(e)(t,n,i)},zv=e=>async(t,n,r)=>Av(e)(t,n,r),Bv=/^[cC][0-9a-z]{6,}$/,Vv=/^[0-9a-z]+$/,Hv=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Uv=/^[0-9a-vA-V]{20}$/,Wv=/^[A-Za-z0-9]{27}$/,Gv=/^[a-zA-Z0-9_-]{21}$/,Kv=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,qv=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Jv=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Yv=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function Xv(){return RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)}let Zv=/^(?:(?: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])$/,Qv=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,$v=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,ey=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ty=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ny=/^[A-Za-z0-9_-]*$/,ry=/^https?$/,iy=/^\+[1-9]\d{6,14}$/,ay=`(?:(?:\\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])))`,oy=RegExp(`^${ay}$`);function sy(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function cy(e){return RegExp(`^${sy(e)}$`)}function ly(e){let t=sy({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${ay}T(?:${r})$`)}let uy=e=>{var t,n;let r=e?`[\\s\\S]{${(t=e==null?void 0:e.minimum)==null?0:t},${(n=e==null?void 0:e.maximum)==null?``:n}}`:`[\\s\\S]*`;return RegExp(`^${r}$`)},dy=/^-?\d+$/,fy=/^-?\d+(?:\.\d+)?$/,py=/^(?:true|false)$/i,my=/^null$/i,hy=/^[^A-Z]*$/,gy=/^[^a-z]*$/,_y=K(`$ZodCheck`,(e,t)=>{var n;e._zod!=null||(e._zod={}),e._zod.def=t,(n=e._zod).onattach!=null||(n.onattach=[])}),vy={number:`number`,bigint:`bigint`,object:`date`},yy=K(`$ZodCheckLessThan`,(e,t)=>{_y.init(e,t);let n=vy[typeof t.value];e._zod.onattach.push(e=>{var n;let r=e._zod.bag,i=(n=t.inclusive?r.maximum:r.exclusiveMaximum)==null?1/0:n;t.value<i&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),by=K(`$ZodCheckGreaterThan`,(e,t)=>{_y.init(e,t);let n=vy[typeof t.value];e._zod.onattach.push(e=>{var n;let r=e._zod.bag,i=(n=t.inclusive?r.minimum:r.exclusiveMinimum)==null?-1/0:n;t.value>i&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),xy=K(`$ZodCheckMultipleOf`,(e,t)=>{_y.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf!=null||(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):W_(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Sy=K(`$ZodCheckNumberFormat`,(e,t)=>{var n;_y.init(e,t),t.format=t.format||`float64`;let r=(n=t.format)==null?void 0:n.includes(`int`),i=r?`int`:`number`,[a,o]=ov[t.format];e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,n.minimum=a,n.maximum=o,r&&(n.pattern=dy)}),e._zod.check=n=>{let s=n.value;if(r){if(!Number.isInteger(s)){n.issues.push({expected:i,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?n.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:i,inclusive:!0,continue:!t.abort}):n.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:i,inclusive:!0,continue:!t.abort});return}}s<a&&n.issues.push({origin:`number`,input:s,code:`too_small`,minimum:a,inclusive:!0,inst:e,continue:!t.abort}),s>o&&n.issues.push({origin:`number`,input:s,code:`too_big`,maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),Cy=K(`$ZodCheckMaxLength`,(e,t)=>{var n;_y.init(e,t),(n=e._zod.def).when!=null||(n.when=e=>{let t=e.value;return!H_(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{var n;let r=(n=e._zod.bag.maximum)==null?1/0:n;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=yv(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),wy=K(`$ZodCheckMinLength`,(e,t)=>{var n;_y.init(e,t),(n=e._zod.def).when!=null||(n.when=e=>{let t=e.value;return!H_(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{var n;let r=(n=e._zod.bag.minimum)==null?-1/0:n;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=yv(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ty=K(`$ZodCheckLengthEquals`,(e,t)=>{var n;_y.init(e,t),(n=e._zod.def).when!=null||(n.when=e=>{let t=e.value;return!H_(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=yv(r),o=i>t.length;n.issues.push(U(U({origin:a},o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length}),{},{inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort}))}}),Ey=K(`$ZodCheckStringFormat`,(e,t)=>{var n,r;_y.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns!=null||(n.patterns=new Set),n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check!=null||(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push(U(U({origin:`string`,code:`invalid_format`,format:t.format,input:n.value},t.pattern?{pattern:t.pattern.toString()}:{}),{},{inst:e,continue:!t.abort}))}):(r=e._zod).check!=null||(r.check=()=>{})}),Dy=K(`$ZodCheckRegex`,(e,t)=>{Ey.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Oy=K(`$ZodCheckLowerCase`,(e,t)=>{t.pattern!=null||(t.pattern=hy),Ey.init(e,t)}),ky=K(`$ZodCheckUpperCase`,(e,t)=>{t.pattern!=null||(t.pattern=gy),Ey.init(e,t)}),Ay=K(`$ZodCheckIncludes`,(e,t)=>{_y.init(e,t);let n=rv(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns!=null||(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),jy=K(`$ZodCheckStartsWith`,(e,t)=>{_y.init(e,t);let n=RegExp(`^${rv(t.prefix)}.*`);t.pattern!=null||(t.pattern=n),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns!=null||(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),My=K(`$ZodCheckEndsWith`,(e,t)=>{_y.init(e,t);let n=RegExp(`.*${rv(t.suffix)}$`);t.pattern!=null||(t.pattern=n),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns!=null||(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Ny=K(`$ZodCheckOverwrite`,(e,t)=>{_y.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var Py=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
35
+ `,n),i=-1;if(t!==-1&&r!==-1?i=t<r?t:r:t===-1?r!==-1&&(i=r):i=t===e.length-1?-1:t,i===-1)break;_(e,n,i),n=i+1,e.charCodeAt(n-1)===13&&e.charCodeAt(n)===10&&n++}return e.slice(n)}function _(e,t,n){if(t===n){y();return}let r=e.charCodeAt(t);if(ng(e,t,r)){let r=e.charCodeAt(t+5)===32?t+6:t+5,i=e.slice(r,n);u=d===0?i:`${u}
36
+ ${i}`,d++;return}if(rg(e,t,r)){f=e.slice(e.charCodeAt(t+6)===32?t+7:t+6,n)||void 0;return}if(r===105&&e.charCodeAt(t+1)===100&&e.charCodeAt(t+2)===58){let r=e.slice(e.charCodeAt(t+3)===32?t+4:t+3,n);l=r.includes(`\0`)?void 0:r;return}if(r===58){if(i){let r=e.slice(t,n);i(r.slice(e.charCodeAt(t+1)===32?2:1))}return}let a=e.slice(t,n),o=a.indexOf(`:`);if(o===-1){v(a,``,a);return}let s=a.slice(0,o),c=a.charCodeAt(o+1)===32?2:1;v(s,a.slice(o+c),a)}function v(e,t,i){switch(e){case`event`:f=t||void 0;break;case`data`:u=d===0?t:`${u}
37
+ ${t}`,d++;break;case`id`:l=t.includes(`\0`)?void 0:t;break;case`retry`:/^\d+$/.test(t)?r(parseInt(t,10)):n(new $h(`Invalid \`retry\` value: "${t}"`,{type:`invalid-retry`,value:t,line:i}));break;default:n(new $h(`Unknown field "${e.length>20?`${e.slice(0,20)}\u2026`:e}"`,{type:`unknown-field`,field:e,value:t,line:i}));break}}function y(){d>0&&t({id:l,event:f,data:u}),l=void 0,u=``,d=0,f=void 0}function b(e={}){if(e.consume&&o.length>0){let e=o.join(``);_(e,0,e.length)}c=!0,l=void 0,u=``,d=0,f=void 0,o.length=0,s=0,p=!1}return{feed:m,reset:b}}function ng(e,t,n){return n===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function rg(e,t,n){return n===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}var ig=class extends TransformStream{constructor({onError:e,onRetry:t,onComment:n,maxBufferSize:r}={}){let i;super({start(a){i=tg({onEvent:e=>{a.enqueue(e)},onError(t){typeof e==`function`&&e(t),(e===`terminate`||t.type===`max-buffer-size-exceeded`)&&a.error(t)},onRetry:t,onComment:n,maxBufferSize:r})},transform(e){i.feed(e)}})}},ag;function K(e,t,n){var r;function i(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:s,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=s.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let a=(r=n==null?void 0:n.Parent)==null?Object:r;class o extends a{}Object.defineProperty(o,"name",{value:e});function s(e){var t;let r=n!=null&&n.Parent?new o:this;i(r,e),(t=r._zod).deferred!=null||(t.deferred=[]);for(let e of r._zod.deferred)e();return r}return Object.defineProperty(s,"init",{value:i}),Object.defineProperty(s,Symbol.hasInstance,{value:t=>{var r;return n!=null&&n.Parent&&t instanceof n.Parent?!0:t==null||(r=t._zod)==null||(r=r.traits)==null?void 0:r.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}var og=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},sg=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(ag=globalThis).__zod_globalConfig!=null||(ag.__zod_globalConfig={});let cg=globalThis.__zod_globalConfig;function lg(e){return e&&Object.assign(cg,e),cg}let ug=[`inst`,`continue`,`input`];function dg(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function fg(e,t){return typeof t==`bigint`?t.toString():t}function pg(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function mg(e){return e==null}function hg(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function gg(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}let _g=Symbol(`evaluating`);function vg(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==_g)return r===void 0&&(r=_g,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function yg(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function bg(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function xg(e){return JSON.stringify(e)}function Sg(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}let Cg=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function wg(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}let Tg=pg(()=>{var e;if(cg.jitless||typeof navigator<`u`&&!((e=navigator)==null||(e=e.userAgent)==null)&&e.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch(e){return!1}});function Eg(e){if(wg(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(wg(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Dg(e){return Eg(e)?U({},e):Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}let Og=new Set([`string`,`number`,`symbol`]);function kg(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Ag(e,t,n){let r=new e._zod.constr(t==null?e._zod.def:t);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function q(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?U(U({},t),{},{error:()=>t.error}):t}function jg(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}let Mg={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Ng(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return Ag(e,bg(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return yg(this,`shape`,e),e},checks:[]}))}function Pg(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return Ag(e,bg(e._zod.def,{get shape(){let r=U({},e._zod.def.shape);for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return yg(this,`shape`,r),r},checks:[]}))}function Fg(e,t){if(!Eg(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Ag(e,bg(e._zod.def,{get shape(){let n=U(U({},e._zod.def.shape),t);return yg(this,`shape`,n),n}}))}function Ig(e,t){if(!Eg(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Ag(e,bg(e._zod.def,{get shape(){let n=U(U({},e._zod.def.shape),t);return yg(this,`shape`,n),n}}))}function Lg(e,t){var n,r;if((n=e._zod.def.checks)!=null&&n.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return Ag(e,bg(e._zod.def,{get shape(){let n=U(U({},e._zod.def.shape),t._zod.def.shape);return yg(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:(r=t._zod.def.checks)==null?[]:r}))}function Rg(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return Ag(t,bg(t._zod.def,{get shape(){let r=t._zod.def.shape,i=U({},r);if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return yg(this,`shape`,i),i},checks:[]}))}function zg(e,t,n){return Ag(t,bg(t._zod.def,{get shape(){let r=t._zod.def.shape,i=U({},r);if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return yg(this,`shape`,i),i}}))}function Bg(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++){var n;if(((n=e.issues[r])==null?void 0:n.continue)!==!0)return!0}return!1}function Vg(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++){var n;if(((n=e.issues[r])==null?void 0:n.continue)===!1)return!0}return!1}function Hg(e,t){return t.map(t=>{var n;return(n=t).path!=null||(n.path=[]),t.path.unshift(e),t})}function Ug(e){return typeof e==`string`?e:e==null?void 0:e.message}function Wg(e,t,n){var r,i,a,o,s,c,l,u,d;let f=e.message?e.message:(r=(i=(a=(o=Ug((s=e.inst)==null||(s=s._zod.def)==null||(c=s.error)==null?void 0:c.call(s,e)))==null?Ug(t==null||(l=t.error)==null?void 0:l.call(t,e)):o)==null?Ug((u=n.customError)==null?void 0:u.call(n,e)):a)==null?Ug((d=n.localeError)==null?void 0:d.call(n,e)):i)==null?`Invalid input`:r,{inst:p,continue:m,input:h}=e,g=vr(e,ug);return g.path!=null||(g.path=[]),g.message=f,t!=null&&t.reportInput&&(g.input=h),g}function Gg(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Kg(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:U({},t)}let qg=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,fg,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Jg=K(`$ZodError`,qg),Yg=K(`$ZodError`,qg,{Parent:Error});function Xg(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Zg(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}let Qg=e=>(t,n,r,i)=>{let a=r?U(U({},r),{},{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new og;if(o.issues.length){var s;let t=new((s=i==null?void 0:i.Err)==null?e:s)(o.issues.map(e=>Wg(e,a,lg())));throw Cg(t,i==null?void 0:i.callee),t}return o.value},$g=e=>async(t,n,r,i)=>{let a=r?U(U({},r),{},{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){var s;let t=new((s=i==null?void 0:i.Err)==null?e:s)(o.issues.map(e=>Wg(e,a,lg())));throw Cg(t,i==null?void 0:i.callee),t}return o.value},e_=e=>(t,n,r)=>{let i=r?U(U({},r),{},{async:!1}):{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new og;return a.issues.length?{success:!1,error:new(e==null?Jg:e)(a.issues.map(e=>Wg(e,i,lg())))}:{success:!0,data:a.value}},t_=e_(Yg),n_=e=>async(t,n,r)=>{let i=r?U(U({},r),{},{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>Wg(e,i,lg())))}:{success:!0,data:a.value}},r_=n_(Yg),i_=e=>(t,n,r)=>{let i=r?U(U({},r),{},{direction:`backward`}):{direction:`backward`};return Qg(e)(t,n,i)},a_=e=>(t,n,r)=>Qg(e)(t,n,r),o_=e=>async(t,n,r)=>{let i=r?U(U({},r),{},{direction:`backward`}):{direction:`backward`};return $g(e)(t,n,i)},s_=e=>async(t,n,r)=>$g(e)(t,n,r),c_=e=>(t,n,r)=>{let i=r?U(U({},r),{},{direction:`backward`}):{direction:`backward`};return e_(e)(t,n,i)},l_=e=>(t,n,r)=>e_(e)(t,n,r),u_=e=>async(t,n,r)=>{let i=r?U(U({},r),{},{direction:`backward`}):{direction:`backward`};return n_(e)(t,n,i)},d_=e=>async(t,n,r)=>n_(e)(t,n,r),f_=/^[cC][0-9a-z]{6,}$/,p_=/^[0-9a-z]+$/,m_=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,h_=/^[0-9a-vA-V]{20}$/,g_=/^[A-Za-z0-9]{27}$/,__=/^[a-zA-Z0-9_-]{21}$/,v_=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,y_=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,b_=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,x_=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function S_(){return RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)}let C_=/^(?:(?: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])$/,w_=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,T_=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,E_=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,D_=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,O_=/^[A-Za-z0-9_-]*$/,k_=/^https?$/,A_=/^\+[1-9]\d{6,14}$/,j_=`(?:(?:\\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])))`,M_=RegExp(`^${j_}$`);function N_(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function P_(e){return RegExp(`^${N_(e)}$`)}function F_(e){let t=N_({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${j_}T(?:${r})$`)}let I_=e=>{var t,n;let r=e?`[\\s\\S]{${(t=e==null?void 0:e.minimum)==null?0:t},${(n=e==null?void 0:e.maximum)==null?``:n}}`:`[\\s\\S]*`;return RegExp(`^${r}$`)},L_=/^-?\d+$/,R_=/^-?\d+(?:\.\d+)?$/,z_=/^(?:true|false)$/i,B_=/^null$/i,V_=/^[^A-Z]*$/,H_=/^[^a-z]*$/,U_=K(`$ZodCheck`,(e,t)=>{var n;e._zod!=null||(e._zod={}),e._zod.def=t,(n=e._zod).onattach!=null||(n.onattach=[])}),W_={number:`number`,bigint:`bigint`,object:`date`},G_=K(`$ZodCheckLessThan`,(e,t)=>{U_.init(e,t);let n=W_[typeof t.value];e._zod.onattach.push(e=>{var n;let r=e._zod.bag,i=(n=t.inclusive?r.maximum:r.exclusiveMaximum)==null?1/0:n;t.value<i&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),K_=K(`$ZodCheckGreaterThan`,(e,t)=>{U_.init(e,t);let n=W_[typeof t.value];e._zod.onattach.push(e=>{var n;let r=e._zod.bag,i=(n=t.inclusive?r.minimum:r.exclusiveMinimum)==null?-1/0:n;t.value>i&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),q_=K(`$ZodCheckMultipleOf`,(e,t)=>{U_.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf!=null||(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):gg(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),J_=K(`$ZodCheckNumberFormat`,(e,t)=>{var n;U_.init(e,t),t.format=t.format||`float64`;let r=(n=t.format)==null?void 0:n.includes(`int`),i=r?`int`:`number`,[a,o]=Mg[t.format];e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,n.minimum=a,n.maximum=o,r&&(n.pattern=L_)}),e._zod.check=n=>{let s=n.value;if(r){if(!Number.isInteger(s)){n.issues.push({expected:i,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?n.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:i,inclusive:!0,continue:!t.abort}):n.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:i,inclusive:!0,continue:!t.abort});return}}s<a&&n.issues.push({origin:`number`,input:s,code:`too_small`,minimum:a,inclusive:!0,inst:e,continue:!t.abort}),s>o&&n.issues.push({origin:`number`,input:s,code:`too_big`,maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),Y_=K(`$ZodCheckMaxLength`,(e,t)=>{var n;U_.init(e,t),(n=e._zod.def).when!=null||(n.when=e=>{let t=e.value;return!mg(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{var n;let r=(n=e._zod.bag.maximum)==null?1/0:n;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=Gg(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),X_=K(`$ZodCheckMinLength`,(e,t)=>{var n;U_.init(e,t),(n=e._zod.def).when!=null||(n.when=e=>{let t=e.value;return!mg(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{var n;let r=(n=e._zod.bag.minimum)==null?-1/0:n;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=Gg(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Z_=K(`$ZodCheckLengthEquals`,(e,t)=>{var n;U_.init(e,t),(n=e._zod.def).when!=null||(n.when=e=>{let t=e.value;return!mg(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=Gg(r),o=i>t.length;n.issues.push(U(U({origin:a},o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length}),{},{inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort}))}}),Q_=K(`$ZodCheckStringFormat`,(e,t)=>{var n,r;U_.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns!=null||(n.patterns=new Set),n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check!=null||(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push(U(U({origin:`string`,code:`invalid_format`,format:t.format,input:n.value},t.pattern?{pattern:t.pattern.toString()}:{}),{},{inst:e,continue:!t.abort}))}):(r=e._zod).check!=null||(r.check=()=>{})}),$_=K(`$ZodCheckRegex`,(e,t)=>{Q_.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),ev=K(`$ZodCheckLowerCase`,(e,t)=>{t.pattern!=null||(t.pattern=V_),Q_.init(e,t)}),tv=K(`$ZodCheckUpperCase`,(e,t)=>{t.pattern!=null||(t.pattern=H_),Q_.init(e,t)}),nv=K(`$ZodCheckIncludes`,(e,t)=>{U_.init(e,t);let n=kg(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns!=null||(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),rv=K(`$ZodCheckStartsWith`,(e,t)=>{U_.init(e,t);let n=RegExp(`^${kg(t.prefix)}.*`);t.pattern!=null||(t.pattern=n),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns!=null||(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),iv=K(`$ZodCheckEndsWith`,(e,t)=>{U_.init(e,t);let n=RegExp(`.*${kg(t.suffix)}$`);t.pattern!=null||(t.pattern=n),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns!=null||(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),av=K(`$ZodCheckOverwrite`,(e,t)=>{U_.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var ov=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
97
38
  `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){var e,t,n;let r=Function,i=(e=this)==null?void 0:e.args,a=[...((t=(n=this)==null?void 0:n.content)==null?[``]:t).map(e=>` ${e}`)];return new r(...i,a.join(`
98
- `))}};let Fy={major:4,minor:4,patch:3},Iy=K(`$ZodType`,(e,t)=>{var n,r;e!=null||(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Fy;let i=[...(n=e._zod.def.checks)==null?[]:n];e._zod.traits.has(`$ZodCheck`)&&i.unshift(e);for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0){var a;(r=e._zod).deferred!=null||(r.deferred=[]),(a=e._zod.deferred)==null||a.push(()=>{e._zod.run=e._zod.parse})}else{let t=(e,t,n)=>{let r=mv(e),i;for(let o of t){if(o._zod.def.when){if(hv(e)||!o._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,s=o._zod.check(e);if(s instanceof Promise&&(n==null?void 0:n.async)===!1)throw new P_;if(i||s instanceof Promise){var a;i=((a=i)==null?Promise.resolve():a).then(async()=>{await s,e.issues.length!==t&&(r||(r=mv(e,t)))})}else{if(e.issues.length===t)continue;r||(r=mv(e,t))}}return i?i.then(()=>e):e},n=(n,r,a)=>{if(mv(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new P_;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},U(U({},a),{},{skipChecks:!0}));return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new P_;return o.then(e=>t(e,i,a))}return t(o,i,a)}}K_(e,`~standard`,()=>({validate:t=>{try{var n;let r=kv(e,t);return r.success?{value:r.data}:{issues:(n=r.error)==null?void 0:n.issues}}catch(n){return jv(e,t).then(e=>{var t;return e.success?{value:e.data}:{issues:(t=e.error)==null?void 0:t.issues}})}},vendor:`zod`,version:1}))}),Ly=K(`$ZodString`,(e,t)=>{var n,r,i;Iy.init(e,t),e._zod.pattern=(n=[...(r=e==null||(i=e._zod.bag)==null?void 0:i.patterns)==null?[]:r].pop())==null?uy(e._zod.bag):n,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(e){}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),Ry=K(`$ZodStringFormat`,(e,t)=>{Ey.init(e,t),Ly.init(e,t)}),zy=K(`$ZodGUID`,(e,t)=>{t.pattern!=null||(t.pattern=qv),Ry.init(e,t)}),By=K(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern!=null||(t.pattern=Jv(e))}else t.pattern!=null||(t.pattern=Jv());Ry.init(e,t)}),Vy=K(`$ZodEmail`,(e,t)=>{t.pattern!=null||(t.pattern=Yv),Ry.init(e,t)}),Hy=K(`$ZodURL`,(e,t)=>{Ry.init(e,t),e._zod.check=n=>{try{var r;let i=n.value.trim();if(!t.normalize&&((r=t.protocol)==null?void 0:r.source)===ry.source&&!/^https?:\/\//i.test(i)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let a=new URL(i);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(a.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(a.protocol.endsWith(`:`)?a.protocol.slice(0,-1):a.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=a.href:n.value=i;return}catch(r){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Uy=K(`$ZodEmoji`,(e,t)=>{t.pattern!=null||(t.pattern=Xv()),Ry.init(e,t)}),Wy=K(`$ZodNanoID`,(e,t)=>{t.pattern!=null||(t.pattern=Gv),Ry.init(e,t)}),Gy=K(`$ZodCUID`,(e,t)=>{t.pattern!=null||(t.pattern=Bv),Ry.init(e,t)}),Ky=K(`$ZodCUID2`,(e,t)=>{t.pattern!=null||(t.pattern=Vv),Ry.init(e,t)}),qy=K(`$ZodULID`,(e,t)=>{t.pattern!=null||(t.pattern=Hv),Ry.init(e,t)}),Jy=K(`$ZodXID`,(e,t)=>{t.pattern!=null||(t.pattern=Uv),Ry.init(e,t)}),Yy=K(`$ZodKSUID`,(e,t)=>{t.pattern!=null||(t.pattern=Wv),Ry.init(e,t)}),Xy=K(`$ZodISODateTime`,(e,t)=>{t.pattern!=null||(t.pattern=ly(t)),Ry.init(e,t)}),Zy=K(`$ZodISODate`,(e,t)=>{t.pattern!=null||(t.pattern=oy),Ry.init(e,t)}),Qy=K(`$ZodISOTime`,(e,t)=>{t.pattern!=null||(t.pattern=cy(t)),Ry.init(e,t)}),$y=K(`$ZodISODuration`,(e,t)=>{t.pattern!=null||(t.pattern=Kv),Ry.init(e,t)}),eb=K(`$ZodIPv4`,(e,t)=>{t.pattern!=null||(t.pattern=Zv),Ry.init(e,t),e._zod.bag.format=`ipv4`}),tb=K(`$ZodIPv6`,(e,t)=>{t.pattern!=null||(t.pattern=Qv),Ry.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch(r){n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),nb=K(`$ZodCIDRv4`,(e,t)=>{t.pattern!=null||(t.pattern=$v),Ry.init(e,t)}),rb=K(`$ZodCIDRv6`,(e,t)=>{t.pattern!=null||(t.pattern=ey),Ry.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch(r){n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function ib(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch(e){return!1}}let ab=K(`$ZodBase64`,(e,t)=>{t.pattern!=null||(t.pattern=ty),Ry.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{ib(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function ob(e){if(!ny.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return ib(t.padEnd(Math.ceil(t.length/4)*4,`=`))}let sb=K(`$ZodBase64URL`,(e,t)=>{t.pattern!=null||(t.pattern=ny),Ry.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{ob(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),cb=K(`$ZodE164`,(e,t)=>{t.pattern!=null||(t.pattern=iy),Ry.init(e,t)});function lb(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&(i==null?void 0:i.typ)!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch(e){return!1}}let ub=K(`$ZodJWT`,(e,t)=>{Ry.init(e,t),e._zod.check=n=>{lb(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),db=K(`$ZodNumber`,(e,t)=>{var n;Iy.init(e,t),e._zod.pattern=(n=e._zod.bag.pattern)==null?fy:n,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch(e){}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push(U({expected:`number`,code:`invalid_type`,input:i,inst:e},a?{received:a}:{})),n}}),fb=K(`$ZodNumberFormat`,(e,t)=>{Sy.init(e,t),db.init(e,t)}),pb=K(`$ZodBoolean`,(e,t)=>{Iy.init(e,t),e._zod.pattern=py,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch(e){}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),mb=K(`$ZodNull`,(e,t)=>{Iy.init(e,t),e._zod.pattern=my,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),hb=K(`$ZodUnknown`,(e,t)=>{Iy.init(e,t),e._zod.parse=e=>e}),gb=K(`$ZodNever`,(e,t)=>{Iy.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function _b(e,t,n){e.issues.length&&t.issues.push(...gv(n,e.issues)),t.value[n]=e.value}let vb=K(`$ZodArray`,(e,t)=>{Iy.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>_b(t,n,e))):_b(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function yb(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...gv(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function bb(e){let t=Object.keys(e.shape);for(let r of t){var n;if(!(!((n=e.shape)==null||(n=n[r])==null||(n=n._zod)==null||(n=n.traits)==null)&&n.has(`$ZodType`)))throw Error(`Invalid element at key "${r}": expected a Zod schema`)}let r=av(e.shape);return U(U({},e),{},{keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)})}function xb(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>yb(e,n,i,t,u,d))):yb(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}let Sb=K(`$ZodObject`,(e,t)=>{Iy.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`);if(!(n!=null&&n.get)){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n=U({},e);return Object.defineProperty(t,"shape",{value:n}),n}})}let r=V_(()=>bb(t));K_(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]!=null||(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let i=Q_,a=t.catchall,o;e._zod.parse=(t,n)=>{o!=null||(o=r.value);let s=t.value;if(!i(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=o.shape;for(let e of o.keys){let r=l[e],i=r._zod.optin===`optional`,a=r._zod.optout===`optional`,o=r._zod.run({value:s[e],issues:[]},n);o instanceof Promise?c.push(o.then(n=>yb(n,t,e,s,i,a))):yb(o,t,e,s,i,a)}return a?xb(c,s,t,n,r.value,e):c.length?Promise.all(c).then(()=>t):t}}),Cb=K(`$ZodObjectJIT`,(e,t)=>{Sb.init(e,t);let n=e._zod.parse,r=V_(()=>bb(t)),i=e=>{let t=new Py([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=Y_(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){var s,c;let n=a[r],o=Y_(r),l=e[r],u=(l==null||(s=l._zod)==null?void 0:s.optin)===`optional`,d=(l==null||(c=l._zod)==null?void 0:c.optout)===`optional`;t.write(`const ${n} = ${i(r)};`),u&&d?t.write(`
39
+ `))}};let sv={major:4,minor:4,patch:3},cv=K(`$ZodType`,(e,t)=>{var n,r;e!=null||(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=sv;let i=[...(n=e._zod.def.checks)==null?[]:n];e._zod.traits.has(`$ZodCheck`)&&i.unshift(e);for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0){var a;(r=e._zod).deferred!=null||(r.deferred=[]),(a=e._zod.deferred)==null||a.push(()=>{e._zod.run=e._zod.parse})}else{let t=(e,t,n)=>{let r=Bg(e),i;for(let o of t){if(o._zod.def.when){if(Vg(e)||!o._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,s=o._zod.check(e);if(s instanceof Promise&&(n==null?void 0:n.async)===!1)throw new og;if(i||s instanceof Promise){var a;i=((a=i)==null?Promise.resolve():a).then(async()=>{await s,e.issues.length!==t&&(r||(r=Bg(e,t)))})}else{if(e.issues.length===t)continue;r||(r=Bg(e,t))}}return i?i.then(()=>e):e},n=(n,r,a)=>{if(Bg(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new og;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},U(U({},a),{},{skipChecks:!0}));return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new og;return o.then(e=>t(e,i,a))}return t(o,i,a)}}vg(e,`~standard`,()=>({validate:t=>{try{var n;let r=t_(e,t);return r.success?{value:r.data}:{issues:(n=r.error)==null?void 0:n.issues}}catch(n){return r_(e,t).then(e=>{var t;return e.success?{value:e.data}:{issues:(t=e.error)==null?void 0:t.issues}})}},vendor:`zod`,version:1}))}),lv=K(`$ZodString`,(e,t)=>{var n,r,i;cv.init(e,t),e._zod.pattern=(n=[...(r=e==null||(i=e._zod.bag)==null?void 0:i.patterns)==null?[]:r].pop())==null?I_(e._zod.bag):n,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(e){}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),uv=K(`$ZodStringFormat`,(e,t)=>{Q_.init(e,t),lv.init(e,t)}),dv=K(`$ZodGUID`,(e,t)=>{t.pattern!=null||(t.pattern=y_),uv.init(e,t)}),fv=K(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern!=null||(t.pattern=b_(e))}else t.pattern!=null||(t.pattern=b_());uv.init(e,t)}),pv=K(`$ZodEmail`,(e,t)=>{t.pattern!=null||(t.pattern=x_),uv.init(e,t)}),mv=K(`$ZodURL`,(e,t)=>{uv.init(e,t),e._zod.check=n=>{try{var r;let i=n.value.trim();if(!t.normalize&&((r=t.protocol)==null?void 0:r.source)===k_.source&&!/^https?:\/\//i.test(i)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let a=new URL(i);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(a.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(a.protocol.endsWith(`:`)?a.protocol.slice(0,-1):a.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=a.href:n.value=i;return}catch(r){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),hv=K(`$ZodEmoji`,(e,t)=>{t.pattern!=null||(t.pattern=S_()),uv.init(e,t)}),gv=K(`$ZodNanoID`,(e,t)=>{t.pattern!=null||(t.pattern=__),uv.init(e,t)}),_v=K(`$ZodCUID`,(e,t)=>{t.pattern!=null||(t.pattern=f_),uv.init(e,t)}),vv=K(`$ZodCUID2`,(e,t)=>{t.pattern!=null||(t.pattern=p_),uv.init(e,t)}),yv=K(`$ZodULID`,(e,t)=>{t.pattern!=null||(t.pattern=m_),uv.init(e,t)}),bv=K(`$ZodXID`,(e,t)=>{t.pattern!=null||(t.pattern=h_),uv.init(e,t)}),xv=K(`$ZodKSUID`,(e,t)=>{t.pattern!=null||(t.pattern=g_),uv.init(e,t)}),Sv=K(`$ZodISODateTime`,(e,t)=>{t.pattern!=null||(t.pattern=F_(t)),uv.init(e,t)}),Cv=K(`$ZodISODate`,(e,t)=>{t.pattern!=null||(t.pattern=M_),uv.init(e,t)}),wv=K(`$ZodISOTime`,(e,t)=>{t.pattern!=null||(t.pattern=P_(t)),uv.init(e,t)}),Tv=K(`$ZodISODuration`,(e,t)=>{t.pattern!=null||(t.pattern=v_),uv.init(e,t)}),Ev=K(`$ZodIPv4`,(e,t)=>{t.pattern!=null||(t.pattern=C_),uv.init(e,t),e._zod.bag.format=`ipv4`}),Dv=K(`$ZodIPv6`,(e,t)=>{t.pattern!=null||(t.pattern=w_),uv.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch(r){n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),Ov=K(`$ZodCIDRv4`,(e,t)=>{t.pattern!=null||(t.pattern=T_),uv.init(e,t)}),kv=K(`$ZodCIDRv6`,(e,t)=>{t.pattern!=null||(t.pattern=E_),uv.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch(r){n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function Av(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch(e){return!1}}let jv=K(`$ZodBase64`,(e,t)=>{t.pattern!=null||(t.pattern=D_),uv.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Av(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Mv(e){if(!O_.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Av(t.padEnd(Math.ceil(t.length/4)*4,`=`))}let Nv=K(`$ZodBase64URL`,(e,t)=>{t.pattern!=null||(t.pattern=O_),uv.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Mv(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Pv=K(`$ZodE164`,(e,t)=>{t.pattern!=null||(t.pattern=A_),uv.init(e,t)});function Fv(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&(i==null?void 0:i.typ)!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch(e){return!1}}let Iv=K(`$ZodJWT`,(e,t)=>{uv.init(e,t),e._zod.check=n=>{Fv(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Lv=K(`$ZodNumber`,(e,t)=>{var n;cv.init(e,t),e._zod.pattern=(n=e._zod.bag.pattern)==null?R_:n,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch(e){}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push(U({expected:`number`,code:`invalid_type`,input:i,inst:e},a?{received:a}:{})),n}}),Rv=K(`$ZodNumberFormat`,(e,t)=>{J_.init(e,t),Lv.init(e,t)}),zv=K(`$ZodBoolean`,(e,t)=>{cv.init(e,t),e._zod.pattern=z_,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch(e){}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),Bv=K(`$ZodNull`,(e,t)=>{cv.init(e,t),e._zod.pattern=B_,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),Vv=K(`$ZodUnknown`,(e,t)=>{cv.init(e,t),e._zod.parse=e=>e}),Hv=K(`$ZodNever`,(e,t)=>{cv.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Uv(e,t,n){e.issues.length&&t.issues.push(...Hg(n,e.issues)),t.value[n]=e.value}let Wv=K(`$ZodArray`,(e,t)=>{cv.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>Uv(t,n,e))):Uv(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function Gv(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...Hg(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function Kv(e){let t=Object.keys(e.shape);for(let r of t){var n;if(!(!((n=e.shape)==null||(n=n[r])==null||(n=n._zod)==null||(n=n.traits)==null)&&n.has(`$ZodType`)))throw Error(`Invalid element at key "${r}": expected a Zod schema`)}let r=jg(e.shape);return U(U({},e),{},{keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)})}function qv(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Gv(e,n,i,t,u,d))):Gv(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}let Jv=K(`$ZodObject`,(e,t)=>{cv.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`);if(!(n!=null&&n.get)){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n=U({},e);return Object.defineProperty(t,"shape",{value:n}),n}})}let r=pg(()=>Kv(t));vg(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]!=null||(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let i=wg,a=t.catchall,o;e._zod.parse=(t,n)=>{o!=null||(o=r.value);let s=t.value;if(!i(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=o.shape;for(let e of o.keys){let r=l[e],i=r._zod.optin===`optional`,a=r._zod.optout===`optional`,o=r._zod.run({value:s[e],issues:[]},n);o instanceof Promise?c.push(o.then(n=>Gv(n,t,e,s,i,a))):Gv(o,t,e,s,i,a)}return a?qv(c,s,t,n,r.value,e):c.length?Promise.all(c).then(()=>t):t}}),Yv=K(`$ZodObjectJIT`,(e,t)=>{Jv.init(e,t);let n=e._zod.parse,r=pg(()=>Kv(t)),i=e=>{let t=new ov([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=xg(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){var s,c;let n=a[r],o=xg(r),l=e[r],u=(l==null||(s=l._zod)==null?void 0:s.optin)===`optional`,d=(l==null||(c=l._zod)==null?void 0:c.optout)===`optional`;t.write(`const ${n} = ${i(r)};`),u&&d?t.write(`
99
40
  if (${n}.issues.length) {
100
41
  if (${o} in input) {
101
42
  payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
@@ -154,25 +95,84 @@ ${t}`,d++;break;case`id`:l=t.includes(`\0`)?void 0:t;break;case`retry`:/^\d+$/.t
154
95
  }
155
96
  }
156
97
 
157
- `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let l=t.compile();return(t,n)=>l(e,t,n)},a,o=Q_,s=!I_.jitless,c=s&&$_.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u!=null||(u=r.value);let p=d.value;return o(p)?s&&c&&(f==null?void 0:f.async)===!1&&f.jitless!==!0?(a||(a=i(t.shape)),d=a(d,f),l?xb([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function wb(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!mv(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>vv(e,r,L_())))}),t)}let Tb=K(`$ZodUnion`,(e,t)=>{Iy.init(e,t),K_(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),K_(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),K_(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),K_(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>U_(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>wb(t,r,e,i)):wb(o,r,e,i)}}),Eb=K(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Tb.init(e,t);let n=e._zod.parse;K_(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=V_(()=>{let e=t.options,n=new Map;for(let i of e){var r;let e=(r=i._zod.propValues)==null?void 0:r[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,i)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!Q_(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o==null?void 0:o[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),Db=K(`$ZodIntersection`,(e,t)=>{Iy.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>kb(e,t,n)):kb(e,i,a)}});function Ob(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ev(e)&&ev(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i=U(U({},e),t);for(let n of r){let r=Ob(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Ob(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function kb(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i!=null||(i=n);for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push(U(U({},i),{},{keys:a})),mv(e))return e;let o=Ob(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}let Ab=K(`$ZodRecord`,(e,t)=>{Iy.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!ev(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let c=new Set;for(let s of o)if(typeof s==`string`||typeof s==`number`||typeof s==`symbol`){c.add(typeof s==`number`?s.toString():s);let o=t.keyType._zod.run({value:s,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>vv(e,r,L_())),input:s,path:[s],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[s],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...gv(s,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...gv(s,u.issues)),n.value[l]=u.value)}let l;for(let e in i)if(!c.has(e)){var s;l=(s=l)==null?[]:s,l.push(e)}l&&l.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:l})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&fy.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>vv(e,r,L_())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...gv(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...gv(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),jb=K(`$ZodEnum`,(e,t)=>{Iy.init(e,t);let n=z_(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>nv.has(typeof e)).map(e=>typeof e==`string`?rv(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Mb=K(`$ZodLiteral`,(e,t)=>{if(Iy.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?rv(e):e?rv(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Nb=K(`$ZodTransform`,(e,t)=>{Iy.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new F_(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new P_;return n.value=i,n.fallback=!0,n}});function Pb(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}let Fb=K(`$ZodOptional`,(e,t)=>{Iy.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,K_(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),K_(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${U_(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Pb(e,r)):Pb(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Ib=K(`$ZodExactOptional`,(e,t)=>{Fb.init(e,t),K_(e._zod,`values`,()=>t.innerType._zod.values),K_(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Lb=K(`$ZodNullable`,(e,t)=>{Iy.init(e,t),K_(e._zod,`optin`,()=>t.innerType._zod.optin),K_(e._zod,`optout`,()=>t.innerType._zod.optout),K_(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${U_(e.source)}|null)$`):void 0}),K_(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Rb=K(`$ZodDefault`,(e,t)=>{Iy.init(e,t),e._zod.optin=`optional`,K_(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>zb(e,t)):zb(r,t)}});function zb(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}let Bb=K(`$ZodPrefault`,(e,t)=>{Iy.init(e,t),e._zod.optin=`optional`,K_(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Vb=K(`$ZodNonOptional`,(e,t)=>{Iy.init(e,t),K_(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Hb(t,e)):Hb(i,e)}});function Hb(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}let Ub=K(`$ZodCatch`,(e,t)=>{Iy.init(e,t),e._zod.optin=`optional`,K_(e._zod,`optout`,()=>t.innerType._zod.optout),K_(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue(U(U({},e),{},{error:{issues:r.issues.map(e=>vv(e,n,L_()))},input:e.value})),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue(U(U({},e),{},{error:{issues:r.issues.map(e=>vv(e,n,L_()))},input:e.value})),e.issues=[],e.fallback=!0),e)}}),Wb=K(`$ZodPipe`,(e,t)=>{Iy.init(e,t),K_(e._zod,`values`,()=>t.in._zod.values),K_(e._zod,`optin`,()=>t.in._zod.optin),K_(e._zod,`optout`,()=>t.out._zod.optout),K_(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Gb(e,t.in,n)):Gb(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Gb(e,t.out,n)):Gb(r,t.out,n)}});function Gb(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}let Kb=K(`$ZodReadonly`,(e,t)=>{Iy.init(e,t),K_(e._zod,`propValues`,()=>t.innerType._zod.propValues),K_(e._zod,`values`,()=>t.innerType._zod.values),K_(e._zod,`optin`,()=>{var e;return(e=t.innerType)==null||(e=e._zod)==null?void 0:e.optin}),K_(e._zod,`optout`,()=>{var e;return(e=t.innerType)==null||(e=e._zod)==null?void 0:e.optout}),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(qb):qb(r)}});function qb(e){return e.value=Object.freeze(e.value),e}let Jb=K(`$ZodLazy`,(e,t)=>{Iy.init(e,t),K_(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||(e._cachedInner=t.getter()),e._cachedInner}),K_(e._zod,`pattern`,()=>{var t;return(t=e._zod.innerType)==null||(t=t._zod)==null?void 0:t.pattern}),K_(e._zod,`propValues`,()=>{var t;return(t=e._zod.innerType)==null||(t=t._zod)==null?void 0:t.propValues}),K_(e._zod,`optin`,()=>{var t,n;return(t=(n=e._zod.innerType)==null||(n=n._zod)==null?void 0:n.optin)==null?void 0:t}),K_(e._zod,`optout`,()=>{var t,n;return(t=(n=e._zod.innerType)==null||(n=n._zod)==null?void 0:n.optout)==null?void 0:t}),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Yb=K(`$ZodCustom`,(e,t)=>{_y.init(e,t),Iy.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Xb(t,n,r,e));Xb(i,n,r,e)}});function Xb(e,t,n,r){if(!e){var i;let e={code:`custom`,input:n,inst:r,path:[...(i=r._zod.def.path)==null?[]:i],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(bv(e))}}var Zb,Qb=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){var n;let r=U({},(n=this.get(t))==null?{}:n);delete r.id;let i=U(U({},r),this._map.get(e));return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function $b(){return new Qb}(Zb=globalThis).__zod_globalRegistry!=null||(Zb.__zod_globalRegistry=$b());let ex=globalThis.__zod_globalRegistry;function tx(e,t){return new e(U({type:`string`},q(t)))}function nx(e,t){return new e(U({type:`string`,format:`email`,check:`string_format`,abort:!1},q(t)))}function rx(e,t){return new e(U({type:`string`,format:`guid`,check:`string_format`,abort:!1},q(t)))}function ix(e,t){return new e(U({type:`string`,format:`uuid`,check:`string_format`,abort:!1},q(t)))}function ax(e,t){return new e(U({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`},q(t)))}function ox(e,t){return new e(U({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`},q(t)))}function sx(e,t){return new e(U({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`},q(t)))}function cx(e,t){return new e(U({type:`string`,format:`url`,check:`string_format`,abort:!1},q(t)))}function lx(e,t){return new e(U({type:`string`,format:`emoji`,check:`string_format`,abort:!1},q(t)))}function ux(e,t){return new e(U({type:`string`,format:`nanoid`,check:`string_format`,abort:!1},q(t)))}function dx(e,t){return new e(U({type:`string`,format:`cuid`,check:`string_format`,abort:!1},q(t)))}function fx(e,t){return new e(U({type:`string`,format:`cuid2`,check:`string_format`,abort:!1},q(t)))}function px(e,t){return new e(U({type:`string`,format:`ulid`,check:`string_format`,abort:!1},q(t)))}function mx(e,t){return new e(U({type:`string`,format:`xid`,check:`string_format`,abort:!1},q(t)))}function hx(e,t){return new e(U({type:`string`,format:`ksuid`,check:`string_format`,abort:!1},q(t)))}function gx(e,t){return new e(U({type:`string`,format:`ipv4`,check:`string_format`,abort:!1},q(t)))}function _x(e,t){return new e(U({type:`string`,format:`ipv6`,check:`string_format`,abort:!1},q(t)))}function vx(e,t){return new e(U({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1},q(t)))}function yx(e,t){return new e(U({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1},q(t)))}function bx(e,t){return new e(U({type:`string`,format:`base64`,check:`string_format`,abort:!1},q(t)))}function xx(e,t){return new e(U({type:`string`,format:`base64url`,check:`string_format`,abort:!1},q(t)))}function Sx(e,t){return new e(U({type:`string`,format:`e164`,check:`string_format`,abort:!1},q(t)))}function Cx(e,t){return new e(U({type:`string`,format:`jwt`,check:`string_format`,abort:!1},q(t)))}function wx(e,t){return new e(U({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null},q(t)))}function Tx(e,t){return new e(U({type:`string`,format:`date`,check:`string_format`},q(t)))}function Ex(e,t){return new e(U({type:`string`,format:`time`,check:`string_format`,precision:null},q(t)))}function Dx(e,t){return new e(U({type:`string`,format:`duration`,check:`string_format`},q(t)))}function Ox(e,t){return new e(U({type:`number`,checks:[]},q(t)))}function kx(e,t){return new e(U({type:`number`,check:`number_format`,abort:!1,format:`safeint`},q(t)))}function Ax(e,t){return new e(U({type:`boolean`},q(t)))}function jx(e,t){return new e(U({type:`null`},q(t)))}function Mx(e){return new e({type:`unknown`})}function Nx(e,t){return new e(U({type:`never`},q(t)))}function Px(e,t){return new yy(U(U({check:`less_than`},q(t)),{},{value:e,inclusive:!1}))}function Fx(e,t){return new yy(U(U({check:`less_than`},q(t)),{},{value:e,inclusive:!0}))}function Ix(e,t){return new by(U(U({check:`greater_than`},q(t)),{},{value:e,inclusive:!1}))}function Lx(e,t){return new by(U(U({check:`greater_than`},q(t)),{},{value:e,inclusive:!0}))}function Rx(e,t){return new xy(U(U({check:`multiple_of`},q(t)),{},{value:e}))}function zx(e,t){return new Cy(U(U({check:`max_length`},q(t)),{},{maximum:e}))}function Bx(e,t){return new wy(U(U({check:`min_length`},q(t)),{},{minimum:e}))}function Vx(e,t){return new Ty(U(U({check:`length_equals`},q(t)),{},{length:e}))}function Hx(e,t){return new Dy(U(U({check:`string_format`,format:`regex`},q(t)),{},{pattern:e}))}function Ux(e){return new Oy(U({check:`string_format`,format:`lowercase`},q(e)))}function Wx(e){return new ky(U({check:`string_format`,format:`uppercase`},q(e)))}function Gx(e,t){return new Ay(U(U({check:`string_format`,format:`includes`},q(t)),{},{includes:e}))}function Kx(e,t){return new jy(U(U({check:`string_format`,format:`starts_with`},q(t)),{},{prefix:e}))}function qx(e,t){return new My(U(U({check:`string_format`,format:`ends_with`},q(t)),{},{suffix:e}))}function Jx(e){return new Ny({check:`overwrite`,tx:e})}function Yx(e){return Jx(t=>t.normalize(e))}function Xx(){return Jx(e=>e.trim())}function Zx(){return Jx(e=>e.toLowerCase())}function Qx(){return Jx(e=>e.toUpperCase())}function $x(){return Jx(e=>X_(e))}function eS(e,t,n){return new e(U({type:`array`,element:t},q(n)))}function tS(e,t,n){let r=q(n);return r.abort!=null||(r.abort=!0),new e(U({type:`custom`,check:`custom`,fn:t},r))}function nS(e,t,n){return new e(U({type:`custom`,check:`custom`,fn:t},q(n)))}function rS(e,t){let n=iS(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(bv(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code!=null||(r.code=`custom`),r.input!=null||(r.input=t.value),r.inst!=null||(r.inst=n),r.continue!=null||(r.continue=!n._zod.def.abort),t.issues.push(bv(r))}},e(t.value,t)),t);return n}function iS(e,t){let n=new _y(U({check:`custom`},q(t)));return n._zod.check=e,n}function aS(e){var t,n,r,i,a,o,s,c,l;let u=(t=e==null?void 0:e.target)==null?`draft-2020-12`:t;return u===`draft-4`&&(u=`draft-04`),u===`draft-7`&&(u=`draft-07`),{processors:(n=e.processors)==null?{}:n,metadataRegistry:(r=e==null?void 0:e.metadata)==null?ex:r,target:u,unrepresentable:(i=e==null?void 0:e.unrepresentable)==null?`throw`:i,override:(a=e==null?void 0:e.override)==null?(()=>{}):a,io:(o=e==null?void 0:e.io)==null?`output`:o,counter:0,seen:new Map,cycles:(s=e==null?void 0:e.cycles)==null?`ref`:s,reused:(c=e==null?void 0:e.reused)==null?`inline`:c,external:(l=e==null?void 0:e.external)==null?void 0:l}}function oS(e,t,n={path:[],schemaPath:[]}){var r,i,a;let o=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;let c={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,c);let l=(r=(i=e._zod).toJSONSchema)==null?void 0:r.call(i);if(l)c.schema=l;else{let r=U(U({},n),{},{schemaPath:[...n.schemaPath,e],path:n.path});if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,c.schema,r);else{let n=c.schema,i=t.processors[o.type];if(!i)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);i(e,t,n,r)}let i=e._zod.parent;i&&(c.ref||(c.ref=i),oS(i,t,r),t.seen.get(i).isParent=!0)}let u=t.metadataRegistry.get(e);return u&&Object.assign(c.schema,u),t.io===`input`&&lS(e)&&(delete c.schema.examples,delete c.schema.default),t.io===`input`&&`_prefault`in c.schema&&((a=c.schema).default!=null||(a.default=c.schema._prefault)),delete c.schema._prefault,t.seen.get(e).schema}function sS(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){var i;let n=(i=e.metadataRegistry.get(t[0]))==null?void 0:i.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let a=t=>{var r;let i=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){var a,o,s,c;let n=(a=e.external.registry.get(t[0]))==null?void 0:a.id,r=(o=e.external.uri)==null?(e=>e):o;if(n)return{ref:r(n)};let l=(s=(c=t[1].defId)==null?t[1].schema.id:c)==null?`schema${e.counter++}`:s;return t[1].defId=l,{defId:l,ref:`${r(`__shared`)}#/${i}/${l}`}}if(t[1]===n)return{ref:`#`};let l=`#/${i}/`,u=(r=t[1].schema.id)==null?`__schema${e.counter++}`:r;return{defId:u,ref:l+u}},o=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=a(e);t.def=U({},t.schema),r&&(t.defId=r);let i=t.schema;for(let e in i)delete i[e];i.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle){var s;throw Error(`Cycle detected: #/${(s=e.cycle)==null?void 0:s.join(`/`)}/<root>
98
+ `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let l=t.compile();return(t,n)=>l(e,t,n)},a,o=wg,s=!cg.jitless,c=s&&Tg.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u!=null||(u=r.value);let p=d.value;return o(p)?s&&c&&(f==null?void 0:f.async)===!1&&f.jitless!==!0?(a||(a=i(t.shape)),d=a(d,f),l?qv([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function Xv(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Bg(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Wg(e,r,lg())))}),t)}let Zv=K(`$ZodUnion`,(e,t)=>{cv.init(e,t),vg(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),vg(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),vg(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),vg(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>hg(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Xv(t,r,e,i)):Xv(o,r,e,i)}}),Qv=K(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Zv.init(e,t);let n=e._zod.parse;vg(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=pg(()=>{let e=t.options,n=new Map;for(let i of e){var r;let e=(r=i._zod.propValues)==null?void 0:r[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,i)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!wg(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o==null?void 0:o[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),$v=K(`$ZodIntersection`,(e,t)=>{cv.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>ty(e,t,n)):ty(e,i,a)}});function ey(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Eg(e)&&Eg(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i=U(U({},e),t);for(let n of r){let r=ey(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=ey(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function ty(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i!=null||(i=n);for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push(U(U({},i),{},{keys:a})),Bg(e))return e;let o=ey(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}let ny=K(`$ZodRecord`,(e,t)=>{cv.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Eg(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let c=new Set;for(let s of o)if(typeof s==`string`||typeof s==`number`||typeof s==`symbol`){c.add(typeof s==`number`?s.toString():s);let o=t.keyType._zod.run({value:s,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>Wg(e,r,lg())),input:s,path:[s],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[s],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...Hg(s,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...Hg(s,u.issues)),n.value[l]=u.value)}let l;for(let e in i)if(!c.has(e)){var s;l=(s=l)==null?[]:s,l.push(e)}l&&l.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:l})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&R_.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>Wg(e,r,lg())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...Hg(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...Hg(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),ry=K(`$ZodEnum`,(e,t)=>{cv.init(e,t);let n=dg(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Og.has(typeof e)).map(e=>typeof e==`string`?kg(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),iy=K(`$ZodLiteral`,(e,t)=>{if(cv.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?kg(e):e?kg(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),ay=K(`$ZodTransform`,(e,t)=>{cv.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new sg(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new og;return n.value=i,n.fallback=!0,n}});function oy(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}let sy=K(`$ZodOptional`,(e,t)=>{cv.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,vg(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),vg(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${hg(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>oy(e,r)):oy(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),cy=K(`$ZodExactOptional`,(e,t)=>{sy.init(e,t),vg(e._zod,`values`,()=>t.innerType._zod.values),vg(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),ly=K(`$ZodNullable`,(e,t)=>{cv.init(e,t),vg(e._zod,`optin`,()=>t.innerType._zod.optin),vg(e._zod,`optout`,()=>t.innerType._zod.optout),vg(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${hg(e.source)}|null)$`):void 0}),vg(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),uy=K(`$ZodDefault`,(e,t)=>{cv.init(e,t),e._zod.optin=`optional`,vg(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>dy(e,t)):dy(r,t)}});function dy(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}let fy=K(`$ZodPrefault`,(e,t)=>{cv.init(e,t),e._zod.optin=`optional`,vg(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),py=K(`$ZodNonOptional`,(e,t)=>{cv.init(e,t),vg(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>my(t,e)):my(i,e)}});function my(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}let hy=K(`$ZodCatch`,(e,t)=>{cv.init(e,t),e._zod.optin=`optional`,vg(e._zod,`optout`,()=>t.innerType._zod.optout),vg(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue(U(U({},e),{},{error:{issues:r.issues.map(e=>Wg(e,n,lg()))},input:e.value})),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue(U(U({},e),{},{error:{issues:r.issues.map(e=>Wg(e,n,lg()))},input:e.value})),e.issues=[],e.fallback=!0),e)}}),gy=K(`$ZodPipe`,(e,t)=>{cv.init(e,t),vg(e._zod,`values`,()=>t.in._zod.values),vg(e._zod,`optin`,()=>t.in._zod.optin),vg(e._zod,`optout`,()=>t.out._zod.optout),vg(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>_y(e,t.in,n)):_y(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>_y(e,t.out,n)):_y(r,t.out,n)}});function _y(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}let vy=K(`$ZodReadonly`,(e,t)=>{cv.init(e,t),vg(e._zod,`propValues`,()=>t.innerType._zod.propValues),vg(e._zod,`values`,()=>t.innerType._zod.values),vg(e._zod,`optin`,()=>{var e;return(e=t.innerType)==null||(e=e._zod)==null?void 0:e.optin}),vg(e._zod,`optout`,()=>{var e;return(e=t.innerType)==null||(e=e._zod)==null?void 0:e.optout}),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(yy):yy(r)}});function yy(e){return e.value=Object.freeze(e.value),e}let by=K(`$ZodLazy`,(e,t)=>{cv.init(e,t),vg(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||(e._cachedInner=t.getter()),e._cachedInner}),vg(e._zod,`pattern`,()=>{var t;return(t=e._zod.innerType)==null||(t=t._zod)==null?void 0:t.pattern}),vg(e._zod,`propValues`,()=>{var t;return(t=e._zod.innerType)==null||(t=t._zod)==null?void 0:t.propValues}),vg(e._zod,`optin`,()=>{var t,n;return(t=(n=e._zod.innerType)==null||(n=n._zod)==null?void 0:n.optin)==null?void 0:t}),vg(e._zod,`optout`,()=>{var t,n;return(t=(n=e._zod.innerType)==null||(n=n._zod)==null?void 0:n.optout)==null?void 0:t}),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),xy=K(`$ZodCustom`,(e,t)=>{U_.init(e,t),cv.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Sy(t,n,r,e));Sy(i,n,r,e)}});function Sy(e,t,n,r){if(!e){var i;let e={code:`custom`,input:n,inst:r,path:[...(i=r._zod.def.path)==null?[]:i],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Kg(e))}}var Cy,wy=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){var n;let r=U({},(n=this.get(t))==null?{}:n);delete r.id;let i=U(U({},r),this._map.get(e));return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Ty(){return new wy}(Cy=globalThis).__zod_globalRegistry!=null||(Cy.__zod_globalRegistry=Ty());let Ey=globalThis.__zod_globalRegistry;function Dy(e,t){return new e(U({type:`string`},q(t)))}function Oy(e,t){return new e(U({type:`string`,format:`email`,check:`string_format`,abort:!1},q(t)))}function ky(e,t){return new e(U({type:`string`,format:`guid`,check:`string_format`,abort:!1},q(t)))}function Ay(e,t){return new e(U({type:`string`,format:`uuid`,check:`string_format`,abort:!1},q(t)))}function jy(e,t){return new e(U({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`},q(t)))}function My(e,t){return new e(U({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`},q(t)))}function Ny(e,t){return new e(U({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`},q(t)))}function Py(e,t){return new e(U({type:`string`,format:`url`,check:`string_format`,abort:!1},q(t)))}function Fy(e,t){return new e(U({type:`string`,format:`emoji`,check:`string_format`,abort:!1},q(t)))}function Iy(e,t){return new e(U({type:`string`,format:`nanoid`,check:`string_format`,abort:!1},q(t)))}function Ly(e,t){return new e(U({type:`string`,format:`cuid`,check:`string_format`,abort:!1},q(t)))}function Ry(e,t){return new e(U({type:`string`,format:`cuid2`,check:`string_format`,abort:!1},q(t)))}function zy(e,t){return new e(U({type:`string`,format:`ulid`,check:`string_format`,abort:!1},q(t)))}function By(e,t){return new e(U({type:`string`,format:`xid`,check:`string_format`,abort:!1},q(t)))}function Vy(e,t){return new e(U({type:`string`,format:`ksuid`,check:`string_format`,abort:!1},q(t)))}function Hy(e,t){return new e(U({type:`string`,format:`ipv4`,check:`string_format`,abort:!1},q(t)))}function Uy(e,t){return new e(U({type:`string`,format:`ipv6`,check:`string_format`,abort:!1},q(t)))}function Wy(e,t){return new e(U({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1},q(t)))}function Gy(e,t){return new e(U({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1},q(t)))}function Ky(e,t){return new e(U({type:`string`,format:`base64`,check:`string_format`,abort:!1},q(t)))}function qy(e,t){return new e(U({type:`string`,format:`base64url`,check:`string_format`,abort:!1},q(t)))}function Jy(e,t){return new e(U({type:`string`,format:`e164`,check:`string_format`,abort:!1},q(t)))}function Yy(e,t){return new e(U({type:`string`,format:`jwt`,check:`string_format`,abort:!1},q(t)))}function Xy(e,t){return new e(U({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null},q(t)))}function Zy(e,t){return new e(U({type:`string`,format:`date`,check:`string_format`},q(t)))}function Qy(e,t){return new e(U({type:`string`,format:`time`,check:`string_format`,precision:null},q(t)))}function $y(e,t){return new e(U({type:`string`,format:`duration`,check:`string_format`},q(t)))}function eb(e,t){return new e(U({type:`number`,checks:[]},q(t)))}function tb(e,t){return new e(U({type:`number`,check:`number_format`,abort:!1,format:`safeint`},q(t)))}function nb(e,t){return new e(U({type:`boolean`},q(t)))}function rb(e,t){return new e(U({type:`null`},q(t)))}function ib(e){return new e({type:`unknown`})}function ab(e,t){return new e(U({type:`never`},q(t)))}function ob(e,t){return new G_(U(U({check:`less_than`},q(t)),{},{value:e,inclusive:!1}))}function sb(e,t){return new G_(U(U({check:`less_than`},q(t)),{},{value:e,inclusive:!0}))}function cb(e,t){return new K_(U(U({check:`greater_than`},q(t)),{},{value:e,inclusive:!1}))}function lb(e,t){return new K_(U(U({check:`greater_than`},q(t)),{},{value:e,inclusive:!0}))}function ub(e,t){return new q_(U(U({check:`multiple_of`},q(t)),{},{value:e}))}function db(e,t){return new Y_(U(U({check:`max_length`},q(t)),{},{maximum:e}))}function fb(e,t){return new X_(U(U({check:`min_length`},q(t)),{},{minimum:e}))}function pb(e,t){return new Z_(U(U({check:`length_equals`},q(t)),{},{length:e}))}function mb(e,t){return new $_(U(U({check:`string_format`,format:`regex`},q(t)),{},{pattern:e}))}function hb(e){return new ev(U({check:`string_format`,format:`lowercase`},q(e)))}function gb(e){return new tv(U({check:`string_format`,format:`uppercase`},q(e)))}function _b(e,t){return new nv(U(U({check:`string_format`,format:`includes`},q(t)),{},{includes:e}))}function vb(e,t){return new rv(U(U({check:`string_format`,format:`starts_with`},q(t)),{},{prefix:e}))}function yb(e,t){return new iv(U(U({check:`string_format`,format:`ends_with`},q(t)),{},{suffix:e}))}function bb(e){return new av({check:`overwrite`,tx:e})}function xb(e){return bb(t=>t.normalize(e))}function Sb(){return bb(e=>e.trim())}function Cb(){return bb(e=>e.toLowerCase())}function wb(){return bb(e=>e.toUpperCase())}function Tb(){return bb(e=>Sg(e))}function Eb(e,t,n){return new e(U({type:`array`,element:t},q(n)))}function Db(e,t,n){let r=q(n);return r.abort!=null||(r.abort=!0),new e(U({type:`custom`,check:`custom`,fn:t},r))}function Ob(e,t,n){return new e(U({type:`custom`,check:`custom`,fn:t},q(n)))}function kb(e,t){let n=Ab(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Kg(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code!=null||(r.code=`custom`),r.input!=null||(r.input=t.value),r.inst!=null||(r.inst=n),r.continue!=null||(r.continue=!n._zod.def.abort),t.issues.push(Kg(r))}},e(t.value,t)),t);return n}function Ab(e,t){let n=new U_(U({check:`custom`},q(t)));return n._zod.check=e,n}function jb(e){var t,n,r,i,a,o,s,c,l;let u=(t=e==null?void 0:e.target)==null?`draft-2020-12`:t;return u===`draft-4`&&(u=`draft-04`),u===`draft-7`&&(u=`draft-07`),{processors:(n=e.processors)==null?{}:n,metadataRegistry:(r=e==null?void 0:e.metadata)==null?Ey:r,target:u,unrepresentable:(i=e==null?void 0:e.unrepresentable)==null?`throw`:i,override:(a=e==null?void 0:e.override)==null?(()=>{}):a,io:(o=e==null?void 0:e.io)==null?`output`:o,counter:0,seen:new Map,cycles:(s=e==null?void 0:e.cycles)==null?`ref`:s,reused:(c=e==null?void 0:e.reused)==null?`inline`:c,external:(l=e==null?void 0:e.external)==null?void 0:l}}function Mb(e,t,n={path:[],schemaPath:[]}){var r,i,a;let o=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;let c={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,c);let l=(r=(i=e._zod).toJSONSchema)==null?void 0:r.call(i);if(l)c.schema=l;else{let r=U(U({},n),{},{schemaPath:[...n.schemaPath,e],path:n.path});if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,c.schema,r);else{let n=c.schema,i=t.processors[o.type];if(!i)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);i(e,t,n,r)}let i=e._zod.parent;i&&(c.ref||(c.ref=i),Mb(i,t,r),t.seen.get(i).isParent=!0)}let u=t.metadataRegistry.get(e);return u&&Object.assign(c.schema,u),t.io===`input`&&Fb(e)&&(delete c.schema.examples,delete c.schema.default),t.io===`input`&&`_prefault`in c.schema&&((a=c.schema).default!=null||(a.default=c.schema._prefault)),delete c.schema._prefault,t.seen.get(e).schema}function Nb(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){var i;let n=(i=e.metadataRegistry.get(t[0]))==null?void 0:i.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let a=t=>{var r;let i=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){var a,o,s,c;let n=(a=e.external.registry.get(t[0]))==null?void 0:a.id,r=(o=e.external.uri)==null?(e=>e):o;if(n)return{ref:r(n)};let l=(s=(c=t[1].defId)==null?t[1].schema.id:c)==null?`schema${e.counter++}`:s;return t[1].defId=l,{defId:l,ref:`${r(`__shared`)}#/${i}/${l}`}}if(t[1]===n)return{ref:`#`};let l=`#/${i}/`,u=(r=t[1].schema.id)==null?`__schema${e.counter++}`:r;return{defId:u,ref:l+u}},o=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=a(e);t.def=U({},t.schema),r&&(t.defId=r);let i=t.schema;for(let e in i)delete i[e];i.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle){var s;throw Error(`Cycle detected: #/${(s=e.cycle)==null?void 0:s.join(`/`)}/<root>
158
99
 
159
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}}for(let n of e.seen.entries()){var c;let r=n[1];if(t===n[0]){o(n);continue}if(e.external){var l;let r=(l=e.external.registry.get(n[0]))==null?void 0:l.id;if(t!==n[0]&&r){o(n);continue}}if((c=e.metadataRegistry.get(n[0]))!=null&&c.id){o(n);continue}if(r.cycle){o(n);continue}if(r.count>1&&e.reused===`ref`){o(n);continue}}}function cS(e,t){var n,r,i,a,o;let s=e.seen.get(t);if(!s)throw Error(`Unprocessed schema. This is a bug in Zod.`);let c=t=>{var n,r;let i=e.seen.get(t);if(i.ref===null)return;let a=(n=i.def)==null?i.schema:n,o=U({},a),s=i.ref;if(i.ref=null,s){c(s);let n=e.seen.get(s),r=n.schema;if(r.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)){var l;a.allOf=(l=a.allOf)==null?[]:l,a.allOf.push(r)}else Object.assign(a,r);if(Object.assign(a,o),t._zod.parent===s)for(let e in a)e===`$ref`||e===`allOf`||e in o||delete a[e];if(r.$ref&&n.def)for(let e in a)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(a[e])===JSON.stringify(n.def[e])&&delete a[e]}let u=t._zod.parent;if(u&&u!==s){c(u);let t=e.seen.get(u);if(t!=null&&t.schema.$ref&&(a.$ref=t.schema.$ref,t.def))for(let e in a)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(a[e])===JSON.stringify(t.def[e])&&delete a[e]}e.override({zodSchema:t,jsonSchema:a,path:(r=i.path)==null?[]:r})};for(let t of[...e.seen.entries()].reverse())c(t[0]);let l={};if(e.target===`draft-2020-12`?l.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?l.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?l.$schema=`http://json-schema.org/draft-04/schema#`:e.target,(n=e.external)!=null&&n.uri){var u;let n=(u=e.external.registry.get(t))==null?void 0:u.id;if(!n)throw Error("Schema is missing an `id` property");l.$id=e.external.uri(n)}Object.assign(l,(r=s.def)==null?s.schema:r);let d=(i=e.metadataRegistry.get(t))==null?void 0:i.id;d!==void 0&&l.id===d&&delete l.id;let f=(a=(o=e.external)==null?void 0:o.defs)==null?{}:a;for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,f[e.defId]=e.def)}e.external||Object.keys(f).length>0&&(e.target===`draft-2020-12`?l.$defs=f:l.definitions=f);try{let n=JSON.parse(JSON.stringify(l));return Object.defineProperty(n,"~standard",{value:U(U({},t[`~standard`]),{},{jsonSchema:{input:dS(t,`input`,e.processors),output:dS(t,`output`,e.processors)}}),enumerable:!1,writable:!1}),n}catch(e){throw Error(`Error converting schema to JSON.`)}}function lS(e,t){let n=t==null?{seen:new Set}:t;if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return lS(r.element,n);if(r.type===`set`)return lS(r.valueType,n);if(r.type===`lazy`)return lS(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return lS(r.innerType,n);if(r.type===`intersection`)return lS(r.left,n)||lS(r.right,n);if(r.type===`record`||r.type===`map`)return lS(r.keyType,n)||lS(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:lS(r.in,n)||lS(r.out,n);if(r.type===`object`){for(let e in r.shape)if(lS(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(lS(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(lS(e,n))return!0;return!!(r.rest&&lS(r.rest,n))}return!1}let uS=(e,t={})=>n=>{let r=aS(U(U({},n),{},{processors:t}));return oS(e,r),sS(r,e),cS(r,e)},dS=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r==null?{}:r,o=aS(U(U({},i==null?{}:i),{},{target:a,io:t,processors:n}));return oS(e,o),sS(o,e),cS(o,e)},fS={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},pS=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s){var u;i.format=(u=fS[s])==null?s:u,i.format===``&&delete i.format,s===`time`&&delete i.format}if(l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>U(U({},t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{}),{},{pattern:e.source}))])}},mS=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a==null?-1/0:a),f=typeof l==`number`&&l<=(o==null?1/0:o),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},hS=(e,t,n,r)=>{n.type=`boolean`},gS=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`BigInt cannot be represented in JSON Schema`)},_S=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Symbols cannot be represented in JSON Schema`)},vS=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},yS=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Undefined cannot be represented in JSON Schema`)},bS=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Void cannot be represented in JSON Schema`)},xS=(e,t,n,r)=>{n.not={}},SS=(e,t,n,r)=>{},CS=(e,t,n,r)=>{},wS=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Date cannot be represented in JSON Schema`)},TS=(e,t,n,r)=>{let i=e._zod.def,a=z_(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},ES=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},DS=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`NaN cannot be represented in JSON Schema`)},OS=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},kS=(e,t,n,r)=>{let i=n,a={type:`string`,format:`binary`,contentEncoding:`binary`},{minimum:o,maximum:s,mime:c}=e._zod.bag;o!==void 0&&(a.minLength=o),s!==void 0&&(a.maxLength=s),c?c.length===1?(a.contentMediaType=c[0],Object.assign(i,a)):(Object.assign(i,a),i.anyOf=c.map(e=>({contentMediaType:e}))):Object.assign(i,a)},AS=(e,t,n,r)=>{n.type=`boolean`},jS=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},MS=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Function types cannot be represented in JSON Schema`)},NS=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},PS=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Map cannot be represented in JSON Schema`)},FS=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Set cannot be represented in JSON Schema`)},IS=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=oS(a.element,t,U(U({},r),{},{path:[...r.path,`items`]}))},LS=(e,t,n,r)=>{var i;let a=n,o=e._zod.def;a.type=`object`,a.properties={};let s=o.shape;for(let e in s)a.properties[e]=oS(s[e],t,U(U({},r),{},{path:[...r.path,`properties`,e]}));let c=new Set(Object.keys(s)),l=new Set([...c].filter(e=>{let n=o.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));l.size>0&&(a.required=Array.from(l)),((i=o.catchall)==null?void 0:i._zod.def.type)===`never`?a.additionalProperties=!1:o.catchall?o.catchall&&(a.additionalProperties=oS(o.catchall,t,U(U({},r),{},{path:[...r.path,`additionalProperties`]}))):t.io===`output`&&(a.additionalProperties=!1)},RS=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>oS(e,t,U(U({},r),{},{path:[...r.path,a?`oneOf`:`anyOf`,n]})));a?n.oneOf=o:n.anyOf=o},zS=(e,t,n,r)=>{let i=e._zod.def,a=oS(i.left,t,U(U({},r),{},{path:[...r.path,`allOf`,0]})),o=oS(i.right,t,U(U({},r),{},{path:[...r.path,`allOf`,1]})),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},BS=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>oS(e,t,U(U({},r),{},{path:[...r.path,o,n]}))),l=a.rest?oS(a.rest,t,U(U({},r),{},{path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]})):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof d==`number`&&(i.maxItems=d)},VS=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag,c=s==null?void 0:s.patterns;if(a.mode===`loose`&&c&&c.size>0){let e=oS(a.valueType,t,U(U({},r),{},{path:[...r.path,`patternProperties`,`*`]}));i.patternProperties={};for(let t of c)i.patternProperties[t.source]=e}else(t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=oS(a.keyType,t,U(U({},r),{},{path:[...r.path,`propertyNames`]}))),i.additionalProperties=oS(a.valueType,t,U(U({},r),{},{path:[...r.path,`additionalProperties`]}));let l=o._zod.values;if(l){let e=[...l].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},HS=(e,t,n,r)=>{let i=e._zod.def,a=oS(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},US=(e,t,n,r)=>{let i=e._zod.def;oS(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},WS=(e,t,n,r)=>{let i=e._zod.def;oS(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},GS=(e,t,n,r)=>{let i=e._zod.def;oS(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},KS=(e,t,n,r)=>{let i=e._zod.def;oS(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch(e){throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},qS=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;oS(o,t,r);let s=t.seen.get(e);s.ref=o},JS=(e,t,n,r)=>{let i=e._zod.def;oS(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},YS=(e,t,n,r)=>{let i=e._zod.def;oS(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},XS=(e,t,n,r)=>{let i=e._zod.def;oS(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ZS=(e,t,n,r)=>{let i=e._zod.innerType;oS(i,t,r);let a=t.seen.get(e);a.ref=i},QS={string:pS,number:mS,boolean:hS,bigint:gS,symbol:_S,null:vS,undefined:yS,void:bS,never:xS,any:SS,unknown:CS,date:wS,enum:TS,literal:ES,nan:DS,template_literal:OS,file:kS,success:AS,custom:jS,function:MS,transform:NS,map:PS,set:FS,array:IS,object:LS,union:RS,intersection:zS,tuple:BS,record:VS,nullable:HS,nonoptional:US,default:WS,prefault:GS,catch:KS,pipe:qS,readonly:JS,promise:YS,optional:XS,lazy:ZS};function $S(e,t){if(`_idmap`in e){let n=e,r=aS(U(U({},t),{},{processors:QS})),i={};for(let e of n._idmap.entries()){let[t,n]=e;oS(n,r)}let a={};r.external={registry:n,uri:t==null?void 0:t.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;sS(r,n),a[t]=cS(r,n)}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=aS(U(U({},t),{},{processors:QS}));return oS(e,n),sS(n,e),cS(n,e)}let eC=K(`ZodISODateTime`,(e,t)=>{Xy.init(e,t),EC.init(e,t)});function tC(e){return wx(eC,e)}let nC=K(`ZodISODate`,(e,t)=>{Zy.init(e,t),EC.init(e,t)});function rC(e){return Tx(nC,e)}let iC=K(`ZodISOTime`,(e,t)=>{Qy.init(e,t),EC.init(e,t)});function aC(e){return Ex(iC,e)}let oC=K(`ZodISODuration`,(e,t)=>{$y.init(e,t),EC.init(e,t)});function sC(e){return Dx(oC,e)}let cC=K(`ZodError`,(e,t)=>{Sv.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Tv(e,t)},flatten:{value:t=>wv(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,B_,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,B_,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),lC=Ev(cC),uC=Dv(cC),dC=Ov(cC),fC=Av(cC),pC=Mv(cC),mC=Nv(cC),hC=Pv(cC),gC=Fv(cC),_C=Iv(cC),vC=Lv(cC),yC=Rv(cC),bC=zv(cC),xC=new WeakMap;function SC(e,t,n){let r=Object.getPrototypeOf(e),i=xC.get(r);if(i||(i=new Set,xC.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}let CC=K(`ZodType`,(e,t)=>(Iy.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:dS(e,`input`),output:dS(e,`output`)}}),e.toJSONSchema=uS(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>lC(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>dC(e,t,n),e.parseAsync=async(t,n)=>uC(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>fC(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>pC(e,t,n),e.decode=(t,n)=>mC(e,t,n),e.encodeAsync=async(t,n)=>hC(e,t,n),e.decodeAsync=async(t,n)=>gC(e,t,n),e.safeEncode=(t,n)=>_C(e,t,n),e.safeDecode=(t,n)=>vC(e,t,n),e.safeEncodeAsync=async(t,n)=>yC(e,t,n),e.safeDecodeAsync=async(t,n)=>bC(e,t,n),SC(e,`ZodType`,{check(...e){var t;let n=this.def;return this.clone(J_(n,{checks:[...(t=n.checks)==null?[]:t,...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return iv(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Gw(e,t))},superRefine(e,t){return this.check(Kw(e,t))},overwrite(e){return this.check(Jx(e))},optional(){return ww(this)},exactOptional(){return Ew(this)},nullable(){return Ow(this)},nullish(){return ww(Ow(this))},nonoptional(e){return Pw(this,e)},array(){return aw(this)},or(e){return uw([this,e])},and(e){return mw(this,e)},transform(e){return Rw(this,Sw(e))},default(e){return Aw(this,e)},prefault(e){return Mw(this,e)},catch(e){return Iw(this,e)},pipe(e){return Rw(this,e)},readonly(){return Bw(this)},describe(e){let t=this.clone();return ex.add(t,{description:e}),t},meta(...e){if(e.length===0)return ex.get(this);let t=this.clone();return ex.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){var t;return(t=ex.get(e))==null?void 0:t.description},configurable:!0}),e)),wC=K(`_ZodString`,(e,t)=>{var n,r,i;Ly.init(e,t),CC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pS(e,t,n,r);let a=e._zod.bag;e.format=(n=a.format)==null?null:n,e.minLength=(r=a.minimum)==null?null:r,e.maxLength=(i=a.maximum)==null?null:i,SC(e,`_ZodString`,{regex(...e){return this.check(Hx(...e))},includes(...e){return this.check(Gx(...e))},startsWith(...e){return this.check(Kx(...e))},endsWith(...e){return this.check(qx(...e))},min(...e){return this.check(Bx(...e))},max(...e){return this.check(zx(...e))},length(...e){return this.check(Vx(...e))},nonempty(...e){return this.check(Bx(1,...e))},lowercase(e){return this.check(Ux(e))},uppercase(e){return this.check(Wx(e))},trim(){return this.check(Xx())},normalize(...e){return this.check(Yx(...e))},toLowerCase(){return this.check(Zx())},toUpperCase(){return this.check(Qx())},slugify(){return this.check($x())}})}),TC=K(`ZodString`,(e,t)=>{Ly.init(e,t),wC.init(e,t),e.email=t=>e.check(nx(DC,t)),e.url=t=>e.check(cx(AC,t)),e.jwt=t=>e.check(Cx(GC,t)),e.emoji=t=>e.check(lx(jC,t)),e.guid=t=>e.check(rx(OC,t)),e.uuid=t=>e.check(ix(kC,t)),e.uuidv4=t=>e.check(ax(kC,t)),e.uuidv6=t=>e.check(ox(kC,t)),e.uuidv7=t=>e.check(sx(kC,t)),e.nanoid=t=>e.check(ux(MC,t)),e.guid=t=>e.check(rx(OC,t)),e.cuid=t=>e.check(dx(NC,t)),e.cuid2=t=>e.check(fx(PC,t)),e.ulid=t=>e.check(px(FC,t)),e.base64=t=>e.check(bx(HC,t)),e.base64url=t=>e.check(xx(UC,t)),e.xid=t=>e.check(mx(IC,t)),e.ksuid=t=>e.check(hx(LC,t)),e.ipv4=t=>e.check(gx(RC,t)),e.ipv6=t=>e.check(_x(zC,t)),e.cidrv4=t=>e.check(vx(BC,t)),e.cidrv6=t=>e.check(yx(VC,t)),e.e164=t=>e.check(Sx(WC,t)),e.datetime=t=>e.check(tC(t)),e.date=t=>e.check(rC(t)),e.time=t=>e.check(aC(t)),e.duration=t=>e.check(sC(t))});function J(e){return tx(TC,e)}let EC=K(`ZodStringFormat`,(e,t)=>{Ry.init(e,t),wC.init(e,t)}),DC=K(`ZodEmail`,(e,t)=>{Vy.init(e,t),EC.init(e,t)}),OC=K(`ZodGUID`,(e,t)=>{zy.init(e,t),EC.init(e,t)}),kC=K(`ZodUUID`,(e,t)=>{By.init(e,t),EC.init(e,t)}),AC=K(`ZodURL`,(e,t)=>{Hy.init(e,t),EC.init(e,t)}),jC=K(`ZodEmoji`,(e,t)=>{Uy.init(e,t),EC.init(e,t)}),MC=K(`ZodNanoID`,(e,t)=>{Wy.init(e,t),EC.init(e,t)}),NC=K(`ZodCUID`,(e,t)=>{Gy.init(e,t),EC.init(e,t)}),PC=K(`ZodCUID2`,(e,t)=>{Ky.init(e,t),EC.init(e,t)}),FC=K(`ZodULID`,(e,t)=>{qy.init(e,t),EC.init(e,t)}),IC=K(`ZodXID`,(e,t)=>{Jy.init(e,t),EC.init(e,t)}),LC=K(`ZodKSUID`,(e,t)=>{Yy.init(e,t),EC.init(e,t)}),RC=K(`ZodIPv4`,(e,t)=>{eb.init(e,t),EC.init(e,t)}),zC=K(`ZodIPv6`,(e,t)=>{tb.init(e,t),EC.init(e,t)}),BC=K(`ZodCIDRv4`,(e,t)=>{nb.init(e,t),EC.init(e,t)}),VC=K(`ZodCIDRv6`,(e,t)=>{rb.init(e,t),EC.init(e,t)}),HC=K(`ZodBase64`,(e,t)=>{ab.init(e,t),EC.init(e,t)}),UC=K(`ZodBase64URL`,(e,t)=>{sb.init(e,t),EC.init(e,t)}),WC=K(`ZodE164`,(e,t)=>{cb.init(e,t),EC.init(e,t)}),GC=K(`ZodJWT`,(e,t)=>{ub.init(e,t),EC.init(e,t)}),KC=K(`ZodNumber`,(e,t)=>{var n,r,i,a,o,s,c,l,u;db.init(e,t),CC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mS(e,t,n,r),SC(e,`ZodNumber`,{gt(e,t){return this.check(Ix(e,t))},gte(e,t){return this.check(Lx(e,t))},min(e,t){return this.check(Lx(e,t))},lt(e,t){return this.check(Px(e,t))},lte(e,t){return this.check(Fx(e,t))},max(e,t){return this.check(Fx(e,t))},int(e){return this.check(YC(e))},safe(e){return this.check(YC(e))},positive(e){return this.check(Ix(0,e))},nonnegative(e){return this.check(Lx(0,e))},negative(e){return this.check(Px(0,e))},nonpositive(e){return this.check(Fx(0,e))},multipleOf(e,t){return this.check(Rx(e,t))},step(e,t){return this.check(Rx(e,t))},finite(){return this}});let d=e._zod.bag;e.minValue=(n=Math.max((r=d.minimum)==null?-1/0:r,(i=d.exclusiveMinimum)==null?-1/0:i))==null?null:n,e.maxValue=(a=Math.min((o=d.maximum)==null?1/0:o,(s=d.exclusiveMaximum)==null?1/0:s))==null?null:a,e.isInt=((c=d.format)==null?``:c).includes(`int`)||Number.isSafeInteger((l=d.multipleOf)==null?.5:l),e.isFinite=!0,e.format=(u=d.format)==null?null:u});function qC(e){return Ox(KC,e)}let JC=K(`ZodNumberFormat`,(e,t)=>{fb.init(e,t),KC.init(e,t)});function YC(e){return kx(JC,e)}let XC=K(`ZodBoolean`,(e,t)=>{pb.init(e,t),CC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hS(e,t,n,r)});function ZC(e){return Ax(XC,e)}let QC=K(`ZodNull`,(e,t)=>{mb.init(e,t),CC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vS(e,t,n,r)});function $C(e){return jx(QC,e)}let ew=K(`ZodUnknown`,(e,t)=>{hb.init(e,t),CC.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function tw(){return Mx(ew)}let nw=K(`ZodNever`,(e,t)=>{gb.init(e,t),CC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xS(e,t,n,r)});function rw(e){return Nx(nw,e)}let iw=K(`ZodArray`,(e,t)=>{vb.init(e,t),CC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>IS(e,t,n,r),e.element=t.element,SC(e,`ZodArray`,{min(e,t){return this.check(Bx(e,t))},nonempty(e){return this.check(Bx(1,e))},max(e,t){return this.check(zx(e,t))},length(e,t){return this.check(Vx(e,t))},unwrap(){return this.element}})});function aw(e,t){return eS(iw,e,t)}let ow=K(`ZodObject`,(e,t)=>{Cb.init(e,t),CC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>LS(e,t,n,r),K_(e,`shape`,()=>t.shape),SC(e,`ZodObject`,{keyof(){return vw(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(U(U({},this._zod.def),{},{catchall:e}))},passthrough(){return this.clone(U(U({},this._zod.def),{},{catchall:tw()}))},loose(){return this.clone(U(U({},this._zod.def),{},{catchall:tw()}))},strict(){return this.clone(U(U({},this._zod.def),{},{catchall:rw()}))},strip(){return this.clone(U(U({},this._zod.def),{},{catchall:void 0}))},extend(e){return lv(this,e)},safeExtend(e){return uv(this,e)},merge(e){return dv(this,e)},pick(e){return sv(this,e)},omit(e){return cv(this,e)},partial(...e){return fv(Cw,this,e[0])},required(...e){return pv(Nw,this,e[0])}})});function sw(e,t){let n=U({type:`object`,shape:e==null?{}:e},q(t));return new ow(n)}function cw(e,t){return new ow(U({type:`object`,shape:e,catchall:rw()},q(t)))}let lw=K(`ZodUnion`,(e,t)=>{Tb.init(e,t),CC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>RS(e,t,n,r),e.options=t.options});function uw(e,t){return new lw(U({type:`union`,options:e},q(t)))}let dw=K(`ZodDiscriminatedUnion`,(e,t)=>{lw.init(e,t),Eb.init(e,t)});function fw(e,t,n){return new dw(U({type:`union`,options:t,discriminator:e},q(n)))}let pw=K(`ZodIntersection`,(e,t)=>{Db.init(e,t),CC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zS(e,t,n,r)});function mw(e,t){return new pw({type:`intersection`,left:e,right:t})}let hw=K(`ZodRecord`,(e,t)=>{Ab.init(e,t),CC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>VS(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function gw(e,t,n){return!t||!t._zod?new hw(U({type:`record`,keyType:J(),valueType:e},q(t))):new hw(U({type:`record`,keyType:e,valueType:t},q(n)))}let _w=K(`ZodEnum`,(e,t)=>{jb.init(e,t),CC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>TS(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new _w(U(U(U({},t),{},{checks:[]},q(r)),{},{entries:i}))},e.exclude=(e,r)=>{let i=U({},t.entries);for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new _w(U(U(U({},t),{},{checks:[]},q(r)),{},{entries:i}))}});function vw(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new _w(U({type:`enum`,entries:n},q(t)))}let yw=K(`ZodLiteral`,(e,t)=>{Mb.init(e,t),CC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ES(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function bw(e,t){return new yw(U({type:`literal`,values:Array.isArray(e)?e:[e]},q(t)))}let xw=K(`ZodTransform`,(e,t)=>{Nb.init(e,t),CC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>NS(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new F_(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(bv(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code!=null||(t.code=`custom`),t.input!=null||(t.input=n.value),t.inst!=null||(t.inst=e),n.issues.push(bv(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function Sw(e){return new xw({type:`transform`,transform:e})}let Cw=K(`ZodOptional`,(e,t)=>{Fb.init(e,t),CC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>XS(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ww(e){return new Cw({type:`optional`,innerType:e})}let Tw=K(`ZodExactOptional`,(e,t)=>{Ib.init(e,t),CC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>XS(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ew(e){return new Tw({type:`optional`,innerType:e})}let Dw=K(`ZodNullable`,(e,t)=>{Lb.init(e,t),CC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>HS(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ow(e){return new Dw({type:`nullable`,innerType:e})}let kw=K(`ZodDefault`,(e,t)=>{Rb.init(e,t),CC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>WS(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Aw(e,t){return new kw({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():tv(t)}})}let jw=K(`ZodPrefault`,(e,t)=>{Bb.init(e,t),CC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>GS(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Mw(e,t){return new jw({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():tv(t)}})}let Nw=K(`ZodNonOptional`,(e,t)=>{Vb.init(e,t),CC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>US(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Pw(e,t){return new Nw(U({type:`nonoptional`,innerType:e},q(t)))}let Fw=K(`ZodCatch`,(e,t)=>{Ub.init(e,t),CC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>KS(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Iw(e,t){return new Fw({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}let Lw=K(`ZodPipe`,(e,t)=>{Wb.init(e,t),CC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qS(e,t,n,r),e.in=t.in,e.out=t.out});function Rw(e,t){return new Lw({type:`pipe`,in:e,out:t})}let zw=K(`ZodReadonly`,(e,t)=>{Kb.init(e,t),CC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>JS(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Bw(e){return new zw({type:`readonly`,innerType:e})}let Vw=K(`ZodLazy`,(e,t)=>{Jb.init(e,t),CC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ZS(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function Hw(e){return new Vw({type:`lazy`,getter:e})}let Uw=K(`ZodCustom`,(e,t)=>{Yb.init(e,t),CC.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jS(e,t,n,r)});function Ww(e,t){return tS(Uw,e==null?(()=>!0):e,t)}function Gw(e,t={}){return nS(Uw,e,t)}function Kw(e,t){return rS(e,t)}function qw(e,t={}){let n=new Uw(U({type:`custom`,check:`custom`,fn:t=>t instanceof e,abort:!0},q(t)));return n._zod.bag.Class=e,n._zod.check=t=>{if(!(t.value instanceof e)){var r;t.issues.push({code:`invalid_type`,expected:e.name,input:t.value,inst:n,path:[...(r=n._zod.def.path)==null?[]:r]})}},n}var Jw;(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,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=>typeof t[t[e]]!=`number`),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=typeof Object.keys==`function`?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=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(Jw||(Jw={}));var Yw;(function(e){e.mergeShapes=(e,t)=>U(U({},e),t)})(Yw||(Yw={}));let Y=Jw.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),Xw=e=>{switch(typeof e){case`undefined`:return Y.undefined;case`string`:return Y.string;case`number`:return Number.isNaN(e)?Y.nan:Y.number;case`boolean`:return Y.boolean;case`function`:return Y.function;case`bigint`:return Y.bigint;case`symbol`:return Y.symbol;case`object`:return Array.isArray(e)?Y.array:e===null?Y.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?Y.promise:typeof Map<`u`&&e instanceof Map?Y.map:typeof Set<`u`&&e instanceof Set?Y.set:typeof Date<`u`&&e instanceof Date?Y.date:Y.object;default:return Y.unknown}},X=Jw.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`]);var Zw=class e 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(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)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(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Jw.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=e=>e.message){let t=Object.create(null),n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};Zw.create=e=>new Zw(e);let Qw=(e,t)=>{let n;switch(e.code){case X.invalid_type:n=e.received===Y.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case X.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Jw.jsonStringifyReplacer)}`;break;case X.unrecognized_keys:n=`Unrecognized key(s) in object: ${Jw.joinValues(e.keys,`, `)}`;break;case X.invalid_union:n=`Invalid input`;break;case X.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Jw.joinValues(e.options)}`;break;case X.invalid_enum_value:n=`Invalid enum value. Expected ${Jw.joinValues(e.options)}, received '${e.received}'`;break;case X.invalid_arguments:n=`Invalid function arguments`;break;case X.invalid_return_type:n=`Invalid function return type`;break;case X.invalid_date:n=`Invalid date`;break;case X.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(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}"`:Jw.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case X.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`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 X.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case X.custom:n=`Invalid input`;break;case X.invalid_intersection_types:n=`Intersection results could not be merged`;break;case X.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case X.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,Jw.assertNever(e)}return{message:n}},$w=Qw;function eT(){return $w}let tT=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o=U(U({},i),{},{path:a});if(i.message!==void 0)return U(U({},i),{},{path:a,message:i.message});let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return U(U({},i),{},{path:a,message:s})};function Z(e,t){let n=eT(),r=tT({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Qw?void 0:Qw].filter(e=>!!e)});e.common.issues.push(r)}var nT=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return rT;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return rT;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}};let rT=Object.freeze({status:`aborted`}),iT=e=>({status:`dirty`,value:e}),aT=e=>({status:`valid`,value:e}),oT=e=>e.status===`aborted`,sT=e=>e.status===`dirty`,cT=e=>e.status===`valid`,lT=e=>typeof Promise<`u`&&e instanceof Promise;var Q;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e==null?void 0:e.message})(Q||(Q={}));var uT=class{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||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};let dT=(e,t)=>{if(cT(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 Zw(e.common.issues);return this._error=t,this._error}}};function fT(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;let{message:o}=e;if(t.code===`invalid_enum_value`)return{message:o==null?i.defaultError:o};if(i.data===void 0){var s;return{message:(s=o==null?r:o)==null?i.defaultError:s}}return t.code===`invalid_type`?{message:(a=o==null?n:o)==null?i.defaultError:a}:{message:i.defaultError}},description:i}}var pT=class{get description(){return this._def.description}_getType(e){return Xw(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Xw(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new nT,ctx:{common:e.parent.common,data:e.data,parsedType:Xw(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(lT(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}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:(n=t==null?void 0:t.async)!=null&&n,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Xw(e)},i=this._parseSync({data:e,path:r.path,parent:r});return dT(r,i)}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Xw(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return cT(n)?{value:n.value}:{issues:t.common.issues}}catch(e){var n;!(e==null||(n=e.message)==null||(n=n.toLowerCase())==null)&&n.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>cT(e)?{value:e.value}:{issues:t.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){var n=this;let r={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:n._def.errorMap,parent:null,data:e,parsedType:Xw(e)},i=n._parse({data:e,path:r.path,parent:r}),a=await(lT(i)?i:Promise.resolve(i));return dT(r,a)}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue(U({code:X.custom},n(t)));return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new hE({schema:this,typeName:$.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 gE.create(this,this._def)}nullable(){return _E.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return XT.create(this)}promise(){return mE.create(this,this._def)}or(e){return $T.create([this,e],this._def)}and(e){return rE.create(this,e,this._def)}transform(e){return new hE(U(U({},fT(this._def)),{},{schema:this,typeName:$.ZodEffects,effect:{type:`transform`,transform:e}}))}default(e){let t=typeof e==`function`?e:()=>e;return new vE(U(U({},fT(this._def)),{},{innerType:this,defaultValue:t,typeName:$.ZodDefault}))}brand(){return new xE(U({typeName:$.ZodBranded,type:this},fT(this._def)))}catch(e){let t=typeof e==`function`?e:()=>e;return new yE(U(U({},fT(this._def)),{},{innerType:this,catchValue:t,typeName:$.ZodCatch}))}describe(e){let t=this.constructor;return new t(U(U({},this._def),{},{description:e}))}pipe(e){return SE.create(this,e)}readonly(){return CE.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};let mT=/^c[^\s-]{8,}$/i,hT=/^[0-9a-z]+$/,gT=/^[0-9A-HJKMNP-TV-Z]{26}$/i,_T=/^[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,vT=/^[a-z0-9_-]{21}$/i,yT=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,bT=/^[-+]?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)?)??$/,xT=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ST,CT=/^(?:(?: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])$/,wT=/^(?:(?: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])$/,TT=/^(([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]))$/,ET=/^(([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])$/,DT=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,OT=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,kT=`((\\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])))`,AT=RegExp(`^${kT}$`);function jT(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function MT(e){return RegExp(`^${jT(e)}$`)}function NT(e){let t=`${kT}T${jT(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function PT(e,t){return!!((t===`v4`||!t)&&CT.test(e)||(t===`v6`||!t)&&TT.test(e))}function FT(e,t){if(!yT.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&(i==null?void 0:i.typ)!==`JWT`||!i.alg||t&&i.alg!==t)}catch(e){return!1}}function IT(e,t){return!!((t===`v4`||!t)&&wT.test(e)||(t===`v6`||!t)&&ET.test(e))}var LT=class e extends pT{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Y.string){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.string,received:t.parsedType}),rT}let t=new nT,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),Z(n,{code:X.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`max`)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),Z(n,{code:X.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`length`){let i=e.data.length>r.value,a=e.data.length<r.value;(i||a)&&(n=this._getOrReturnCtx(e,n),i?Z(n,{code:X.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}):a&&Z(n,{code:X.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if(r.kind===`email`)xT.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`email`,code:X.invalid_string,message:r.message}),t.dirty());else if(r.kind===`emoji`)ST||(ST=RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)),ST.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`emoji`,code:X.invalid_string,message:r.message}),t.dirty());else if(r.kind===`uuid`)_T.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`uuid`,code:X.invalid_string,message:r.message}),t.dirty());else if(r.kind===`nanoid`)vT.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`nanoid`,code:X.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid`)mT.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`cuid`,code:X.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid2`)hT.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`cuid2`,code:X.invalid_string,message:r.message}),t.dirty());else if(r.kind===`ulid`)gT.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`ulid`,code:X.invalid_string,message:r.message}),t.dirty());else if(r.kind===`url`)try{new URL(e.data)}catch(i){n=this._getOrReturnCtx(e,n),Z(n,{validation:`url`,code:X.invalid_string,message:r.message}),t.dirty()}else r.kind===`regex`?(r.regex.lastIndex=0,r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`regex`,code:X.invalid_string,message:r.message}),t.dirty())):r.kind===`trim`?e.data=e.data.trim():r.kind===`includes`?e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),Z(n,{code:X.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):r.kind===`toLowerCase`?e.data=e.data.toLowerCase():r.kind===`toUpperCase`?e.data=e.data.toUpperCase():r.kind===`startsWith`?e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),Z(n,{code:X.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):r.kind===`endsWith`?e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),Z(n,{code:X.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):r.kind===`datetime`?NT(r).test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{code:X.invalid_string,validation:`datetime`,message:r.message}),t.dirty()):r.kind===`date`?AT.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{code:X.invalid_string,validation:`date`,message:r.message}),t.dirty()):r.kind===`time`?MT(r).test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{code:X.invalid_string,validation:`time`,message:r.message}),t.dirty()):r.kind===`duration`?bT.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`duration`,code:X.invalid_string,message:r.message}),t.dirty()):r.kind===`ip`?PT(e.data,r.version)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`ip`,code:X.invalid_string,message:r.message}),t.dirty()):r.kind===`jwt`?FT(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`jwt`,code:X.invalid_string,message:r.message}),t.dirty()):r.kind===`cidr`?IT(e.data,r.version)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`cidr`,code:X.invalid_string,message:r.message}),t.dirty()):r.kind===`base64`?DT.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`base64`,code:X.invalid_string,message:r.message}),t.dirty()):r.kind===`base64url`?OT.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`base64url`,code:X.invalid_string,message:r.message}),t.dirty()):Jw.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),U({validation:t,code:X.invalid_string},Q.errToObj(n)))}_addCheck(t){return new e(U(U({},this._def),{},{checks:[...this._def.checks,t]}))}email(e){return this._addCheck(U({kind:`email`},Q.errToObj(e)))}url(e){return this._addCheck(U({kind:`url`},Q.errToObj(e)))}emoji(e){return this._addCheck(U({kind:`emoji`},Q.errToObj(e)))}uuid(e){return this._addCheck(U({kind:`uuid`},Q.errToObj(e)))}nanoid(e){return this._addCheck(U({kind:`nanoid`},Q.errToObj(e)))}cuid(e){return this._addCheck(U({kind:`cuid`},Q.errToObj(e)))}cuid2(e){return this._addCheck(U({kind:`cuid2`},Q.errToObj(e)))}ulid(e){return this._addCheck(U({kind:`ulid`},Q.errToObj(e)))}base64(e){return this._addCheck(U({kind:`base64`},Q.errToObj(e)))}base64url(e){return this._addCheck(U({kind:`base64url`},Q.errToObj(e)))}jwt(e){return this._addCheck(U({kind:`jwt`},Q.errToObj(e)))}ip(e){return this._addCheck(U({kind:`ip`},Q.errToObj(e)))}cidr(e){return this._addCheck(U({kind:`cidr`},Q.errToObj(e)))}datetime(e){var t,n;return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck(U({kind:`datetime`,precision:(e==null?void 0:e.precision)===void 0?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!=null&&t,local:(n=e==null?void 0:e.local)!=null&&n},Q.errToObj(e==null?void 0:e.message)))}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck(U({kind:`time`,precision:(e==null?void 0:e.precision)===void 0?null:e==null?void 0:e.precision},Q.errToObj(e==null?void 0:e.message)))}duration(e){return this._addCheck(U({kind:`duration`},Q.errToObj(e)))}regex(e,t){return this._addCheck(U({kind:`regex`,regex:e},Q.errToObj(t)))}includes(e,t){return this._addCheck(U({kind:`includes`,value:e,position:t==null?void 0:t.position},Q.errToObj(t==null?void 0:t.message)))}startsWith(e,t){return this._addCheck(U({kind:`startsWith`,value:e},Q.errToObj(t)))}endsWith(e,t){return this._addCheck(U({kind:`endsWith`,value:e},Q.errToObj(t)))}min(e,t){return this._addCheck(U({kind:`min`,value:e},Q.errToObj(t)))}max(e,t){return this._addCheck(U({kind:`max`,value:e},Q.errToObj(t)))}length(e,t){return this._addCheck(U({kind:`length`,value:e},Q.errToObj(t)))}nonempty(e){return this.min(1,Q.errToObj(e))}trim(){return new e(U(U({},this._def),{},{checks:[...this._def.checks,{kind:`trim`}]}))}toLowerCase(){return new e(U(U({},this._def),{},{checks:[...this._def.checks,{kind:`toLowerCase`}]}))}toUpperCase(){return new e(U(U({},this._def),{},{checks:[...this._def.checks,{kind:`toUpperCase`}]}))}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};LT.create=e=>{var t;return new LT(U({checks:[],typeName:$.ZodString,coerce:(t=e==null?void 0:e.coerce)!=null&&t},fT(e)))};function RT(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}var zT=class e extends pT{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Y.number){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.number,received:t.parsedType}),rT}let t,n=new nT;for(let r of this._def.checks)r.kind===`int`?Jw.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),Z(t,{code:X.invalid_type,expected:`integer`,received:`float`,message:r.message}),n.dirty()):r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),Z(t,{code:X.too_small,minimum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Z(t,{code:X.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?RT(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),Z(t,{code:X.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),Z(t,{code:X.not_finite,message:r.message}),n.dirty()):Jw.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,Q.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,Q.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,Q.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,Q.toString(t))}setLimit(t,n,r,i){return new e(U(U({},this._def),{},{checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Q.toString(i)}]}))}_addCheck(t){return new e(U(U({},this._def),{},{checks:[...this._def.checks,t]}))}int(e){return this._addCheck({kind:`int`,message:Q.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:Q.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:Q.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:Q.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:Q.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:Q.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:Q.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:Q.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:Q.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind===`int`||e.kind===`multipleOf`&&Jw.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.value<e)&&(e=n.value);return Number.isFinite(t)&&Number.isFinite(e)}};zT.create=e=>new zT(U({checks:[],typeName:$.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1},fT(e)));var BT=class e extends pT{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(t){return this._getInvalidInput(e)}if(this._getType(e)!==Y.bigint)return this._getInvalidInput(e);let t,n=new nT;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),Z(t,{code:X.too_small,type:`bigint`,minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Z(t,{code:X.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),Z(t,{code:X.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):Jw.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.bigint,received:t.parsedType}),rT}gte(e,t){return this.setLimit(`min`,e,!0,Q.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,Q.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,Q.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,Q.toString(t))}setLimit(t,n,r,i){return new e(U(U({},this._def),{},{checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Q.toString(i)}]}))}_addCheck(t){return new e(U(U({},this._def),{},{checks:[...this._def.checks,t]}))}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:Q.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:Q.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:Q.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:Q.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:Q.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};BT.create=e=>{var t;return new BT(U({checks:[],typeName:$.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!=null&&t},fT(e)))};var VT=class extends pT{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Y.boolean){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.boolean,received:t.parsedType}),rT}return aT(e.data)}};VT.create=e=>new VT(U({typeName:$.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1},fT(e)));var HT=class e extends pT{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Y.date){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.date,received:t.parsedType}),rT}if(Number.isNaN(e.data.getTime()))return Z(this._getOrReturnCtx(e),{code:X.invalid_date}),rT;let t=new nT,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),Z(n,{code:X.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:`date`}),t.dirty()):r.kind===`max`?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),Z(n,{code:X.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):Jw.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e(U(U({},this._def),{},{checks:[...this._def.checks,t]}))}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:Q.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:Q.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e==null?null:new Date(e)}};HT.create=e=>new HT(U({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:$.ZodDate},fT(e)));var UT=class extends pT{_parse(e){if(this._getType(e)!==Y.symbol){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.symbol,received:t.parsedType}),rT}return aT(e.data)}};UT.create=e=>new UT(U({typeName:$.ZodSymbol},fT(e)));var WT=class extends pT{_parse(e){if(this._getType(e)!==Y.undefined){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.undefined,received:t.parsedType}),rT}return aT(e.data)}};WT.create=e=>new WT(U({typeName:$.ZodUndefined},fT(e)));var GT=class extends pT{_parse(e){if(this._getType(e)!==Y.null){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.null,received:t.parsedType}),rT}return aT(e.data)}};GT.create=e=>new GT(U({typeName:$.ZodNull},fT(e)));var KT=class extends pT{constructor(){super(...arguments),this._any=!0}_parse(e){return aT(e.data)}};KT.create=e=>new KT(U({typeName:$.ZodAny},fT(e)));var qT=class extends pT{constructor(){super(...arguments),this._unknown=!0}_parse(e){return aT(e.data)}};qT.create=e=>new qT(U({typeName:$.ZodUnknown},fT(e)));var JT=class extends pT{_parse(e){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.never,received:t.parsedType}),rT}};JT.create=e=>new JT(U({typeName:$.ZodNever},fT(e)));var YT=class extends pT{_parse(e){if(this._getType(e)!==Y.undefined){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.void,received:t.parsedType}),rT}return aT(e.data)}};YT.create=e=>new YT(U({typeName:$.ZodVoid},fT(e)));var XT=class e extends pT{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==Y.array)return Z(t,{code:X.invalid_type,expected:Y.array,received:t.parsedType}),rT;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(Z(t,{code:e?X.too_big:X.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(r.minLength!==null&&t.data.length<r.minLength.value&&(Z(t,{code:X.too_small,minimum:r.minLength.value,type:`array`,inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(Z(t,{code:X.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 uT(t,e,t.path,n)))).then(e=>nT.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new uT(t,e,t.path,n)));return nT.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e(U(U({},this._def),{},{minLength:{value:t,message:Q.toString(n)}}))}max(t,n){return new e(U(U({},this._def),{},{maxLength:{value:t,message:Q.toString(n)}}))}length(t,n){return new e(U(U({},this._def),{},{exactLength:{value:t,message:Q.toString(n)}}))}nonempty(e){return this.min(1,e)}};XT.create=(e,t)=>new XT(U({type:e,minLength:null,maxLength:null,exactLength:null,typeName:$.ZodArray},fT(t)));function ZT(e){if(e instanceof QT){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=gE.create(ZT(r))}return new QT(U(U({},e._def),{},{shape:()=>t}))}else if(e instanceof XT)return new XT(U(U({},e._def),{},{type:ZT(e.element)}));else if(e instanceof gE)return gE.create(ZT(e.unwrap()));else if(e instanceof _E)return _E.create(ZT(e.unwrap()));else if(e instanceof iE)return iE.create(e.items.map(e=>ZT(e)));else return e}var QT=class e extends pT{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=Jw.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==Y.object){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.object,received:t.parsedType}),rT}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof JT&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=r[e],i=n.data[e];o.push({key:{status:`valid`,value:e},value:t._parse(new uT(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof JT){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of a)o.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)a.length>0&&(Z(n,{code:X.unrecognized_keys,keys:a}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];o.push({key:{status:`valid`,value:t},value:e._parse(new uT(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>nT.mergeObjectSync(t,e)):nT.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return Q.errToObj,new e(U(U({},this._def),{},{unknownKeys:`strict`},t===void 0?{}:{errorMap:(e,n)=>{var r,i,a,o;let s=(r=(i=(a=this._def).errorMap)==null?void 0:i.call(a,e,n).message)==null?n.defaultError:r;return e.code===`unrecognized_keys`?{message:(o=Q.errToObj(t).message)==null?s:o}:{message:s}}}))}strip(){return new e(U(U({},this._def),{},{unknownKeys:`strip`}))}passthrough(){return new e(U(U({},this._def),{},{unknownKeys:`passthrough`}))}extend(t){return new e(U(U({},this._def),{},{shape:()=>U(U({},this._def.shape()),t)}))}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>U(U({},this._def.shape()),t._def.shape()),typeName:$.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e(U(U({},this._def),{},{catchall:t}))}pick(t){let n={};for(let e of Jw.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e(U(U({},this._def),{},{shape:()=>n}))}omit(t){let n={};for(let e of Jw.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e(U(U({},this._def),{},{shape:()=>n}))}deepPartial(){return ZT(this)}partial(t){let n={};for(let e of Jw.objectKeys(this.shape)){let r=this.shape[e];t&&!t[e]?n[e]=r:n[e]=r.optional()}return new e(U(U({},this._def),{},{shape:()=>n}))}required(t){let n={};for(let e of Jw.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof gE;)t=t._def.innerType;n[e]=t}return new e(U(U({},this._def),{},{shape:()=>n}))}keyof(){return dE(Jw.objectKeys(this.shape))}};QT.create=(e,t)=>new QT(U({shape:()=>e,unknownKeys:`strip`,catchall:JT.create(),typeName:$.ZodObject},fT(t))),QT.strictCreate=(e,t)=>new QT(U({shape:()=>e,unknownKeys:`strict`,catchall:JT.create(),typeName:$.ZodObject},fT(t))),QT.lazycreate=(e,t)=>new QT(U({shape:e,unknownKeys:`strip`,catchall:JT.create(),typeName:$.ZodObject},fT(t)));var $T=class extends pT{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new Zw(e.ctx.common.issues));return Z(t,{code:X.invalid_union,unionErrors:n}),rT}if(t.common.async)return Promise.all(n.map(async e=>{let n=U(U({},t),{},{common:U(U({},t.common),{},{issues:[]}),parent:null});return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n=U(U({},t),{},{common:U(U({},t.common),{},{issues:[]}),parent:null}),a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!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 Zw(e));return Z(t,{code:X.invalid_union,unionErrors:i}),rT}}get options(){return this._def.options}};$T.create=(e,t)=>new $T(U({options:e,typeName:$.ZodUnion},fT(t)));let eE=e=>e instanceof lE?eE(e.schema):e instanceof hE?eE(e.innerType()):e instanceof uE?[e.value]:e instanceof fE?e.options:e instanceof pE?Jw.objectValues(e.enum):e instanceof vE?eE(e._def.innerType):e instanceof WT?[void 0]:e instanceof GT?[null]:e instanceof gE?[void 0,...eE(e.unwrap())]:e instanceof _E?[null,...eE(e.unwrap())]:e instanceof xE||e instanceof CE?eE(e.unwrap()):e instanceof yE?eE(e._def.innerType):[];var tE=class e extends pT{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Y.object)return Z(t,{code:X.invalid_type,expected:Y.object,received:t.parsedType}),rT;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}):(Z(t,{code:X.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),rT)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=eE(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e(U({typeName:$.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i},fT(r)))}};function nE(e,t){let n=Xw(e),r=Xw(t);if(e===t)return{valid:!0,data:e};if(n===Y.object&&r===Y.object){let n=Jw.objectKeys(t),r=Jw.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i=U(U({},e),t);for(let n of r){let r=nE(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}else if(n===Y.array&&r===Y.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=nE(i,a);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}else if(n===Y.date&&r===Y.date&&+e==+t)return{valid:!0,data:e};else return{valid:!1}}var rE=class extends pT{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(oT(e)||oT(r))return rT;let i=nE(e.value,r.value);return i.valid?((sT(e)||sT(r))&&t.dirty(),{status:t.value,value:i.data}):(Z(n,{code:X.invalid_intersection_types}),rT)};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}))}};rE.create=(e,t,n)=>new rE(U({left:e,right:t,typeName:$.ZodIntersection},fT(n)));var iE=class e extends pT{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Y.array)return Z(n,{code:X.invalid_type,expected:Y.array,received:n.parsedType}),rT;if(n.data.length<this._def.items.length)return Z(n,{code:X.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),rT;!this._def.rest&&n.data.length>this._def.items.length&&(Z(n,{code:X.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 uT(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>nT.mergeArray(t,e)):nT.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e(U(U({},this._def),{},{rest:t}))}};iE.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new iE(U({items:e,typeName:$.ZodTuple,rest:null},fT(t)))};var aE=class e extends pT{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!==Y.object)return Z(n,{code:X.invalid_type,expected:Y.object,received:n.parsedType}),rT;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new uT(n,e,n.path,e)),value:a._parse(new uT(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?nT.mergeObjectAsync(t,r):nT.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof pT?new e(U({keyType:t,valueType:n,typeName:$.ZodRecord},fT(r))):new e(U({keyType:LT.create(),valueType:t,typeName:$.ZodRecord},fT(n)))}},oE=class extends pT{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!==Y.map)return Z(n,{code:X.invalid_type,expected:Y.map,received:n.parsedType}),rT;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new uT(n,e,n.path,[a,`key`])),value:i._parse(new uT(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(r.status===`aborted`||i.status===`aborted`)return rT;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}else{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return rT;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};oE.create=(e,t,n)=>new oE(U({valueType:t,keyType:e,typeName:$.ZodMap},fT(n)));var sE=class e extends pT{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Y.set)return Z(n,{code:X.invalid_type,expected:Y.set,received:n.parsedType}),rT;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(Z(n,{code:X.too_small,minimum:r.minSize.value,type:`set`,inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(Z(n,{code:X.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(r.status===`aborted`)return rT;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new uT(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e(U(U({},this._def),{},{minSize:{value:t,message:Q.toString(n)}}))}max(t,n){return new e(U(U({},this._def),{},{maxSize:{value:t,message:Q.toString(n)}}))}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};sE.create=(e,t)=>new sE(U({valueType:e,minSize:null,maxSize:null,typeName:$.ZodSet},fT(t)));var cE=class e extends pT{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Y.function)return Z(t,{code:X.invalid_type,expected:Y.function,received:t.parsedType}),rT;function n(e,n){return tT({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,eT(),Qw].filter(e=>!!e),issueData:{code:X.invalid_arguments,argumentsError:n}})}function r(e,n){return tT({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,eT(),Qw].filter(e=>!!e),issueData:{code:X.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof mE){let e=this;return aT(async function(...t){let o=new Zw([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(n(t,e)),o}),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,i).catch(e=>{throw o.addIssue(r(c,e)),o})})}else{let e=this;return aT(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new Zw([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new Zw([r(s,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e(U(U({},this._def),{},{args:iE.create(t).rest(qT.create())}))}returns(t){return new e(U(U({},this._def),{},{returns:t}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e(U({args:t||iE.create([]).rest(qT.create()),returns:n||qT.create(),typeName:$.ZodFunction},fT(r)))}},lE=class extends pT{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})}};lE.create=(e,t)=>new lE(U({getter:e,typeName:$.ZodLazy},fT(t)));var uE=class extends pT{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return Z(t,{received:t.data,code:X.invalid_literal,expected:this._def.value}),rT}return{status:`valid`,value:e.data}}get value(){return this._def.value}};uE.create=(e,t)=>new uE(U({value:e,typeName:$.ZodLiteral},fT(t)));function dE(e,t){return new fE(U({values:e,typeName:$.ZodEnum},fT(t)))}var fE=class e extends pT{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return Z(t,{expected:Jw.joinValues(n),received:t.parsedType,code:X.invalid_type}),rT}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return Z(t,{received:t.data,code:X.invalid_enum_value,options:n}),rT}return aT(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(t,n=this._def){return e.create(t,U(U({},this._def),n))}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),U(U({},this._def),n))}};fE.create=dE;var pE=class extends pT{_parse(e){let t=Jw.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Y.string&&n.parsedType!==Y.number){let e=Jw.objectValues(t);return Z(n,{expected:Jw.joinValues(e),received:n.parsedType,code:X.invalid_type}),rT}if(this._cache||(this._cache=new Set(Jw.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let e=Jw.objectValues(t);return Z(n,{received:n.data,code:X.invalid_enum_value,options:e}),rT}return aT(e.data)}get enum(){return this._def.values}};pE.create=(e,t)=>new pE(U({values:e,typeName:$.ZodNativeEnum},fT(t)));var mE=class extends pT{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==Y.promise&&t.common.async===!1?(Z(t,{code:X.invalid_type,expected:Y.promise,received:t.parsedType}),rT):aT((t.parsedType===Y.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};mE.create=(e,t)=>new mE(U({type:e,typeName:$.ZodPromise},fT(t)));var hE=class extends pT{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===$.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){var t=this;let{status:n,ctx:r}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:e=>{Z(r,e),e.fatal?n.abort():n.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),i.type===`preprocess`){let e=i.transform(r.data,a);if(r.common.async)return Promise.resolve(e).then(async e=>{if(n.value===`aborted`)return rT;let i=await t._def.schema._parseAsync({data:e,path:r.path,parent:r});return i.status===`aborted`?rT:i.status===`dirty`||n.value===`dirty`?iT(i.value):i});{if(n.value===`aborted`)return rT;let t=this._def.schema._parseSync({data:e,path:r.path,parent:r});return t.status===`aborted`?rT:t.status===`dirty`||n.value===`dirty`?iT(t.value):t}}if(i.type===`refinement`){let e=e=>{let t=i.refinement(e,a);if(r.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(r.common.async===!1){let t=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return t.status===`aborted`?rT:(t.status===`dirty`&&n.dirty(),e(t.value),{status:n.value,value:t.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(t=>t.status===`aborted`?rT:(t.status===`dirty`&&n.dirty(),e(t.value).then(()=>({status:n.value,value:t.value}))))}if(i.type===`transform`)if(r.common.async===!1){let e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!cT(e))return rT;let t=i.transform(e.value,a);if(t instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:n.value,value:t}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>cT(e)?Promise.resolve(i.transform(e.value,a)).then(e=>({status:n.value,value:e})):rT);Jw.assertNever(i)}};hE.create=(e,t,n)=>new hE(U({schema:e,typeName:$.ZodEffects,effect:t},fT(n))),hE.createWithPreprocess=(e,t,n)=>new hE(U({schema:t,effect:{type:`preprocess`,transform:e},typeName:$.ZodEffects},fT(n)));var gE=class extends pT{_parse(e){return this._getType(e)===Y.undefined?aT(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};gE.create=(e,t)=>new gE(U({innerType:e,typeName:$.ZodOptional},fT(t)));var _E=class extends pT{_parse(e){return this._getType(e)===Y.null?aT(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};_E.create=(e,t)=>new _E(U({innerType:e,typeName:$.ZodNullable},fT(t)));var vE=class extends pT{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===Y.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};vE.create=(e,t)=>new vE(U({innerType:e,typeName:$.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default},fT(t)));var yE=class extends pT{_parse(e){let{ctx:t}=this._processInputParams(e),n=U(U({},t),{},{common:U(U({},t.common),{},{issues:[]})}),r=this._def.innerType._parse({data:n.data,path:n.path,parent:U({},n)});return lT(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new Zw(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new Zw(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};yE.create=(e,t)=>new yE(U({innerType:e,typeName:$.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch},fT(t)));var bE=class extends pT{_parse(e){if(this._getType(e)!==Y.nan){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.nan,received:t.parsedType}),rT}return{status:`valid`,value:e.data}}};bE.create=e=>new bE(U({typeName:$.ZodNaN},fT(e)));var xE=class extends pT{_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}},SE=class e extends pT{_parse(e){var t=this;let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let e=await t._def.in._parseAsync({data:r.data,path:r.path,parent:r});return e.status===`aborted`?rT:e.status===`dirty`?(n.dirty(),iT(e.value)):t._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{let e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return e.status===`aborted`?rT:e.status===`dirty`?(n.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(t,n){return new e({in:t,out:n,typeName:$.ZodPipeline})}},CE=class extends pT{_parse(e){let t=this._def.innerType._parse(e),n=e=>(cT(e)&&(e.value=Object.freeze(e.value)),e);return lT(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};CE.create=(e,t)=>new CE(U({innerType:e,typeName:$.ZodReadonly},fT(t))),QT.lazycreate;var $;(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`})($||($={})),LT.create,zT.create,bE.create,BT.create,VT.create,HT.create,UT.create,WT.create,GT.create,KT.create,qT.create,JT.create,YT.create,XT.create,QT.create,QT.strictCreate,$T.create,tE.create,rE.create,iE.create,aE.create,oE.create,sE.create,cE.create,lE.create,uE.create,fE.create,pE.create,mE.create,hE.create,gE.create,_E.create,hE.createWithPreprocess,SE.create;let wE=[`additionalProperties`],TE=[`type`],EE=[`type`];var DE=({prefix:e,size:t=16,alphabet:n=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`,separator:r=`-`}={})=>{let i=()=>{let e=n.length,r=Array(t);for(let i=0;i<t;i++)r[i]=n[Math.random()*e|0];return r.join(``)};if(e==null)return i;if(n.includes(r))throw new m_({argument:`separator`,message:`The separator "${r}" must not be part of the alphabet "${n}".`});return()=>`${e}${r}${i()}`},OE=DE();function kE(e){if(e==null)return{};let t={};if(e instanceof Headers)e.forEach((e,n)=>{t[n.toLowerCase()]=e});else{Array.isArray(e)||(e=Object.entries(e));for(let[n,r]of e)r!=null&&(t[n.toLowerCase()]=r)}return t}var AE=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,jE=/"(?: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 ME(e){let t=JSON.parse(e);return typeof t!=`object`||!t||AE.test(e)===!1&&jE.test(e)===!1?t:NE(t)}function NE(e){let t=[e];for(;t.length;){let e=t;t=[];for(let n of e){if(Object.prototype.hasOwnProperty.call(n,`__proto__`)||Object.prototype.hasOwnProperty.call(n,`constructor`)&&n.constructor!==null&&typeof n.constructor==`object`&&Object.prototype.hasOwnProperty.call(n.constructor,`prototype`))throw SyntaxError(`Object contains forbidden prototype property`);for(let e in n){let r=n[e];r&&typeof r==`object`&&t.push(r)}}}return e}function PE(e){let{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch(t){return ME(e)}try{return ME(e)}finally{Error.stackTraceLimit=t}}var FE=Symbol.for(`vercel.ai.validator`);function IE(e){return{[FE]:!0,validate:e}}function LE(e){return typeof e==`object`&&!!e&&FE in e&&e[FE]===!0&&`validate`in e}function RE(e){let t;return()=>(t==null&&(t=e()),t)}function zE(e){return LE(e)?e:`~standard`in e?BE(e):e()}function BE(e){return IE(async t=>{let n=await e[`~standard`].validate(t);return n.issues==null?{success:!0,value:n.value}:{success:!1,error:new E_({value:t,cause:n.issues})}})}async function VE({value:e,schema:t}){let n=await HE({value:e,schema:t});if(!n.success)throw E_.wrap({value:e,cause:n.error});return n.value}async function HE({value:e,schema:t}){let n=zE(t);try{if(n.validate==null)return{success:!0,value:e,rawValue:e};let t=await n.validate(e);return t.success?{success:!0,value:t.value,rawValue:e}:{success:!1,error:E_.wrap({value:e,cause:t.error}),rawValue:e}}catch(t){return{success:!1,error:E_.wrap({value:e,cause:t}),rawValue:e}}}async function UE({text:e,schema:t}){try{let n=PE(e);return t==null?{success:!0,value:n,rawValue:n}:await HE({value:n,schema:t})}catch(t){return{success:!1,error:b_.isInstance(t)?t:new b_({text:e,cause:t}),rawValue:void 0}}}function WE({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new M_).pipeThrough(new TransformStream({async transform({data:e},n){e!==`[DONE]`&&n.enqueue(await UE({text:e,schema:t}))}}))}async function GE(e){return typeof e==`function`&&(e=e()),Promise.resolve(e)}new TextDecoder;var KE=Symbol.for(`vercel.ai.schema`);function qE(e,{validate:t}={}){return{[KE]:!0,_type:void 0,[FE]:!0,get jsonSchema(){return typeof e==`function`&&(e=e()),e},validate:t}}function JE(e){if(e.type===`object`){e.additionalProperties=!1;let t=e.properties;if(t!=null)for(let e in t)t[e]=JE(t[e])}return e.type===`array`&&e.items!=null&&(Array.isArray(e.items)?e.items=e.items.map(e=>JE(e)):e.items=JE(e.items)),e}var YE=Symbol(`Let zodToJsonSchema decide on which parser to use`),XE={name:void 0,$refStrategy:`root`,basePath:[`#`],effectStrategy:`input`,pipeStrategy:`all`,dateStrategy:`format:date-time`,mapStrategy:`entries`,removeAdditionalStrategy:`passthrough`,allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:`definitions`,strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:`escape`,applyRegexFlags:!1,emailStrategy:`format:email`,base64Strategy:`contentEncoding:base64`,nameStrategy:`ref`},ZE=e=>typeof e==`string`?U(U({},XE),{},{name:e}):U(U({},XE),e);function QE(){return{}}function $E(e,t){var n,r,i;let a={type:`array`};return(n=e.type)!=null&&n._def&&((i=(r=e.type)==null?void 0:r._def)==null?void 0:i.typeName)!==$.ZodAny&&(a.items=WD(e.type._def,U(U({},t),{},{currentPath:[...t.currentPath,`items`]}))),e.minLength&&(a.minItems=e.minLength.value),e.maxLength&&(a.maxItems=e.maxLength.value),e.exactLength&&(a.minItems=e.exactLength.value,a.maxItems=e.exactLength.value),a}function eD(e){let t={type:`integer`,format:`int64`};if(!e.checks)return t;for(let n of e.checks)switch(n.kind){case`min`:n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case`max`:n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case`multipleOf`:t.multipleOf=n.value;break}return t}function tD(){return{type:`boolean`}}function nD(e,t){return WD(e.type._def,t)}var rD=(e,t)=>WD(e.innerType._def,t);function iD(e,t,n){let r=n==null?t.dateStrategy:n;if(Array.isArray(r))return{anyOf:r.map((n,r)=>iD(e,t,n))};switch(r){case`string`:case`format:date-time`:return{type:`string`,format:`date-time`};case`format:date`:return{type:`string`,format:`date`};case`integer`:return aD(e)}}var aD=e=>{let t={type:`integer`,format:`unix-time`};for(let n of e.checks)switch(n.kind){case`min`:t.minimum=n.value;break;case`max`:t.maximum=n.value;break}return t};function oD(e,t){return U(U({},WD(e.innerType._def,t)),{},{default:e.defaultValue()})}function sD(e,t){return t.effectStrategy===`input`?WD(e.schema._def,t):QE()}function cD(e){return{type:`string`,enum:Array.from(e.values)}}var lD=e=>`type`in e&&e.type===`string`?!1:`allOf`in e;function uD(e,t){let n=[WD(e.left._def,U(U({},t),{},{currentPath:[...t.currentPath,`allOf`,`0`]})),WD(e.right._def,U(U({},t),{},{currentPath:[...t.currentPath,`allOf`,`1`]}))].filter(e=>!!e),r=[];return n.forEach(e=>{if(lD(e))r.push(...e.allOf);else{let t=e;if(`additionalProperties`in e&&e.additionalProperties===!1){let{additionalProperties:n}=e;t=vr(e,wE)}r.push(t)}}),r.length?{allOf:r}:void 0}function dD(e){let t=typeof e.value;return t!==`bigint`&&t!==`number`&&t!==`boolean`&&t!==`string`?{type:Array.isArray(e.value)?`array`:`object`}:{type:t===`bigint`?`integer`:t,const:e.value}}var fD=void 0,pD={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:()=>(fD===void 0&&(fD=RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)),fD),uuid:/^[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}$/,ipv4:/^(?:(?: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])$/,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])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,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 mD(e,t){let n={type:`string`};if(e.checks)for(let r of e.checks)switch(r.kind){case`min`:n.minLength=typeof n.minLength==`number`?Math.max(n.minLength,r.value):r.value;break;case`max`:n.maxLength=typeof n.maxLength==`number`?Math.min(n.maxLength,r.value):r.value;break;case`email`:switch(t.emailStrategy){case`format:email`:vD(n,`email`,r.message,t);break;case`format:idn-email`:vD(n,`idn-email`,r.message,t);break;case`pattern:zod`:yD(n,pD.email,r.message,t);break}break;case`url`:vD(n,`uri`,r.message,t);break;case`uuid`:vD(n,`uuid`,r.message,t);break;case`regex`:yD(n,r.regex,r.message,t);break;case`cuid`:yD(n,pD.cuid,r.message,t);break;case`cuid2`:yD(n,pD.cuid2,r.message,t);break;case`startsWith`:yD(n,RegExp(`^${hD(r.value,t)}`),r.message,t);break;case`endsWith`:yD(n,RegExp(`${hD(r.value,t)}$`),r.message,t);break;case`datetime`:vD(n,`date-time`,r.message,t);break;case`date`:vD(n,`date`,r.message,t);break;case`time`:vD(n,`time`,r.message,t);break;case`duration`:vD(n,`duration`,r.message,t);break;case`length`:n.minLength=typeof n.minLength==`number`?Math.max(n.minLength,r.value):r.value,n.maxLength=typeof n.maxLength==`number`?Math.min(n.maxLength,r.value):r.value;break;case`includes`:yD(n,RegExp(hD(r.value,t)),r.message,t);break;case`ip`:r.version!==`v6`&&vD(n,`ipv4`,r.message,t),r.version!==`v4`&&vD(n,`ipv6`,r.message,t);break;case`base64url`:yD(n,pD.base64url,r.message,t);break;case`jwt`:yD(n,pD.jwt,r.message,t);break;case`cidr`:r.version!==`v6`&&yD(n,pD.ipv4Cidr,r.message,t),r.version!==`v4`&&yD(n,pD.ipv6Cidr,r.message,t);break;case`emoji`:yD(n,pD.emoji(),r.message,t);break;case`ulid`:yD(n,pD.ulid,r.message,t);break;case`base64`:switch(t.base64Strategy){case`format:binary`:vD(n,`binary`,r.message,t);break;case`contentEncoding:base64`:n.contentEncoding=`base64`;break;case`pattern:zod`:yD(n,pD.base64,r.message,t);break}break;case`nanoid`:yD(n,pD.nanoid,r.message,t);case`toLowerCase`:case`toUpperCase`:case`trim`:break;default:}return n}function hD(e,t){return t.patternStrategy===`escape`?_D(e):e}var gD=new Set(`ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789`);function _D(e){let t=``;for(let n=0;n<e.length;n++)gD.has(e[n])||(t+=`\\`),t+=e[n];return t}function vD(e,t,n,r){var i;e.format||(i=e.anyOf)!=null&&i.some(e=>e.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format}),delete e.format),e.anyOf.push(U({format:t},n&&r.errorMessages&&{errorMessage:{format:n}}))):e.format=t}function yD(e,t,n,r){var i;e.pattern||(i=e.allOf)!=null&&i.some(e=>e.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern}),delete e.pattern),e.allOf.push(U({pattern:bD(t,r)},n&&r.errorMessages&&{errorMessage:{pattern:n}}))):e.pattern=bD(t,r)}function bD(e,t){var n;if(!t.applyRegexFlags||!e.flags)return e.source;let r={i:e.flags.includes(`i`),m:e.flags.includes(`m`),s:e.flags.includes(`s`)},i=r.i?e.source.toLowerCase():e.source,a=``,o=!1,s=!1,c=!1;for(let e=0;e<i.length;e++){if(o){a+=i[e],o=!1;continue}if(r.i){if(s){if(i[e].match(/[a-z]/)){c?(a+=i[e],a+=`${i[e-2]}-${i[e]}`.toUpperCase(),c=!1):i[e+1]===`-`&&(n=i[e+2])!=null&&n.match(/[a-z]/)?(a+=i[e],c=!0):a+=`${i[e]}${i[e].toUpperCase()}`;continue}}else if(i[e].match(/[a-z]/)){a+=`[${i[e]}${i[e].toUpperCase()}]`;continue}}if(r.m){if(i[e]===`^`){a+=`(^|(?<=[\r
100
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}}for(let n of e.seen.entries()){var c;let r=n[1];if(t===n[0]){o(n);continue}if(e.external){var l;let r=(l=e.external.registry.get(n[0]))==null?void 0:l.id;if(t!==n[0]&&r){o(n);continue}}if((c=e.metadataRegistry.get(n[0]))!=null&&c.id){o(n);continue}if(r.cycle){o(n);continue}if(r.count>1&&e.reused===`ref`){o(n);continue}}}function Pb(e,t){var n,r,i,a,o;let s=e.seen.get(t);if(!s)throw Error(`Unprocessed schema. This is a bug in Zod.`);let c=t=>{var n,r;let i=e.seen.get(t);if(i.ref===null)return;let a=(n=i.def)==null?i.schema:n,o=U({},a),s=i.ref;if(i.ref=null,s){c(s);let n=e.seen.get(s),r=n.schema;if(r.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)){var l;a.allOf=(l=a.allOf)==null?[]:l,a.allOf.push(r)}else Object.assign(a,r);if(Object.assign(a,o),t._zod.parent===s)for(let e in a)e===`$ref`||e===`allOf`||e in o||delete a[e];if(r.$ref&&n.def)for(let e in a)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(a[e])===JSON.stringify(n.def[e])&&delete a[e]}let u=t._zod.parent;if(u&&u!==s){c(u);let t=e.seen.get(u);if(t!=null&&t.schema.$ref&&(a.$ref=t.schema.$ref,t.def))for(let e in a)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(a[e])===JSON.stringify(t.def[e])&&delete a[e]}e.override({zodSchema:t,jsonSchema:a,path:(r=i.path)==null?[]:r})};for(let t of[...e.seen.entries()].reverse())c(t[0]);let l={};if(e.target===`draft-2020-12`?l.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?l.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?l.$schema=`http://json-schema.org/draft-04/schema#`:e.target,(n=e.external)!=null&&n.uri){var u;let n=(u=e.external.registry.get(t))==null?void 0:u.id;if(!n)throw Error("Schema is missing an `id` property");l.$id=e.external.uri(n)}Object.assign(l,(r=s.def)==null?s.schema:r);let d=(i=e.metadataRegistry.get(t))==null?void 0:i.id;d!==void 0&&l.id===d&&delete l.id;let f=(a=(o=e.external)==null?void 0:o.defs)==null?{}:a;for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,f[e.defId]=e.def)}e.external||Object.keys(f).length>0&&(e.target===`draft-2020-12`?l.$defs=f:l.definitions=f);try{let n=JSON.parse(JSON.stringify(l));return Object.defineProperty(n,"~standard",{value:U(U({},t[`~standard`]),{},{jsonSchema:{input:Lb(t,`input`,e.processors),output:Lb(t,`output`,e.processors)}}),enumerable:!1,writable:!1}),n}catch(e){throw Error(`Error converting schema to JSON.`)}}function Fb(e,t){let n=t==null?{seen:new Set}:t;if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Fb(r.element,n);if(r.type===`set`)return Fb(r.valueType,n);if(r.type===`lazy`)return Fb(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return Fb(r.innerType,n);if(r.type===`intersection`)return Fb(r.left,n)||Fb(r.right,n);if(r.type===`record`||r.type===`map`)return Fb(r.keyType,n)||Fb(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Fb(r.in,n)||Fb(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Fb(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Fb(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Fb(e,n))return!0;return!!(r.rest&&Fb(r.rest,n))}return!1}let Ib=(e,t={})=>n=>{let r=jb(U(U({},n),{},{processors:t}));return Mb(e,r),Nb(r,e),Pb(r,e)},Lb=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r==null?{}:r,o=jb(U(U({},i==null?{}:i),{},{target:a,io:t,processors:n}));return Mb(e,o),Nb(o,e),Pb(o,e)},Rb={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},zb=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s){var u;i.format=(u=Rb[s])==null?s:u,i.format===``&&delete i.format,s===`time`&&delete i.format}if(l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>U(U({},t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{}),{},{pattern:e.source}))])}},Bb=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a==null?-1/0:a),f=typeof l==`number`&&l<=(o==null?1/0:o),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},Vb=(e,t,n,r)=>{n.type=`boolean`},Hb=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`BigInt cannot be represented in JSON Schema`)},Ub=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Symbols cannot be represented in JSON Schema`)},Wb=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Gb=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Undefined cannot be represented in JSON Schema`)},Kb=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Void cannot be represented in JSON Schema`)},qb=(e,t,n,r)=>{n.not={}},Jb=(e,t,n,r)=>{},Yb=(e,t,n,r)=>{},Xb=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Date cannot be represented in JSON Schema`)},Zb=(e,t,n,r)=>{let i=e._zod.def,a=dg(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Qb=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},$b=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`NaN cannot be represented in JSON Schema`)},ex=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},tx=(e,t,n,r)=>{let i=n,a={type:`string`,format:`binary`,contentEncoding:`binary`},{minimum:o,maximum:s,mime:c}=e._zod.bag;o!==void 0&&(a.minLength=o),s!==void 0&&(a.maxLength=s),c?c.length===1?(a.contentMediaType=c[0],Object.assign(i,a)):(Object.assign(i,a),i.anyOf=c.map(e=>({contentMediaType:e}))):Object.assign(i,a)},nx=(e,t,n,r)=>{n.type=`boolean`},rx=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},ix=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Function types cannot be represented in JSON Schema`)},ax=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},ox=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Map cannot be represented in JSON Schema`)},sx=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Set cannot be represented in JSON Schema`)},cx=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Mb(a.element,t,U(U({},r),{},{path:[...r.path,`items`]}))},lx=(e,t,n,r)=>{var i;let a=n,o=e._zod.def;a.type=`object`,a.properties={};let s=o.shape;for(let e in s)a.properties[e]=Mb(s[e],t,U(U({},r),{},{path:[...r.path,`properties`,e]}));let c=new Set(Object.keys(s)),l=new Set([...c].filter(e=>{let n=o.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));l.size>0&&(a.required=Array.from(l)),((i=o.catchall)==null?void 0:i._zod.def.type)===`never`?a.additionalProperties=!1:o.catchall?o.catchall&&(a.additionalProperties=Mb(o.catchall,t,U(U({},r),{},{path:[...r.path,`additionalProperties`]}))):t.io===`output`&&(a.additionalProperties=!1)},ux=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Mb(e,t,U(U({},r),{},{path:[...r.path,a?`oneOf`:`anyOf`,n]})));a?n.oneOf=o:n.anyOf=o},dx=(e,t,n,r)=>{let i=e._zod.def,a=Mb(i.left,t,U(U({},r),{},{path:[...r.path,`allOf`,0]})),o=Mb(i.right,t,U(U({},r),{},{path:[...r.path,`allOf`,1]})),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},fx=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>Mb(e,t,U(U({},r),{},{path:[...r.path,o,n]}))),l=a.rest?Mb(a.rest,t,U(U({},r),{},{path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]})):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof d==`number`&&(i.maxItems=d)},px=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag,c=s==null?void 0:s.patterns;if(a.mode===`loose`&&c&&c.size>0){let e=Mb(a.valueType,t,U(U({},r),{},{path:[...r.path,`patternProperties`,`*`]}));i.patternProperties={};for(let t of c)i.patternProperties[t.source]=e}else(t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=Mb(a.keyType,t,U(U({},r),{},{path:[...r.path,`propertyNames`]}))),i.additionalProperties=Mb(a.valueType,t,U(U({},r),{},{path:[...r.path,`additionalProperties`]}));let l=o._zod.values;if(l){let e=[...l].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},mx=(e,t,n,r)=>{let i=e._zod.def,a=Mb(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},hx=(e,t,n,r)=>{let i=e._zod.def;Mb(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},gx=(e,t,n,r)=>{let i=e._zod.def;Mb(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},_x=(e,t,n,r)=>{let i=e._zod.def;Mb(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},vx=(e,t,n,r)=>{let i=e._zod.def;Mb(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch(e){throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},yx=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;Mb(o,t,r);let s=t.seen.get(e);s.ref=o},bx=(e,t,n,r)=>{let i=e._zod.def;Mb(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},xx=(e,t,n,r)=>{let i=e._zod.def;Mb(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Sx=(e,t,n,r)=>{let i=e._zod.def;Mb(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Cx=(e,t,n,r)=>{let i=e._zod.innerType;Mb(i,t,r);let a=t.seen.get(e);a.ref=i},wx={string:zb,number:Bb,boolean:Vb,bigint:Hb,symbol:Ub,null:Wb,undefined:Gb,void:Kb,never:qb,any:Jb,unknown:Yb,date:Xb,enum:Zb,literal:Qb,nan:$b,template_literal:ex,file:tx,success:nx,custom:rx,function:ix,transform:ax,map:ox,set:sx,array:cx,object:lx,union:ux,intersection:dx,tuple:fx,record:px,nullable:mx,nonoptional:hx,default:gx,prefault:_x,catch:vx,pipe:yx,readonly:bx,promise:xx,optional:Sx,lazy:Cx};function Tx(e,t){if(`_idmap`in e){let n=e,r=jb(U(U({},t),{},{processors:wx})),i={};for(let e of n._idmap.entries()){let[t,n]=e;Mb(n,r)}let a={};r.external={registry:n,uri:t==null?void 0:t.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;Nb(r,n),a[t]=Pb(r,n)}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=jb(U(U({},t),{},{processors:wx}));return Mb(e,n),Nb(n,e),Pb(n,e)}let Ex=K(`ZodISODateTime`,(e,t)=>{Sv.init(e,t),Qx.init(e,t)});function Dx(e){return Xy(Ex,e)}let Ox=K(`ZodISODate`,(e,t)=>{Cv.init(e,t),Qx.init(e,t)});function kx(e){return Zy(Ox,e)}let Ax=K(`ZodISOTime`,(e,t)=>{wv.init(e,t),Qx.init(e,t)});function jx(e){return Qy(Ax,e)}let Mx=K(`ZodISODuration`,(e,t)=>{Tv.init(e,t),Qx.init(e,t)});function Nx(e){return $y(Mx,e)}let Px=K(`ZodError`,(e,t)=>{Jg.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Zg(e,t)},flatten:{value:t=>Xg(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,fg,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,fg,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Fx=Qg(Px),Ix=$g(Px),Lx=e_(Px),Rx=n_(Px),zx=i_(Px),Bx=a_(Px),Vx=o_(Px),Hx=s_(Px),Ux=c_(Px),Wx=l_(Px),Gx=u_(Px),Kx=d_(Px),qx=new WeakMap;function Jx(e,t,n){let r=Object.getPrototypeOf(e),i=qx.get(r);if(i||(i=new Set,qx.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}let Yx=K(`ZodType`,(e,t)=>(cv.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Lb(e,`input`),output:Lb(e,`output`)}}),e.toJSONSchema=Ib(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>Fx(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Lx(e,t,n),e.parseAsync=async(t,n)=>Ix(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Rx(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>zx(e,t,n),e.decode=(t,n)=>Bx(e,t,n),e.encodeAsync=async(t,n)=>Vx(e,t,n),e.decodeAsync=async(t,n)=>Hx(e,t,n),e.safeEncode=(t,n)=>Ux(e,t,n),e.safeDecode=(t,n)=>Wx(e,t,n),e.safeEncodeAsync=async(t,n)=>Gx(e,t,n),e.safeDecodeAsync=async(t,n)=>Kx(e,t,n),Jx(e,`ZodType`,{check(...e){var t;let n=this.def;return this.clone(bg(n,{checks:[...(t=n.checks)==null?[]:t,...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Ag(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(_C(e,t))},superRefine(e,t){return this.check(vC(e,t))},overwrite(e){return this.check(bb(e))},optional(){return XS(this)},exactOptional(){return QS(this)},nullable(){return eC(this)},nullish(){return XS(eC(this))},nonoptional(e){return oC(this,e)},array(){return jS(this)},or(e){return IS([this,e])},and(e){return BS(this,e)},transform(e){return uC(this,JS(e))},default(e){return nC(this,e)},prefault(e){return iC(this,e)},catch(e){return cC(this,e)},pipe(e){return uC(this,e)},readonly(){return fC(this)},describe(e){let t=this.clone();return Ey.add(t,{description:e}),t},meta(...e){if(e.length===0)return Ey.get(this);let t=this.clone();return Ey.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){var t;return(t=Ey.get(e))==null?void 0:t.description},configurable:!0}),e)),Xx=K(`_ZodString`,(e,t)=>{var n,r,i;lv.init(e,t),Yx.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zb(e,t,n,r);let a=e._zod.bag;e.format=(n=a.format)==null?null:n,e.minLength=(r=a.minimum)==null?null:r,e.maxLength=(i=a.maximum)==null?null:i,Jx(e,`_ZodString`,{regex(...e){return this.check(mb(...e))},includes(...e){return this.check(_b(...e))},startsWith(...e){return this.check(vb(...e))},endsWith(...e){return this.check(yb(...e))},min(...e){return this.check(fb(...e))},max(...e){return this.check(db(...e))},length(...e){return this.check(pb(...e))},nonempty(...e){return this.check(fb(1,...e))},lowercase(e){return this.check(hb(e))},uppercase(e){return this.check(gb(e))},trim(){return this.check(Sb())},normalize(...e){return this.check(xb(...e))},toLowerCase(){return this.check(Cb())},toUpperCase(){return this.check(wb())},slugify(){return this.check(Tb())}})}),Zx=K(`ZodString`,(e,t)=>{lv.init(e,t),Xx.init(e,t),e.email=t=>e.check(Oy($x,t)),e.url=t=>e.check(Py(nS,t)),e.jwt=t=>e.check(Yy(_S,t)),e.emoji=t=>e.check(Fy(rS,t)),e.guid=t=>e.check(ky(eS,t)),e.uuid=t=>e.check(Ay(tS,t)),e.uuidv4=t=>e.check(jy(tS,t)),e.uuidv6=t=>e.check(My(tS,t)),e.uuidv7=t=>e.check(Ny(tS,t)),e.nanoid=t=>e.check(Iy(iS,t)),e.guid=t=>e.check(ky(eS,t)),e.cuid=t=>e.check(Ly(aS,t)),e.cuid2=t=>e.check(Ry(oS,t)),e.ulid=t=>e.check(zy(sS,t)),e.base64=t=>e.check(Ky(mS,t)),e.base64url=t=>e.check(qy(hS,t)),e.xid=t=>e.check(By(cS,t)),e.ksuid=t=>e.check(Vy(lS,t)),e.ipv4=t=>e.check(Hy(uS,t)),e.ipv6=t=>e.check(Uy(dS,t)),e.cidrv4=t=>e.check(Wy(fS,t)),e.cidrv6=t=>e.check(Gy(pS,t)),e.e164=t=>e.check(Jy(gS,t)),e.datetime=t=>e.check(Dx(t)),e.date=t=>e.check(kx(t)),e.time=t=>e.check(jx(t)),e.duration=t=>e.check(Nx(t))});function J(e){return Dy(Zx,e)}let Qx=K(`ZodStringFormat`,(e,t)=>{uv.init(e,t),Xx.init(e,t)}),$x=K(`ZodEmail`,(e,t)=>{pv.init(e,t),Qx.init(e,t)}),eS=K(`ZodGUID`,(e,t)=>{dv.init(e,t),Qx.init(e,t)}),tS=K(`ZodUUID`,(e,t)=>{fv.init(e,t),Qx.init(e,t)}),nS=K(`ZodURL`,(e,t)=>{mv.init(e,t),Qx.init(e,t)}),rS=K(`ZodEmoji`,(e,t)=>{hv.init(e,t),Qx.init(e,t)}),iS=K(`ZodNanoID`,(e,t)=>{gv.init(e,t),Qx.init(e,t)}),aS=K(`ZodCUID`,(e,t)=>{_v.init(e,t),Qx.init(e,t)}),oS=K(`ZodCUID2`,(e,t)=>{vv.init(e,t),Qx.init(e,t)}),sS=K(`ZodULID`,(e,t)=>{yv.init(e,t),Qx.init(e,t)}),cS=K(`ZodXID`,(e,t)=>{bv.init(e,t),Qx.init(e,t)}),lS=K(`ZodKSUID`,(e,t)=>{xv.init(e,t),Qx.init(e,t)}),uS=K(`ZodIPv4`,(e,t)=>{Ev.init(e,t),Qx.init(e,t)}),dS=K(`ZodIPv6`,(e,t)=>{Dv.init(e,t),Qx.init(e,t)}),fS=K(`ZodCIDRv4`,(e,t)=>{Ov.init(e,t),Qx.init(e,t)}),pS=K(`ZodCIDRv6`,(e,t)=>{kv.init(e,t),Qx.init(e,t)}),mS=K(`ZodBase64`,(e,t)=>{jv.init(e,t),Qx.init(e,t)}),hS=K(`ZodBase64URL`,(e,t)=>{Nv.init(e,t),Qx.init(e,t)}),gS=K(`ZodE164`,(e,t)=>{Pv.init(e,t),Qx.init(e,t)}),_S=K(`ZodJWT`,(e,t)=>{Iv.init(e,t),Qx.init(e,t)}),vS=K(`ZodNumber`,(e,t)=>{var n,r,i,a,o,s,c,l,u;Lv.init(e,t),Yx.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bb(e,t,n,r),Jx(e,`ZodNumber`,{gt(e,t){return this.check(cb(e,t))},gte(e,t){return this.check(lb(e,t))},min(e,t){return this.check(lb(e,t))},lt(e,t){return this.check(ob(e,t))},lte(e,t){return this.check(sb(e,t))},max(e,t){return this.check(sb(e,t))},int(e){return this.check(xS(e))},safe(e){return this.check(xS(e))},positive(e){return this.check(cb(0,e))},nonnegative(e){return this.check(lb(0,e))},negative(e){return this.check(ob(0,e))},nonpositive(e){return this.check(sb(0,e))},multipleOf(e,t){return this.check(ub(e,t))},step(e,t){return this.check(ub(e,t))},finite(){return this}});let d=e._zod.bag;e.minValue=(n=Math.max((r=d.minimum)==null?-1/0:r,(i=d.exclusiveMinimum)==null?-1/0:i))==null?null:n,e.maxValue=(a=Math.min((o=d.maximum)==null?1/0:o,(s=d.exclusiveMaximum)==null?1/0:s))==null?null:a,e.isInt=((c=d.format)==null?``:c).includes(`int`)||Number.isSafeInteger((l=d.multipleOf)==null?.5:l),e.isFinite=!0,e.format=(u=d.format)==null?null:u});function yS(e){return eb(vS,e)}let bS=K(`ZodNumberFormat`,(e,t)=>{Rv.init(e,t),vS.init(e,t)});function xS(e){return tb(bS,e)}let SS=K(`ZodBoolean`,(e,t)=>{zv.init(e,t),Yx.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vb(e,t,n,r)});function CS(e){return nb(SS,e)}let wS=K(`ZodNull`,(e,t)=>{Bv.init(e,t),Yx.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wb(e,t,n,r)});function TS(e){return rb(wS,e)}let ES=K(`ZodUnknown`,(e,t)=>{Vv.init(e,t),Yx.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function DS(){return ib(ES)}let OS=K(`ZodNever`,(e,t)=>{Hv.init(e,t),Yx.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qb(e,t,n,r)});function kS(e){return ab(OS,e)}let AS=K(`ZodArray`,(e,t)=>{Wv.init(e,t),Yx.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cx(e,t,n,r),e.element=t.element,Jx(e,`ZodArray`,{min(e,t){return this.check(fb(e,t))},nonempty(e){return this.check(fb(1,e))},max(e,t){return this.check(db(e,t))},length(e,t){return this.check(pb(e,t))},unwrap(){return this.element}})});function jS(e,t){return Eb(AS,e,t)}let MS=K(`ZodObject`,(e,t)=>{Yv.init(e,t),Yx.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lx(e,t,n,r),vg(e,`shape`,()=>t.shape),Jx(e,`ZodObject`,{keyof(){return WS(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(U(U({},this._zod.def),{},{catchall:e}))},passthrough(){return this.clone(U(U({},this._zod.def),{},{catchall:DS()}))},loose(){return this.clone(U(U({},this._zod.def),{},{catchall:DS()}))},strict(){return this.clone(U(U({},this._zod.def),{},{catchall:kS()}))},strip(){return this.clone(U(U({},this._zod.def),{},{catchall:void 0}))},extend(e){return Fg(this,e)},safeExtend(e){return Ig(this,e)},merge(e){return Lg(this,e)},pick(e){return Ng(this,e)},omit(e){return Pg(this,e)},partial(...e){return Rg(YS,this,e[0])},required(...e){return zg(aC,this,e[0])}})});function NS(e,t){let n=U({type:`object`,shape:e==null?{}:e},q(t));return new MS(n)}function PS(e,t){return new MS(U({type:`object`,shape:e,catchall:kS()},q(t)))}let FS=K(`ZodUnion`,(e,t)=>{Zv.init(e,t),Yx.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ux(e,t,n,r),e.options=t.options});function IS(e,t){return new FS(U({type:`union`,options:e},q(t)))}let LS=K(`ZodDiscriminatedUnion`,(e,t)=>{FS.init(e,t),Qv.init(e,t)});function RS(e,t,n){return new LS(U({type:`union`,options:t,discriminator:e},q(n)))}let zS=K(`ZodIntersection`,(e,t)=>{$v.init(e,t),Yx.init(e,t),e._zod.processJSONSchema=(t,n,r)=>dx(e,t,n,r)});function BS(e,t){return new zS({type:`intersection`,left:e,right:t})}let VS=K(`ZodRecord`,(e,t)=>{ny.init(e,t),Yx.init(e,t),e._zod.processJSONSchema=(t,n,r)=>px(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function HS(e,t,n){return!t||!t._zod?new VS(U({type:`record`,keyType:J(),valueType:e},q(t))):new VS(U({type:`record`,keyType:e,valueType:t},q(n)))}let US=K(`ZodEnum`,(e,t)=>{ry.init(e,t),Yx.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zb(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new US(U(U(U({},t),{},{checks:[]},q(r)),{},{entries:i}))},e.exclude=(e,r)=>{let i=U({},t.entries);for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new US(U(U(U({},t),{},{checks:[]},q(r)),{},{entries:i}))}});function WS(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new US(U({type:`enum`,entries:n},q(t)))}let GS=K(`ZodLiteral`,(e,t)=>{iy.init(e,t),Yx.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qb(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function KS(e,t){return new GS(U({type:`literal`,values:Array.isArray(e)?e:[e]},q(t)))}let qS=K(`ZodTransform`,(e,t)=>{ay.init(e,t),Yx.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ax(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new sg(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Kg(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code!=null||(t.code=`custom`),t.input!=null||(t.input=n.value),t.inst!=null||(t.inst=e),n.issues.push(Kg(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function JS(e){return new qS({type:`transform`,transform:e})}let YS=K(`ZodOptional`,(e,t)=>{sy.init(e,t),Yx.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Sx(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function XS(e){return new YS({type:`optional`,innerType:e})}let ZS=K(`ZodExactOptional`,(e,t)=>{cy.init(e,t),Yx.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Sx(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function QS(e){return new ZS({type:`optional`,innerType:e})}let $S=K(`ZodNullable`,(e,t)=>{ly.init(e,t),Yx.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mx(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function eC(e){return new $S({type:`nullable`,innerType:e})}let tC=K(`ZodDefault`,(e,t)=>{uy.init(e,t),Yx.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gx(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function nC(e,t){return new tC({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Dg(t)}})}let rC=K(`ZodPrefault`,(e,t)=>{fy.init(e,t),Yx.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_x(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function iC(e,t){return new rC({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Dg(t)}})}let aC=K(`ZodNonOptional`,(e,t)=>{py.init(e,t),Yx.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hx(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function oC(e,t){return new aC(U({type:`nonoptional`,innerType:e},q(t)))}let sC=K(`ZodCatch`,(e,t)=>{hy.init(e,t),Yx.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vx(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function cC(e,t){return new sC({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}let lC=K(`ZodPipe`,(e,t)=>{gy.init(e,t),Yx.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yx(e,t,n,r),e.in=t.in,e.out=t.out});function uC(e,t){return new lC({type:`pipe`,in:e,out:t})}let dC=K(`ZodReadonly`,(e,t)=>{vy.init(e,t),Yx.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bx(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function fC(e){return new dC({type:`readonly`,innerType:e})}let pC=K(`ZodLazy`,(e,t)=>{by.init(e,t),Yx.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Cx(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function mC(e){return new pC({type:`lazy`,getter:e})}let hC=K(`ZodCustom`,(e,t)=>{xy.init(e,t),Yx.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rx(e,t,n,r)});function gC(e,t){return Db(hC,e==null?(()=>!0):e,t)}function _C(e,t={}){return Ob(hC,e,t)}function vC(e,t){return kb(e,t)}function yC(e,t={}){let n=new hC(U({type:`custom`,check:`custom`,fn:t=>t instanceof e,abort:!0},q(t)));return n._zod.bag.Class=e,n._zod.check=t=>{if(!(t.value instanceof e)){var r;t.issues.push({code:`invalid_type`,expected:e.name,input:t.value,inst:n,path:[...(r=n._zod.def.path)==null?[]:r]})}},n}var bC;(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,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=>typeof t[t[e]]!=`number`),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=typeof Object.keys==`function`?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=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(bC||(bC={}));var xC;(function(e){e.mergeShapes=(e,t)=>U(U({},e),t)})(xC||(xC={}));let Y=bC.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),SC=e=>{switch(typeof e){case`undefined`:return Y.undefined;case`string`:return Y.string;case`number`:return Number.isNaN(e)?Y.nan:Y.number;case`boolean`:return Y.boolean;case`function`:return Y.function;case`bigint`:return Y.bigint;case`symbol`:return Y.symbol;case`object`:return Array.isArray(e)?Y.array:e===null?Y.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?Y.promise:typeof Map<`u`&&e instanceof Map?Y.map:typeof Set<`u`&&e instanceof Set?Y.set:typeof Date<`u`&&e instanceof Date?Y.date:Y.object;default:return Y.unknown}},X=bC.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`]);var CC=class e 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(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)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(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,bC.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=e=>e.message){let t=Object.create(null),n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};CC.create=e=>new CC(e);let wC=(e,t)=>{let n;switch(e.code){case X.invalid_type:n=e.received===Y.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case X.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,bC.jsonStringifyReplacer)}`;break;case X.unrecognized_keys:n=`Unrecognized key(s) in object: ${bC.joinValues(e.keys,`, `)}`;break;case X.invalid_union:n=`Invalid input`;break;case X.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${bC.joinValues(e.options)}`;break;case X.invalid_enum_value:n=`Invalid enum value. Expected ${bC.joinValues(e.options)}, received '${e.received}'`;break;case X.invalid_arguments:n=`Invalid function arguments`;break;case X.invalid_return_type:n=`Invalid function return type`;break;case X.invalid_date:n=`Invalid date`;break;case X.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(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}"`:bC.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case X.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`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 X.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case X.custom:n=`Invalid input`;break;case X.invalid_intersection_types:n=`Intersection results could not be merged`;break;case X.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case X.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,bC.assertNever(e)}return{message:n}},TC=wC;function EC(){return TC}let DC=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o=U(U({},i),{},{path:a});if(i.message!==void 0)return U(U({},i),{},{path:a,message:i.message});let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return U(U({},i),{},{path:a,message:s})};function Z(e,t){let n=EC(),r=DC({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===wC?void 0:wC].filter(e=>!!e)});e.common.issues.push(r)}var OC=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return kC;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return kC;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}};let kC=Object.freeze({status:`aborted`}),AC=e=>({status:`dirty`,value:e}),jC=e=>({status:`valid`,value:e}),MC=e=>e.status===`aborted`,NC=e=>e.status===`dirty`,PC=e=>e.status===`valid`,FC=e=>typeof Promise<`u`&&e instanceof Promise;var Q;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e==null?void 0:e.message})(Q||(Q={}));var IC=class{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||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};let LC=(e,t)=>{if(PC(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 CC(e.common.issues);return this._error=t,this._error}}};function RC(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;let{message:o}=e;if(t.code===`invalid_enum_value`)return{message:o==null?i.defaultError:o};if(i.data===void 0){var s;return{message:(s=o==null?r:o)==null?i.defaultError:s}}return t.code===`invalid_type`?{message:(a=o==null?n:o)==null?i.defaultError:a}:{message:i.defaultError}},description:i}}var zC=class{get description(){return this._def.description}_getType(e){return SC(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:SC(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new OC,ctx:{common:e.parent.common,data:e.data,parsedType:SC(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(FC(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}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:(n=t==null?void 0:t.async)!=null&&n,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:SC(e)},i=this._parseSync({data:e,path:r.path,parent:r});return LC(r,i)}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:SC(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return PC(n)?{value:n.value}:{issues:t.common.issues}}catch(e){var n;!(e==null||(n=e.message)==null||(n=n.toLowerCase())==null)&&n.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>PC(e)?{value:e.value}:{issues:t.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){var n=this;let r={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:n._def.errorMap,parent:null,data:e,parsedType:SC(e)},i=n._parse({data:e,path:r.path,parent:r}),a=await(FC(i)?i:Promise.resolve(i));return LC(r,a)}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue(U({code:X.custom},n(t)));return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new Vw({schema:this,typeName:$.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 Hw.create(this,this._def)}nullable(){return Uw.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Sw.create(this)}promise(){return Bw.create(this,this._def)}or(e){return Tw.create([this,e],this._def)}and(e){return kw.create(this,e,this._def)}transform(e){return new Vw(U(U({},RC(this._def)),{},{schema:this,typeName:$.ZodEffects,effect:{type:`transform`,transform:e}}))}default(e){let t=typeof e==`function`?e:()=>e;return new Ww(U(U({},RC(this._def)),{},{innerType:this,defaultValue:t,typeName:$.ZodDefault}))}brand(){return new qw(U({typeName:$.ZodBranded,type:this},RC(this._def)))}catch(e){let t=typeof e==`function`?e:()=>e;return new Gw(U(U({},RC(this._def)),{},{innerType:this,catchValue:t,typeName:$.ZodCatch}))}describe(e){let t=this.constructor;return new t(U(U({},this._def),{},{description:e}))}pipe(e){return Jw.create(this,e)}readonly(){return Yw.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};let BC=/^c[^\s-]{8,}$/i,VC=/^[0-9a-z]+$/,HC=/^[0-9A-HJKMNP-TV-Z]{26}$/i,UC=/^[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,WC=/^[a-z0-9_-]{21}$/i,GC=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,KC=/^[-+]?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)?)??$/,qC=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,JC,YC=/^(?:(?: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])$/,XC=/^(?:(?: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])$/,ZC=/^(([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]))$/,QC=/^(([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])$/,$C=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ew=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,tw=`((\\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])))`,nw=RegExp(`^${tw}$`);function rw(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function iw(e){return RegExp(`^${rw(e)}$`)}function aw(e){let t=`${tw}T${rw(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function ow(e,t){return!!((t===`v4`||!t)&&YC.test(e)||(t===`v6`||!t)&&ZC.test(e))}function sw(e,t){if(!GC.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&(i==null?void 0:i.typ)!==`JWT`||!i.alg||t&&i.alg!==t)}catch(e){return!1}}function cw(e,t){return!!((t===`v4`||!t)&&XC.test(e)||(t===`v6`||!t)&&QC.test(e))}var lw=class e extends zC{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Y.string){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.string,received:t.parsedType}),kC}let t=new OC,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),Z(n,{code:X.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`max`)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),Z(n,{code:X.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`length`){let i=e.data.length>r.value,a=e.data.length<r.value;(i||a)&&(n=this._getOrReturnCtx(e,n),i?Z(n,{code:X.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}):a&&Z(n,{code:X.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if(r.kind===`email`)qC.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`email`,code:X.invalid_string,message:r.message}),t.dirty());else if(r.kind===`emoji`)JC||(JC=RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)),JC.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`emoji`,code:X.invalid_string,message:r.message}),t.dirty());else if(r.kind===`uuid`)UC.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`uuid`,code:X.invalid_string,message:r.message}),t.dirty());else if(r.kind===`nanoid`)WC.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`nanoid`,code:X.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid`)BC.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`cuid`,code:X.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid2`)VC.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`cuid2`,code:X.invalid_string,message:r.message}),t.dirty());else if(r.kind===`ulid`)HC.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`ulid`,code:X.invalid_string,message:r.message}),t.dirty());else if(r.kind===`url`)try{new URL(e.data)}catch(i){n=this._getOrReturnCtx(e,n),Z(n,{validation:`url`,code:X.invalid_string,message:r.message}),t.dirty()}else r.kind===`regex`?(r.regex.lastIndex=0,r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`regex`,code:X.invalid_string,message:r.message}),t.dirty())):r.kind===`trim`?e.data=e.data.trim():r.kind===`includes`?e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),Z(n,{code:X.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):r.kind===`toLowerCase`?e.data=e.data.toLowerCase():r.kind===`toUpperCase`?e.data=e.data.toUpperCase():r.kind===`startsWith`?e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),Z(n,{code:X.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):r.kind===`endsWith`?e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),Z(n,{code:X.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):r.kind===`datetime`?aw(r).test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{code:X.invalid_string,validation:`datetime`,message:r.message}),t.dirty()):r.kind===`date`?nw.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{code:X.invalid_string,validation:`date`,message:r.message}),t.dirty()):r.kind===`time`?iw(r).test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{code:X.invalid_string,validation:`time`,message:r.message}),t.dirty()):r.kind===`duration`?KC.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`duration`,code:X.invalid_string,message:r.message}),t.dirty()):r.kind===`ip`?ow(e.data,r.version)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`ip`,code:X.invalid_string,message:r.message}),t.dirty()):r.kind===`jwt`?sw(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`jwt`,code:X.invalid_string,message:r.message}),t.dirty()):r.kind===`cidr`?cw(e.data,r.version)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`cidr`,code:X.invalid_string,message:r.message}),t.dirty()):r.kind===`base64`?$C.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`base64`,code:X.invalid_string,message:r.message}),t.dirty()):r.kind===`base64url`?ew.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:`base64url`,code:X.invalid_string,message:r.message}),t.dirty()):bC.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),U({validation:t,code:X.invalid_string},Q.errToObj(n)))}_addCheck(t){return new e(U(U({},this._def),{},{checks:[...this._def.checks,t]}))}email(e){return this._addCheck(U({kind:`email`},Q.errToObj(e)))}url(e){return this._addCheck(U({kind:`url`},Q.errToObj(e)))}emoji(e){return this._addCheck(U({kind:`emoji`},Q.errToObj(e)))}uuid(e){return this._addCheck(U({kind:`uuid`},Q.errToObj(e)))}nanoid(e){return this._addCheck(U({kind:`nanoid`},Q.errToObj(e)))}cuid(e){return this._addCheck(U({kind:`cuid`},Q.errToObj(e)))}cuid2(e){return this._addCheck(U({kind:`cuid2`},Q.errToObj(e)))}ulid(e){return this._addCheck(U({kind:`ulid`},Q.errToObj(e)))}base64(e){return this._addCheck(U({kind:`base64`},Q.errToObj(e)))}base64url(e){return this._addCheck(U({kind:`base64url`},Q.errToObj(e)))}jwt(e){return this._addCheck(U({kind:`jwt`},Q.errToObj(e)))}ip(e){return this._addCheck(U({kind:`ip`},Q.errToObj(e)))}cidr(e){return this._addCheck(U({kind:`cidr`},Q.errToObj(e)))}datetime(e){var t,n;return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck(U({kind:`datetime`,precision:(e==null?void 0:e.precision)===void 0?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!=null&&t,local:(n=e==null?void 0:e.local)!=null&&n},Q.errToObj(e==null?void 0:e.message)))}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck(U({kind:`time`,precision:(e==null?void 0:e.precision)===void 0?null:e==null?void 0:e.precision},Q.errToObj(e==null?void 0:e.message)))}duration(e){return this._addCheck(U({kind:`duration`},Q.errToObj(e)))}regex(e,t){return this._addCheck(U({kind:`regex`,regex:e},Q.errToObj(t)))}includes(e,t){return this._addCheck(U({kind:`includes`,value:e,position:t==null?void 0:t.position},Q.errToObj(t==null?void 0:t.message)))}startsWith(e,t){return this._addCheck(U({kind:`startsWith`,value:e},Q.errToObj(t)))}endsWith(e,t){return this._addCheck(U({kind:`endsWith`,value:e},Q.errToObj(t)))}min(e,t){return this._addCheck(U({kind:`min`,value:e},Q.errToObj(t)))}max(e,t){return this._addCheck(U({kind:`max`,value:e},Q.errToObj(t)))}length(e,t){return this._addCheck(U({kind:`length`,value:e},Q.errToObj(t)))}nonempty(e){return this.min(1,Q.errToObj(e))}trim(){return new e(U(U({},this._def),{},{checks:[...this._def.checks,{kind:`trim`}]}))}toLowerCase(){return new e(U(U({},this._def),{},{checks:[...this._def.checks,{kind:`toLowerCase`}]}))}toUpperCase(){return new e(U(U({},this._def),{},{checks:[...this._def.checks,{kind:`toUpperCase`}]}))}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};lw.create=e=>{var t;return new lw(U({checks:[],typeName:$.ZodString,coerce:(t=e==null?void 0:e.coerce)!=null&&t},RC(e)))};function uw(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}var dw=class e extends zC{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Y.number){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.number,received:t.parsedType}),kC}let t,n=new OC;for(let r of this._def.checks)r.kind===`int`?bC.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),Z(t,{code:X.invalid_type,expected:`integer`,received:`float`,message:r.message}),n.dirty()):r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),Z(t,{code:X.too_small,minimum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Z(t,{code:X.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?uw(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),Z(t,{code:X.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),Z(t,{code:X.not_finite,message:r.message}),n.dirty()):bC.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,Q.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,Q.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,Q.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,Q.toString(t))}setLimit(t,n,r,i){return new e(U(U({},this._def),{},{checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Q.toString(i)}]}))}_addCheck(t){return new e(U(U({},this._def),{},{checks:[...this._def.checks,t]}))}int(e){return this._addCheck({kind:`int`,message:Q.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:Q.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:Q.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:Q.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:Q.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:Q.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:Q.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:Q.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:Q.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind===`int`||e.kind===`multipleOf`&&bC.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.value<e)&&(e=n.value);return Number.isFinite(t)&&Number.isFinite(e)}};dw.create=e=>new dw(U({checks:[],typeName:$.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1},RC(e)));var fw=class e extends zC{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(t){return this._getInvalidInput(e)}if(this._getType(e)!==Y.bigint)return this._getInvalidInput(e);let t,n=new OC;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),Z(t,{code:X.too_small,type:`bigint`,minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Z(t,{code:X.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),Z(t,{code:X.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):bC.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.bigint,received:t.parsedType}),kC}gte(e,t){return this.setLimit(`min`,e,!0,Q.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,Q.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,Q.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,Q.toString(t))}setLimit(t,n,r,i){return new e(U(U({},this._def),{},{checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Q.toString(i)}]}))}_addCheck(t){return new e(U(U({},this._def),{},{checks:[...this._def.checks,t]}))}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:Q.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:Q.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:Q.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:Q.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:Q.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};fw.create=e=>{var t;return new fw(U({checks:[],typeName:$.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!=null&&t},RC(e)))};var pw=class extends zC{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Y.boolean){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.boolean,received:t.parsedType}),kC}return jC(e.data)}};pw.create=e=>new pw(U({typeName:$.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1},RC(e)));var mw=class e extends zC{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Y.date){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.date,received:t.parsedType}),kC}if(Number.isNaN(e.data.getTime()))return Z(this._getOrReturnCtx(e),{code:X.invalid_date}),kC;let t=new OC,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),Z(n,{code:X.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:`date`}),t.dirty()):r.kind===`max`?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),Z(n,{code:X.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):bC.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e(U(U({},this._def),{},{checks:[...this._def.checks,t]}))}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:Q.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:Q.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e==null?null:new Date(e)}};mw.create=e=>new mw(U({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:$.ZodDate},RC(e)));var hw=class extends zC{_parse(e){if(this._getType(e)!==Y.symbol){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.symbol,received:t.parsedType}),kC}return jC(e.data)}};hw.create=e=>new hw(U({typeName:$.ZodSymbol},RC(e)));var gw=class extends zC{_parse(e){if(this._getType(e)!==Y.undefined){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.undefined,received:t.parsedType}),kC}return jC(e.data)}};gw.create=e=>new gw(U({typeName:$.ZodUndefined},RC(e)));var _w=class extends zC{_parse(e){if(this._getType(e)!==Y.null){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.null,received:t.parsedType}),kC}return jC(e.data)}};_w.create=e=>new _w(U({typeName:$.ZodNull},RC(e)));var vw=class extends zC{constructor(){super(...arguments),this._any=!0}_parse(e){return jC(e.data)}};vw.create=e=>new vw(U({typeName:$.ZodAny},RC(e)));var yw=class extends zC{constructor(){super(...arguments),this._unknown=!0}_parse(e){return jC(e.data)}};yw.create=e=>new yw(U({typeName:$.ZodUnknown},RC(e)));var bw=class extends zC{_parse(e){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.never,received:t.parsedType}),kC}};bw.create=e=>new bw(U({typeName:$.ZodNever},RC(e)));var xw=class extends zC{_parse(e){if(this._getType(e)!==Y.undefined){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.void,received:t.parsedType}),kC}return jC(e.data)}};xw.create=e=>new xw(U({typeName:$.ZodVoid},RC(e)));var Sw=class e extends zC{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==Y.array)return Z(t,{code:X.invalid_type,expected:Y.array,received:t.parsedType}),kC;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(Z(t,{code:e?X.too_big:X.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(r.minLength!==null&&t.data.length<r.minLength.value&&(Z(t,{code:X.too_small,minimum:r.minLength.value,type:`array`,inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(Z(t,{code:X.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 IC(t,e,t.path,n)))).then(e=>OC.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new IC(t,e,t.path,n)));return OC.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e(U(U({},this._def),{},{minLength:{value:t,message:Q.toString(n)}}))}max(t,n){return new e(U(U({},this._def),{},{maxLength:{value:t,message:Q.toString(n)}}))}length(t,n){return new e(U(U({},this._def),{},{exactLength:{value:t,message:Q.toString(n)}}))}nonempty(e){return this.min(1,e)}};Sw.create=(e,t)=>new Sw(U({type:e,minLength:null,maxLength:null,exactLength:null,typeName:$.ZodArray},RC(t)));function Cw(e){if(e instanceof ww){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=Hw.create(Cw(r))}return new ww(U(U({},e._def),{},{shape:()=>t}))}else if(e instanceof Sw)return new Sw(U(U({},e._def),{},{type:Cw(e.element)}));else if(e instanceof Hw)return Hw.create(Cw(e.unwrap()));else if(e instanceof Uw)return Uw.create(Cw(e.unwrap()));else if(e instanceof Aw)return Aw.create(e.items.map(e=>Cw(e)));else return e}var ww=class e extends zC{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=bC.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==Y.object){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.object,received:t.parsedType}),kC}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof bw&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=r[e],i=n.data[e];o.push({key:{status:`valid`,value:e},value:t._parse(new IC(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof bw){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of a)o.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)a.length>0&&(Z(n,{code:X.unrecognized_keys,keys:a}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];o.push({key:{status:`valid`,value:t},value:e._parse(new IC(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>OC.mergeObjectSync(t,e)):OC.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return Q.errToObj,new e(U(U({},this._def),{},{unknownKeys:`strict`},t===void 0?{}:{errorMap:(e,n)=>{var r,i,a,o;let s=(r=(i=(a=this._def).errorMap)==null?void 0:i.call(a,e,n).message)==null?n.defaultError:r;return e.code===`unrecognized_keys`?{message:(o=Q.errToObj(t).message)==null?s:o}:{message:s}}}))}strip(){return new e(U(U({},this._def),{},{unknownKeys:`strip`}))}passthrough(){return new e(U(U({},this._def),{},{unknownKeys:`passthrough`}))}extend(t){return new e(U(U({},this._def),{},{shape:()=>U(U({},this._def.shape()),t)}))}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>U(U({},this._def.shape()),t._def.shape()),typeName:$.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e(U(U({},this._def),{},{catchall:t}))}pick(t){let n={};for(let e of bC.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e(U(U({},this._def),{},{shape:()=>n}))}omit(t){let n={};for(let e of bC.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e(U(U({},this._def),{},{shape:()=>n}))}deepPartial(){return Cw(this)}partial(t){let n={};for(let e of bC.objectKeys(this.shape)){let r=this.shape[e];t&&!t[e]?n[e]=r:n[e]=r.optional()}return new e(U(U({},this._def),{},{shape:()=>n}))}required(t){let n={};for(let e of bC.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof Hw;)t=t._def.innerType;n[e]=t}return new e(U(U({},this._def),{},{shape:()=>n}))}keyof(){return Lw(bC.objectKeys(this.shape))}};ww.create=(e,t)=>new ww(U({shape:()=>e,unknownKeys:`strip`,catchall:bw.create(),typeName:$.ZodObject},RC(t))),ww.strictCreate=(e,t)=>new ww(U({shape:()=>e,unknownKeys:`strict`,catchall:bw.create(),typeName:$.ZodObject},RC(t))),ww.lazycreate=(e,t)=>new ww(U({shape:e,unknownKeys:`strip`,catchall:bw.create(),typeName:$.ZodObject},RC(t)));var Tw=class extends zC{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new CC(e.ctx.common.issues));return Z(t,{code:X.invalid_union,unionErrors:n}),kC}if(t.common.async)return Promise.all(n.map(async e=>{let n=U(U({},t),{},{common:U(U({},t.common),{},{issues:[]}),parent:null});return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n=U(U({},t),{},{common:U(U({},t.common),{},{issues:[]}),parent:null}),a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!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 CC(e));return Z(t,{code:X.invalid_union,unionErrors:i}),kC}}get options(){return this._def.options}};Tw.create=(e,t)=>new Tw(U({options:e,typeName:$.ZodUnion},RC(t)));let Ew=e=>e instanceof Fw?Ew(e.schema):e instanceof Vw?Ew(e.innerType()):e instanceof Iw?[e.value]:e instanceof Rw?e.options:e instanceof zw?bC.objectValues(e.enum):e instanceof Ww?Ew(e._def.innerType):e instanceof gw?[void 0]:e instanceof _w?[null]:e instanceof Hw?[void 0,...Ew(e.unwrap())]:e instanceof Uw?[null,...Ew(e.unwrap())]:e instanceof qw||e instanceof Yw?Ew(e.unwrap()):e instanceof Gw?Ew(e._def.innerType):[];var Dw=class e extends zC{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Y.object)return Z(t,{code:X.invalid_type,expected:Y.object,received:t.parsedType}),kC;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}):(Z(t,{code:X.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),kC)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=Ew(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e(U({typeName:$.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i},RC(r)))}};function Ow(e,t){let n=SC(e),r=SC(t);if(e===t)return{valid:!0,data:e};if(n===Y.object&&r===Y.object){let n=bC.objectKeys(t),r=bC.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i=U(U({},e),t);for(let n of r){let r=Ow(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}else if(n===Y.array&&r===Y.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Ow(i,a);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}else if(n===Y.date&&r===Y.date&&+e==+t)return{valid:!0,data:e};else return{valid:!1}}var kw=class extends zC{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(MC(e)||MC(r))return kC;let i=Ow(e.value,r.value);return i.valid?((NC(e)||NC(r))&&t.dirty(),{status:t.value,value:i.data}):(Z(n,{code:X.invalid_intersection_types}),kC)};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}))}};kw.create=(e,t,n)=>new kw(U({left:e,right:t,typeName:$.ZodIntersection},RC(n)));var Aw=class e extends zC{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Y.array)return Z(n,{code:X.invalid_type,expected:Y.array,received:n.parsedType}),kC;if(n.data.length<this._def.items.length)return Z(n,{code:X.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),kC;!this._def.rest&&n.data.length>this._def.items.length&&(Z(n,{code:X.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 IC(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>OC.mergeArray(t,e)):OC.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e(U(U({},this._def),{},{rest:t}))}};Aw.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new Aw(U({items:e,typeName:$.ZodTuple,rest:null},RC(t)))};var jw=class e extends zC{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!==Y.object)return Z(n,{code:X.invalid_type,expected:Y.object,received:n.parsedType}),kC;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new IC(n,e,n.path,e)),value:a._parse(new IC(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?OC.mergeObjectAsync(t,r):OC.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof zC?new e(U({keyType:t,valueType:n,typeName:$.ZodRecord},RC(r))):new e(U({keyType:lw.create(),valueType:t,typeName:$.ZodRecord},RC(n)))}},Mw=class extends zC{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!==Y.map)return Z(n,{code:X.invalid_type,expected:Y.map,received:n.parsedType}),kC;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new IC(n,e,n.path,[a,`key`])),value:i._parse(new IC(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(r.status===`aborted`||i.status===`aborted`)return kC;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}else{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return kC;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};Mw.create=(e,t,n)=>new Mw(U({valueType:t,keyType:e,typeName:$.ZodMap},RC(n)));var Nw=class e extends zC{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Y.set)return Z(n,{code:X.invalid_type,expected:Y.set,received:n.parsedType}),kC;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(Z(n,{code:X.too_small,minimum:r.minSize.value,type:`set`,inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(Z(n,{code:X.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(r.status===`aborted`)return kC;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new IC(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e(U(U({},this._def),{},{minSize:{value:t,message:Q.toString(n)}}))}max(t,n){return new e(U(U({},this._def),{},{maxSize:{value:t,message:Q.toString(n)}}))}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Nw.create=(e,t)=>new Nw(U({valueType:e,minSize:null,maxSize:null,typeName:$.ZodSet},RC(t)));var Pw=class e extends zC{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Y.function)return Z(t,{code:X.invalid_type,expected:Y.function,received:t.parsedType}),kC;function n(e,n){return DC({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,EC(),wC].filter(e=>!!e),issueData:{code:X.invalid_arguments,argumentsError:n}})}function r(e,n){return DC({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,EC(),wC].filter(e=>!!e),issueData:{code:X.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof Bw){let e=this;return jC(async function(...t){let o=new CC([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(n(t,e)),o}),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,i).catch(e=>{throw o.addIssue(r(c,e)),o})})}else{let e=this;return jC(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new CC([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new CC([r(s,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e(U(U({},this._def),{},{args:Aw.create(t).rest(yw.create())}))}returns(t){return new e(U(U({},this._def),{},{returns:t}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e(U({args:t||Aw.create([]).rest(yw.create()),returns:n||yw.create(),typeName:$.ZodFunction},RC(r)))}},Fw=class extends zC{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})}};Fw.create=(e,t)=>new Fw(U({getter:e,typeName:$.ZodLazy},RC(t)));var Iw=class extends zC{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return Z(t,{received:t.data,code:X.invalid_literal,expected:this._def.value}),kC}return{status:`valid`,value:e.data}}get value(){return this._def.value}};Iw.create=(e,t)=>new Iw(U({value:e,typeName:$.ZodLiteral},RC(t)));function Lw(e,t){return new Rw(U({values:e,typeName:$.ZodEnum},RC(t)))}var Rw=class e extends zC{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return Z(t,{expected:bC.joinValues(n),received:t.parsedType,code:X.invalid_type}),kC}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return Z(t,{received:t.data,code:X.invalid_enum_value,options:n}),kC}return jC(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(t,n=this._def){return e.create(t,U(U({},this._def),n))}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),U(U({},this._def),n))}};Rw.create=Lw;var zw=class extends zC{_parse(e){let t=bC.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Y.string&&n.parsedType!==Y.number){let e=bC.objectValues(t);return Z(n,{expected:bC.joinValues(e),received:n.parsedType,code:X.invalid_type}),kC}if(this._cache||(this._cache=new Set(bC.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let e=bC.objectValues(t);return Z(n,{received:n.data,code:X.invalid_enum_value,options:e}),kC}return jC(e.data)}get enum(){return this._def.values}};zw.create=(e,t)=>new zw(U({values:e,typeName:$.ZodNativeEnum},RC(t)));var Bw=class extends zC{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==Y.promise&&t.common.async===!1?(Z(t,{code:X.invalid_type,expected:Y.promise,received:t.parsedType}),kC):jC((t.parsedType===Y.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Bw.create=(e,t)=>new Bw(U({type:e,typeName:$.ZodPromise},RC(t)));var Vw=class extends zC{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===$.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){var t=this;let{status:n,ctx:r}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:e=>{Z(r,e),e.fatal?n.abort():n.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),i.type===`preprocess`){let e=i.transform(r.data,a);if(r.common.async)return Promise.resolve(e).then(async e=>{if(n.value===`aborted`)return kC;let i=await t._def.schema._parseAsync({data:e,path:r.path,parent:r});return i.status===`aborted`?kC:i.status===`dirty`||n.value===`dirty`?AC(i.value):i});{if(n.value===`aborted`)return kC;let t=this._def.schema._parseSync({data:e,path:r.path,parent:r});return t.status===`aborted`?kC:t.status===`dirty`||n.value===`dirty`?AC(t.value):t}}if(i.type===`refinement`){let e=e=>{let t=i.refinement(e,a);if(r.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(r.common.async===!1){let t=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return t.status===`aborted`?kC:(t.status===`dirty`&&n.dirty(),e(t.value),{status:n.value,value:t.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(t=>t.status===`aborted`?kC:(t.status===`dirty`&&n.dirty(),e(t.value).then(()=>({status:n.value,value:t.value}))))}if(i.type===`transform`)if(r.common.async===!1){let e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!PC(e))return kC;let t=i.transform(e.value,a);if(t instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:n.value,value:t}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>PC(e)?Promise.resolve(i.transform(e.value,a)).then(e=>({status:n.value,value:e})):kC);bC.assertNever(i)}};Vw.create=(e,t,n)=>new Vw(U({schema:e,typeName:$.ZodEffects,effect:t},RC(n))),Vw.createWithPreprocess=(e,t,n)=>new Vw(U({schema:t,effect:{type:`preprocess`,transform:e},typeName:$.ZodEffects},RC(n)));var Hw=class extends zC{_parse(e){return this._getType(e)===Y.undefined?jC(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Hw.create=(e,t)=>new Hw(U({innerType:e,typeName:$.ZodOptional},RC(t)));var Uw=class extends zC{_parse(e){return this._getType(e)===Y.null?jC(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Uw.create=(e,t)=>new Uw(U({innerType:e,typeName:$.ZodNullable},RC(t)));var Ww=class extends zC{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===Y.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Ww.create=(e,t)=>new Ww(U({innerType:e,typeName:$.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default},RC(t)));var Gw=class extends zC{_parse(e){let{ctx:t}=this._processInputParams(e),n=U(U({},t),{},{common:U(U({},t.common),{},{issues:[]})}),r=this._def.innerType._parse({data:n.data,path:n.path,parent:U({},n)});return FC(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new CC(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new CC(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Gw.create=(e,t)=>new Gw(U({innerType:e,typeName:$.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch},RC(t)));var Kw=class extends zC{_parse(e){if(this._getType(e)!==Y.nan){let t=this._getOrReturnCtx(e);return Z(t,{code:X.invalid_type,expected:Y.nan,received:t.parsedType}),kC}return{status:`valid`,value:e.data}}};Kw.create=e=>new Kw(U({typeName:$.ZodNaN},RC(e)));var qw=class extends zC{_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}},Jw=class e extends zC{_parse(e){var t=this;let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let e=await t._def.in._parseAsync({data:r.data,path:r.path,parent:r});return e.status===`aborted`?kC:e.status===`dirty`?(n.dirty(),AC(e.value)):t._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{let e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return e.status===`aborted`?kC:e.status===`dirty`?(n.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(t,n){return new e({in:t,out:n,typeName:$.ZodPipeline})}},Yw=class extends zC{_parse(e){let t=this._def.innerType._parse(e),n=e=>(PC(e)&&(e.value=Object.freeze(e.value)),e);return FC(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};Yw.create=(e,t)=>new Yw(U({innerType:e,typeName:$.ZodReadonly},RC(t))),ww.lazycreate;var $;(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`})($||($={})),lw.create,dw.create,Kw.create,fw.create,pw.create,mw.create,hw.create,gw.create,_w.create,vw.create,yw.create,bw.create,xw.create,Sw.create,ww.create,ww.strictCreate,Tw.create,Dw.create,kw.create,Aw.create,jw.create,Mw.create,Nw.create,Pw.create,Fw.create,Iw.create,Rw.create,zw.create,Bw.create,Vw.create,Hw.create,Uw.create,Vw.createWithPreprocess,Jw.create;let Xw=[`additionalProperties`],Zw=[`type`],Qw=[`type`];var $w=({prefix:e,size:t=16,alphabet:n=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`,separator:r=`-`}={})=>{let i=()=>{let e=n.length,r=Array(t);for(let i=0;i<t;i++)r[i]=n[Math.random()*e|0];return r.join(``)};if(e==null)return i;if(n.includes(r))throw new Bh({argument:`separator`,message:`The separator "${r}" must not be part of the alphabet "${n}".`});return()=>`${e}${r}${i()}`},eT=$w();function tT(e){if(e==null)return{};let t={};if(e instanceof Headers)e.forEach((e,n)=>{t[n.toLowerCase()]=e});else{Array.isArray(e)||(e=Object.entries(e));for(let[n,r]of e)r!=null&&(t[n.toLowerCase()]=r)}return t}var nT=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,rT=/"(?: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 iT(e){let t=JSON.parse(e);return typeof t!=`object`||!t||nT.test(e)===!1&&rT.test(e)===!1?t:aT(t)}function aT(e){let t=[e];for(;t.length;){let e=t;t=[];for(let n of e){if(Object.prototype.hasOwnProperty.call(n,`__proto__`)||Object.prototype.hasOwnProperty.call(n,`constructor`)&&n.constructor!==null&&typeof n.constructor==`object`&&Object.prototype.hasOwnProperty.call(n.constructor,`prototype`))throw SyntaxError(`Object contains forbidden prototype property`);for(let e in n){let r=n[e];r&&typeof r==`object`&&t.push(r)}}}return e}function oT(e){let{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch(t){return iT(e)}try{return iT(e)}finally{Error.stackTraceLimit=t}}var sT=Symbol.for(`vercel.ai.validator`);function cT(e){return{[sT]:!0,validate:e}}function lT(e){return typeof e==`object`&&!!e&&sT in e&&e[sT]===!0&&`validate`in e}function uT(e){let t;return()=>(t==null&&(t=e()),t)}function dT(e){return lT(e)?e:`~standard`in e?fT(e):e()}function fT(e){return cT(async t=>{let n=await e[`~standard`].validate(t);return n.issues==null?{success:!0,value:n.value}:{success:!1,error:new Qh({value:t,cause:n.issues})}})}async function pT({value:e,schema:t}){let n=await mT({value:e,schema:t});if(!n.success)throw Qh.wrap({value:e,cause:n.error});return n.value}async function mT({value:e,schema:t}){let n=dT(t);try{if(n.validate==null)return{success:!0,value:e,rawValue:e};let t=await n.validate(e);return t.success?{success:!0,value:t.value,rawValue:e}:{success:!1,error:Qh.wrap({value:e,cause:t.error}),rawValue:e}}catch(t){return{success:!1,error:Qh.wrap({value:e,cause:t}),rawValue:e}}}async function hT({text:e,schema:t}){try{let n=oT(e);return t==null?{success:!0,value:n,rawValue:n}:await mT({value:n,schema:t})}catch(t){return{success:!1,error:Kh.isInstance(t)?t:new Kh({text:e,cause:t}),rawValue:void 0}}}function gT({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new ig).pipeThrough(new TransformStream({async transform({data:e},n){e!==`[DONE]`&&n.enqueue(await hT({text:e,schema:t}))}}))}async function _T(e){return typeof e==`function`&&(e=e()),Promise.resolve(e)}new TextDecoder;var vT=Symbol.for(`vercel.ai.schema`);function yT(e,{validate:t}={}){return{[vT]:!0,_type:void 0,[sT]:!0,get jsonSchema(){return typeof e==`function`&&(e=e()),e},validate:t}}function bT(e){if(e.type===`object`){e.additionalProperties=!1;let t=e.properties;if(t!=null)for(let e in t)t[e]=bT(t[e])}return e.type===`array`&&e.items!=null&&(Array.isArray(e.items)?e.items=e.items.map(e=>bT(e)):e.items=bT(e.items)),e}var xT=Symbol(`Let zodToJsonSchema decide on which parser to use`),ST={name:void 0,$refStrategy:`root`,basePath:[`#`],effectStrategy:`input`,pipeStrategy:`all`,dateStrategy:`format:date-time`,mapStrategy:`entries`,removeAdditionalStrategy:`passthrough`,allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:`definitions`,strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:`escape`,applyRegexFlags:!1,emailStrategy:`format:email`,base64Strategy:`contentEncoding:base64`,nameStrategy:`ref`},CT=e=>typeof e==`string`?U(U({},ST),{},{name:e}):U(U({},ST),e);function wT(){return{}}function TT(e,t){var n,r,i;let a={type:`array`};return(n=e.type)!=null&&n._def&&((i=(r=e.type)==null?void 0:r._def)==null?void 0:i.typeName)!==$.ZodAny&&(a.items=gE(e.type._def,U(U({},t),{},{currentPath:[...t.currentPath,`items`]}))),e.minLength&&(a.minItems=e.minLength.value),e.maxLength&&(a.maxItems=e.maxLength.value),e.exactLength&&(a.minItems=e.exactLength.value,a.maxItems=e.exactLength.value),a}function ET(e){let t={type:`integer`,format:`int64`};if(!e.checks)return t;for(let n of e.checks)switch(n.kind){case`min`:n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case`max`:n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case`multipleOf`:t.multipleOf=n.value;break}return t}function DT(){return{type:`boolean`}}function OT(e,t){return gE(e.type._def,t)}var kT=(e,t)=>gE(e.innerType._def,t);function AT(e,t,n){let r=n==null?t.dateStrategy:n;if(Array.isArray(r))return{anyOf:r.map((n,r)=>AT(e,t,n))};switch(r){case`string`:case`format:date-time`:return{type:`string`,format:`date-time`};case`format:date`:return{type:`string`,format:`date`};case`integer`:return jT(e)}}var jT=e=>{let t={type:`integer`,format:`unix-time`};for(let n of e.checks)switch(n.kind){case`min`:t.minimum=n.value;break;case`max`:t.maximum=n.value;break}return t};function MT(e,t){return U(U({},gE(e.innerType._def,t)),{},{default:e.defaultValue()})}function NT(e,t){return t.effectStrategy===`input`?gE(e.schema._def,t):wT()}function PT(e){return{type:`string`,enum:Array.from(e.values)}}var FT=e=>`type`in e&&e.type===`string`?!1:`allOf`in e;function IT(e,t){let n=[gE(e.left._def,U(U({},t),{},{currentPath:[...t.currentPath,`allOf`,`0`]})),gE(e.right._def,U(U({},t),{},{currentPath:[...t.currentPath,`allOf`,`1`]}))].filter(e=>!!e),r=[];return n.forEach(e=>{if(FT(e))r.push(...e.allOf);else{let t=e;if(`additionalProperties`in e&&e.additionalProperties===!1){let{additionalProperties:n}=e;t=vr(e,Xw)}r.push(t)}}),r.length?{allOf:r}:void 0}function LT(e){let t=typeof e.value;return t!==`bigint`&&t!==`number`&&t!==`boolean`&&t!==`string`?{type:Array.isArray(e.value)?`array`:`object`}:{type:t===`bigint`?`integer`:t,const:e.value}}var RT=void 0,zT={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:()=>(RT===void 0&&(RT=RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)),RT),uuid:/^[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}$/,ipv4:/^(?:(?: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])$/,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])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,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 BT(e,t){let n={type:`string`};if(e.checks)for(let r of e.checks)switch(r.kind){case`min`:n.minLength=typeof n.minLength==`number`?Math.max(n.minLength,r.value):r.value;break;case`max`:n.maxLength=typeof n.maxLength==`number`?Math.min(n.maxLength,r.value):r.value;break;case`email`:switch(t.emailStrategy){case`format:email`:WT(n,`email`,r.message,t);break;case`format:idn-email`:WT(n,`idn-email`,r.message,t);break;case`pattern:zod`:GT(n,zT.email,r.message,t);break}break;case`url`:WT(n,`uri`,r.message,t);break;case`uuid`:WT(n,`uuid`,r.message,t);break;case`regex`:GT(n,r.regex,r.message,t);break;case`cuid`:GT(n,zT.cuid,r.message,t);break;case`cuid2`:GT(n,zT.cuid2,r.message,t);break;case`startsWith`:GT(n,RegExp(`^${VT(r.value,t)}`),r.message,t);break;case`endsWith`:GT(n,RegExp(`${VT(r.value,t)}$`),r.message,t);break;case`datetime`:WT(n,`date-time`,r.message,t);break;case`date`:WT(n,`date`,r.message,t);break;case`time`:WT(n,`time`,r.message,t);break;case`duration`:WT(n,`duration`,r.message,t);break;case`length`:n.minLength=typeof n.minLength==`number`?Math.max(n.minLength,r.value):r.value,n.maxLength=typeof n.maxLength==`number`?Math.min(n.maxLength,r.value):r.value;break;case`includes`:GT(n,RegExp(VT(r.value,t)),r.message,t);break;case`ip`:r.version!==`v6`&&WT(n,`ipv4`,r.message,t),r.version!==`v4`&&WT(n,`ipv6`,r.message,t);break;case`base64url`:GT(n,zT.base64url,r.message,t);break;case`jwt`:GT(n,zT.jwt,r.message,t);break;case`cidr`:r.version!==`v6`&&GT(n,zT.ipv4Cidr,r.message,t),r.version!==`v4`&&GT(n,zT.ipv6Cidr,r.message,t);break;case`emoji`:GT(n,zT.emoji(),r.message,t);break;case`ulid`:GT(n,zT.ulid,r.message,t);break;case`base64`:switch(t.base64Strategy){case`format:binary`:WT(n,`binary`,r.message,t);break;case`contentEncoding:base64`:n.contentEncoding=`base64`;break;case`pattern:zod`:GT(n,zT.base64,r.message,t);break}break;case`nanoid`:GT(n,zT.nanoid,r.message,t);case`toLowerCase`:case`toUpperCase`:case`trim`:break;default:}return n}function VT(e,t){return t.patternStrategy===`escape`?UT(e):e}var HT=new Set(`ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789`);function UT(e){let t=``;for(let n=0;n<e.length;n++)HT.has(e[n])||(t+=`\\`),t+=e[n];return t}function WT(e,t,n,r){var i;e.format||(i=e.anyOf)!=null&&i.some(e=>e.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format}),delete e.format),e.anyOf.push(U({format:t},n&&r.errorMessages&&{errorMessage:{format:n}}))):e.format=t}function GT(e,t,n,r){var i;e.pattern||(i=e.allOf)!=null&&i.some(e=>e.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern}),delete e.pattern),e.allOf.push(U({pattern:KT(t,r)},n&&r.errorMessages&&{errorMessage:{pattern:n}}))):e.pattern=KT(t,r)}function KT(e,t){var n;if(!t.applyRegexFlags||!e.flags)return e.source;let r={i:e.flags.includes(`i`),m:e.flags.includes(`m`),s:e.flags.includes(`s`)},i=r.i?e.source.toLowerCase():e.source,a=``,o=!1,s=!1,c=!1;for(let e=0;e<i.length;e++){if(o){a+=i[e],o=!1;continue}if(r.i){if(s){if(i[e].match(/[a-z]/)){c?(a+=i[e],a+=`${i[e-2]}-${i[e]}`.toUpperCase(),c=!1):i[e+1]===`-`&&(n=i[e+2])!=null&&n.match(/[a-z]/)?(a+=i[e],c=!0):a+=`${i[e]}${i[e].toUpperCase()}`;continue}}else if(i[e].match(/[a-z]/)){a+=`[${i[e]}${i[e].toUpperCase()}]`;continue}}if(r.m){if(i[e]===`^`){a+=`(^|(?<=[\r
160
101
  ]))`;continue}else if(i[e]===`$`){a+=`($|(?=[\r
161
102
  ]))`;continue}}if(r.s&&i[e]===`.`){a+=s?`${i[e]}\r
162
103
  `:`[${i[e]}\r
163
- ]`;continue}a+=i[e],i[e]===`\\`?o=!0:s&&i[e]===`]`?s=!1:!s&&i[e]===`[`&&(s=!0)}try{new RegExp(a)}catch(n){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 a}function xD(e,t){var n,r,i,a,o,s;let c={type:`object`,additionalProperties:(n=WD(e.valueType._def,U(U({},t),{},{currentPath:[...t.currentPath,`additionalProperties`]})))==null?t.allowedAdditionalProperties:n};if(((r=e.keyType)==null?void 0:r._def.typeName)===$.ZodString&&(i=e.keyType._def.checks)!=null&&i.length){let n=mD(e.keyType._def,t),{type:r}=n,i=vr(n,TE);return U(U({},c),{},{propertyNames:i})}else if(((a=e.keyType)==null?void 0:a._def.typeName)===$.ZodEnum)return U(U({},c),{},{propertyNames:{enum:e.keyType._def.values}});else if(((o=e.keyType)==null?void 0:o._def.typeName)===$.ZodBranded&&e.keyType._def.type._def.typeName===$.ZodString&&(s=e.keyType._def.type._def.checks)!=null&&s.length){let n=nD(e.keyType._def,t),{type:r}=n,i=vr(n,EE);return U(U({},c),{},{propertyNames:i})}return c}function SD(e,t){return t.mapStrategy===`record`?xD(e,t):{type:`array`,maxItems:125,items:{type:`array`,items:[WD(e.keyType._def,U(U({},t),{},{currentPath:[...t.currentPath,`items`,`items`,`0`]}))||QE(),WD(e.valueType._def,U(U({},t),{},{currentPath:[...t.currentPath,`items`,`items`,`1`]}))||QE()],minItems:2,maxItems:2}}}function CD(e){let t=e.values,n=Object.keys(e.values).filter(e=>typeof t[t[e]]!=`number`).map(e=>t[e]),r=Array.from(new Set(n.map(e=>typeof e)));return{type:r.length===1?r[0]===`string`?`string`:`number`:[`string`,`number`],enum:n}}function wD(){return{not:QE()}}function TD(){return{type:`null`}}var ED={ZodString:`string`,ZodNumber:`number`,ZodBigInt:`integer`,ZodBoolean:`boolean`,ZodNull:`null`};function DD(e,t){let n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in ED&&(!e._def.checks||!e._def.checks.length))){let e=n.reduce((e,t)=>{let n=ED[t._def.typeName];return n&&!e.includes(n)?[...e,n]:e},[]);return{type:e.length>1?e:e[0]}}else if(n.every(e=>e._def.typeName===`ZodLiteral`&&!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(t._def.value===null)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=>e._def.typeName===`ZodEnum`))return{type:`string`,enum:n.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return OD(e,t)}var OD=(e,t)=>{let n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>WD(e._def,U(U({},t),{},{currentPath:[...t.currentPath,`anyOf`,`${n}`]}))).filter(e=>!!e&&(!t.strictUnions||typeof e==`object`&&Object.keys(e).length>0));return n.length?{anyOf:n}:void 0};function kD(e,t){if([`ZodString`,`ZodNumber`,`ZodBigInt`,`ZodBoolean`,`ZodNull`].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[ED[e.innerType._def.typeName],`null`]};let n=WD(e.innerType._def,U(U({},t),{},{currentPath:[...t.currentPath,`anyOf`,`0`]}));return n&&{anyOf:[n,{type:`null`}]}}function AD(e){let t={type:`number`};if(!e.checks)return t;for(let n of e.checks)switch(n.kind){case`int`:t.type=`integer`;break;case`min`:n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case`max`:n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case`multipleOf`:t.multipleOf=n.value;break}return t}function jD(e,t){let n={type:`object`,properties:{}},r=[],i=e.shape();for(let e in i){let a=i[e];if(a===void 0||a._def===void 0)continue;let o=ND(a),s=WD(a._def,U(U({},t),{},{currentPath:[...t.currentPath,`properties`,e],propertyPath:[...t.currentPath,`properties`,e]}));s!==void 0&&(n.properties[e]=s,o||r.push(e))}r.length&&(n.required=r);let a=MD(e,t);return a!==void 0&&(n.additionalProperties=a),n}function MD(e,t){if(e.catchall._def.typeName!==`ZodNever`)return WD(e.catchall._def,U(U({},t),{},{currentPath:[...t.currentPath,`additionalProperties`]}));switch(e.unknownKeys){case`passthrough`:return t.allowedAdditionalProperties;case`strict`:return t.rejectedAdditionalProperties;case`strip`:return t.removeAdditionalStrategy===`strict`?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function ND(e){try{return e.isOptional()}catch(e){return!0}}var PD=(e,t)=>{var n;if(t.currentPath.toString()===((n=t.propertyPath)==null?void 0:n.toString()))return WD(e.innerType._def,t);let r=WD(e.innerType._def,U(U({},t),{},{currentPath:[...t.currentPath,`anyOf`,`1`]}));return r?{anyOf:[{not:QE()},r]}:QE()},FD=(e,t)=>{if(t.pipeStrategy===`input`)return WD(e.in._def,t);if(t.pipeStrategy===`output`)return WD(e.out._def,t);let n=WD(e.in._def,U(U({},t),{},{currentPath:[...t.currentPath,`allOf`,`0`]}));return{allOf:[n,WD(e.out._def,U(U({},t),{},{currentPath:[...t.currentPath,`allOf`,n?`1`:`0`]}))].filter(e=>e!==void 0)}};function ID(e,t){return WD(e.type._def,t)}function LD(e,t){let n={type:`array`,uniqueItems:!0,items:WD(e.valueType._def,U(U({},t),{},{currentPath:[...t.currentPath,`items`]}))};return e.minSize&&(n.minItems=e.minSize.value),e.maxSize&&(n.maxItems=e.maxSize.value),n}function RD(e,t){return e.rest?{type:`array`,minItems:e.items.length,items:e.items.map((e,n)=>WD(e._def,U(U({},t),{},{currentPath:[...t.currentPath,`items`,`${n}`]}))).reduce((e,t)=>t===void 0?e:[...e,t],[]),additionalItems:WD(e.rest._def,U(U({},t),{},{currentPath:[...t.currentPath,`additionalItems`]}))}:{type:`array`,minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>WD(e._def,U(U({},t),{},{currentPath:[...t.currentPath,`items`,`${n}`]}))).reduce((e,t)=>t===void 0?e:[...e,t],[])}}function zD(){return{not:QE()}}function BD(){return QE()}var VD=(e,t)=>WD(e.innerType._def,t),HD=(e,t,n)=>{switch(t){case $.ZodString:return mD(e,n);case $.ZodNumber:return AD(e);case $.ZodObject:return jD(e,n);case $.ZodBigInt:return eD(e);case $.ZodBoolean:return tD();case $.ZodDate:return iD(e,n);case $.ZodUndefined:return zD();case $.ZodNull:return TD();case $.ZodArray:return $E(e,n);case $.ZodUnion:case $.ZodDiscriminatedUnion:return DD(e,n);case $.ZodIntersection:return uD(e,n);case $.ZodTuple:return RD(e,n);case $.ZodRecord:return xD(e,n);case $.ZodLiteral:return dD(e);case $.ZodEnum:return cD(e);case $.ZodNativeEnum:return CD(e);case $.ZodNullable:return kD(e,n);case $.ZodOptional:return PD(e,n);case $.ZodMap:return SD(e,n);case $.ZodSet:return LD(e,n);case $.ZodLazy:return()=>e.getter()._def;case $.ZodPromise:return ID(e,n);case $.ZodNaN:case $.ZodNever:return wD();case $.ZodEffects:return sD(e,n);case $.ZodAny:return QE();case $.ZodUnknown:return BD();case $.ZodDefault:return oD(e,n);case $.ZodBranded:return nD(e,n);case $.ZodReadonly:return VD(e,n);case $.ZodCatch:return rD(e,n);case $.ZodPipeline:return FD(e,n);case $.ZodFunction:case $.ZodVoid:case $.ZodSymbol:return;default:return(e=>void 0)(t)}},UD=(e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join(`/`)};function WD(e,t,n=!1){var r;let i=t.seen.get(e);if(t.override){let a=(r=t.override)==null?void 0:r.call(t,e,t,i,n);if(a!==YE)return a}if(i&&!n){let e=GD(i,t);if(e!==void 0)return e}let a={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,a);let o=HD(e,e.typeName,t),s=typeof o==`function`?WD(o(),t):o;if(s&&KD(e,t,s),t.postProcess){let n=t.postProcess(s,e,t);return a.jsonSchema=s,n}return a.jsonSchema=s,s}var GD=(e,t)=>{switch(t.$refStrategy){case`root`:return{$ref:e.path.join(`/`)};case`relative`:return{$ref:UD(t.currentPath,e.path)};case`none`:case`seen`:return e.path.length<t.currentPath.length&&e.path.every((e,n)=>t.currentPath[n]===e)?(console.warn(`Recursive reference detected at ${t.currentPath.join(`/`)}! Defaulting to any`),QE()):t.$refStrategy===`seen`?QE():void 0}},KD=(e,t,n)=>(e.description&&(n.description=e.description),n),qD=e=>{let t=ZE(e),n=t.name===void 0?t.basePath:[...t.basePath,t.definitionPath,t.name];return U(U({},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}]))})},JD=(e,t)=>{var n;let r=qD(t),i=typeof t==`object`&&t.definitions?Object.entries(t.definitions).reduce((e,[t,n])=>{var i;return U(U({},e),{},{[t]:(i=WD(n._def,U(U({},r),{},{currentPath:[...r.basePath,r.definitionPath,t]}),!0))==null?QE():i})},{}):void 0,a=typeof t==`string`?t:(t==null?void 0:t.nameStrategy)===`title`||t==null?void 0:t.name,o=(n=WD(e._def,a===void 0?r:U(U({},r),{},{currentPath:[...r.basePath,r.definitionPath,a]}),!1))==null?QE():n,s=typeof t==`object`&&t.name!==void 0&&t.nameStrategy===`title`?t.name:void 0;s!==void 0&&(o.title=s);let c=a===void 0?i?U(U({},o),{},{[r.definitionPath]:i}):o:{$ref:[...r.$refStrategy===`relative`?[]:r.basePath,r.definitionPath,a].join(`/`),[r.definitionPath]:U(U({},i),{},{[a]:o})};return c.$schema=`http://json-schema.org/draft-07/schema#`,c};function YD(e,t){var n;let r=(n=t==null?void 0:t.useReferences)!=null&&n;return qE(()=>JD(e,{$refStrategy:r?`root`:`none`}),{validate:async t=>{let n=await e.safeParseAsync(t);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function XD(e,t){var n;let r=(n=t==null?void 0:t.useReferences)!=null&&n;return qE(()=>JE($S(e,{target:`draft-7`,io:`input`,reused:r?`ref`:`inline`})),{validate:async t=>{let n=await fC(e,t);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function ZD(e){return`_zod`in e}function QD(e,t){return ZD(e)?XD(e,t):YD(e,t)}function $D(e){return typeof e==`object`&&!!e&&KE in e&&e[KE]===!0&&`jsonSchema`in e&&`validate`in e}function eO(e){return e==null?qE({properties:{},additionalProperties:!1}):$D(e)?e:typeof e==`function`?e():QD(e)}var{btoa:tO,atob:nO}=globalThis;let rO=[`abortSignal`],iO=[`messageId`];var aO=Object.defineProperty,oO=(e,t)=>{for(var n in t)aO(e,n,{get:t[n],enumerable:!0})},sO=`AI_NoObjectGeneratedError`,cO=`vercel.ai.error.${sO}`,lO=Symbol.for(cO),uO,dO=class extends s_{constructor({message:e=`No object generated.`,cause:t,text:n,response:r,usage:i,finishReason:a}){super({name:sO,message:e,cause:t}),this[uO]=!0,this.text=n,this.response=r,this.usage=i,this.finishReason=a}static isInstance(e){return s_.hasMarker(e,cO)}};uO=lO;var fO=uw([J(),qw(Uint8Array),qw(ArrayBuffer),Ww(e=>{var t,n;return(n=(t=globalThis.Buffer)==null?void 0:t.isBuffer(e))!=null&&n},{message:`Must be a Buffer`})]),pO=Hw(()=>uw([$C(),J(),qC(),ZC(),gw(J(),pO),aw(pO)])),mO=gw(J(),gw(J(),pO)),hO=sw({type:bw(`text`),text:J(),providerOptions:mO.optional()}),gO=sw({type:bw(`image`),image:uw([fO,qw(URL)]),mediaType:J().optional(),providerOptions:mO.optional()}),_O=sw({type:bw(`file`),data:uw([fO,qw(URL)]),filename:J().optional(),mediaType:J(),providerOptions:mO.optional()}),vO=sw({type:bw(`reasoning`),text:J(),providerOptions:mO.optional()}),yO=sw({type:bw(`tool-call`),toolCallId:J(),toolName:J(),input:tw(),providerOptions:mO.optional(),providerExecuted:ZC().optional()}),bO=fw(`type`,[sw({type:bw(`text`),value:J()}),sw({type:bw(`json`),value:pO}),sw({type:bw(`error-text`),value:J()}),sw({type:bw(`error-json`),value:pO}),sw({type:bw(`content`),value:aw(uw([sw({type:bw(`text`),text:J()}),sw({type:bw(`media`),data:J(),mediaType:J()})]))})]),xO=sw({type:bw(`tool-result`),toolCallId:J(),toolName:J(),output:bO,providerOptions:mO.optional()});uw([sw({role:bw(`system`),content:J(),providerOptions:mO.optional()}),sw({role:bw(`user`),content:uw([J(),aw(uw([hO,gO,_O]))]),providerOptions:mO.optional()}),sw({role:bw(`assistant`),content:uw([J(),aw(uw([hO,_O,vO,yO,xO]))]),providerOptions:mO.optional()}),sw({role:bw(`tool`),content:aw(xO),providerOptions:mO.optional()})]),DE({prefix:`aitxt`,size:24}),TransformStream;var SO=RE(()=>QD(uw([cw({type:bw(`text-start`),id:J(),providerMetadata:mO.optional()}),cw({type:bw(`text-delta`),id:J(),delta:J(),providerMetadata:mO.optional()}),cw({type:bw(`text-end`),id:J(),providerMetadata:mO.optional()}),cw({type:bw(`error`),errorText:J()}),cw({type:bw(`tool-input-start`),toolCallId:J(),toolName:J(),providerExecuted:ZC().optional(),dynamic:ZC().optional()}),cw({type:bw(`tool-input-delta`),toolCallId:J(),inputTextDelta:J()}),cw({type:bw(`tool-input-available`),toolCallId:J(),toolName:J(),input:tw(),providerExecuted:ZC().optional(),providerMetadata:mO.optional(),dynamic:ZC().optional()}),cw({type:bw(`tool-input-error`),toolCallId:J(),toolName:J(),input:tw(),providerExecuted:ZC().optional(),providerMetadata:mO.optional(),dynamic:ZC().optional(),errorText:J()}),cw({type:bw(`tool-output-available`),toolCallId:J(),output:tw(),providerExecuted:ZC().optional(),dynamic:ZC().optional(),preliminary:ZC().optional()}),cw({type:bw(`tool-output-error`),toolCallId:J(),errorText:J(),providerExecuted:ZC().optional(),dynamic:ZC().optional()}),cw({type:bw(`reasoning-start`),id:J(),providerMetadata:mO.optional()}),cw({type:bw(`reasoning-delta`),id:J(),delta:J(),providerMetadata:mO.optional()}),cw({type:bw(`reasoning-end`),id:J(),providerMetadata:mO.optional()}),cw({type:bw(`source-url`),sourceId:J(),url:J(),title:J().optional(),providerMetadata:mO.optional()}),cw({type:bw(`source-document`),sourceId:J(),mediaType:J(),title:J(),filename:J().optional(),providerMetadata:mO.optional()}),cw({type:bw(`file`),url:J(),mediaType:J(),providerMetadata:mO.optional()}),cw({type:Ww(e=>typeof e==`string`&&e.startsWith(`data-`),{message:`Type must start with "data-"`}),id:J().optional(),data:tw(),transient:ZC().optional()}),cw({type:bw(`start-step`)}),cw({type:bw(`finish-step`)}),cw({type:bw(`start`),messageId:J().optional(),messageMetadata:tw().optional()}),cw({type:bw(`finish`),finishReason:vw([`stop`,`length`,`content-filter`,`tool-calls`,`error`,`other`,`unknown`]).optional(),messageMetadata:tw().optional()}),cw({type:bw(`abort`)}),cw({type:bw(`message-metadata`),messageMetadata:tw()})])));function CO(e){return e.type.startsWith(`data-`)}function wO(){return Object.create(null)}function TO(e,t){if(e===void 0&&t===void 0)return;if(e===void 0)return t;if(t===void 0)return e;let n=U({},e);for(let r in t)if(!(r===`__proto__`||r===`constructor`||r===`prototype`)&&Object.prototype.hasOwnProperty.call(t,r)){let i=t[r];if(i===void 0)continue;let a=r in e?e[r]:void 0,o=typeof i==`object`&&!!i&&!Array.isArray(i)&&!(i instanceof Date)&&!(i instanceof RegExp),s=typeof a==`object`&&!!a&&!Array.isArray(a)&&!(a instanceof Date)&&!(a instanceof RegExp);o&&s?n[r]=TO(a,i):n[r]=i}return n}function EO(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`);break}}function a(e,r){switch(e){case`,`:t.pop(),t.push(`INSIDE_OBJECT_AFTER_COMMA`);break;case`}`:n=r,t.pop();break}}function o(e,r){switch(e){case`,`:t.pop(),t.push(`INSIDE_ARRAY_AFTER_COMMA`);break;case`]`:n=r,t.pop();break}}for(let s=0;s<e.length;s++){let c=e[s];switch(t[t.length-1]){case`ROOT`:i(c,s,`FINISH`);break;case`INSIDE_OBJECT_START`:switch(c){case`"`:t.pop(),t.push(`INSIDE_OBJECT_KEY`);break;case`}`:n=s,t.pop();break}break;case`INSIDE_OBJECT_AFTER_COMMA`:switch(c){case`"`:t.pop(),t.push(`INSIDE_OBJECT_KEY`);break}break;case`INSIDE_OBJECT_KEY`:switch(c){case`"`:t.pop(),t.push(`INSIDE_OBJECT_AFTER_KEY`);break}break;case`INSIDE_OBJECT_AFTER_KEY`:switch(c){case`:`:t.pop(),t.push(`INSIDE_OBJECT_BEFORE_VALUE`);break}break;case`INSIDE_OBJECT_BEFORE_VALUE`:i(c,s,`INSIDE_OBJECT_AFTER_VALUE`);break;case`INSIDE_OBJECT_AFTER_VALUE`:a(c,s);break;case`INSIDE_STRING`:switch(c){case`"`:t.pop(),n=s;break;case`\\`:t.push(`INSIDE_STRING_ESCAPE`);break;default:n=s}break;case`INSIDE_ARRAY_START`:switch(c){case`]`:n=s,t.pop();break;default:n=s,i(c,s,`INSIDE_ARRAY_AFTER_VALUE`);break}break;case`INSIDE_ARRAY_AFTER_VALUE`:switch(c){case`,`:t.pop(),t.push(`INSIDE_ARRAY_AFTER_COMMA`);break;case`]`:n=s,t.pop();break;default:n=s;break}break;case`INSIDE_ARRAY_AFTER_COMMA`:i(c,s,`INSIDE_ARRAY_AFTER_VALUE`);break;case`INSIDE_STRING_ESCAPE`:t.pop(),n=s;break;case`INSIDE_NUMBER`:switch(c){case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n=s;break;case`e`:case`E`:case`-`:case`.`:break;case`,`:t.pop(),t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&o(c,s),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`&&a(c,s);break;case`}`:t.pop(),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`&&a(c,s);break;case`]`:t.pop(),t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&o(c,s);break;default:t.pop();break}break;case`INSIDE_LITERAL`:{let i=e.substring(r,s+1);!`false`.startsWith(i)&&!`true`.startsWith(i)&&!`null`.startsWith(i)?(t.pop(),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`?a(c,s):t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&o(c,s)):n=s;break}}}let s=e.slice(0,n+1);for(let n=t.length-1;n>=0;n--)switch(t[n]){case`INSIDE_STRING`:s+=`"`;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`:s+=`}`;break;case`INSIDE_ARRAY_START`:case`INSIDE_ARRAY_AFTER_COMMA`:case`INSIDE_ARRAY_AFTER_VALUE`:s+=`]`;break;case`INSIDE_LITERAL`:{let t=e.substring(r,e.length);`true`.startsWith(t)?s+=`true`.slice(t.length):`false`.startsWith(t)?s+=`false`.slice(t.length):`null`.startsWith(t)&&(s+=`null`.slice(t.length))}}return s}async function DO(e){if(e===void 0)return{value:void 0,state:`undefined-input`};let t=await UE({text:e});return t.success?{value:t.value,state:`successful-parse`}:(t=await UE({text:EO(e)}),t.success?{value:t.value,state:`repaired-parse`}:{value:void 0,state:`failed-parse`})}function OO(e){return e.type.startsWith(`tool-`)}function kO(e){return e.type===`dynamic-tool`}function AO(e){return OO(e)||kO(e)}function jO(e){return e.type.split(`-`).slice(1).join(`-`)}function MO({lastMessage:e,messageId:t}){return{message:(e==null?void 0:e.role)===`assistant`?e:{id:t,metadata:void 0,role:`assistant`,parts:[]},activeTextParts:wO(),activeReasoningParts:wO(),partialToolCalls:wO()}}function NO({stream:e,messageMetadataSchema:t,dataPartSchemas:n,runUpdateMessageJob:r,onError:i,onToolCall:a,onData:o}){return e.pipeThrough(new TransformStream({async transform(e,s){await r(async({state:r,write:c})=>{var l,u,d,f;function p(e){let t=r.message.parts.filter(OO).find(t=>t.toolCallId===e);if(t==null)throw Error(`tool-output-error must be preceded by a tool-input-available`);return t}function m(e){let t=r.message.parts.filter(e=>e.type===`dynamic-tool`).find(t=>t.toolCallId===e);if(t==null)throw Error(`tool-output-error must be preceded by a tool-input-available`);return t}function h(e){var t;let n=r.message.parts.find(t=>OO(t)&&t.toolCallId===e.toolCallId),i=e,a=n;n==null?r.message.parts.push(U({type:`tool-${e.toolName}`,toolCallId:e.toolCallId,state:e.state,input:i.input,output:i.output,rawInput:i.rawInput,errorText:i.errorText,providerExecuted:i.providerExecuted,preliminary:i.preliminary},i.providerMetadata==null?{}:{callProviderMetadata:i.providerMetadata})):(n.state=e.state,a.input=i.input,a.output=i.output,a.errorText=i.errorText,a.rawInput=i.rawInput,a.preliminary=i.preliminary,a.providerExecuted=(t=i.providerExecuted)==null?n.providerExecuted:t,i.providerMetadata!=null&&n.state===`input-available`&&(n.callProviderMetadata=i.providerMetadata))}function g(e){var t,n;let i=r.message.parts.find(t=>t.type===`dynamic-tool`&&t.toolCallId===e.toolCallId),a=e,o=i;i==null?r.message.parts.push(U({type:`dynamic-tool`,toolName:e.toolName,toolCallId:e.toolCallId,state:e.state,input:a.input,output:a.output,errorText:a.errorText,preliminary:a.preliminary,providerExecuted:a.providerExecuted},a.providerMetadata==null?{}:{callProviderMetadata:a.providerMetadata})):(i.state=e.state,o.toolName=e.toolName,o.input=a.input,o.output=a.output,o.errorText=a.errorText,o.rawInput=(t=a.rawInput)==null?o.rawInput:t,o.preliminary=a.preliminary,o.providerExecuted=(n=a.providerExecuted)==null?i.providerExecuted:n,a.providerMetadata!=null&&i.state===`input-available`&&(i.callProviderMetadata=a.providerMetadata))}async function _(e){if(e!=null){let n=r.message.metadata==null?e:TO(r.message.metadata,e);t!=null&&await VE({value:n,schema:t}),r.message.metadata=n}}switch(e.type){case`text-start`:{let t={type:`text`,text:``,providerMetadata:e.providerMetadata,state:`streaming`};r.activeTextParts[e.id]=t,r.message.parts.push(t),c();break}case`text-delta`:{let t=r.activeTextParts[e.id];t.text+=e.delta,t.providerMetadata=(l=e.providerMetadata)==null?t.providerMetadata:l,c();break}case`text-end`:{let t=r.activeTextParts[e.id];t.state=`done`,t.providerMetadata=(u=e.providerMetadata)==null?t.providerMetadata:u,delete r.activeTextParts[e.id],c();break}case`reasoning-start`:{let t={type:`reasoning`,text:``,providerMetadata:e.providerMetadata,state:`streaming`};r.activeReasoningParts[e.id]=t,r.message.parts.push(t),c();break}case`reasoning-delta`:{let t=r.activeReasoningParts[e.id];t.text+=e.delta,t.providerMetadata=(d=e.providerMetadata)==null?t.providerMetadata:d,c();break}case`reasoning-end`:{let t=r.activeReasoningParts[e.id];t.providerMetadata=(f=e.providerMetadata)==null?t.providerMetadata:f,t.state=`done`,delete r.activeReasoningParts[e.id],c();break}case`file`:r.message.parts.push({type:`file`,mediaType:e.mediaType,url:e.url}),c();break;case`source-url`:r.message.parts.push({type:`source-url`,sourceId:e.sourceId,url:e.url,title:e.title,providerMetadata:e.providerMetadata}),c();break;case`source-document`:r.message.parts.push({type:`source-document`,sourceId:e.sourceId,mediaType:e.mediaType,title:e.title,filename:e.filename,providerMetadata:e.providerMetadata}),c();break;case`tool-input-start`:{let t=r.message.parts.filter(OO);r.partialToolCalls[e.toolCallId]={text:``,toolName:e.toolName,index:t.length,dynamic:e.dynamic},e.dynamic?g({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-streaming`,input:void 0,providerExecuted:e.providerExecuted}):h({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-streaming`,input:void 0,providerExecuted:e.providerExecuted}),c();break}case`tool-input-delta`:{let t=r.partialToolCalls[e.toolCallId];t.text+=e.inputTextDelta;let{value:n}=await DO(t.text);t.dynamic?g({toolCallId:e.toolCallId,toolName:t.toolName,state:`input-streaming`,input:n}):h({toolCallId:e.toolCallId,toolName:t.toolName,state:`input-streaming`,input:n}),c();break}case`tool-input-available`:e.dynamic?g({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-available`,input:e.input,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata}):h({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-available`,input:e.input,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata}),c(),a&&!e.providerExecuted&&await a({toolCall:e});break;case`tool-input-error`:e.dynamic?g({toolCallId:e.toolCallId,toolName:e.toolName,state:`output-error`,input:e.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata}):h({toolCallId:e.toolCallId,toolName:e.toolName,state:`output-error`,input:void 0,rawInput:e.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata}),c();break;case`tool-output-available`:if(e.dynamic){let t=m(e.toolCallId);g({toolCallId:e.toolCallId,toolName:t.toolName,state:`output-available`,input:t.input,output:e.output,preliminary:e.preliminary})}else{let t=p(e.toolCallId);h({toolCallId:e.toolCallId,toolName:jO(t),state:`output-available`,input:t.input,output:e.output,providerExecuted:e.providerExecuted,preliminary:e.preliminary})}c();break;case`tool-output-error`:if(e.dynamic){let t=m(e.toolCallId);g({toolCallId:e.toolCallId,toolName:t.toolName,state:`output-error`,input:t.input,errorText:e.errorText,providerExecuted:e.providerExecuted})}else{let t=p(e.toolCallId);h({toolCallId:e.toolCallId,toolName:jO(t),state:`output-error`,input:t.input,rawInput:t.rawInput,errorText:e.errorText,providerExecuted:e.providerExecuted})}c();break;case`start-step`:r.message.parts.push({type:`step-start`});break;case`finish-step`:r.activeTextParts=wO(),r.activeReasoningParts=wO();break;case`start`:e.messageId!=null&&(r.message.id=e.messageId),await _(e.messageMetadata),(e.messageId!=null||e.messageMetadata!=null)&&c();break;case`finish`:e.finishReason!=null&&(r.finishReason=e.finishReason),await _(e.messageMetadata),e.messageMetadata!=null&&c();break;case`message-metadata`:await _(e.messageMetadata),e.messageMetadata!=null&&c();break;case`error`:i==null||i(Error(e.errorText));break;default:if(CO(e)){(n==null?void 0:n[e.type])!=null&&await VE({value:e.data,schema:n[e.type]});let t=e;if(t.transient){o==null||o(t);break}let i=t.id==null?void 0:r.message.parts.find(e=>t.type===e.type&&t.id===e.id);i==null?r.message.parts.push(t):i.data=t.data,o==null||o(t),c()}}s.enqueue(e)})}}))}async function PO({stream:e,onError:t}){let n=e.getReader();try{for(;;){let{done:e}=await n.read();if(e)break}}catch(e){t==null||t(e)}finally{n.releaseLock()}}DE({prefix:`aitxt`,size:24}),DE({prefix:`aiobj`,size:24});var FO=class{constructor(){this.queue=[],this.isProcessing=!1}async processQueue(){var e=this;if(!e.isProcessing){for(e.isProcessing=!0;e.queue.length>0;)await e.queue[0](),e.queue.shift();e.isProcessing=!1}}async run(e){var t=this;return new Promise((n,r)=>{t.queue.push(async()=>{try{await e(),n()}catch(e){r(e)}}),t.processQueue()})}};DE({prefix:`aiobj`,size:24}),oO({},{object:()=>LO,text:()=>IO});var IO=()=>({type:`text`,responseFormat:{type:`text`},async parsePartial({text:e}){return{partial:e}},async parseOutput({text:e}){return e}}),LO=({schema:e})=>{let t=eO(e);return{type:`object`,responseFormat:{type:`json`,schema:t.jsonSchema},async parsePartial({text:e}){let t=await DO(e);switch(t.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:return{partial:t.value};default:{let e=t.state;throw Error(`Unsupported parse state: ${e}`)}}},async parseOutput({text:e},n){let r=await UE({text:e});if(!r.success)throw new dO({message:`No object generated: could not parse the response.`,cause:r.error,text:e,response:n.response,usage:n.usage,finishReason:n.finishReason});let i=await HE({value:r.value,schema:t});if(!i.success)throw new dO({message:`No object generated: response did not match schema.`,cause:i.error,text:e,response:n.response,usage:n.usage,finishReason:n.finishReason});return i.value}}};async function RO(e){if(e==null)return[];if(!globalThis.FileList||!(e instanceof globalThis.FileList))throw Error(`FileList is not supported in the current environment`);return Promise.all(Array.from(e).map(async e=>{let{name:t,type:n}=e;return{type:`file`,mediaType:n,filename:t,url:await new Promise((t,n)=>{let r=new FileReader;r.onload=e=>{var n;t((n=e.target)==null?void 0:n.result)},r.onerror=e=>n(e),r.readAsDataURL(e)})}}))}var zO=class{constructor({api:e=`/api/chat`,credentials:t,headers:n,body:r,fetch:i,prepareSendMessagesRequest:a,prepareReconnectToStreamRequest:o}){this.api=e,this.credentials=t,this.headers=n,this.body=r,this.fetch=i,this.prepareSendMessagesRequest=a,this.prepareReconnectToStreamRequest=o}async sendMessages(e){var t=this;let{abortSignal:n}=e,r=vr(e,rO);var i,a,o,s,c;let l=await GE(t.body),u=await GE(t.headers),d=await GE(t.credentials),f=U(U({},kE(u)),kE(r.headers)),p=await((i=t.prepareSendMessagesRequest)==null?void 0:i.call(t,{api:t.api,id:r.chatId,messages:r.messages,body:U(U({},l),r.body),headers:f,credentials:d,requestMetadata:r.metadata,trigger:r.trigger,messageId:r.messageId})),m=(a=p==null?void 0:p.api)==null?t.api:a,h=(p==null?void 0:p.headers)===void 0?f:kE(p.headers),g=(p==null?void 0:p.body)===void 0?U(U(U({},l),r.body),{},{id:r.chatId,messages:r.messages,trigger:r.trigger,messageId:r.messageId}):p.body,_=(o=p==null?void 0:p.credentials)==null?d:o,v=await((s=t.fetch)==null?globalThis.fetch:s)(m,{method:`POST`,headers:U({"Content-Type":`application/json`},h),body:JSON.stringify(g),credentials:_,signal:n});if(!v.ok)throw Error((c=await v.text())==null?`Failed to fetch the chat response.`:c);if(!v.body)throw Error(`The response body is empty.`);return t.processResponseStream(v.body)}async reconnectToStream(e){var t=this,n,r,i,a,o;let s=await GE(t.body),c=await GE(t.headers),l=await GE(t.credentials),u=U(U({},kE(c)),kE(e.headers)),d=await((n=t.prepareReconnectToStreamRequest)==null?void 0:n.call(t,{api:t.api,id:e.chatId,body:U(U({},s),e.body),headers:u,credentials:l,requestMetadata:e.metadata})),f=(r=d==null?void 0:d.api)==null?`${t.api}/${e.chatId}/stream`:r,p=(d==null?void 0:d.headers)===void 0?u:kE(d.headers),m=(i=d==null?void 0:d.credentials)==null?l:i,h=await((a=t.fetch)==null?globalThis.fetch:a)(f,{method:`GET`,headers:p,credentials:m});if(h.status===204)return null;if(!h.ok)throw Error((o=await h.text())==null?`Failed to fetch the chat response.`:o);if(!h.body)throw Error(`The response body is empty.`);return t.processResponseStream(h.body)}},BO=class extends zO{constructor(e={}){super(e)}processResponseStream(e){return WE({stream:e,schema:SO}).pipeThrough(new TransformStream({async transform(e,t){if(!e.success)throw e.error;t.enqueue(e.value)}}))}},VO=class{constructor({generateId:e=OE,id:t=e(),transport:n=new BO,messageMetadataSchema:r,dataPartSchemas:i,state:a,onError:o,onToolCall:s,onFinish:c,onData:l,sendAutomaticallyWhen:u}){var d=this;this.activeResponse=void 0,this.jobExecutor=new FO,this.sendMessage=async(e,t)=>{var n,r,i,a;if(e==null){await d.makeRequest(U({trigger:`submit-message`,messageId:(n=d.lastMessage)==null?void 0:n.id},t));return}let o;if(o=`text`in e||`files`in e?{parts:[...Array.isArray(e.files)?e.files:await RO(e.files),...`text`in e&&e.text!=null?[{type:`text`,text:e.text}]:[]]}:e,e.messageId!=null){let t=d.state.messages.findIndex(t=>t.id===e.messageId);if(t===-1)throw Error(`message with id ${e.messageId} not found`);if(d.state.messages[t].role!==`user`)throw Error(`message with id ${e.messageId} is not a user message`);d.state.messages=d.state.messages.slice(0,t+1),d.state.replaceMessage(t,U(U({},o),{},{id:e.messageId,role:(r=o.role)==null?`user`:r,metadata:e.metadata}))}else d.state.pushMessage(U(U({},o),{},{id:(i=o.id)==null?d.generateId():i,role:(a=o.role)==null?`user`:a,metadata:e.metadata}));await d.makeRequest(U({trigger:`submit-message`,messageId:e.messageId},t))},this.regenerate=async(e={})=>{let{messageId:t}=e,n=vr(e,iO),r=t==null?d.state.messages.length-1:d.state.messages.findIndex(e=>e.id===t);if(r===-1)throw Error(`message ${t} not found`);d.state.messages=d.state.messages.slice(0,d.messages[r].role===`assistant`?r:r+1),await d.makeRequest(U({trigger:`regenerate-message`,messageId:t},n))},this.resumeStream=async(e={})=>{await d.makeRequest(U({trigger:`resume-stream`},e))},this.clearError=()=>{this.status===`error`&&(this.state.error=void 0,this.setStatus({status:`ready`}))},this.addToolOutput=async({state:e=`output-available`,tool:t,toolCallId:n,output:r,errorText:i})=>d.jobExecutor.run(async()=>{var t,a;let o=d.state.messages,s=o[o.length-1];d.state.replaceMessage(o.length-1,U(U({},s),{},{parts:s.parts.map(t=>AO(t)&&t.toolCallId===n?U(U({},t),{},{state:e,output:r,errorText:i}):t)})),d.activeResponse&&(d.activeResponse.state.message.parts=d.activeResponse.state.message.parts.map(t=>AO(t)&&t.toolCallId===n?U(U({},t),{},{state:e,output:r,errorText:i}):t)),d.status!==`streaming`&&d.status!==`submitted`&&(t=d.sendAutomaticallyWhen)!=null&&t.call(d,{messages:d.state.messages})&&d.makeRequest({trigger:`submit-message`,messageId:(a=d.lastMessage)==null?void 0:a.id})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{var e;d.status!==`streaming`&&d.status!==`submitted`||(e=d.activeResponse)!=null&&e.abortController&&d.activeResponse.abortController.abort()},this.id=t,this.transport=n,this.generateId=e,this.messageMetadataSchema=r,this.dataPartSchemas=i,this.state=a,this.onError=o,this.onToolCall=s,this.onFinish=c,this.onData=l,this.sendAutomaticallyWhen=u}get status(){return this.state.status}setStatus({status:e,error:t}){this.status!==e&&(this.state.status=e,this.state.error=t)}get error(){return this.state.error}get messages(){return this.state.messages}get lastMessage(){return this.state.messages[this.state.messages.length-1]}set messages(e){this.state.messages=e}async makeRequest({trigger:e,metadata:t,headers:n,body:r,messageId:i}){var a=this,o,s,c,l;a.setStatus({status:`submitted`,error:void 0});let u=a.lastMessage,d=!1,f=!1,p=!1;try{let o={state:MO({lastMessage:a.state.snapshot(u),messageId:a.generateId()}),abortController:new AbortController};o.abortController.signal.addEventListener(`abort`,()=>{d=!0}),a.activeResponse=o;let s;if(e===`resume-stream`){let e=await a.transport.reconnectToStream({chatId:a.id,metadata:t,headers:n,body:r});if(e==null){a.setStatus({status:`ready`});return}s=e}else s=await a.transport.sendMessages({chatId:a.id,messages:a.state.messages,abortSignal:o.abortController.signal,metadata:t,headers:n,body:r,trigger:e,messageId:i});await PO({stream:NO({stream:s,onToolCall:a.onToolCall,onData:a.onData,messageMetadataSchema:a.messageMetadataSchema,dataPartSchemas:a.dataPartSchemas,runUpdateMessageJob:e=>a.jobExecutor.run(()=>e({state:o.state,write:()=>{var e;a.setStatus({status:`streaming`}),o.state.message.id===((e=a.lastMessage)==null?void 0:e.id)?a.state.replaceMessage(a.state.messages.length-1,o.state.message):a.state.pushMessage(o.state.message)}})),onError:e=>{throw e}}),onError:e=>{throw e}}),a.setStatus({status:`ready`})}catch(e){if(d||e.name===`AbortError`)return d=!0,a.setStatus({status:`ready`}),null;p=!0,e instanceof TypeError&&(e.message.toLowerCase().includes(`fetch`)||e.message.toLowerCase().includes(`network`))&&(f=!0),a.onError&&e instanceof Error&&a.onError(e),a.setStatus({status:`error`,error:e})}finally{try{(s=a.onFinish)==null||s.call(a,{message:a.activeResponse.state.message,messages:a.state.messages,isAbort:d,isDisconnect:f,isError:p,finishReason:(o=a.activeResponse)==null?void 0:o.state.finishReason})}catch(e){console.error(e)}a.activeResponse=void 0}(c=a.sendAutomaticallyWhen)!=null&&c.call(a,{messages:a.state.messages})&&!p&&await a.makeRequest({trigger:`submit-message`,messageId:(l=a.lastMessage)==null?void 0:l.id,metadata:t,headers:n,body:r})}};function HO({messages:e}){let t=e[e.length-1];if(!t||t.role!==`assistant`)return!1;let n=t.parts.reduce((e,t,n)=>t.type===`step-start`?n:e,-1),r=t.parts.slice(n+1).filter(AO).filter(e=>!e.providerExecuted);return r.length>0&&r.every(e=>e.state===`output-available`||e.state===`output-error`)}var UO=s(((e,t)=>{function n(e,t){if(typeof e!=`function`)throw TypeError(`Expected the first argument to be a \`function\`, got \`${typeof e}\`.`);let n,r=0;return function(...i){clearTimeout(n);let a=Date.now(),o=t-(a-r);o<=0?(r=a,e.apply(this,i)):n=setTimeout(()=>{r=Date.now(),e.apply(this,i)},o)}}t.exports=n}));V();var WO=u(UO(),1);let GO=[`messages`],KO=[`experimental_throttle`,`resume`];var qO=(e,t,n)=>{if(!t.has(e))throw TypeError(`Cannot `+n)},JO=(e,t,n)=>(qO(e,t,`read from private field`),n?n.call(e):t.get(e)),YO=(e,t,n)=>{if(t.has(e))throw TypeError(`Cannot add the same private member more than once`);t instanceof WeakSet?t.add(e):t.set(e,n)},XO=(e,t,n,r)=>(qO(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n);function ZO(e,t){return t==null?e:(0,WO.default)(e,t)}var QO,$O,ek,tk,nk,rk,ik,ak,ok,sk=class{constructor(e=[]){YO(this,QO,void 0),YO(this,$O,`ready`),YO(this,ek,void 0),YO(this,tk,new Set),YO(this,nk,new Set),YO(this,rk,new Set),this.pushMessage=e=>{XO(this,QO,JO(this,QO).concat(e)),JO(this,ik).call(this)},this.popMessage=()=>{XO(this,QO,JO(this,QO).slice(0,-1)),JO(this,ik).call(this)},this.replaceMessage=(e,t)=>{XO(this,QO,[...JO(this,QO).slice(0,e),this.snapshot(t),...JO(this,QO).slice(e+1)]),JO(this,ik).call(this)},this.snapshot=e=>structuredClone(e),this[`~registerMessagesCallback`]=(e,t)=>{let n=t?ZO(e,t):e;return JO(this,tk).add(n),()=>{JO(this,tk).delete(n)}},this[`~registerStatusCallback`]=e=>(JO(this,nk).add(e),()=>{JO(this,nk).delete(e)}),this[`~registerErrorCallback`]=e=>(JO(this,rk).add(e),()=>{JO(this,rk).delete(e)}),YO(this,ik,()=>{JO(this,tk).forEach(e=>e())}),YO(this,ak,()=>{JO(this,nk).forEach(e=>e())}),YO(this,ok,()=>{JO(this,rk).forEach(e=>e())}),XO(this,QO,e)}get status(){return JO(this,$O)}set status(e){XO(this,$O,e),JO(this,ak).call(this)}get error(){return JO(this,ek)}set error(e){XO(this,ek,e),JO(this,ok).call(this)}get messages(){return JO(this,QO)}set messages(e){XO(this,QO,[...e]),JO(this,ik).call(this)}};QO=new WeakMap,$O=new WeakMap,ek=new WeakMap,tk=new WeakMap,nk=new WeakMap,rk=new WeakMap,ik=new WeakMap,ak=new WeakMap,ok=new WeakMap;var ck,lk=class extends VO{constructor(e){let{messages:t}=e,n=vr(e,GO),r=new sk(t);super(U(U({},n),{},{state:r})),YO(this,ck,void 0),this[`~registerMessagesCallback`]=(e,t)=>JO(this,ck)[`~registerMessagesCallback`](e,t),this[`~registerStatusCallback`]=e=>JO(this,ck)[`~registerStatusCallback`](e),this[`~registerErrorCallback`]=e=>JO(this,ck)[`~registerErrorCallback`](e),XO(this,ck,r)}};ck=new WeakMap;function uk(e={}){let{experimental_throttle:t,resume:n=!1}=e,r=vr(e,KO),i=R(`chat`in r?r.chat:new lk(r));(`chat`in r&&r.chat!==i.current||`id`in r&&i.current.id!==r.id)&&(i.current=`chat`in r?r.chat:new lk(r));let a=dt(Le(e=>i.current[`~registerMessagesCallback`](e,t),[t,i.current.id]),()=>i.current.messages,()=>i.current.messages),o=dt(i.current[`~registerStatusCallback`],()=>i.current.status,()=>i.current.status),s=dt(i.current[`~registerErrorCallback`],()=>i.current.error,()=>i.current.error),c=Le(e=>{typeof e==`function`&&(e=e(i.current.messages)),i.current.messages=e},[i]);return Pe(()=>{n&&i.current.resumeStream()},[n,i]),{id:i.current.id,messages:a,setMessages:c,sendMessage:i.current.sendMessage,regenerate:i.current.regenerate,clearError:i.current.clearError,stop:i.current.stop,error:s,resumeStream:i.current.resumeStream,status:o,addToolResult:i.current.addToolOutput,addToolOutput:i.current.addToolOutput}}V();function dk(e){return B.createElement(`svg`,_({width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,fillRule:`evenodd`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`},e),B.createElement(`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`}),B.createElement(`path`,{d:`M12 9v4`}),B.createElement(`path`,{d:`M12 17h.01`}))}function fk(){return B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:18,height:18,viewBox:`0 0 18 18`,fill:`none`},B.createElement(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M8.99984 1.29102C4.74264 1.29102 1.2915 4.74215 1.2915 8.99935C1.2915 13.2565 4.74264 16.7077 8.99984 16.7077C13.257 16.7077 16.7082 13.2565 16.7082 8.99935C16.7082 4.74215 13.257 1.29102 8.99984 1.29102ZM0.0415039 8.99935C0.0415039 4.0518 4.05229 0.0410156 8.99984 0.0410156C13.9474 0.0410156 17.9582 4.0518 17.9582 8.99935C17.9582 13.9469 13.9474 17.9577 8.99984 17.9577C4.05229 17.9577 0.0415039 13.9469 0.0415039 8.99935ZM5.87484 6.49935C5.87484 6.15417 6.15466 5.87435 6.49984 5.87435H11.4998C11.845 5.87435 12.1248 6.15417 12.1248 6.49935V11.4993C12.1248 11.8445 11.845 12.1243 11.4998 12.1243H6.49984C6.15466 12.1243 5.87484 11.8445 5.87484 11.4993V6.49935ZM7.12484 7.12435V10.8743H10.8748V7.12435H7.12484Z`,fill:`currentcolor`}))}function pk(){return B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:4,height:16,viewBox:`0 0 4 16`,fill:`none`},B.createElement(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M1.99984 1.95898C1.88478 1.95898 1.7915 2.05226 1.7915 2.16732C1.7915 2.28238 1.88478 2.37565 1.99984 2.37565C2.1149 2.37565 2.20817 2.28238 2.20817 2.16732C2.20817 2.05226 2.1149 1.95898 1.99984 1.95898ZM0.541504 2.16732C0.541504 1.3619 1.19442 0.708984 1.99984 0.708984C2.80525 0.708984 3.45817 1.3619 3.45817 2.16732C3.45817 2.97273 2.80525 3.62565 1.99984 3.62565C1.19442 3.62565 0.541504 2.97273 0.541504 2.16732ZM1.99984 7.79232C1.88478 7.79232 1.7915 7.88559 1.7915 8.00065C1.7915 8.11571 1.88478 8.20898 1.99984 8.20898C2.1149 8.20898 2.20817 8.11571 2.20817 8.00065C2.20817 7.88559 2.1149 7.79232 1.99984 7.79232ZM0.541504 8.00065C0.541504 7.19524 1.19442 6.54232 1.99984 6.54232C2.80525 6.54232 3.45817 7.19524 3.45817 8.00065C3.45817 8.80607 2.80525 9.45898 1.99984 9.45898C1.19442 9.45898 0.541504 8.80607 0.541504 8.00065ZM1.99984 13.6257C1.88478 13.6257 1.7915 13.7189 1.7915 13.834C1.7915 13.949 1.88478 14.0423 1.99984 14.0423C2.1149 14.0423 2.20817 13.949 2.20817 13.834C2.20817 13.7189 2.1149 13.6257 1.99984 13.6257ZM0.541504 13.834C0.541504 13.0286 1.19442 12.3757 1.99984 12.3757C2.80525 12.3757 3.45817 13.0286 3.45817 13.834C3.45817 14.6394 2.80525 15.2923 1.99984 15.2923C1.19442 15.2923 0.541504 14.6394 0.541504 13.834Z`,fill:`currentcolor`}))}function mk(){return B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`18`,height:`18`,viewBox:`0 0 18 18`,fill:`none`},B.createElement(`path`,{d:`M9 0.875C10.6068 0.875 12.1776 1.35149 13.5137 2.24414C14.8498 3.13693 15.8919 4.40598 16.5068 5.89062C17.1218 7.37522 17.2822 9.00892 16.9688 10.585C16.6552 12.1611 15.8814 13.6088 14.7451 14.7451C13.6088 15.8814 12.1611 16.6552 10.585 16.9688C9.00892 17.2822 7.37523 17.1218 5.89062 16.5068C4.40598 15.8919 3.13693 14.8498 2.24414 13.5137C1.35149 12.1776 0.875 10.6068 0.875 9C0.875 8.65482 1.15482 8.375 1.5 8.375C1.84518 8.375 2.125 8.65482 2.125 9C2.125 10.3596 2.52792 11.6888 3.2832 12.8193C4.03864 13.9499 5.1129 14.8312 6.36914 15.3516C7.62523 15.8718 9.00736 16.0083 10.3408 15.7432C11.6744 15.4779 12.8998 14.8228 13.8613 13.8613C14.8228 12.8998 15.4779 11.6744 15.7432 10.3408C16.0083 9.00736 15.8718 7.62523 15.3516 6.36914C14.8312 5.1129 13.9499 4.03864 12.8193 3.2832C11.6888 2.52792 10.3596 2.125 9 2.125C7.06829 2.125 5.21604 2.89096 3.82129 4.22949L3.00879 5.04199H5.66699C6.01202 5.04217 6.29199 5.32192 6.29199 5.66699C6.29182 6.01191 6.01191 6.29182 5.66699 6.29199H1.5C1.45939 6.29199 1.41889 6.28716 1.37891 6.2793C1.36148 6.27587 1.345 6.26949 1.32812 6.26465C1.267 6.24714 1.20782 6.22205 1.15332 6.18555C1.08536 6.14005 1.02604 6.08256 0.980469 6.01465C0.970244 5.99942 0.962841 5.98268 0.954102 5.9668C0.904937 5.87756 0.875056 5.77606 0.875 5.66699V1.5C0.875 1.15482 1.15482 0.875002 1.5 0.875C1.84518 0.875 2.125 1.15482 2.125 1.5V4.15723L2.94141 3.3418L2.9502 3.33301C4.57158 1.77433 6.73388 0.875 9 0.875ZM9.33301 4.20801C9.67808 4.20801 9.95783 4.48798 9.95801 4.83301V9.44727L12.9463 10.9414C13.2548 11.0958 13.3798 11.4707 13.2256 11.7793C13.0712 12.088 12.6955 12.213 12.3867 12.0586L9.05371 10.3926C8.84198 10.2867 8.70801 10.0697 8.70801 9.83301V4.83301C8.70818 4.48809 8.98809 4.20819 9.33301 4.20801Z`,fill:`currentcolor`}))}function hk(){return B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`19`,height:`19`,viewBox:`0 0 19 19`,fill:`none`},B.createElement(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M0.712717 3.38039C1.14249 2.95062 1.72538 2.70917 2.33317 2.70917H8.1665C8.51168 2.70917 8.7915 2.989 8.7915 3.33417C8.7915 3.67935 8.51168 3.95917 8.1665 3.95917H2.33317C2.0569 3.95917 1.79195 4.06892 1.5966 4.26427C1.40125 4.45962 1.2915 4.72457 1.2915 5.00084V16.6675C1.2915 16.9438 1.40125 17.2087 1.5966 17.4041C1.79195 17.5994 2.0569 17.7092 2.33317 17.7092H13.9998C14.2761 17.7092 14.5411 17.5994 14.7364 17.4041C14.9318 17.2087 15.0415 16.9438 15.0415 16.6675V10.8342C15.0415 10.489 15.3213 10.2092 15.6665 10.2092C16.0117 10.2092 16.2915 10.489 16.2915 10.8342V16.6675C16.2915 17.2753 16.0501 17.8582 15.6203 18.288C15.1905 18.7177 14.6076 18.9592 13.9998 18.9592H2.33317C1.72538 18.9592 1.14249 18.7177 0.712717 18.288C0.282947 17.8582 0.0415039 17.2753 0.0415039 16.6675V5.00084C0.0415039 4.39305 0.282947 3.81016 0.712717 3.38039Z`,fill:`currentcolor`}),B.createElement(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M15.6665 2.19141C15.3634 2.19141 15.0728 2.3118 14.8584 2.52611L7.06419 10.3204L6.52548 12.4752L8.68031 11.9365L16.4746 4.14223C16.6889 3.92792 16.8093 3.63725 16.8093 3.33417C16.8093 3.03109 16.6889 2.74043 16.4746 2.52611C16.2603 2.3118 15.9696 2.19141 15.6665 2.19141ZM13.9746 1.64223C14.4233 1.1935 15.0319 0.941406 15.6665 0.941406C16.3011 0.941406 16.9097 1.1935 17.3584 1.64223C17.8072 2.09096 18.0593 2.69957 18.0593 3.33417C18.0593 3.96877 17.8072 4.57738 17.3584 5.02611L9.44178 12.9428C9.36168 13.0229 9.26132 13.0797 9.15142 13.1072L5.81809 13.9405C5.6051 13.9938 5.3798 13.9314 5.22456 13.7761C5.06932 13.6209 5.00692 13.3956 5.06016 13.1826L5.8935 9.84925C5.92097 9.73936 5.9778 9.639 6.0579 9.5589L13.9746 1.64223Z`,fill:`currentcolor`}))}function gk({size:e=20}){return B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`DocSearch-Search-Icon`},B.createElement(`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`}))}function _k(){return B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},B.createElement(`path`,{d:`M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z`}),B.createElement(`path`,{d:`M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z`}))}function vk({size:e=20,color:t=`currentColor`}){return B.createElement(`svg`,{width:e,height:e,className:`DocSearch-Back-Icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:t,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`},B.createElement(`path`,{d:`m12 19-7-7 7-7`}),B.createElement(`path`,{d:`M19 12H5`}))}let yk=B.memo(function({title:e,suggestions:t,onSelectPromptSuggestion:n}){let r=B.useId(),i=B.useCallback(e=>{n(e.currentTarget.value)},[n]);return B.createElement(`section`,{className:`DocSearch-PromptSuggestions`,"aria-labelledby":r},B.createElement(`h3`,{className:`DocSearch-PromptSuggestions-Title`,id:r},e),B.createElement(`div`,{className:`DocSearch-PromptSuggestions-Content`},t.map(e=>B.createElement(`button`,{key:e,type:`button`,className:`DocSearch-PromptSuggestions-Action`,value:e,onClick:i},e))))}),bk=[{value:`incorrect`,translationKey:`feedbackTagIncorrect`,defaultLabel:`Incorrect or incomplete`},{value:`not_what_i_asked`,translationKey:`feedbackTagNotWhatIAsked`,defaultLabel:`Not what I asked for`},{value:`slow_or_buggy`,translationKey:`feedbackTagSlowOrBuggy`,defaultLabel:`Slow or buggy`},{value:`style_or_tone`,translationKey:`feedbackTagStyleOrTone`,defaultLabel:`Style or tone`},{value:`safety_or_legal`,translationKey:`feedbackTagSafetyOrLegal`,defaultLabel:`Safety or legal concern`},{value:`other`,translationKey:`feedbackTagOther`,defaultLabel:`Other`}],xk=1e3;function Sk({id:e,showActions:t,latestAssistantMessageContent:n,translations:r,conversations:i,onFeedback:a,isSidepanel:o=!1}){let[s,c]=Me(()=>{var t;let n=(t=i.getOne)==null?void 0:t.call(i,e);return n!=null&&n.feedback?`thanks`:`actions`}),[l,u]=Me([]),[d,f]=Me(``),[p,m]=Me(!1),[h,g]=Me(null),{likeButtonTitle:_=`Like`,dislikeButtonTitle:v=`Dislike`,thanksForFeedbackText:y=`Thanks for your feedback!`}=r,b=async()=>{if(!p){g(null),m(!0);try{await(a==null?void 0:a(e,{thumbs:1})),c(`thanks`)}catch(e){g(e)}finally{m(!1)}}},x=()=>{g(null),c(`note`)},S=e=>{u(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},C=async()=>{if(!p){g(null),m(!0);try{await(a==null?void 0:a(e,{thumbs:0,tags:l.length>0?l:void 0,notes:d.trim()||void 0})),c(`thanks`)}catch(e){g(e)}finally{m(!1)}}},w=()=>{u([]),f(``),g(null),c(`actions`)};if(!t||!n)return null;let T=B.createElement(wk,{translations:r,onClick:()=>navigator.clipboard.writeText(n)});return B.createElement(B.Fragment,null,B.createElement(`div`,{className:`DocSearch-AskAiScreen-Actions-Controls`},o?T:null,s===`thanks`?B.createElement(`p`,{className:`DocSearch-AskAiScreen-FeedbackText DocSearch-AskAiScreen-FeedbackText--visible`},y):B.createElement(B.Fragment,null,p&&s===`actions`?B.createElement(Er,{className:`DocSearch-AskAiScreen-SmallerLoadingIcon`}):B.createElement(B.Fragment,null,B.createElement(Tk,{title:_,onClick:b}),B.createElement(Ek,{title:v,onClick:x})),h&&s===`actions`?B.createElement(`p`,{className:`DocSearch-AskAiScreen-FeedbackText`},h.message||`An error occured`):null),o?null:T),s===`note`?B.createElement(Ck,{translations:r,tags:l,notes:d,saving:p,savingError:h,onToggleTag:S,onNotesChange:f,onSubmit:C,onClose:w}):null)}function Ck({translations:e,tags:t,notes:n,saving:r,savingError:i,onToggleTag:a,onNotesChange:o,onSubmit:s,onClose:c}){let l=B.useId(),{feedbackPanelTitle:u=`What went wrong? (optional)`,feedbackDetailsPlaceholder:d=`Share some details...`,feedbackSubmitButtonText:f=`Submit`,feedbackCancelButtonText:p=`Cancel`}=e;return B.createElement(`div`,{className:`DocSearch-Feedback-Panel`,role:`group`,"aria-labelledby":l},B.createElement(`div`,{className:`DocSearch-Feedback-Panel-Header`},B.createElement(`p`,{className:`DocSearch-Feedback-Panel-Title`,id:l},u)),B.createElement(`div`,{className:`DocSearch-Feedback-Panel-Reasons`},bk.map(n=>{var r;let i=t.includes(n.value);return B.createElement(`button`,{key:n.value,type:`button`,className:`DocSearch-Feedback-Panel-Reason`,"aria-pressed":i,onClick:()=>a(n.value)},B.createElement(`span`,null,(r=e[n.translationKey])==null?n.defaultLabel:r))})),B.createElement(`textarea`,{className:`DocSearch-Feedback-Panel-Textarea`,placeholder:d,value:n,rows:3,maxLength:xk,onChange:e=>o(e.target.value.slice(0,xk))}),B.createElement(`p`,{className:`DocSearch-Feedback-Panel-CharCount`,"aria-live":`polite`},n.length,`/`,xk),i?B.createElement(`p`,{className:`DocSearch-Feedback-Panel-Error`},i.message||`An error occured`):null,B.createElement(`div`,{className:`DocSearch-Feedback-Panel-Actions`},B.createElement(`button`,{type:`button`,className:`DocSearch-Feedback-Panel-Cancel`,onClick:c},p),B.createElement(`button`,{type:`button`,className:`DocSearch-Feedback-Panel-Submit`,disabled:r,onClick:s},r?B.createElement(Er,{className:`DocSearch-AskAiScreen-SmallerLoadingIcon`}):f)))}function wk({onClick:e,translations:t}){let{copyButtonTitle:n=`Copy`,copyButtonCopiedText:r=`Copied!`}=t,[i,a]=Me(!1);return Pe(()=>{if(i){let e=setTimeout(()=>{a(!1)},1500);return()=>clearTimeout(e)}},[i]),B.createElement(`button`,{type:`button`,className:`DocSearch-AskAiScreen-ActionButton DocSearch-AskAiScreen-CopyButton ${i?`DocSearch-AskAiScreen-CopyButton--copied`:``}`,disabled:i,title:i?r:n,onClick:()=>{e(),a(!0)}},i?B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},B.createElement(`path`,{d:`M20 6 9 17l-5-5`})):B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},B.createElement(`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}),B.createElement(`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`})))}function Tk({title:e,onClick:t}){return B.createElement(`button`,{type:`button`,className:`DocSearch-AskAiScreen-ActionButton DocSearch-AskAiScreen-LikeButton`,title:e,onClick:t},B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},B.createElement(`path`,{d:`M7 10v12`}),B.createElement(`path`,{d:`M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z`})))}function Ek({title:e,onClick:t}){return B.createElement(`button`,{type:`button`,className:`DocSearch-AskAiScreen-ActionButton DocSearch-AskAiScreen-DislikeButton`,title:e,onClick:t},B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},B.createElement(`path`,{d:`M17 14V2`}),B.createElement(`path`,{d:`M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z`})))}let Dk=[`className`],Ok=[`align`,`alignOffset`,`side`,`sideOffset`,`collisionBoundary`,`container`,`children`];function kk(e){let t=Ar({},(kr(e),e));return B.createElement(ih,t)}kk.Trigger=B.forwardRef((e,t)=>{let{className:n}=e,r=pn(e,Dk),i=`DocSearch-Popover-Trigger${n?` ${n}`:``}`;return B.createElement(sh,_({className:i,ref:t},r))});function Ak(e){let{align:t=`center`,alignOffset:n=0,side:r=`bottom`,sideOffset:i=4,collisionBoundary:a=`clipping-ancestors`,container:o,children:s}=e,c=pn(e,Ok);return B.createElement(dh,{container:o},B.createElement(hh,{className:`DocSearch-Popover-Positioner`,align:t,alignOffset:n,side:r,sideOffset:i,collisionBoundary:a},B.createElement(Sh,_({className:`DocSearch-Popover-Popup`},c),B.createElement(wh,{className:`DocSearch-Popover-Arrow`}),B.createElement(Oh,{className:`DocSearch-Popover-Close`},B.createElement(jr,null)),s)))}kk.Popup=Ak;function jk(e){let t=Ar({},(kr(e),e));return B.createElement(Eh,_({className:`DocSearch-Popover-Title`},t))}kk.Title=jk;function Mk({links:e,titleText:t=`Source`,pluralTitleText:n=`Sources`}){let[r,i]=B.useState(!1),a=B.useRef(null),[o,s]=B.useState(null),c=e.length>1?n:t;return Pe(()=>{var e,t;if(!r)return;let n=a.current,o=(e=(t=n==null?void 0:n.closest(`.DocSearch-Sidepanel-Content`))==null?n==null?void 0:n.closest(`.DocSearch-Dropdown`):t)==null?null:e;if(s(o),!o)return;let c=()=>{if(!a.current)return;let e=a.current.getBoundingClientRect(),t=o.getBoundingClientRect();(e.bottom<=t.top||e.top>=t.bottom)&&i(!1)};return o.addEventListener(`scroll`,c,{passive:!0}),()=>{o.removeEventListener(`scroll`,c)}},[r]),e.length===0?null:B.createElement(kk,{open:r,modal:`trap-focus`,onOpenChange:i},B.createElement(kk.Trigger,{ref:a,className:`DocSearch-AskAiScreen-Sources-Action`},B.createElement(`span`,{className:`DocSearch-AskAiScreen-Sources-Action-icon`},B.createElement(Fr,null)),B.createElement(`span`,{className:`DocSearch-AskAiScreen-Sources-Action-text`},e.length,` `,c)),B.createElement(kk.Popup,{container:o,sideOffset:10,align:`start`,alignOffset:-16,collisionBoundary:o==null?`clipping-ancestors`:o},B.createElement(kk.Title,null,c),B.createElement(`ul`,{className:`DocSearch-AskAiScreen-Sources`},e.map(e=>B.createElement(`li`,{key:e.url,className:`DocSearch-AskAiScreen-Sources-source`},B.createElement(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`},B.createElement(Fr,null),B.createElement(`span`,{className:`DocSearch-AskAiScreen-Sources-source-title`},e.title||e.url)))))))}let Nk=new Set([`AI-203`,`AI-205`,`AI-224`,`AI-225`]);function Pk(e,t){for(let[n,r]of Object.entries(e))if(n.toLowerCase()===t.toLowerCase()&&typeof r==`string`&&r.trim()!==``)return r.trim()}function Fk(e){let t=/\b(AI-\d{3})\b/i.exec(e);if(t)return t[1].toUpperCase()}function Ik(e){try{let t=JSON.parse(e);if(t&&typeof t==`object`&&!Array.isArray(t))return t}catch(e){}return null}function Lk(e){return/\brequest blocked for this domain\b/.test(e)||/\bblocked for this domain\b/.test(e)}function Rk(e){return/\b429\b/.test(e)||/\brate\s*limit/.test(e)||/\bretry\s+after\s+\d+/.test(e)||/\btoo\s+many\s+attempts\b/.test(e)||/\btoo_many_requests\b/.test(e)}function zk(e){return/\btokenoutputlimiterror\b/.test(e)||/could not complete response due to token output limits/.test(e)}function Bk(e){return/\bwhitelist(?:ed)?\b/.test(e)||/\bnot\s+allowed\s+for\s+this\s+domain\b/.test(e)||/\bcontext\s+length\b/.test(e)||/\b(?:max|maximum)\s+tokens?\b/.test(e)||/\btoken\s+limit\b/.test(e)||/\btoken\s+output\b/.test(e)||/\boutput\s+limits?\b/.test(e)||/\bstep\s+limit\b/.test(e)||/\b(?:max|maximum)(?:\s+agent)?\s+steps?\b/.test(e)}function Vk(e){var t,n,r;let i=(t=Pk(e,`type`))==null?``:t,a=(n=Pk(e,`error`))==null?``:n,o=(r=Pk(e,`message`))==null?``:r;return/tokenoutput|outputlimit|steplimit|maxstep|ratelimit|domainnotallowed/i.test(i)||a.toUpperCase()===`TOO_MANY_REQUESTS`||Rk(`${a} ${o}`.toLowerCase())||Bk(`${a} ${o}`.toLowerCase())}let Hk=[{matches:({code:e})=>!!(e&&Nk.has(e))},{matches:({parsedJson:e})=>{var t;return!!(e&&Lk(((t=Pk(e,`message`))==null?``:t).toLowerCase()))},showNewConversationLink:!1},{matches:({parsedJson:e})=>!!(e&&Vk(e))},{matches:({messageLower:e})=>zk(e),showNewConversationLink:!1},{matches:({messageLower:e})=>Rk(e)},{matches:({messageLower:e})=>Lk(e),showNewConversationLink:!1},{matches:({messageLower:e})=>Bk(e)}];function Uk(e){var t;let n=(t=e.message)==null?``:t,r={message:n,messageLower:n.toLowerCase(),parsedJson:Ik(n),code:Fk(n)},i=Hk.filter(e=>e.matches(r));return{blocking:i.length>0,showNewConversationLink:i.every(e=>e.showNewConversationLink!==!1)}}function Wk(e){var t;return!!(e&&zk(((t=e.message)==null?``:t).toLowerCase()))}function Gk(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#039;`)}function Kk(e){return Gk(e.replace(/<[^>]*>/g,``))}function qk(e){let t=e;for(let e=0;e<3;e+=1)try{let e=decodeURIComponent(t);if(e===t)break;t=e}catch(e){break}return t}function Jk(e){let t=``;for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);r>32&&r!==127&&(t+=e[n])}return t}function Yk(e){if(!e)return``;let t=e.trim();if(!t)return``;let n=Jk(qk(t));if(!n||n.startsWith(`//`))return``;if(!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(n))return t;try{let e=new URL(n);if(e.protocol===`http:`||e.protocol===`https:`||e.protocol===`mailto:`)return n}catch(e){return``}return``}function Xk(e){let t=[],n=new Set;return e?(e.parts.forEach(e=>{if(e.type!==`text`||e.text.length===0)return;let r=/\[([^\]]*)\]\(([^)]+)\)/g,i=RegExp('(?<!\\]\\()https?:\\/\\/[^\\s<>"{}|\\\\^`[\\]]+',`g`),a=e.text.replace(/```[\s\S]*?```/g,``).replace(/`[^`]*`/g,``),o=a.matchAll(r);for(let e of o){let r=e[1].trim(),i=Yk(e[2]);i&&!n.has(i)&&(n.add(i),t.push({url:i,title:r||void 0}))}let s=a.matchAll(i);for(let e of s){let r=Yk(e[0].replace(/[.,;:!?]+$/,``));r&&!n.has(r)&&(n.add(r),t.push({url:r}))}}),t):[]}let Zk=(e,t,n)=>{let r=t[0].parts.find(e=>e.type===`text`),i=r!=null&&r.text?Kk(r.text):``;return{query:e,objectID:i,chatId:n,messages:t,type:`askAI`,anchor:`stored`,content:null,hierarchy:{lvl0:`askAI`,lvl1:i,lvl2:new Date().toISOString(),lvl3:null,lvl4:null,lvl5:null,lvl6:null},url:``,url_without_anchor:``}},Qk=e=>{var t;return((t=e==null?void 0:e.parts)==null?[]:t).filter(e=>e.type===`text`).map(e=>e.text).join(`
104
+ ]`;continue}a+=i[e],i[e]===`\\`?o=!0:s&&i[e]===`]`?s=!1:!s&&i[e]===`[`&&(s=!0)}try{new RegExp(a)}catch(n){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 a}function qT(e,t){var n,r,i,a,o,s;let c={type:`object`,additionalProperties:(n=gE(e.valueType._def,U(U({},t),{},{currentPath:[...t.currentPath,`additionalProperties`]})))==null?t.allowedAdditionalProperties:n};if(((r=e.keyType)==null?void 0:r._def.typeName)===$.ZodString&&(i=e.keyType._def.checks)!=null&&i.length){let n=BT(e.keyType._def,t),{type:r}=n,i=vr(n,Zw);return U(U({},c),{},{propertyNames:i})}else if(((a=e.keyType)==null?void 0:a._def.typeName)===$.ZodEnum)return U(U({},c),{},{propertyNames:{enum:e.keyType._def.values}});else if(((o=e.keyType)==null?void 0:o._def.typeName)===$.ZodBranded&&e.keyType._def.type._def.typeName===$.ZodString&&(s=e.keyType._def.type._def.checks)!=null&&s.length){let n=OT(e.keyType._def,t),{type:r}=n,i=vr(n,Qw);return U(U({},c),{},{propertyNames:i})}return c}function JT(e,t){return t.mapStrategy===`record`?qT(e,t):{type:`array`,maxItems:125,items:{type:`array`,items:[gE(e.keyType._def,U(U({},t),{},{currentPath:[...t.currentPath,`items`,`items`,`0`]}))||wT(),gE(e.valueType._def,U(U({},t),{},{currentPath:[...t.currentPath,`items`,`items`,`1`]}))||wT()],minItems:2,maxItems:2}}}function YT(e){let t=e.values,n=Object.keys(e.values).filter(e=>typeof t[t[e]]!=`number`).map(e=>t[e]),r=Array.from(new Set(n.map(e=>typeof e)));return{type:r.length===1?r[0]===`string`?`string`:`number`:[`string`,`number`],enum:n}}function XT(){return{not:wT()}}function ZT(){return{type:`null`}}var QT={ZodString:`string`,ZodNumber:`number`,ZodBigInt:`integer`,ZodBoolean:`boolean`,ZodNull:`null`};function $T(e,t){let n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in QT&&(!e._def.checks||!e._def.checks.length))){let e=n.reduce((e,t)=>{let n=QT[t._def.typeName];return n&&!e.includes(n)?[...e,n]:e},[]);return{type:e.length>1?e:e[0]}}else if(n.every(e=>e._def.typeName===`ZodLiteral`&&!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(t._def.value===null)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=>e._def.typeName===`ZodEnum`))return{type:`string`,enum:n.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return eE(e,t)}var eE=(e,t)=>{let n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>gE(e._def,U(U({},t),{},{currentPath:[...t.currentPath,`anyOf`,`${n}`]}))).filter(e=>!!e&&(!t.strictUnions||typeof e==`object`&&Object.keys(e).length>0));return n.length?{anyOf:n}:void 0};function tE(e,t){if([`ZodString`,`ZodNumber`,`ZodBigInt`,`ZodBoolean`,`ZodNull`].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[QT[e.innerType._def.typeName],`null`]};let n=gE(e.innerType._def,U(U({},t),{},{currentPath:[...t.currentPath,`anyOf`,`0`]}));return n&&{anyOf:[n,{type:`null`}]}}function nE(e){let t={type:`number`};if(!e.checks)return t;for(let n of e.checks)switch(n.kind){case`int`:t.type=`integer`;break;case`min`:n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case`max`:n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case`multipleOf`:t.multipleOf=n.value;break}return t}function rE(e,t){let n={type:`object`,properties:{}},r=[],i=e.shape();for(let e in i){let a=i[e];if(a===void 0||a._def===void 0)continue;let o=aE(a),s=gE(a._def,U(U({},t),{},{currentPath:[...t.currentPath,`properties`,e],propertyPath:[...t.currentPath,`properties`,e]}));s!==void 0&&(n.properties[e]=s,o||r.push(e))}r.length&&(n.required=r);let a=iE(e,t);return a!==void 0&&(n.additionalProperties=a),n}function iE(e,t){if(e.catchall._def.typeName!==`ZodNever`)return gE(e.catchall._def,U(U({},t),{},{currentPath:[...t.currentPath,`additionalProperties`]}));switch(e.unknownKeys){case`passthrough`:return t.allowedAdditionalProperties;case`strict`:return t.rejectedAdditionalProperties;case`strip`:return t.removeAdditionalStrategy===`strict`?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function aE(e){try{return e.isOptional()}catch(e){return!0}}var oE=(e,t)=>{var n;if(t.currentPath.toString()===((n=t.propertyPath)==null?void 0:n.toString()))return gE(e.innerType._def,t);let r=gE(e.innerType._def,U(U({},t),{},{currentPath:[...t.currentPath,`anyOf`,`1`]}));return r?{anyOf:[{not:wT()},r]}:wT()},sE=(e,t)=>{if(t.pipeStrategy===`input`)return gE(e.in._def,t);if(t.pipeStrategy===`output`)return gE(e.out._def,t);let n=gE(e.in._def,U(U({},t),{},{currentPath:[...t.currentPath,`allOf`,`0`]}));return{allOf:[n,gE(e.out._def,U(U({},t),{},{currentPath:[...t.currentPath,`allOf`,n?`1`:`0`]}))].filter(e=>e!==void 0)}};function cE(e,t){return gE(e.type._def,t)}function lE(e,t){let n={type:`array`,uniqueItems:!0,items:gE(e.valueType._def,U(U({},t),{},{currentPath:[...t.currentPath,`items`]}))};return e.minSize&&(n.minItems=e.minSize.value),e.maxSize&&(n.maxItems=e.maxSize.value),n}function uE(e,t){return e.rest?{type:`array`,minItems:e.items.length,items:e.items.map((e,n)=>gE(e._def,U(U({},t),{},{currentPath:[...t.currentPath,`items`,`${n}`]}))).reduce((e,t)=>t===void 0?e:[...e,t],[]),additionalItems:gE(e.rest._def,U(U({},t),{},{currentPath:[...t.currentPath,`additionalItems`]}))}:{type:`array`,minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>gE(e._def,U(U({},t),{},{currentPath:[...t.currentPath,`items`,`${n}`]}))).reduce((e,t)=>t===void 0?e:[...e,t],[])}}function dE(){return{not:wT()}}function fE(){return wT()}var pE=(e,t)=>gE(e.innerType._def,t),mE=(e,t,n)=>{switch(t){case $.ZodString:return BT(e,n);case $.ZodNumber:return nE(e);case $.ZodObject:return rE(e,n);case $.ZodBigInt:return ET(e);case $.ZodBoolean:return DT();case $.ZodDate:return AT(e,n);case $.ZodUndefined:return dE();case $.ZodNull:return ZT();case $.ZodArray:return TT(e,n);case $.ZodUnion:case $.ZodDiscriminatedUnion:return $T(e,n);case $.ZodIntersection:return IT(e,n);case $.ZodTuple:return uE(e,n);case $.ZodRecord:return qT(e,n);case $.ZodLiteral:return LT(e);case $.ZodEnum:return PT(e);case $.ZodNativeEnum:return YT(e);case $.ZodNullable:return tE(e,n);case $.ZodOptional:return oE(e,n);case $.ZodMap:return JT(e,n);case $.ZodSet:return lE(e,n);case $.ZodLazy:return()=>e.getter()._def;case $.ZodPromise:return cE(e,n);case $.ZodNaN:case $.ZodNever:return XT();case $.ZodEffects:return NT(e,n);case $.ZodAny:return wT();case $.ZodUnknown:return fE();case $.ZodDefault:return MT(e,n);case $.ZodBranded:return OT(e,n);case $.ZodReadonly:return pE(e,n);case $.ZodCatch:return kT(e,n);case $.ZodPipeline:return sE(e,n);case $.ZodFunction:case $.ZodVoid:case $.ZodSymbol:return;default:return(e=>void 0)(t)}},hE=(e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join(`/`)};function gE(e,t,n=!1){var r;let i=t.seen.get(e);if(t.override){let a=(r=t.override)==null?void 0:r.call(t,e,t,i,n);if(a!==xT)return a}if(i&&!n){let e=_E(i,t);if(e!==void 0)return e}let a={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,a);let o=mE(e,e.typeName,t),s=typeof o==`function`?gE(o(),t):o;if(s&&vE(e,t,s),t.postProcess){let n=t.postProcess(s,e,t);return a.jsonSchema=s,n}return a.jsonSchema=s,s}var _E=(e,t)=>{switch(t.$refStrategy){case`root`:return{$ref:e.path.join(`/`)};case`relative`:return{$ref:hE(t.currentPath,e.path)};case`none`:case`seen`:return e.path.length<t.currentPath.length&&e.path.every((e,n)=>t.currentPath[n]===e)?(console.warn(`Recursive reference detected at ${t.currentPath.join(`/`)}! Defaulting to any`),wT()):t.$refStrategy===`seen`?wT():void 0}},vE=(e,t,n)=>(e.description&&(n.description=e.description),n),yE=e=>{let t=CT(e),n=t.name===void 0?t.basePath:[...t.basePath,t.definitionPath,t.name];return U(U({},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}]))})},bE=(e,t)=>{var n;let r=yE(t),i=typeof t==`object`&&t.definitions?Object.entries(t.definitions).reduce((e,[t,n])=>{var i;return U(U({},e),{},{[t]:(i=gE(n._def,U(U({},r),{},{currentPath:[...r.basePath,r.definitionPath,t]}),!0))==null?wT():i})},{}):void 0,a=typeof t==`string`?t:(t==null?void 0:t.nameStrategy)===`title`||t==null?void 0:t.name,o=(n=gE(e._def,a===void 0?r:U(U({},r),{},{currentPath:[...r.basePath,r.definitionPath,a]}),!1))==null?wT():n,s=typeof t==`object`&&t.name!==void 0&&t.nameStrategy===`title`?t.name:void 0;s!==void 0&&(o.title=s);let c=a===void 0?i?U(U({},o),{},{[r.definitionPath]:i}):o:{$ref:[...r.$refStrategy===`relative`?[]:r.basePath,r.definitionPath,a].join(`/`),[r.definitionPath]:U(U({},i),{},{[a]:o})};return c.$schema=`http://json-schema.org/draft-07/schema#`,c};function xE(e,t){var n;let r=(n=t==null?void 0:t.useReferences)!=null&&n;return yT(()=>bE(e,{$refStrategy:r?`root`:`none`}),{validate:async t=>{let n=await e.safeParseAsync(t);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function SE(e,t){var n;let r=(n=t==null?void 0:t.useReferences)!=null&&n;return yT(()=>bT(Tx(e,{target:`draft-7`,io:`input`,reused:r?`ref`:`inline`})),{validate:async t=>{let n=await Rx(e,t);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function CE(e){return`_zod`in e}function wE(e,t){return CE(e)?SE(e,t):xE(e,t)}function TE(e){return typeof e==`object`&&!!e&&vT in e&&e[vT]===!0&&`jsonSchema`in e&&`validate`in e}function EE(e){return e==null?yT({properties:{},additionalProperties:!1}):TE(e)?e:typeof e==`function`?e():wE(e)}var{btoa:DE,atob:OE}=globalThis;let kE=[`abortSignal`],AE=[`messageId`];var jE=Object.defineProperty,ME=(e,t)=>{for(var n in t)jE(e,n,{get:t[n],enumerable:!0})},NE=`AI_NoObjectGeneratedError`,PE=`vercel.ai.error.${NE}`,FE=Symbol.for(PE),IE,LE=class extends Nh{constructor({message:e=`No object generated.`,cause:t,text:n,response:r,usage:i,finishReason:a}){super({name:NE,message:e,cause:t}),this[IE]=!0,this.text=n,this.response=r,this.usage=i,this.finishReason=a}static isInstance(e){return Nh.hasMarker(e,PE)}};IE=FE;var RE=IS([J(),yC(Uint8Array),yC(ArrayBuffer),gC(e=>{var t,n;return(n=(t=globalThis.Buffer)==null?void 0:t.isBuffer(e))!=null&&n},{message:`Must be a Buffer`})]),zE=mC(()=>IS([TS(),J(),yS(),CS(),HS(J(),zE),jS(zE)])),BE=HS(J(),HS(J(),zE)),VE=NS({type:KS(`text`),text:J(),providerOptions:BE.optional()}),HE=NS({type:KS(`image`),image:IS([RE,yC(URL)]),mediaType:J().optional(),providerOptions:BE.optional()}),UE=NS({type:KS(`file`),data:IS([RE,yC(URL)]),filename:J().optional(),mediaType:J(),providerOptions:BE.optional()}),WE=NS({type:KS(`reasoning`),text:J(),providerOptions:BE.optional()}),GE=NS({type:KS(`tool-call`),toolCallId:J(),toolName:J(),input:DS(),providerOptions:BE.optional(),providerExecuted:CS().optional()}),KE=RS(`type`,[NS({type:KS(`text`),value:J()}),NS({type:KS(`json`),value:zE}),NS({type:KS(`error-text`),value:J()}),NS({type:KS(`error-json`),value:zE}),NS({type:KS(`content`),value:jS(IS([NS({type:KS(`text`),text:J()}),NS({type:KS(`media`),data:J(),mediaType:J()})]))})]),qE=NS({type:KS(`tool-result`),toolCallId:J(),toolName:J(),output:KE,providerOptions:BE.optional()});IS([NS({role:KS(`system`),content:J(),providerOptions:BE.optional()}),NS({role:KS(`user`),content:IS([J(),jS(IS([VE,HE,UE]))]),providerOptions:BE.optional()}),NS({role:KS(`assistant`),content:IS([J(),jS(IS([VE,UE,WE,GE,qE]))]),providerOptions:BE.optional()}),NS({role:KS(`tool`),content:jS(qE),providerOptions:BE.optional()})]),$w({prefix:`aitxt`,size:24}),TransformStream;var JE=uT(()=>wE(IS([PS({type:KS(`text-start`),id:J(),providerMetadata:BE.optional()}),PS({type:KS(`text-delta`),id:J(),delta:J(),providerMetadata:BE.optional()}),PS({type:KS(`text-end`),id:J(),providerMetadata:BE.optional()}),PS({type:KS(`error`),errorText:J()}),PS({type:KS(`tool-input-start`),toolCallId:J(),toolName:J(),providerExecuted:CS().optional(),dynamic:CS().optional()}),PS({type:KS(`tool-input-delta`),toolCallId:J(),inputTextDelta:J()}),PS({type:KS(`tool-input-available`),toolCallId:J(),toolName:J(),input:DS(),providerExecuted:CS().optional(),providerMetadata:BE.optional(),dynamic:CS().optional()}),PS({type:KS(`tool-input-error`),toolCallId:J(),toolName:J(),input:DS(),providerExecuted:CS().optional(),providerMetadata:BE.optional(),dynamic:CS().optional(),errorText:J()}),PS({type:KS(`tool-output-available`),toolCallId:J(),output:DS(),providerExecuted:CS().optional(),dynamic:CS().optional(),preliminary:CS().optional()}),PS({type:KS(`tool-output-error`),toolCallId:J(),errorText:J(),providerExecuted:CS().optional(),dynamic:CS().optional()}),PS({type:KS(`reasoning-start`),id:J(),providerMetadata:BE.optional()}),PS({type:KS(`reasoning-delta`),id:J(),delta:J(),providerMetadata:BE.optional()}),PS({type:KS(`reasoning-end`),id:J(),providerMetadata:BE.optional()}),PS({type:KS(`source-url`),sourceId:J(),url:J(),title:J().optional(),providerMetadata:BE.optional()}),PS({type:KS(`source-document`),sourceId:J(),mediaType:J(),title:J(),filename:J().optional(),providerMetadata:BE.optional()}),PS({type:KS(`file`),url:J(),mediaType:J(),providerMetadata:BE.optional()}),PS({type:gC(e=>typeof e==`string`&&e.startsWith(`data-`),{message:`Type must start with "data-"`}),id:J().optional(),data:DS(),transient:CS().optional()}),PS({type:KS(`start-step`)}),PS({type:KS(`finish-step`)}),PS({type:KS(`start`),messageId:J().optional(),messageMetadata:DS().optional()}),PS({type:KS(`finish`),finishReason:WS([`stop`,`length`,`content-filter`,`tool-calls`,`error`,`other`,`unknown`]).optional(),messageMetadata:DS().optional()}),PS({type:KS(`abort`)}),PS({type:KS(`message-metadata`),messageMetadata:DS()})])));function YE(e){return e.type.startsWith(`data-`)}function XE(){return Object.create(null)}function ZE(e,t){if(e===void 0&&t===void 0)return;if(e===void 0)return t;if(t===void 0)return e;let n=U({},e);for(let r in t)if(!(r===`__proto__`||r===`constructor`||r===`prototype`)&&Object.prototype.hasOwnProperty.call(t,r)){let i=t[r];if(i===void 0)continue;let a=r in e?e[r]:void 0,o=typeof i==`object`&&!!i&&!Array.isArray(i)&&!(i instanceof Date)&&!(i instanceof RegExp),s=typeof a==`object`&&!!a&&!Array.isArray(a)&&!(a instanceof Date)&&!(a instanceof RegExp);o&&s?n[r]=ZE(a,i):n[r]=i}return n}function QE(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`);break}}function a(e,r){switch(e){case`,`:t.pop(),t.push(`INSIDE_OBJECT_AFTER_COMMA`);break;case`}`:n=r,t.pop();break}}function o(e,r){switch(e){case`,`:t.pop(),t.push(`INSIDE_ARRAY_AFTER_COMMA`);break;case`]`:n=r,t.pop();break}}for(let s=0;s<e.length;s++){let c=e[s];switch(t[t.length-1]){case`ROOT`:i(c,s,`FINISH`);break;case`INSIDE_OBJECT_START`:switch(c){case`"`:t.pop(),t.push(`INSIDE_OBJECT_KEY`);break;case`}`:n=s,t.pop();break}break;case`INSIDE_OBJECT_AFTER_COMMA`:switch(c){case`"`:t.pop(),t.push(`INSIDE_OBJECT_KEY`);break}break;case`INSIDE_OBJECT_KEY`:switch(c){case`"`:t.pop(),t.push(`INSIDE_OBJECT_AFTER_KEY`);break}break;case`INSIDE_OBJECT_AFTER_KEY`:switch(c){case`:`:t.pop(),t.push(`INSIDE_OBJECT_BEFORE_VALUE`);break}break;case`INSIDE_OBJECT_BEFORE_VALUE`:i(c,s,`INSIDE_OBJECT_AFTER_VALUE`);break;case`INSIDE_OBJECT_AFTER_VALUE`:a(c,s);break;case`INSIDE_STRING`:switch(c){case`"`:t.pop(),n=s;break;case`\\`:t.push(`INSIDE_STRING_ESCAPE`);break;default:n=s}break;case`INSIDE_ARRAY_START`:switch(c){case`]`:n=s,t.pop();break;default:n=s,i(c,s,`INSIDE_ARRAY_AFTER_VALUE`);break}break;case`INSIDE_ARRAY_AFTER_VALUE`:switch(c){case`,`:t.pop(),t.push(`INSIDE_ARRAY_AFTER_COMMA`);break;case`]`:n=s,t.pop();break;default:n=s;break}break;case`INSIDE_ARRAY_AFTER_COMMA`:i(c,s,`INSIDE_ARRAY_AFTER_VALUE`);break;case`INSIDE_STRING_ESCAPE`:t.pop(),n=s;break;case`INSIDE_NUMBER`:switch(c){case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n=s;break;case`e`:case`E`:case`-`:case`.`:break;case`,`:t.pop(),t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&o(c,s),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`&&a(c,s);break;case`}`:t.pop(),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`&&a(c,s);break;case`]`:t.pop(),t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&o(c,s);break;default:t.pop();break}break;case`INSIDE_LITERAL`:{let i=e.substring(r,s+1);!`false`.startsWith(i)&&!`true`.startsWith(i)&&!`null`.startsWith(i)?(t.pop(),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`?a(c,s):t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&o(c,s)):n=s;break}}}let s=e.slice(0,n+1);for(let n=t.length-1;n>=0;n--)switch(t[n]){case`INSIDE_STRING`:s+=`"`;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`:s+=`}`;break;case`INSIDE_ARRAY_START`:case`INSIDE_ARRAY_AFTER_COMMA`:case`INSIDE_ARRAY_AFTER_VALUE`:s+=`]`;break;case`INSIDE_LITERAL`:{let t=e.substring(r,e.length);`true`.startsWith(t)?s+=`true`.slice(t.length):`false`.startsWith(t)?s+=`false`.slice(t.length):`null`.startsWith(t)&&(s+=`null`.slice(t.length))}}return s}async function $E(e){if(e===void 0)return{value:void 0,state:`undefined-input`};let t=await hT({text:e});return t.success?{value:t.value,state:`successful-parse`}:(t=await hT({text:QE(e)}),t.success?{value:t.value,state:`repaired-parse`}:{value:void 0,state:`failed-parse`})}function eD(e){return e.type.startsWith(`data-`)}function tD(e){return e.type.startsWith(`tool-`)}function nD(e){return e.type===`dynamic-tool`}function rD(e){return tD(e)||nD(e)}function iD(e){return e.type.split(`-`).slice(1).join(`-`)}function aD({lastMessage:e,messageId:t}){return{message:(e==null?void 0:e.role)===`assistant`?e:{id:t,metadata:void 0,role:`assistant`,parts:[]},activeTextParts:XE(),activeReasoningParts:XE(),partialToolCalls:XE()}}function oD({stream:e,messageMetadataSchema:t,dataPartSchemas:n,runUpdateMessageJob:r,onError:i,onToolCall:a,onData:o}){return e.pipeThrough(new TransformStream({async transform(e,s){await r(async({state:r,write:c})=>{var l,u,d,f;function p(e){let t=r.message.parts.filter(tD).find(t=>t.toolCallId===e);if(t==null)throw Error(`tool-output-error must be preceded by a tool-input-available`);return t}function m(e){let t=r.message.parts.filter(e=>e.type===`dynamic-tool`).find(t=>t.toolCallId===e);if(t==null)throw Error(`tool-output-error must be preceded by a tool-input-available`);return t}function h(e){var t;let n=r.message.parts.find(t=>tD(t)&&t.toolCallId===e.toolCallId),i=e,a=n;n==null?r.message.parts.push(U({type:`tool-${e.toolName}`,toolCallId:e.toolCallId,state:e.state,input:i.input,output:i.output,rawInput:i.rawInput,errorText:i.errorText,providerExecuted:i.providerExecuted,preliminary:i.preliminary},i.providerMetadata==null?{}:{callProviderMetadata:i.providerMetadata})):(n.state=e.state,a.input=i.input,a.output=i.output,a.errorText=i.errorText,a.rawInput=i.rawInput,a.preliminary=i.preliminary,a.providerExecuted=(t=i.providerExecuted)==null?n.providerExecuted:t,i.providerMetadata!=null&&n.state===`input-available`&&(n.callProviderMetadata=i.providerMetadata))}function g(e){var t,n;let i=r.message.parts.find(t=>t.type===`dynamic-tool`&&t.toolCallId===e.toolCallId),a=e,o=i;i==null?r.message.parts.push(U({type:`dynamic-tool`,toolName:e.toolName,toolCallId:e.toolCallId,state:e.state,input:a.input,output:a.output,errorText:a.errorText,preliminary:a.preliminary,providerExecuted:a.providerExecuted},a.providerMetadata==null?{}:{callProviderMetadata:a.providerMetadata})):(i.state=e.state,o.toolName=e.toolName,o.input=a.input,o.output=a.output,o.errorText=a.errorText,o.rawInput=(t=a.rawInput)==null?o.rawInput:t,o.preliminary=a.preliminary,o.providerExecuted=(n=a.providerExecuted)==null?i.providerExecuted:n,a.providerMetadata!=null&&i.state===`input-available`&&(i.callProviderMetadata=a.providerMetadata))}async function _(e){if(e!=null){let n=r.message.metadata==null?e:ZE(r.message.metadata,e);t!=null&&await pT({value:n,schema:t}),r.message.metadata=n}}switch(e.type){case`text-start`:{let t={type:`text`,text:``,providerMetadata:e.providerMetadata,state:`streaming`};r.activeTextParts[e.id]=t,r.message.parts.push(t),c();break}case`text-delta`:{let t=r.activeTextParts[e.id];t.text+=e.delta,t.providerMetadata=(l=e.providerMetadata)==null?t.providerMetadata:l,c();break}case`text-end`:{let t=r.activeTextParts[e.id];t.state=`done`,t.providerMetadata=(u=e.providerMetadata)==null?t.providerMetadata:u,delete r.activeTextParts[e.id],c();break}case`reasoning-start`:{let t={type:`reasoning`,text:``,providerMetadata:e.providerMetadata,state:`streaming`};r.activeReasoningParts[e.id]=t,r.message.parts.push(t),c();break}case`reasoning-delta`:{let t=r.activeReasoningParts[e.id];t.text+=e.delta,t.providerMetadata=(d=e.providerMetadata)==null?t.providerMetadata:d,c();break}case`reasoning-end`:{let t=r.activeReasoningParts[e.id];t.providerMetadata=(f=e.providerMetadata)==null?t.providerMetadata:f,t.state=`done`,delete r.activeReasoningParts[e.id],c();break}case`file`:r.message.parts.push({type:`file`,mediaType:e.mediaType,url:e.url}),c();break;case`source-url`:r.message.parts.push({type:`source-url`,sourceId:e.sourceId,url:e.url,title:e.title,providerMetadata:e.providerMetadata}),c();break;case`source-document`:r.message.parts.push({type:`source-document`,sourceId:e.sourceId,mediaType:e.mediaType,title:e.title,filename:e.filename,providerMetadata:e.providerMetadata}),c();break;case`tool-input-start`:{let t=r.message.parts.filter(tD);r.partialToolCalls[e.toolCallId]={text:``,toolName:e.toolName,index:t.length,dynamic:e.dynamic},e.dynamic?g({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-streaming`,input:void 0,providerExecuted:e.providerExecuted}):h({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-streaming`,input:void 0,providerExecuted:e.providerExecuted}),c();break}case`tool-input-delta`:{let t=r.partialToolCalls[e.toolCallId];t.text+=e.inputTextDelta;let{value:n}=await $E(t.text);t.dynamic?g({toolCallId:e.toolCallId,toolName:t.toolName,state:`input-streaming`,input:n}):h({toolCallId:e.toolCallId,toolName:t.toolName,state:`input-streaming`,input:n}),c();break}case`tool-input-available`:e.dynamic?g({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-available`,input:e.input,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata}):h({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-available`,input:e.input,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata}),c(),a&&!e.providerExecuted&&await a({toolCall:e});break;case`tool-input-error`:e.dynamic?g({toolCallId:e.toolCallId,toolName:e.toolName,state:`output-error`,input:e.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata}):h({toolCallId:e.toolCallId,toolName:e.toolName,state:`output-error`,input:void 0,rawInput:e.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata}),c();break;case`tool-output-available`:if(e.dynamic){let t=m(e.toolCallId);g({toolCallId:e.toolCallId,toolName:t.toolName,state:`output-available`,input:t.input,output:e.output,preliminary:e.preliminary})}else{let t=p(e.toolCallId);h({toolCallId:e.toolCallId,toolName:iD(t),state:`output-available`,input:t.input,output:e.output,providerExecuted:e.providerExecuted,preliminary:e.preliminary})}c();break;case`tool-output-error`:if(e.dynamic){let t=m(e.toolCallId);g({toolCallId:e.toolCallId,toolName:t.toolName,state:`output-error`,input:t.input,errorText:e.errorText,providerExecuted:e.providerExecuted})}else{let t=p(e.toolCallId);h({toolCallId:e.toolCallId,toolName:iD(t),state:`output-error`,input:t.input,rawInput:t.rawInput,errorText:e.errorText,providerExecuted:e.providerExecuted})}c();break;case`start-step`:r.message.parts.push({type:`step-start`});break;case`finish-step`:r.activeTextParts=XE(),r.activeReasoningParts=XE();break;case`start`:e.messageId!=null&&(r.message.id=e.messageId),await _(e.messageMetadata),(e.messageId!=null||e.messageMetadata!=null)&&c();break;case`finish`:e.finishReason!=null&&(r.finishReason=e.finishReason),await _(e.messageMetadata),e.messageMetadata!=null&&c();break;case`message-metadata`:await _(e.messageMetadata),e.messageMetadata!=null&&c();break;case`error`:i==null||i(Error(e.errorText));break;default:if(YE(e)){(n==null?void 0:n[e.type])!=null&&await pT({value:e.data,schema:n[e.type]});let t=e;if(t.transient){o==null||o(t);break}let i=t.id==null?void 0:r.message.parts.find(e=>t.type===e.type&&t.id===e.id);i==null?r.message.parts.push(t):i.data=t.data,o==null||o(t),c()}}s.enqueue(e)})}}))}async function sD({stream:e,onError:t}){let n=e.getReader();try{for(;;){let{done:e}=await n.read();if(e)break}}catch(e){t==null||t(e)}finally{n.releaseLock()}}$w({prefix:`aitxt`,size:24}),$w({prefix:`aiobj`,size:24});var cD=class{constructor(){this.queue=[],this.isProcessing=!1}async processQueue(){var e=this;if(!e.isProcessing){for(e.isProcessing=!0;e.queue.length>0;)await e.queue[0](),e.queue.shift();e.isProcessing=!1}}async run(e){var t=this;return new Promise((n,r)=>{t.queue.push(async()=>{try{await e(),n()}catch(e){r(e)}}),t.processQueue()})}};$w({prefix:`aiobj`,size:24}),ME({},{object:()=>uD,text:()=>lD});var lD=()=>({type:`text`,responseFormat:{type:`text`},async parsePartial({text:e}){return{partial:e}},async parseOutput({text:e}){return e}}),uD=({schema:e})=>{let t=EE(e);return{type:`object`,responseFormat:{type:`json`,schema:t.jsonSchema},async parsePartial({text:e}){let t=await $E(e);switch(t.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:return{partial:t.value};default:{let e=t.state;throw Error(`Unsupported parse state: ${e}`)}}},async parseOutput({text:e},n){let r=await hT({text:e});if(!r.success)throw new LE({message:`No object generated: could not parse the response.`,cause:r.error,text:e,response:n.response,usage:n.usage,finishReason:n.finishReason});let i=await mT({value:r.value,schema:t});if(!i.success)throw new LE({message:`No object generated: response did not match schema.`,cause:i.error,text:e,response:n.response,usage:n.usage,finishReason:n.finishReason});return i.value}}};async function dD(e){if(e==null)return[];if(!globalThis.FileList||!(e instanceof globalThis.FileList))throw Error(`FileList is not supported in the current environment`);return Promise.all(Array.from(e).map(async e=>{let{name:t,type:n}=e;return{type:`file`,mediaType:n,filename:t,url:await new Promise((t,n)=>{let r=new FileReader;r.onload=e=>{var n;t((n=e.target)==null?void 0:n.result)},r.onerror=e=>n(e),r.readAsDataURL(e)})}}))}var fD=class{constructor({api:e=`/api/chat`,credentials:t,headers:n,body:r,fetch:i,prepareSendMessagesRequest:a,prepareReconnectToStreamRequest:o}){this.api=e,this.credentials=t,this.headers=n,this.body=r,this.fetch=i,this.prepareSendMessagesRequest=a,this.prepareReconnectToStreamRequest=o}async sendMessages(e){var t=this;let{abortSignal:n}=e,r=vr(e,kE);var i,a,o,s,c;let l=await _T(t.body),u=await _T(t.headers),d=await _T(t.credentials),f=U(U({},tT(u)),tT(r.headers)),p=await((i=t.prepareSendMessagesRequest)==null?void 0:i.call(t,{api:t.api,id:r.chatId,messages:r.messages,body:U(U({},l),r.body),headers:f,credentials:d,requestMetadata:r.metadata,trigger:r.trigger,messageId:r.messageId})),m=(a=p==null?void 0:p.api)==null?t.api:a,h=(p==null?void 0:p.headers)===void 0?f:tT(p.headers),g=(p==null?void 0:p.body)===void 0?U(U(U({},l),r.body),{},{id:r.chatId,messages:r.messages,trigger:r.trigger,messageId:r.messageId}):p.body,_=(o=p==null?void 0:p.credentials)==null?d:o,v=await((s=t.fetch)==null?globalThis.fetch:s)(m,{method:`POST`,headers:U({"Content-Type":`application/json`},h),body:JSON.stringify(g),credentials:_,signal:n});if(!v.ok)throw Error((c=await v.text())==null?`Failed to fetch the chat response.`:c);if(!v.body)throw Error(`The response body is empty.`);return t.processResponseStream(v.body)}async reconnectToStream(e){var t=this,n,r,i,a,o;let s=await _T(t.body),c=await _T(t.headers),l=await _T(t.credentials),u=U(U({},tT(c)),tT(e.headers)),d=await((n=t.prepareReconnectToStreamRequest)==null?void 0:n.call(t,{api:t.api,id:e.chatId,body:U(U({},s),e.body),headers:u,credentials:l,requestMetadata:e.metadata})),f=(r=d==null?void 0:d.api)==null?`${t.api}/${e.chatId}/stream`:r,p=(d==null?void 0:d.headers)===void 0?u:tT(d.headers),m=(i=d==null?void 0:d.credentials)==null?l:i,h=await((a=t.fetch)==null?globalThis.fetch:a)(f,{method:`GET`,headers:p,credentials:m});if(h.status===204)return null;if(!h.ok)throw Error((o=await h.text())==null?`Failed to fetch the chat response.`:o);if(!h.body)throw Error(`The response body is empty.`);return t.processResponseStream(h.body)}},pD=class extends fD{constructor(e={}){super(e)}processResponseStream(e){return gT({stream:e,schema:JE}).pipeThrough(new TransformStream({async transform(e,t){if(!e.success)throw e.error;t.enqueue(e.value)}}))}},mD=class{constructor({generateId:e=eT,id:t=e(),transport:n=new pD,messageMetadataSchema:r,dataPartSchemas:i,state:a,onError:o,onToolCall:s,onFinish:c,onData:l,sendAutomaticallyWhen:u}){var d=this;this.activeResponse=void 0,this.jobExecutor=new cD,this.sendMessage=async(e,t)=>{var n,r,i,a;if(e==null){await d.makeRequest(U({trigger:`submit-message`,messageId:(n=d.lastMessage)==null?void 0:n.id},t));return}let o;if(o=`text`in e||`files`in e?{parts:[...Array.isArray(e.files)?e.files:await dD(e.files),...`text`in e&&e.text!=null?[{type:`text`,text:e.text}]:[]]}:e,e.messageId!=null){let t=d.state.messages.findIndex(t=>t.id===e.messageId);if(t===-1)throw Error(`message with id ${e.messageId} not found`);if(d.state.messages[t].role!==`user`)throw Error(`message with id ${e.messageId} is not a user message`);d.state.messages=d.state.messages.slice(0,t+1),d.state.replaceMessage(t,U(U({},o),{},{id:e.messageId,role:(r=o.role)==null?`user`:r,metadata:e.metadata}))}else d.state.pushMessage(U(U({},o),{},{id:(i=o.id)==null?d.generateId():i,role:(a=o.role)==null?`user`:a,metadata:e.metadata}));await d.makeRequest(U({trigger:`submit-message`,messageId:e.messageId},t))},this.regenerate=async(e={})=>{let{messageId:t}=e,n=vr(e,AE),r=t==null?d.state.messages.length-1:d.state.messages.findIndex(e=>e.id===t);if(r===-1)throw Error(`message ${t} not found`);d.state.messages=d.state.messages.slice(0,d.messages[r].role===`assistant`?r:r+1),await d.makeRequest(U({trigger:`regenerate-message`,messageId:t},n))},this.resumeStream=async(e={})=>{await d.makeRequest(U({trigger:`resume-stream`},e))},this.clearError=()=>{this.status===`error`&&(this.state.error=void 0,this.setStatus({status:`ready`}))},this.addToolOutput=async({state:e=`output-available`,tool:t,toolCallId:n,output:r,errorText:i})=>d.jobExecutor.run(async()=>{var t,a;let o=d.state.messages,s=o[o.length-1];d.state.replaceMessage(o.length-1,U(U({},s),{},{parts:s.parts.map(t=>rD(t)&&t.toolCallId===n?U(U({},t),{},{state:e,output:r,errorText:i}):t)})),d.activeResponse&&(d.activeResponse.state.message.parts=d.activeResponse.state.message.parts.map(t=>rD(t)&&t.toolCallId===n?U(U({},t),{},{state:e,output:r,errorText:i}):t)),d.status!==`streaming`&&d.status!==`submitted`&&(t=d.sendAutomaticallyWhen)!=null&&t.call(d,{messages:d.state.messages})&&d.makeRequest({trigger:`submit-message`,messageId:(a=d.lastMessage)==null?void 0:a.id})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{var e;d.status!==`streaming`&&d.status!==`submitted`||(e=d.activeResponse)!=null&&e.abortController&&d.activeResponse.abortController.abort()},this.id=t,this.transport=n,this.generateId=e,this.messageMetadataSchema=r,this.dataPartSchemas=i,this.state=a,this.onError=o,this.onToolCall=s,this.onFinish=c,this.onData=l,this.sendAutomaticallyWhen=u}get status(){return this.state.status}setStatus({status:e,error:t}){this.status!==e&&(this.state.status=e,this.state.error=t)}get error(){return this.state.error}get messages(){return this.state.messages}get lastMessage(){return this.state.messages[this.state.messages.length-1]}set messages(e){this.state.messages=e}async makeRequest({trigger:e,metadata:t,headers:n,body:r,messageId:i}){var a=this,o,s,c,l;a.setStatus({status:`submitted`,error:void 0});let u=a.lastMessage,d=!1,f=!1,p=!1;try{let o={state:aD({lastMessage:a.state.snapshot(u),messageId:a.generateId()}),abortController:new AbortController};o.abortController.signal.addEventListener(`abort`,()=>{d=!0}),a.activeResponse=o;let s;if(e===`resume-stream`){let e=await a.transport.reconnectToStream({chatId:a.id,metadata:t,headers:n,body:r});if(e==null){a.setStatus({status:`ready`});return}s=e}else s=await a.transport.sendMessages({chatId:a.id,messages:a.state.messages,abortSignal:o.abortController.signal,metadata:t,headers:n,body:r,trigger:e,messageId:i});await sD({stream:oD({stream:s,onToolCall:a.onToolCall,onData:a.onData,messageMetadataSchema:a.messageMetadataSchema,dataPartSchemas:a.dataPartSchemas,runUpdateMessageJob:e=>a.jobExecutor.run(()=>e({state:o.state,write:()=>{var e;a.setStatus({status:`streaming`}),o.state.message.id===((e=a.lastMessage)==null?void 0:e.id)?a.state.replaceMessage(a.state.messages.length-1,o.state.message):a.state.pushMessage(o.state.message)}})),onError:e=>{throw e}}),onError:e=>{throw e}}),a.setStatus({status:`ready`})}catch(e){if(d||e.name===`AbortError`)return d=!0,a.setStatus({status:`ready`}),null;p=!0,e instanceof TypeError&&(e.message.toLowerCase().includes(`fetch`)||e.message.toLowerCase().includes(`network`))&&(f=!0),a.onError&&e instanceof Error&&a.onError(e),a.setStatus({status:`error`,error:e})}finally{try{(s=a.onFinish)==null||s.call(a,{message:a.activeResponse.state.message,messages:a.state.messages,isAbort:d,isDisconnect:f,isError:p,finishReason:(o=a.activeResponse)==null?void 0:o.state.finishReason})}catch(e){console.error(e)}a.activeResponse=void 0}(c=a.sendAutomaticallyWhen)!=null&&c.call(a,{messages:a.state.messages})&&!p&&await a.makeRequest({trigger:`submit-message`,messageId:(l=a.lastMessage)==null?void 0:l.id,metadata:t,headers:n,body:r})}};function hD({messages:e}){let t=e[e.length-1];if(!t||t.role!==`assistant`)return!1;let n=t.parts.reduce((e,t,n)=>t.type===`step-start`?n:e,-1),r=t.parts.slice(n+1).filter(rD).filter(e=>!e.providerExecuted);return r.length>0&&r.every(e=>e.state===`output-available`||e.state===`output-error`)}var gD;function _D(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var vD=_D();function yD(e){vD=e}var bD={exec:()=>null};function xD(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(CD.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var SD=(()=>{try{return!0}catch(e){return!1}})(),CD={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:RegExp(`[\\p{L}\\p{N}]`,`u`),escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,`i`)},wD=/^(?:[ \t]*(?:\n|$))+/,TD=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,ED=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,DD=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,OD=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,kD=/(?:[*+-]|\d{1,9}[.)])/,AD=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,jD=xD(AD).replace(/bull/g,kD).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),MD=xD(AD).replace(/bull/g,kD).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),ND=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,PD=/^[^\n]+/,FD=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,ID=xD(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,FD).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),LD=xD(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,kD).getRegex(),RD=`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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,zD=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,BD=xD(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,zD).replace(`tag`,RD).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),VD=xD(ND).replace(`hr`,DD).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,RD).getRegex(),HD={blockquote:xD(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,VD).getRegex(),code:TD,def:ID,fences:ED,heading:OD,hr:DD,html:BD,lheading:jD,list:LD,newline:wD,paragraph:VD,table:bD,text:PD},UD=xD(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,DD).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,RD).getRegex(),WD=U(U({},HD),{},{lheading:MD,table:UD,paragraph:xD(ND).replace(`hr`,DD).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,UD).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,RD).getRegex()}),GD=U(U({},HD),{},{html:xD(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,zD).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:bD,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:xD(ND).replace(`hr`,DD).replace(`heading`,` *#{1,6} *[^
105
+ ]`).replace(`lheading`,jD).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()}),KD=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,qD=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,JD=/^( {2,}|\\)\n(?!\s*$)/,YD=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,XD=RegExp(`[\\p{P}\\p{S}]`,`u`),ZD=RegExp(`[\\s\\p{P}\\p{S}]`,`u`),QD=RegExp(`[^\\s\\p{P}\\p{S}]`,`u`),$D=xD(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,ZD).getRegex(),eO=RegExp(`(?!~)[\\p{P}\\p{S}]`,`u`),tO=RegExp(`(?!~)[\\s\\p{P}\\p{S}]`,`u`),nO=RegExp(`(?:[^\\s\\p{P}\\p{S}]|~)`,`u`),rO=xD(/link|precode-code|html/,`g`).replace(`link`,RegExp("\\[(?:[^\\[\\]`]|(?<a>`+)[^`]+\\k<a>(?!`))*?\\]\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)]|\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)])*\\))*\\)",``)).replace(`precode-`,SD?"(?<!`)()":"(^^|[^`])").replace(`code`,RegExp("(?<b>`+)[^`]+\\k<b>(?!`)",``)).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),iO=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,aO=xD(iO,`u`).replace(/punct/g,XD).getRegex(),oO=xD(iO,`u`).replace(/punct/g,eO).getRegex(),sO=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,cO=xD(sO,`gu`).replace(/notPunctSpace/g,QD).replace(/punctSpace/g,ZD).replace(/punct/g,XD).getRegex(),lO=xD(sO,`gu`).replace(/notPunctSpace/g,nO).replace(/punctSpace/g,tO).replace(/punct/g,eO).getRegex(),uO=xD(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,QD).replace(/punctSpace/g,ZD).replace(/punct/g,XD).getRegex(),dO=xD(/\\(punct)/,`gu`).replace(/punct/g,XD).getRegex(),fO=xD(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),pO=xD(zD).replace(`(?:-->|$)`,`-->`).getRegex(),mO=xD(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,pO).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),hO=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,gO=xD(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace(`label`,hO).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),_O=xD(/^!?\[(label)\]\[(ref)\]/).replace(`label`,hO).replace(`ref`,FD).getRegex(),vO=xD(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,FD).getRegex(),yO=xD(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,_O).replace(`nolink`,vO).getRegex(),bO=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,xO={_backpedal:bD,anyPunctuation:dO,autolink:fO,blockSkip:rO,br:JD,code:qD,del:bD,emStrongLDelim:aO,emStrongRDelimAst:cO,emStrongRDelimUnd:uO,escape:KD,link:gO,nolink:vO,punctuation:$D,reflink:_O,reflinkSearch:yO,tag:mO,text:YD,url:bD},SO=U(U({},xO),{},{link:xD(/^!?\[(label)\]\((.*?)\)/).replace(`label`,hO).getRegex(),reflink:xD(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,hO).getRegex()}),CO=U(U({},xO),{},{emStrongRDelimAst:lO,emStrongLDelim:oO,url:xD(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,bO).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:xD(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,bO).getRegex()}),wO=U(U({},CO),{},{br:xD(JD).replace(`{2,}`,`*`).getRegex(),text:xD(CO.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()}),TO={normal:HD,gfm:WD,pedantic:GD},EO={normal:xO,gfm:CO,breaks:wO,pedantic:SO},DO={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},OO=e=>DO[e];function kO(e,t){if(t){if(CD.escapeTest.test(e))return e.replace(CD.escapeReplace,OO)}else if(CD.escapeTestNoEncode.test(e))return e.replace(CD.escapeReplaceNoEncode,OO);return e}function AO(e){try{e=encodeURI(e).replace(CD.percentDecode,`%`)}catch(e){return null}return e}function jO(e,t){var n;let r=e.replace(CD.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(CD.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!((n=r.at(-1))!=null&&n.trim())&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push(``);for(;i<r.length;i++)r[i]=r[i].trim().replace(CD.slashPipe,`|`);return r}function MO(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function NO(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function PO(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function FO(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
106
+ `).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
107
+ `)}var IO=class{constructor(e){H(this,`options`,void 0),H(this,`rules`,void 0),H(this,`lexer`,void 0),this.options=e||vD}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,``);return{type:`code`,raw:t[0],codeBlockStyle:`indented`,text:this.options.pedantic?e:MO(e,`
108
+ `)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=FO(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=MO(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:MO(t[0],`
109
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=MO(t[0],`
110
+ `).split(`
111
+ `),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o;for(o=0;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
112
+ `),c=s.replace(this.rules.other.blockquoteSetextReplace,`
113
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
114
+ ${s}`:s,r=r?`${r}
115
+ ${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if((u==null?void 0:u.type)===`code`)break;if((u==null?void 0:u.type)===`blockquote`){let t=u,a=t.raw+`
116
+ `+e.join(`
117
+ `),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}else if((u==null?void 0:u.type)===`list`){let t=u,a=t.raw+`
118
+ `+e.join(`
119
+ `),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
120
+ `);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=t[2].split(`
121
+ `,1)[0].replace(this.rules.other.listReplaceTabs,e=>` `.repeat(3*e.length)),l=e.split(`
122
+ `,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=t[2].search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
123
+ `,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d);for(;e;){let f=e.split(`
124
+ `,1)[0],p;if(l=f,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),p=l):p=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||t.test(l)||n.test(l))break;if(p.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
125
+ `+p.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
126
+ `+l}!u&&!l.trim()&&(u=!0),r+=f+`
127
+ `,e=e.substring(f.length+1),c=p.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0));let f=null,p;this.options.gfm&&(f=this.rules.other.listIsTask.exec(s),f&&(p=f[0]!==`[ ] `,s=s.replace(this.rules.other.listReplaceTask,``))),i.items.push({type:`list_item`,raw:r,task:!!f,checked:p,loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e=0;e<i.items.length;e++)if(this.lexer.state.top=!1,i.items[e].tokens=this.lexer.blockTokens(i.items[e].text,[]),!i.loose){let t=i.items[e].tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}if(i.loose)for(let e=0;e<i.items.length;e++)i.items[e].loose=!0;return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:`html`,block:!0,raw:t[0],pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:t[0],href:n,title:r}}}table(e){var t;let n=this.rules.block.table.exec(e);if(!n||!this.rules.other.tableDelimiter.test(n[2]))return;let r=jO(n[1]),i=n[2].replace(this.rules.other.tableAlignChars,``).split(`|`),a=(t=n[3])!=null&&t.trim()?n[3].replace(this.rules.other.tableRowBlankLine,``).split(`
128
+ `):[],o={type:`table`,raw:n[0],header:[],align:[],rows:[]};if(r.length===i.length){for(let e of i)this.rules.other.tableAlignRight.test(e)?o.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?o.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?o.align.push(`left`):o.align.push(null);for(let e=0;e<r.length;e++)o.header.push({text:r[e],tokens:this.lexer.inline(r[e]),header:!0,align:o.align[e]});for(let e of a)o.rows.push(jO(e,o.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:o.align[t]})));return o}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:`heading`,raw:t[0],depth:t[2].charAt(0)===`=`?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
129
+ `?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=MO(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=NO(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),PO(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return PO(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[2])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!=null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}else if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:`del`,raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,i;if(t[2]===`@`)e=t[0],i=`mailto:`+e;else{var n,r;let a;do a=t[0],t[0]=(n=(r=this.rules.inline._backpedal.exec(t[0]))==null?void 0:r[0])==null?``:n;while(a!==t[0]);e=t[0],i=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:i,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},LO=class e{constructor(e){H(this,`tokens`,void 0),H(this,`options`,void 0),H(this,`state`,void 0),H(this,`tokenizer`,void 0),H(this,`inlineQueue`,void 0),this.tokens=[],this.tokens.links=Object.create(null),this.options=e||vD,this.options.tokenizer=this.options.tokenizer||new IO,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:CD,block:TO.normal,inline:EO.normal};this.options.pedantic?(t.block=TO.pedantic,t.inline=EO.pedantic):this.options.gfm&&(t.block=TO.gfm,this.options.breaks?t.inline=EO.breaks:t.inline=EO.gfm),this.tokenizer.rules=t}static get rules(){return{block:TO,inline:EO}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(CD.carriageReturn,`
130
+ `),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.options.pedantic&&(e=e.replace(CD.tabCharGlobal,` `).replace(CD.spaceLine,``));e;){var r,i;let a;if(!((r=this.options.extensions)==null||(r=r.block)==null)&&r.some(n=>(a=n.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.space(e)){e=e.substring(a.raw.length);let n=t.at(-1);a.raw.length===1&&n!==void 0?n.raw+=`
131
+ `:t.push(a);continue}if(a=this.tokenizer.code(e)){e=e.substring(a.raw.length);let n=t.at(-1);(n==null?void 0:n.type)===`paragraph`||(n==null?void 0:n.type)===`text`?(n.raw+=(n.raw.endsWith(`
132
+ `)?``:`
133
+ `)+a.raw,n.text+=`
134
+ `+a.text,this.inlineQueue.at(-1).src=n.text):t.push(a);continue}if(a=this.tokenizer.fences(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.heading(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.hr(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.blockquote(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.list(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.html(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.def(e)){e=e.substring(a.raw.length);let n=t.at(-1);(n==null?void 0:n.type)===`paragraph`||(n==null?void 0:n.type)===`text`?(n.raw+=(n.raw.endsWith(`
135
+ `)?``:`
136
+ `)+a.raw,n.text+=`
137
+ `+a.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[a.tag]||(this.tokens.links[a.tag]={href:a.href,title:a.title},t.push(a));continue}if(a=this.tokenizer.table(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.lheading(e)){e=e.substring(a.raw.length),t.push(a);continue}let o=e;if((i=this.options.extensions)!=null&&i.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(o=e.substring(0,t+1))}if(this.state.top&&(a=this.tokenizer.paragraph(o))){let r=t.at(-1);n&&(r==null?void 0:r.type)===`paragraph`?(r.raw+=(r.raw.endsWith(`
138
+ `)?``:`
139
+ `)+a.raw,r.text+=`
140
+ `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(a),n=o.length!==e.length,e=e.substring(a.raw.length);continue}if(a=this.tokenizer.text(e)){e=e.substring(a.raw.length);let n=t.at(-1);(n==null?void 0:n.type)===`text`?(n.raw+=(n.raw.endsWith(`
141
+ `)?``:`
142
+ `)+a.raw,n.text+=`
143
+ `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(a);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}else throw Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var n,r;let i=e,a=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(a=this.tokenizer.rules.inline.reflinkSearch.exec(i))!=null;)e.includes(a[0].slice(a[0].lastIndexOf(`[`)+1,-1))&&(i=i.slice(0,a.index)+`[`+`a`.repeat(a[0].length-2)+`]`+i.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(a=this.tokenizer.rules.inline.anyPunctuation.exec(i))!=null;)i=i.slice(0,a.index)+`++`+i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let o;for(;(a=this.tokenizer.rules.inline.blockSkip.exec(i))!=null;)o=a[2]?a[2].length:0,i=i.slice(0,a.index+o)+`[`+`a`.repeat(a[0].length-o-2)+`]`+i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);i=(n=(r=this.options.hooks)==null||(r=r.emStrongMask)==null?void 0:r.call({lexer:this},i))==null?i:n;let s=!1,c=``;for(;e;){var l,u;s||(c=``),s=!1;let n;if(!((l=this.options.extensions)==null||(l=l.inline)==null)&&l.some(r=>(n=r.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))continue;if(n=this.tokenizer.escape(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.tag(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.link(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(n.raw.length);let r=t.at(-1);n.type===`text`&&(r==null?void 0:r.type)===`text`?(r.raw+=n.raw,r.text+=n.text):t.push(n);continue}if(n=this.tokenizer.emStrong(e,i,c)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.codespan(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.br(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.del(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.autolink(e)){e=e.substring(n.raw.length),t.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(e))){e=e.substring(n.raw.length),t.push(n);continue}let r=e;if((u=this.options.extensions)!=null&&u.startInline){let t=1/0,n=e.slice(1),i;this.options.extensions.startInline.forEach(e=>{i=e.call({lexer:this},n),typeof i==`number`&&i>=0&&(t=Math.min(t,i))}),t<1/0&&t>=0&&(r=e.substring(0,t+1))}if(n=this.tokenizer.inlineText(r)){e=e.substring(n.raw.length),n.raw.slice(-1)!==`_`&&(c=n.raw.slice(-1)),s=!0;let r=t.at(-1);(r==null?void 0:r.type)===`text`?(r.raw+=n.raw,r.text+=n.text):t.push(n);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}else throw Error(t)}}return t}},RO=class{constructor(e){H(this,`options`,void 0),H(this,`parser`,void 0),this.options=e||vD}space(e){return``}code({text:e,lang:t,escaped:n}){var r;let i=(r=(t||``).match(CD.notSpaceStart))==null?void 0:r[0],a=e.replace(CD.endingNewline,``)+`
144
+ `;return i?`<pre><code class="language-`+kO(i)+`">`+(n?a:kO(a,!0))+`</code></pre>
145
+ `:`<pre><code>`+(n?a:kO(a,!0))+`</code></pre>
146
+ `}blockquote({tokens:e}){return`<blockquote>
147
+ ${this.parser.parse(e)}</blockquote>
148
+ `}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
149
+ `}hr(e){return`<hr>
150
+ `}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
151
+ `+r+`</`+i+`>
152
+ `}listitem(e){let t=``;if(e.task){var n;let r=this.checkbox({checked:!!e.checked});e.loose?((n=e.tokens[0])==null?void 0:n.type)===`paragraph`?(e.tokens[0].text=r+` `+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type===`text`&&(e.tokens[0].tokens[0].text=r+` `+kO(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:`text`,raw:r+` `,text:r+` `,escaped:!0}):t+=r+` `}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
153
+ `}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox">`}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
154
+ `}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
155
+ <thead>
156
+ `+t+`</thead>
157
+ `+r+`</table>
158
+ `}tablerow({text:e}){return`<tr>
159
+ ${e}</tr>
160
+ `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
161
+ `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${kO(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=AO(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+kO(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=AO(e);if(i===null)return kO(n);e=i;let a=`<img src="${e}" alt="${n}"`;return t&&(a+=` title="${kO(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:kO(e.text)}},zO=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}},BO=class e{constructor(e){H(this,`options`,void 0),H(this,`renderer`,void 0),H(this,`textRenderer`,void 0),this.options=e||vD,this.options.renderer=this.options.renderer||new RO,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new zO}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e,t=!0){let n=``;for(let i=0;i<e.length;i++){var r;let a=e[i];if(!((r=this.options.extensions)==null||(r=r.renderers)==null)&&r[a.type]){let e=a,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(t!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){n+=t||``;continue}}let o=a;switch(o.type){case`space`:n+=this.renderer.space(o);continue;case`hr`:n+=this.renderer.hr(o);continue;case`heading`:n+=this.renderer.heading(o);continue;case`code`:n+=this.renderer.code(o);continue;case`table`:n+=this.renderer.table(o);continue;case`blockquote`:n+=this.renderer.blockquote(o);continue;case`list`:n+=this.renderer.list(o);continue;case`html`:n+=this.renderer.html(o);continue;case`def`:n+=this.renderer.def(o);continue;case`paragraph`:n+=this.renderer.paragraph(o);continue;case`text`:{let r=o,a=this.renderer.text(r);for(;i+1<e.length&&e[i+1].type===`text`;)r=e[++i],a+=`
162
+ `+this.renderer.text(r);t?n+=this.renderer.paragraph({type:`paragraph`,raw:a,text:a,tokens:[{type:`text`,raw:a,text:a,escaped:!0}]}):n+=a;continue}default:{let e=`Token with "`+o.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}parseInline(e,t=this.renderer){let n=``;for(let i=0;i<e.length;i++){var r;let a=e[i];if(!((r=this.options.extensions)==null||(r=r.renderers)==null)&&r[a.type]){let e=this.options.extensions.renderers[a.type].call({parser:this},a);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(a.type)){n+=e||``;continue}}let o=a;switch(o.type){case`escape`:n+=t.text(o);break;case`html`:n+=t.html(o);break;case`link`:n+=t.link(o);break;case`image`:n+=t.image(o);break;case`strong`:n+=t.strong(o);break;case`em`:n+=t.em(o);break;case`codespan`:n+=t.codespan(o);break;case`br`:n+=t.br(o);break;case`del`:n+=t.del(o);break;case`text`:n+=t.text(o);break;default:{let e=`Token with "`+o.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},VO=(gD=class{constructor(e){H(this,`options`,void 0),H(this,`block`,void 0),this.options=e||vD}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?LO.lex:LO.lexInline}provideParser(){return this.block?BO.parse:BO.parseInline}},H(gD,`passThroughHooks`,new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`])),H(gD,`passThroughHooksRespectAsync`,new Set([`preprocess`,`postprocess`,`processAllTokens`])),gD),HO=new class{constructor(...e){H(this,`defaults`,_D()),H(this,`options`,this.setOptions),H(this,`parse`,this.parseMarkdown(!0)),H(this,`parseInline`,this.parseMarkdown(!1)),H(this,`Parser`,BO),H(this,`Renderer`,RO),H(this,`TextRenderer`,zO),H(this,`Lexer`,LO),H(this,`Tokenizer`,IO),H(this,`Hooks`,VO),this.use(...e)}walkTokens(e,t){let n=[];for(let i of e)switch(n=n.concat(t.call(this,i)),i.type){case`table`:{let e=i;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=i;n=n.concat(this.walkTokens(e.items,t));break}default:{var r;let e=i;!((r=this.defaults.extensions)==null||(r=r.childTokens)==null)&&r[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n=U({},e);if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new RO(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new IO(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new VO;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];VO.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&VO.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults=U(U({},this.defaults),n)}),this}setOptions(e){return this.defaults=U(U({},this.defaults),e),this}lexer(e,t){return LO.lex(e,t==null?this.defaults:t)}parser(e,t){return BO.parse(e,t==null?this.defaults:t)}parseMarkdown(e){var t=this;return(n,r)=>{let i=U({},r),a=U(U({},this.defaults),i),o=this.onError(!!a.silent,!!a.async);if(this.defaults.async===!0&&i.async===!1)return o(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof n>`u`||n===null)return o(Error(`marked(): input parameter is undefined or null`));if(typeof n!=`string`)return o(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(n)+`, string expected`));if(a.hooks&&(a.hooks.options=a,a.hooks.block=e),a.async)return(async()=>{let r=a.hooks?await a.hooks.preprocess(n):n,i=await(a.hooks?await a.hooks.provideLexer():e?LO.lex:LO.lexInline)(r,a),o=a.hooks?await a.hooks.processAllTokens(i):i;a.walkTokens&&await Promise.all(t.walkTokens(o,a.walkTokens));let s=await(a.hooks?await a.hooks.provideParser():e?BO.parse:BO.parseInline)(o,a);return a.hooks?await a.hooks.postprocess(s):s})().catch(o);try{a.hooks&&(n=a.hooks.preprocess(n));let t=(a.hooks?a.hooks.provideLexer():e?LO.lex:LO.lexInline)(n,a);a.hooks&&(t=a.hooks.processAllTokens(t)),a.walkTokens&&this.walkTokens(t,a.walkTokens);let r=(a.hooks?a.hooks.provideParser():e?BO.parse:BO.parseInline)(t,a);return a.hooks&&(r=a.hooks.postprocess(r)),r}catch(e){return o(e)}}}onError(e,t){return n=>{if(n.message+=`
163
+ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+kO(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function UO(e,t){return HO.parse(e,t)}UO.options=UO.setOptions=function(e){return HO.setOptions(e),UO.defaults=HO.defaults,yD(UO.defaults),UO},UO.getDefaults=_D,UO.defaults=vD,UO.use=function(...e){return HO.use(...e),UO.defaults=HO.defaults,yD(UO.defaults),UO},UO.walkTokens=function(e,t){return HO.walkTokens(e,t)},UO.parseInline=HO.parseInline,UO.Parser=BO,UO.parser=BO.parse,UO.Renderer=RO,UO.TextRenderer=zO,UO.Lexer=LO,UO.lexer=LO.lex,UO.Tokenizer=IO,UO.Hooks=VO,UO.parse=UO,UO.options,UO.setOptions,UO.use,UO.walkTokens,UO.parseInline,BO.parse,LO.lex;var WO=s(((e,t)=>{function n(e,t){if(typeof e!=`function`)throw TypeError(`Expected the first argument to be a \`function\`, got \`${typeof e}\`.`);let n,r=0;return function(...i){clearTimeout(n);let a=Date.now(),o=t-(a-r);o<=0?(r=a,e.apply(this,i)):n=setTimeout(()=>{r=Date.now(),e.apply(this,i)},o)}}t.exports=n}));V();var GO=u(WO(),1);let KO=[`messages`],qO=[`experimental_throttle`,`resume`];var JO=(e,t,n)=>{if(!t.has(e))throw TypeError(`Cannot `+n)},YO=(e,t,n)=>(JO(e,t,`read from private field`),n?n.call(e):t.get(e)),XO=(e,t,n)=>{if(t.has(e))throw TypeError(`Cannot add the same private member more than once`);t instanceof WeakSet?t.add(e):t.set(e,n)},ZO=(e,t,n,r)=>(JO(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n);function QO(e,t){return t==null?e:(0,GO.default)(e,t)}var $O,ek,tk,nk,rk,ik,ak,ok,sk,ck=class{constructor(e=[]){XO(this,$O,void 0),XO(this,ek,`ready`),XO(this,tk,void 0),XO(this,nk,new Set),XO(this,rk,new Set),XO(this,ik,new Set),this.pushMessage=e=>{ZO(this,$O,YO(this,$O).concat(e)),YO(this,ak).call(this)},this.popMessage=()=>{ZO(this,$O,YO(this,$O).slice(0,-1)),YO(this,ak).call(this)},this.replaceMessage=(e,t)=>{ZO(this,$O,[...YO(this,$O).slice(0,e),this.snapshot(t),...YO(this,$O).slice(e+1)]),YO(this,ak).call(this)},this.snapshot=e=>structuredClone(e),this[`~registerMessagesCallback`]=(e,t)=>{let n=t?QO(e,t):e;return YO(this,nk).add(n),()=>{YO(this,nk).delete(n)}},this[`~registerStatusCallback`]=e=>(YO(this,rk).add(e),()=>{YO(this,rk).delete(e)}),this[`~registerErrorCallback`]=e=>(YO(this,ik).add(e),()=>{YO(this,ik).delete(e)}),XO(this,ak,()=>{YO(this,nk).forEach(e=>e())}),XO(this,ok,()=>{YO(this,rk).forEach(e=>e())}),XO(this,sk,()=>{YO(this,ik).forEach(e=>e())}),ZO(this,$O,e)}get status(){return YO(this,ek)}set status(e){ZO(this,ek,e),YO(this,ok).call(this)}get error(){return YO(this,tk)}set error(e){ZO(this,tk,e),YO(this,sk).call(this)}get messages(){return YO(this,$O)}set messages(e){ZO(this,$O,[...e]),YO(this,ak).call(this)}};$O=new WeakMap,ek=new WeakMap,tk=new WeakMap,nk=new WeakMap,rk=new WeakMap,ik=new WeakMap,ak=new WeakMap,ok=new WeakMap,sk=new WeakMap;var lk,uk=class extends mD{constructor(e){let{messages:t}=e,n=vr(e,KO),r=new ck(t);super(U(U({},n),{},{state:r})),XO(this,lk,void 0),this[`~registerMessagesCallback`]=(e,t)=>YO(this,lk)[`~registerMessagesCallback`](e,t),this[`~registerStatusCallback`]=e=>YO(this,lk)[`~registerStatusCallback`](e),this[`~registerErrorCallback`]=e=>YO(this,lk)[`~registerErrorCallback`](e),ZO(this,lk,r)}};lk=new WeakMap;function dk(e={}){let{experimental_throttle:t,resume:n=!1}=e,r=vr(e,qO),i=R(`chat`in r?r.chat:new uk(r));(`chat`in r&&r.chat!==i.current||`id`in r&&i.current.id!==r.id)&&(i.current=`chat`in r?r.chat:new uk(r));let a=dt(Le(e=>i.current[`~registerMessagesCallback`](e,t),[t,i.current.id]),()=>i.current.messages,()=>i.current.messages),o=dt(i.current[`~registerStatusCallback`],()=>i.current.status,()=>i.current.status),s=dt(i.current[`~registerErrorCallback`],()=>i.current.error,()=>i.current.error),c=Le(e=>{typeof e==`function`&&(e=e(i.current.messages)),i.current.messages=e},[i]);return Pe(()=>{n&&i.current.resumeStream()},[n,i]),{id:i.current.id,messages:a,setMessages:c,sendMessage:i.current.sendMessage,regenerate:i.current.regenerate,clearError:i.current.clearError,stop:i.current.stop,error:s,resumeStream:i.current.resumeStream,status:o,addToolResult:i.current.addToolOutput,addToolOutput:i.current.addToolOutput}}V();function fk(e){return B.createElement(`svg`,_({width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,fillRule:`evenodd`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`},e),B.createElement(`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`}),B.createElement(`path`,{d:`M12 9v4`}),B.createElement(`path`,{d:`M12 17h.01`}))}function pk(){return B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:18,height:18,viewBox:`0 0 18 18`,fill:`none`},B.createElement(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M8.99984 1.29102C4.74264 1.29102 1.2915 4.74215 1.2915 8.99935C1.2915 13.2565 4.74264 16.7077 8.99984 16.7077C13.257 16.7077 16.7082 13.2565 16.7082 8.99935C16.7082 4.74215 13.257 1.29102 8.99984 1.29102ZM0.0415039 8.99935C0.0415039 4.0518 4.05229 0.0410156 8.99984 0.0410156C13.9474 0.0410156 17.9582 4.0518 17.9582 8.99935C17.9582 13.9469 13.9474 17.9577 8.99984 17.9577C4.05229 17.9577 0.0415039 13.9469 0.0415039 8.99935ZM5.87484 6.49935C5.87484 6.15417 6.15466 5.87435 6.49984 5.87435H11.4998C11.845 5.87435 12.1248 6.15417 12.1248 6.49935V11.4993C12.1248 11.8445 11.845 12.1243 11.4998 12.1243H6.49984C6.15466 12.1243 5.87484 11.8445 5.87484 11.4993V6.49935ZM7.12484 7.12435V10.8743H10.8748V7.12435H7.12484Z`,fill:`currentcolor`}))}function mk(){return B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:4,height:16,viewBox:`0 0 4 16`,fill:`none`},B.createElement(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M1.99984 1.95898C1.88478 1.95898 1.7915 2.05226 1.7915 2.16732C1.7915 2.28238 1.88478 2.37565 1.99984 2.37565C2.1149 2.37565 2.20817 2.28238 2.20817 2.16732C2.20817 2.05226 2.1149 1.95898 1.99984 1.95898ZM0.541504 2.16732C0.541504 1.3619 1.19442 0.708984 1.99984 0.708984C2.80525 0.708984 3.45817 1.3619 3.45817 2.16732C3.45817 2.97273 2.80525 3.62565 1.99984 3.62565C1.19442 3.62565 0.541504 2.97273 0.541504 2.16732ZM1.99984 7.79232C1.88478 7.79232 1.7915 7.88559 1.7915 8.00065C1.7915 8.11571 1.88478 8.20898 1.99984 8.20898C2.1149 8.20898 2.20817 8.11571 2.20817 8.00065C2.20817 7.88559 2.1149 7.79232 1.99984 7.79232ZM0.541504 8.00065C0.541504 7.19524 1.19442 6.54232 1.99984 6.54232C2.80525 6.54232 3.45817 7.19524 3.45817 8.00065C3.45817 8.80607 2.80525 9.45898 1.99984 9.45898C1.19442 9.45898 0.541504 8.80607 0.541504 8.00065ZM1.99984 13.6257C1.88478 13.6257 1.7915 13.7189 1.7915 13.834C1.7915 13.949 1.88478 14.0423 1.99984 14.0423C2.1149 14.0423 2.20817 13.949 2.20817 13.834C2.20817 13.7189 2.1149 13.6257 1.99984 13.6257ZM0.541504 13.834C0.541504 13.0286 1.19442 12.3757 1.99984 12.3757C2.80525 12.3757 3.45817 13.0286 3.45817 13.834C3.45817 14.6394 2.80525 15.2923 1.99984 15.2923C1.19442 15.2923 0.541504 14.6394 0.541504 13.834Z`,fill:`currentcolor`}))}function hk(){return B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`18`,height:`18`,viewBox:`0 0 18 18`,fill:`none`},B.createElement(`path`,{d:`M9 0.875C10.6068 0.875 12.1776 1.35149 13.5137 2.24414C14.8498 3.13693 15.8919 4.40598 16.5068 5.89062C17.1218 7.37522 17.2822 9.00892 16.9688 10.585C16.6552 12.1611 15.8814 13.6088 14.7451 14.7451C13.6088 15.8814 12.1611 16.6552 10.585 16.9688C9.00892 17.2822 7.37523 17.1218 5.89062 16.5068C4.40598 15.8919 3.13693 14.8498 2.24414 13.5137C1.35149 12.1776 0.875 10.6068 0.875 9C0.875 8.65482 1.15482 8.375 1.5 8.375C1.84518 8.375 2.125 8.65482 2.125 9C2.125 10.3596 2.52792 11.6888 3.2832 12.8193C4.03864 13.9499 5.1129 14.8312 6.36914 15.3516C7.62523 15.8718 9.00736 16.0083 10.3408 15.7432C11.6744 15.4779 12.8998 14.8228 13.8613 13.8613C14.8228 12.8998 15.4779 11.6744 15.7432 10.3408C16.0083 9.00736 15.8718 7.62523 15.3516 6.36914C14.8312 5.1129 13.9499 4.03864 12.8193 3.2832C11.6888 2.52792 10.3596 2.125 9 2.125C7.06829 2.125 5.21604 2.89096 3.82129 4.22949L3.00879 5.04199H5.66699C6.01202 5.04217 6.29199 5.32192 6.29199 5.66699C6.29182 6.01191 6.01191 6.29182 5.66699 6.29199H1.5C1.45939 6.29199 1.41889 6.28716 1.37891 6.2793C1.36148 6.27587 1.345 6.26949 1.32812 6.26465C1.267 6.24714 1.20782 6.22205 1.15332 6.18555C1.08536 6.14005 1.02604 6.08256 0.980469 6.01465C0.970244 5.99942 0.962841 5.98268 0.954102 5.9668C0.904937 5.87756 0.875056 5.77606 0.875 5.66699V1.5C0.875 1.15482 1.15482 0.875002 1.5 0.875C1.84518 0.875 2.125 1.15482 2.125 1.5V4.15723L2.94141 3.3418L2.9502 3.33301C4.57158 1.77433 6.73388 0.875 9 0.875ZM9.33301 4.20801C9.67808 4.20801 9.95783 4.48798 9.95801 4.83301V9.44727L12.9463 10.9414C13.2548 11.0958 13.3798 11.4707 13.2256 11.7793C13.0712 12.088 12.6955 12.213 12.3867 12.0586L9.05371 10.3926C8.84198 10.2867 8.70801 10.0697 8.70801 9.83301V4.83301C8.70818 4.48809 8.98809 4.20819 9.33301 4.20801Z`,fill:`currentcolor`}))}function gk(){return B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`19`,height:`19`,viewBox:`0 0 19 19`,fill:`none`},B.createElement(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M0.712717 3.38039C1.14249 2.95062 1.72538 2.70917 2.33317 2.70917H8.1665C8.51168 2.70917 8.7915 2.989 8.7915 3.33417C8.7915 3.67935 8.51168 3.95917 8.1665 3.95917H2.33317C2.0569 3.95917 1.79195 4.06892 1.5966 4.26427C1.40125 4.45962 1.2915 4.72457 1.2915 5.00084V16.6675C1.2915 16.9438 1.40125 17.2087 1.5966 17.4041C1.79195 17.5994 2.0569 17.7092 2.33317 17.7092H13.9998C14.2761 17.7092 14.5411 17.5994 14.7364 17.4041C14.9318 17.2087 15.0415 16.9438 15.0415 16.6675V10.8342C15.0415 10.489 15.3213 10.2092 15.6665 10.2092C16.0117 10.2092 16.2915 10.489 16.2915 10.8342V16.6675C16.2915 17.2753 16.0501 17.8582 15.6203 18.288C15.1905 18.7177 14.6076 18.9592 13.9998 18.9592H2.33317C1.72538 18.9592 1.14249 18.7177 0.712717 18.288C0.282947 17.8582 0.0415039 17.2753 0.0415039 16.6675V5.00084C0.0415039 4.39305 0.282947 3.81016 0.712717 3.38039Z`,fill:`currentcolor`}),B.createElement(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M15.6665 2.19141C15.3634 2.19141 15.0728 2.3118 14.8584 2.52611L7.06419 10.3204L6.52548 12.4752L8.68031 11.9365L16.4746 4.14223C16.6889 3.92792 16.8093 3.63725 16.8093 3.33417C16.8093 3.03109 16.6889 2.74043 16.4746 2.52611C16.2603 2.3118 15.9696 2.19141 15.6665 2.19141ZM13.9746 1.64223C14.4233 1.1935 15.0319 0.941406 15.6665 0.941406C16.3011 0.941406 16.9097 1.1935 17.3584 1.64223C17.8072 2.09096 18.0593 2.69957 18.0593 3.33417C18.0593 3.96877 17.8072 4.57738 17.3584 5.02611L9.44178 12.9428C9.36168 13.0229 9.26132 13.0797 9.15142 13.1072L5.81809 13.9405C5.6051 13.9938 5.3798 13.9314 5.22456 13.7761C5.06932 13.6209 5.00692 13.3956 5.06016 13.1826L5.8935 9.84925C5.92097 9.73936 5.9778 9.639 6.0579 9.5589L13.9746 1.64223Z`,fill:`currentcolor`}))}function _k({size:e=20}){return B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`DocSearch-Search-Icon`},B.createElement(`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`}))}function vk(){return B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},B.createElement(`path`,{d:`M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z`}),B.createElement(`path`,{d:`M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z`}))}function yk({size:e=20,color:t=`currentColor`}){return B.createElement(`svg`,{width:e,height:e,className:`DocSearch-Back-Icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:t,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`},B.createElement(`path`,{d:`m12 19-7-7 7-7`}),B.createElement(`path`,{d:`M19 12H5`}))}let bk=B.memo(function({title:e,suggestions:t,onSelectPromptSuggestion:n}){let r=B.useId(),i=B.useCallback(e=>{n(e.currentTarget.value)},[n]);return B.createElement(`section`,{className:`DocSearch-PromptSuggestions`,"aria-labelledby":r},B.createElement(`h3`,{className:`DocSearch-PromptSuggestions-Title`,id:r},e),B.createElement(`div`,{className:`DocSearch-PromptSuggestions-Content`},t.map(e=>B.createElement(`button`,{key:e,type:`button`,className:`DocSearch-PromptSuggestions-Action`,value:e,onClick:i},e))))}),xk=[{value:`incorrect`,translationKey:`feedbackTagIncorrect`,defaultLabel:`Incorrect or incomplete`},{value:`not_what_i_asked`,translationKey:`feedbackTagNotWhatIAsked`,defaultLabel:`Not what I asked for`},{value:`slow_or_buggy`,translationKey:`feedbackTagSlowOrBuggy`,defaultLabel:`Slow or buggy`},{value:`style_or_tone`,translationKey:`feedbackTagStyleOrTone`,defaultLabel:`Style or tone`},{value:`safety_or_legal`,translationKey:`feedbackTagSafetyOrLegal`,defaultLabel:`Safety or legal concern`},{value:`other`,translationKey:`feedbackTagOther`,defaultLabel:`Other`}],Sk=1e3;function Ck({id:e,showActions:t,latestAssistantMessageContent:n,translations:r,conversations:i,onFeedback:a,isSidepanel:o=!1}){let[s,c]=Me(()=>{var t;let n=(t=i.getOne)==null?void 0:t.call(i,e);return n!=null&&n.feedback?`thanks`:`actions`}),[l,u]=Me([]),[d,f]=Me(``),[p,m]=Me(!1),[h,g]=Me(null),{likeButtonTitle:_=`Like`,dislikeButtonTitle:v=`Dislike`,thanksForFeedbackText:y=`Thanks for your feedback!`}=r,b=async()=>{if(!p){g(null),m(!0);try{await(a==null?void 0:a(e,{thumbs:1})),c(`thanks`)}catch(e){g(e)}finally{m(!1)}}},x=()=>{g(null),c(`note`)},S=e=>{u(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},C=async()=>{if(!p){g(null),m(!0);try{await(a==null?void 0:a(e,{thumbs:0,tags:l.length>0?l:void 0,notes:d.trim()||void 0})),c(`thanks`)}catch(e){g(e)}finally{m(!1)}}},w=()=>{u([]),f(``),g(null),c(`actions`)};if(!t||!n)return null;let T=B.createElement(Tk,{translations:r,onClick:()=>navigator.clipboard.writeText(n)});return B.createElement(B.Fragment,null,B.createElement(`div`,{className:`DocSearch-AskAiScreen-Actions-Controls`},o?T:null,s===`thanks`?B.createElement(`p`,{className:`DocSearch-AskAiScreen-FeedbackText DocSearch-AskAiScreen-FeedbackText--visible`},y):B.createElement(B.Fragment,null,p&&s===`actions`?B.createElement(Er,{className:`DocSearch-AskAiScreen-SmallerLoadingIcon`}):B.createElement(B.Fragment,null,B.createElement(Ek,{title:_,onClick:b}),B.createElement(Dk,{title:v,onClick:x})),h&&s===`actions`?B.createElement(`p`,{className:`DocSearch-AskAiScreen-FeedbackText`},h.message||`An error occured`):null),o?null:T),s===`note`?B.createElement(wk,{translations:r,tags:l,notes:d,saving:p,savingError:h,onToggleTag:S,onNotesChange:f,onSubmit:C,onClose:w}):null)}function wk({translations:e,tags:t,notes:n,saving:r,savingError:i,onToggleTag:a,onNotesChange:o,onSubmit:s,onClose:c}){let l=B.useId(),{feedbackPanelTitle:u=`What went wrong? (optional)`,feedbackDetailsPlaceholder:d=`Share some details...`,feedbackSubmitButtonText:f=`Submit`,feedbackCancelButtonText:p=`Cancel`}=e;return B.createElement(`div`,{className:`DocSearch-Feedback-Panel`,role:`group`,"aria-labelledby":l},B.createElement(`div`,{className:`DocSearch-Feedback-Panel-Header`},B.createElement(`p`,{className:`DocSearch-Feedback-Panel-Title`,id:l},u)),B.createElement(`div`,{className:`DocSearch-Feedback-Panel-Reasons`},xk.map(n=>{var r;let i=t.includes(n.value);return B.createElement(`button`,{key:n.value,type:`button`,className:`DocSearch-Feedback-Panel-Reason`,"aria-pressed":i,onClick:()=>a(n.value)},B.createElement(`span`,null,(r=e[n.translationKey])==null?n.defaultLabel:r))})),B.createElement(`textarea`,{className:`DocSearch-Feedback-Panel-Textarea`,placeholder:d,value:n,rows:3,maxLength:Sk,onChange:e=>o(e.target.value.slice(0,Sk))}),B.createElement(`p`,{className:`DocSearch-Feedback-Panel-CharCount`,"aria-live":`polite`},n.length,`/`,Sk),i?B.createElement(`p`,{className:`DocSearch-Feedback-Panel-Error`},i.message||`An error occured`):null,B.createElement(`div`,{className:`DocSearch-Feedback-Panel-Actions`},B.createElement(`button`,{type:`button`,className:`DocSearch-Feedback-Panel-Cancel`,onClick:c},p),B.createElement(`button`,{type:`button`,className:`DocSearch-Feedback-Panel-Submit`,disabled:r,onClick:s},r?B.createElement(Er,{className:`DocSearch-AskAiScreen-SmallerLoadingIcon`}):f)))}function Tk({onClick:e,translations:t}){let{copyButtonTitle:n=`Copy`,copyButtonCopiedText:r=`Copied!`}=t,[i,a]=Me(!1);return Pe(()=>{if(i){let e=setTimeout(()=>{a(!1)},1500);return()=>clearTimeout(e)}},[i]),B.createElement(`button`,{type:`button`,className:`DocSearch-AskAiScreen-ActionButton DocSearch-AskAiScreen-CopyButton ${i?`DocSearch-AskAiScreen-CopyButton--copied`:``}`,disabled:i,title:i?r:n,onClick:()=>{e(),a(!0)}},i?B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},B.createElement(`path`,{d:`M20 6 9 17l-5-5`})):B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},B.createElement(`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}),B.createElement(`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`})))}function Ek({title:e,onClick:t}){return B.createElement(`button`,{type:`button`,className:`DocSearch-AskAiScreen-ActionButton DocSearch-AskAiScreen-LikeButton`,title:e,onClick:t},B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},B.createElement(`path`,{d:`M7 10v12`}),B.createElement(`path`,{d:`M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z`})))}function Dk({title:e,onClick:t}){return B.createElement(`button`,{type:`button`,className:`DocSearch-AskAiScreen-ActionButton DocSearch-AskAiScreen-DislikeButton`,title:e,onClick:t},B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},B.createElement(`path`,{d:`M17 14V2`}),B.createElement(`path`,{d:`M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z`})))}let Ok=[`className`],kk=[`align`,`alignOffset`,`side`,`sideOffset`,`collisionBoundary`,`container`,`children`];function Ak(e){let t=Ar({},(kr(e),e));return B.createElement(ih,t)}Ak.Trigger=B.forwardRef((e,t)=>{let{className:n}=e,r=pn(e,Ok),i=`DocSearch-Popover-Trigger${n?` ${n}`:``}`;return B.createElement(sh,_({className:i,ref:t},r))});function jk(e){let{align:t=`center`,alignOffset:n=0,side:r=`bottom`,sideOffset:i=4,collisionBoundary:a=`clipping-ancestors`,container:o,children:s}=e,c=pn(e,kk);return B.createElement(dh,{container:o},B.createElement(hh,{className:`DocSearch-Popover-Positioner`,align:t,alignOffset:n,side:r,sideOffset:i,collisionBoundary:a},B.createElement(Sh,_({className:`DocSearch-Popover-Popup`},c),B.createElement(wh,{className:`DocSearch-Popover-Arrow`}),B.createElement(Oh,{className:`DocSearch-Popover-Close`},B.createElement(jr,null)),s)))}Ak.Popup=jk;function Mk(e){let t=Ar({},(kr(e),e));return B.createElement(Eh,_({className:`DocSearch-Popover-Title`},t))}Ak.Title=Mk;function Nk({links:e,titleText:t=`Source`,pluralTitleText:n=`Sources`}){let[r,i]=B.useState(!1),a=B.useRef(null),[o,s]=B.useState(null),c=e.length>1?n:t;return Pe(()=>{var e,t;if(!r)return;let n=a.current,o=(e=(t=n==null?void 0:n.closest(`.DocSearch-Sidepanel-Content`))==null?n==null?void 0:n.closest(`.DocSearch-Dropdown`):t)==null?null:e;if(s(o),!o)return;let c=()=>{if(!a.current)return;let e=a.current.getBoundingClientRect(),t=o.getBoundingClientRect();(e.bottom<=t.top||e.top>=t.bottom)&&i(!1)};return o.addEventListener(`scroll`,c,{passive:!0}),()=>{o.removeEventListener(`scroll`,c)}},[r]),e.length===0?null:B.createElement(Ak,{open:r,modal:`trap-focus`,onOpenChange:i},B.createElement(Ak.Trigger,{ref:a,className:`DocSearch-AskAiScreen-Sources-Action`},B.createElement(`span`,{className:`DocSearch-AskAiScreen-Sources-Action-icon`},B.createElement(Fr,null)),B.createElement(`span`,{className:`DocSearch-AskAiScreen-Sources-Action-text`},e.length,` `,c)),B.createElement(Ak.Popup,{container:o,sideOffset:10,align:`start`,alignOffset:-16,collisionBoundary:o==null?`clipping-ancestors`:o},B.createElement(Ak.Title,null,c),B.createElement(`ul`,{className:`DocSearch-AskAiScreen-Sources`},e.map(e=>B.createElement(`li`,{key:e.url,className:`DocSearch-AskAiScreen-Sources-source`},B.createElement(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`},B.createElement(Fr,null),B.createElement(`span`,{className:`DocSearch-AskAiScreen-Sources-source-title`},e.title||e.url)))))))}let Pk=new Set([`AI-203`,`AI-205`,`AI-224`,`AI-225`]);function Fk(e,t){for(let[n,r]of Object.entries(e))if(n.toLowerCase()===t.toLowerCase()&&typeof r==`string`&&r.trim()!==``)return r.trim()}function Ik(e){let t=/\b(AI-\d{3})\b/i.exec(e);if(t)return t[1].toUpperCase()}function Lk(e){try{let t=JSON.parse(e);if(t&&typeof t==`object`&&!Array.isArray(t))return t}catch(e){}return null}function Rk(e){return/\brequest blocked for this domain\b/.test(e)||/\bblocked for this domain\b/.test(e)}function zk(e){return/\b429\b/.test(e)||/\brate\s*limit/.test(e)||/\bretry\s+after\s+\d+/.test(e)||/\btoo\s+many\s+attempts\b/.test(e)||/\btoo_many_requests\b/.test(e)}function Bk(e){return/\btokenoutputlimiterror\b/.test(e)||/could not complete response due to token output limits/.test(e)}function Vk(e){return/\bwhitelist(?:ed)?\b/.test(e)||/\bnot\s+allowed\s+for\s+this\s+domain\b/.test(e)||/\bcontext\s+length\b/.test(e)||/\b(?:max|maximum)\s+tokens?\b/.test(e)||/\btoken\s+limit\b/.test(e)||/\btoken\s+output\b/.test(e)||/\boutput\s+limits?\b/.test(e)||/\bstep\s+limit\b/.test(e)||/\b(?:max|maximum)(?:\s+agent)?\s+steps?\b/.test(e)}function Hk(e){var t,n,r;let i=(t=Fk(e,`type`))==null?``:t,a=(n=Fk(e,`error`))==null?``:n,o=(r=Fk(e,`message`))==null?``:r;return/tokenoutput|outputlimit|steplimit|maxstep|ratelimit|domainnotallowed/i.test(i)||a.toUpperCase()===`TOO_MANY_REQUESTS`||zk(`${a} ${o}`.toLowerCase())||Vk(`${a} ${o}`.toLowerCase())}let Uk=[{matches:({code:e})=>!!(e&&Pk.has(e))},{matches:({parsedJson:e})=>{var t;return!!(e&&Rk(((t=Fk(e,`message`))==null?``:t).toLowerCase()))},showNewConversationLink:!1},{matches:({parsedJson:e})=>!!(e&&Hk(e))},{matches:({messageLower:e})=>Bk(e),showNewConversationLink:!1},{matches:({messageLower:e})=>zk(e)},{matches:({messageLower:e})=>Rk(e),showNewConversationLink:!1},{matches:({messageLower:e})=>Vk(e)}];function Wk(e){var t;let n=(t=e.message)==null?``:t,r={message:n,messageLower:n.toLowerCase(),parsedJson:Lk(n),code:Ik(n)},i=Uk.filter(e=>e.matches(r));return{blocking:i.length>0,showNewConversationLink:i.every(e=>e.showNewConversationLink!==!1)}}function Gk(e){var t;return!!(e&&Bk(((t=e.message)==null?``:t).toLowerCase()))}function Kk(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#039;`)}function qk(e){return Kk(e.replace(/<[^>]*>/g,``))}function Jk(e){let t=e;for(let e=0;e<3;e+=1)try{let e=decodeURIComponent(t);if(e===t)break;t=e}catch(e){break}return t}function Yk(e){let t=``;for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);r>32&&r!==127&&(t+=e[n])}return t}function Xk(e){if(!e)return``;let t=e.trim();if(!t)return``;let n=Yk(Jk(t));if(!n||n.startsWith(`//`))return``;if(!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(n))return t;try{let e=new URL(n);if(e.protocol===`http:`||e.protocol===`https:`||e.protocol===`mailto:`)return n}catch(e){return``}return``}function Zk(e){let t=[],n=new Set;return e?(e.parts.forEach(e=>{if(e.type!==`text`||e.text.length===0)return;let r=/\[([^\]]*)\]\(([^)]+)\)/g,i=RegExp('(?<!\\]\\()https?:\\/\\/[^\\s<>"{}|\\\\^`[\\]]+',`g`),a=e.text.replace(/```[\s\S]*?```/g,``).replace(/`[^`]*`/g,``),o=a.matchAll(r);for(let e of o){let r=e[1].trim(),i=Xk(e[2]);i&&!n.has(i)&&(n.add(i),t.push({url:i,title:r||void 0}))}let s=a.matchAll(i);for(let e of s){let r=Xk(e[0].replace(/[.,;:!?]+$/,``));r&&!n.has(r)&&(n.add(r),t.push({url:r}))}}),t):[]}let Qk=(e,t,n)=>{let r=t[0].parts.find(e=>e.type===`text`),i=r!=null&&r.text?qk(r.text):``;return{query:e,objectID:i,chatId:n,messages:t,type:`askAI`,anchor:`stored`,content:null,hierarchy:{lvl0:`askAI`,lvl1:i,lvl2:new Date().toISOString(),lvl3:null,lvl4:null,lvl5:null,lvl6:null},url:``,url_without_anchor:``}},$k=e=>{var t;return((t=e==null?void 0:e.parts)==null?[]:t).filter(e=>e.type===`text`).map(e=>e.text).join(`
164
164
 
165
- `)};function $k(e){var t;return e?/(?:ai-217|conversation\s+depth)/i.test((t=e.message)==null?``:t):!1}function eA(e){return!!(e&&($k(e)||Uk(e).blocking))}function tA(e){return Wk(e)}function nA(e){return!e||$k(e)?!0:Uk(e).showNewConversationLink}function rA(e){let t=e.trim();for(let e=0;e<10&&t;e++)try{var n,r;let e=JSON.parse(t);if(typeof e==`string`){t=e.trim();continue}if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e,n=Pk(t,`message`),r=Pk(t,`error`);if(n)return n;if(r)return r}let i=(n=/"message"\s*:\s*"((?:[^"\\]|\\.)*)"/.exec(t))==null?/"error"\s*:\s*"((?:[^"\\]|\\.)*)"/.exec(t):n;return i==null||(r=i[1])==null?void 0:r.replace(/\\"/g,`"`).replace(/\\\\/g,`\\`).trim()}catch(e){if(t.includes(`\\"`)){t=t.replace(/\\"/g,`"`).replace(/\\\\/g,`\\`).trim();continue}return}}function iA(e){var t;if(!e)return;let n=rA((t=e.message)==null?``:t);if($k(e)&&(/^\s*AI-217\s*$/i.test(e.message)||/^\s*\{.*\}\s*$/.test(e.message)&&!n))return;let r=(n==null?e.message.replace(/\s*\(AI-\d{3}\)\s*$/i,``):n).trim();if(r&&!(r.startsWith(`{`)&&r.endsWith(`}`)))return r;if(tA(e))return`Could not complete response due to token output limits`}let aA=Object.freeze({});function oA(e){return e.type.startsWith(`tool-`)}function sA(e){return e.type===`tool-searchIndex`||e.type===`tool-algolia_search_index`||e.type.startsWith(`tool-algolia_search_index_`)}function cA(e){return oA(e)&&sA(e)&&e.state===`output-available`}function lA(e){var t;let n;return e.forEach((t,r)=>{let i=t.parts.filter(e=>!e.type.startsWith(`data-`));if(i.length===t.parts.length){n==null||n.push(t);return}n||(n=e.slice(0,r)),n.push(_(_({},t),{},{parts:i}))}),(t=n)==null?e:t}function uA(e){let t=e.find(e=>e.type===`data-suggestions`);return t?t.data.suggestions:[]}function dA(e){if(e.state!==`input-available`&&e.state!==`output-available`)return[];if(e.type===`tool-searchIndex`){var t,n,r,i;let a=((t=(n=(r=e.output)==null?void 0:r.query)==null?(i=e.input)==null?void 0:i.query:n)==null?``:t).trim();return a?[a]:[]}if(`queries`in e.input&&Array.isArray(e.input.queries))return e.input.queries.map(({query:e})=>e.trim()).filter(Boolean);if(`query`in e.input&&typeof e.input.query==`string`){let t=e.input.query.trim();return t?[t]:[]}return[]}function fA({icon:e,shimmer:t=!1,children:n,variant:r}){let i=`DocSearch-AskAiScreen-MessageContent-Tool Tool--${r}${t?` DocSearch-shimmer`:``}`;return B.createElement(`div`,{className:i},e,n)}function pA({part:e,translations:t,onSearchQueryClick:n}){let{searchingText:r,preToolCallText:i,toolCallResultText:a}=t;switch(e.state){case`input-streaming`:return B.createElement(fA,{shimmer:!0,icon:B.createElement(Er,{className:`DocSearch-AskAiScreen-SmallerLoadingIcon`}),variant:`PartialCall`},B.createElement(`span`,null,r));case`input-available`:{let t=dA(e);return B.createElement(B.Fragment,null,t.map((t,n)=>B.createElement(fA,{key:`${e.toolCallId}-call-${n}`,shimmer:!0,icon:B.createElement(Er,{className:`DocSearch-AskAiScreen-SmallerLoadingIcon`}),variant:`Call`},B.createElement(`span`,null,i,` `,`"${t}" ...`))))}case`output-available`:{let t=dA(e);return B.createElement(B.Fragment,null,t.map((t,r)=>B.createElement(fA,{key:`${e.toolCallId}-result-${r}`,icon:B.createElement(dn,null),variant:`Result`},B.createElement(`span`,null,a,` `,n?B.createElement(`span`,{role:`button`,tabIndex:0,className:`DocSearch-AskAiScreen-MessageContent-Tool-Query`,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n(t))},onClick:()=>n(t)},` `,`"`,t,`"`):B.createElement(`span`,{className:`DocSearch-AskAiScreen-MessageContent-Tool-Query`},` `,`"`,t,`"`)))))}default:return null}}function mA({tool:e,part:t}){let n=z(()=>t.state===`output-available`?e.render({message:{input:t.input,output:t.output}}):null,[t.input,t.output,e,t.state]);if(t.state===`output-error`)return null;if(t.state!==`output-available`){let{callingToolText:t=`Loading tool`}=e.translations||{};return B.createElement(fA,{shimmer:!0,variant:`PartialCall`,icon:B.createElement(gk,null)},B.createElement(`span`,null,t))}return n?B.createElement(fA,{icon:B.createElement(gk,null),variant:`Result`},B.createElement(`span`,null,n)):null}function hA({part:e,translations:t}){let{savedMemoryToolResultText:n,memoryToolResultText:r}=t;return e.state===`output-error`?null:e.type===`tool-algolia_memorize`?B.createElement(fA,{variant:`Result`,icon:B.createElement(_k,null)},n):B.createElement(fA,{variant:`Result`,icon:B.createElement(_k,null)},r)}function gA(e){return e.type===`tool-algolia_ponder`||e.type===`tool-algolia_memorize`||e.type===`tool-algolia_memory_search`}function _A({part:e,translations:t,tools:n,onSearchQueryClick:r,memoryEnabled:i=!1}){let a=n[e.type.replace(`tool-`,``)];return a?B.createElement(mA,{tool:a,part:e}):i&&gA(e)?B.createElement(hA,{part:e,translations:t}):sA(e)?B.createElement(pA,{part:e,translations:t,onSearchQueryClick:r}):null}let vA=new n_.Renderer;vA.code=({text:e,lang:t=``,escaped:n})=>{let r=/^[a-zA-Z0-9_-]+$/.test(t)?t:``,i=r?`language-${r}`:``,a=n?e:Gk(e);return`
165
+ `)};function eA(e){var t;return e?/(?:ai-217|conversation\s+depth)/i.test((t=e.message)==null?``:t):!1}function tA(e){return!!(e&&(eA(e)||Wk(e).blocking))}function nA(e){return Gk(e)}function rA(e){return!e||eA(e)?!0:Wk(e).showNewConversationLink}function iA(e){let t=e.trim();for(let e=0;e<10&&t;e++)try{var n,r;let e=JSON.parse(t);if(typeof e==`string`){t=e.trim();continue}if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e,n=Fk(t,`message`),r=Fk(t,`error`);if(n)return n;if(r)return r}let i=(n=/"message"\s*:\s*"((?:[^"\\]|\\.)*)"/.exec(t))==null?/"error"\s*:\s*"((?:[^"\\]|\\.)*)"/.exec(t):n;return i==null||(r=i[1])==null?void 0:r.replace(/\\"/g,`"`).replace(/\\\\/g,`\\`).trim()}catch(e){if(t.includes(`\\"`)){t=t.replace(/\\"/g,`"`).replace(/\\\\/g,`\\`).trim();continue}return}}function aA(e){var t;if(!e)return;let n=iA((t=e.message)==null?``:t);if(eA(e)&&(/^\s*AI-217\s*$/i.test(e.message)||/^\s*\{.*\}\s*$/.test(e.message)&&!n))return;let r=(n==null?e.message.replace(/\s*\(AI-\d{3}\)\s*$/i,``):n).trim();if(r&&!(r.startsWith(`{`)&&r.endsWith(`}`)))return r;if(nA(e))return`Could not complete response due to token output limits`}let oA=Object.freeze({});function sA(e){return e.type.startsWith(`tool-`)}function cA(e){return e.type===`tool-searchIndex`||e.type===`tool-algolia_search_index`||e.type.startsWith(`tool-algolia_search_index_`)}function lA(e){return sA(e)&&cA(e)&&e.state===`output-available`}function uA(e){var t;let n;return e.forEach((t,r)=>{let i=t.parts.filter(e=>!(eD(e)||rD(e)&&e.state.startsWith(`input-`)));if(i.length===t.parts.length){n==null||n.push(t);return}n||(n=e.slice(0,r)),n.push(_(_({},t),{},{parts:i}))}),(t=n)==null?e:t}function dA(e){let t=e.find(e=>e.type===`data-suggestions`);return t?t.data.suggestions:[]}function fA(e){if(e.state!==`input-available`&&e.state!==`output-available`)return[];if(e.type===`tool-searchIndex`){var t,n,r,i;let a=((t=(n=(r=e.output)==null?void 0:r.query)==null?(i=e.input)==null?void 0:i.query:n)==null?``:t).trim();return a?[a]:[]}if(`queries`in e.input&&Array.isArray(e.input.queries))return e.input.queries.map(({query:e})=>e.trim()).filter(Boolean);if(`query`in e.input&&typeof e.input.query==`string`){let t=e.input.query.trim();return t?[t]:[]}return[]}function pA({icon:e,shimmer:t=!1,children:n,variant:r}){let i=`DocSearch-AskAiScreen-MessageContent-Tool Tool--${r}${t?` DocSearch-shimmer`:``}`;return B.createElement(`div`,{className:i},e,n)}function mA({part:e,translations:t,onSearchQueryClick:n}){let{searchingText:r,preToolCallText:i,toolCallResultText:a}=t;switch(e.state){case`input-streaming`:return B.createElement(pA,{shimmer:!0,icon:B.createElement(Er,{className:`DocSearch-AskAiScreen-SmallerLoadingIcon`}),variant:`PartialCall`},B.createElement(`span`,null,r));case`input-available`:{let t=fA(e);return B.createElement(B.Fragment,null,t.map((t,n)=>B.createElement(pA,{key:`${e.toolCallId}-call-${n}`,shimmer:!0,icon:B.createElement(Er,{className:`DocSearch-AskAiScreen-SmallerLoadingIcon`}),variant:`Call`},B.createElement(`span`,null,i,` `,`"${t}" ...`))))}case`output-available`:{let t=fA(e);return B.createElement(B.Fragment,null,t.map((t,r)=>B.createElement(pA,{key:`${e.toolCallId}-result-${r}`,icon:B.createElement(dn,null),variant:`Result`},B.createElement(`span`,null,a,` `,n?B.createElement(`span`,{role:`button`,tabIndex:0,className:`DocSearch-AskAiScreen-MessageContent-Tool-Query`,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n(t))},onClick:()=>n(t)},` `,`"`,t,`"`):B.createElement(`span`,{className:`DocSearch-AskAiScreen-MessageContent-Tool-Query`},` `,`"`,t,`"`)))))}default:return null}}function hA({tool:e,part:t}){let n=z(()=>t.state===`output-available`?e.render({message:{input:t.input,output:t.output}}):null,[t.input,t.output,e,t.state]);if(t.state===`output-error`)return null;if(t.state!==`output-available`){let{callingToolText:t=`Loading tool`}=e.translations||{};return B.createElement(pA,{shimmer:!0,variant:`PartialCall`,icon:B.createElement(_k,null)},B.createElement(`span`,null,t))}return n?B.createElement(pA,{icon:B.createElement(_k,null),variant:`Result`},B.createElement(`span`,null,n)):null}function gA({part:e,translations:t}){let{savedMemoryToolResultText:n,memoryToolResultText:r}=t;return e.state===`output-error`?null:e.type===`tool-algolia_memorize`?B.createElement(pA,{variant:`Result`,icon:B.createElement(vk,null)},n):B.createElement(pA,{variant:`Result`,icon:B.createElement(vk,null)},r)}function _A(e){return e.type===`tool-algolia_ponder`||e.type===`tool-algolia_memorize`||e.type===`tool-algolia_memory_search`}function vA({part:e,translations:t,tools:n,onSearchQueryClick:r,memoryEnabled:i=!1}){let a=n[e.type.replace(`tool-`,``)];return a?B.createElement(hA,{tool:a,part:e}):i&&_A(e)?B.createElement(gA,{part:e,translations:t}):cA(e)?B.createElement(mA,{part:e,translations:t,onSearchQueryClick:r}):null}let yA=new UO.Renderer;yA.code=({text:e,lang:t=``,escaped:n})=>{let r=/^[a-zA-Z0-9_-]+$/.test(t)?t:``,i=r?`language-${r}`:``,a=n?e:Kk(e);return`
166
166
  <div class="DocSearch-CodeSnippet">
167
167
  <button class="DocSearch-CodeSnippet-CopyButton" data-code="${encodeURIComponent(e)}" aria-label="copy code"><svg class="DocSearch-CodeSnippet-CopyIcon" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="14" x="8" y="8" rx="2" ry="2" /><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" /></svg><svg class="DocSearch-CodeSnippet-CheckIcon" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5" /></svg><span class="DocSearch-CodeSnippet-CopyButton-Label"></span></button>
168
168
  <pre><code class="${i}">${a}</code></pre>
169
169
  </div>
170
- `},vA.link=({href:e,title:t,text:n})=>{let r=Gk(Yk(e)),i=Gk(n);return r?`<a href="${r}"${t?` title="${Gk(t)}"`:``} target="_blank" rel="noopener noreferrer">${i}</a>`:i},vA.image=({href:e,title:t,text:n})=>{let r=Gk(Yk(e));if(!r)return Gk(n);let i=t?` title="${Gk(t)}"`:``;return`<img src="${r}" alt="${Gk(n)}"${i} />`},vA.html=({text:e})=>Gk(e);function yA(e){return n_.parse(e,{gfm:!0,breaks:!0,renderer:vA})}let bA=vt(({content:e,copyButtonText:t,copyButtonCopiedText:n,isStreaming:r})=>{let i=z(()=>yA(e),[e]),a=R(null);return Pe(()=>{let e=a.current;if(!e)return;Array.from(e.querySelectorAll(`.DocSearch-CodeSnippet-CopyButton`)).forEach(e=>{let n=e.querySelector(`.DocSearch-CodeSnippet-CopyButton-Label`);n&&(n.textContent=t),e.classList.remove(`DocSearch-CodeSnippet-CopyButton--copied`)});function r(e){var r;let i=e.target.closest(`.DocSearch-CodeSnippet-CopyButton`);if(!i)return;let a=(r=i.getAttribute(`data-code`))==null?``:r;navigator.clipboard.writeText(decodeURIComponent(a)).catch(()=>{});let o=i.querySelector(`.DocSearch-CodeSnippet-CopyButton-Label`);if(!o)return;i.classList.add(`DocSearch-CodeSnippet-CopyButton--copied`);let s=t;o.textContent=n,setTimeout(()=>{i.classList.remove(`DocSearch-CodeSnippet-CopyButton--copied`),o.textContent=s},1500)}return e.addEventListener(`click`,r),()=>{e.removeEventListener(`click`,r)}},[i,t,n]),B.createElement(`div`,{ref:a,className:`DocSearch-Markdown-Content ${r?`DocSearch-Markdown-Content--streaming`:``}`,dangerouslySetInnerHTML:{__html:i}})});bA.displayName=`MemoizedMarkdown`;function xA(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n];if(cA(r)){let r=[],i,a=n;for(;a<e.length;){let t=e[a];if(cA(t)){let e=dA(t);r.push(...e),e.length>0&&(i=t),a++}else break}r.length>1?t.push({type:`aggregated-tool-call`,queries:r}):r.length===1&&i&&t.push(i),n=a-1}else t.push(r)}return t}let SA=[`children`,`className`,`onClick`],CA=B.createContext({open:!1,setOpen:e=>{}});function wA({children:e}){let[t,n]=B.useState(!1),r=B.useRef(null);return B.useEffect(()=>{function e(e){var t;(t=r.current)!=null&&t.contains(e.target)||n(!1)}return t&&window.addEventListener(`click`,e),function(){window.removeEventListener(`click`,e)}},[t]),B.createElement(CA.Provider,{value:{open:t,setOpen:n}},B.createElement(`div`,{ref:r,className:`DocSearch-Menu`},e))}function TA({children:e,className:t=``,disabled:n}){let{open:r,setOpen:i}=B.useContext(CA);function a(){n||i(!r)}return B.createElement(`button`,{type:`button`,className:`DocSearch-Menu-trigger ${t}${n?` disabled`:``}`,"aria-disabled":n,onClick:()=>a()},e)}wA.Trigger=TA;function EA({children:e}){let{open:t}=B.useContext(CA);return B.createElement(`div`,{className:`DocSearch-Menu-content${t?` open`:``}`},e)}wA.Content=EA;function DA(e){let{children:t,className:n=``,onClick:r}=e,i=pn(e,SA),{setOpen:a}=B.useContext(CA);return B.createElement(`button`,_({type:`button`,className:`DocSearch-Menu-item ${n}`,onClick:e=>{r&&(r(e),a(!1))}},i),t)}wA.Item=DA;let OA=e=>`https://${e}.algolia.net/agent-studio/1`,kA=e=>{var t;let n=e.message,r;try{r=JSON.parse(n)}catch(e){return Error(n)}let i=0;for(;typeof r==`string`&&i<10;){i+=1;let e=r.trim();try{r=JSON.parse(e)}catch(t){return Error(e)}}if(!r||typeof r!=`object`||Array.isArray(r))return Error(n);let a=r,o=r,s=n;if(o.name===`ValidationError`){let e=o;if(e.detail&&e.detail.length>0){let{msg:t,loc:n}=e.detail[0];s=`${t}: ${n.at(-1)}`}}else{var c,l;s=(c=(l=Pk(a,`message`))==null?Pk(a,`error`):l)==null?n:c}let u=(t=o.code)==null?o.errorCode:t;return typeof u==`string`&&u.trim()&&!s.toUpperCase().includes(u.trim().toUpperCase())&&(s=`${s} (${u.trim()})`),Error(s)},AA=({agentId:e,vote:t,messageId:n,appId:r,apiKey:i,abortSignal:a,notes:o,tags:s})=>{let c=new Headers;c.set(`x-algolia-application-id`,r),c.set(`x-algolia-api-key`,i),c.set(`content-type`,`application/json`);let l=`${OA(r)}/feedback`;return fetch(l,{method:`POST`,body:JSON.stringify(_(_({messageId:n,agentId:e,vote:t},o?{notes:o}:{}),s&&s.length>0?{tags:s}:{})),headers:c,signal:a})},jA=[`id`,`messages`,`body`],MA=({appId:e,apiKey:t,agentId:n,searchParameters:r,userToken:i,indices:a})=>{let o={};return r&&(o.searchParameters=r),a&&a.length>0&&(o.indices=a),new BO({api:`${OA(e)}/agents/${n}/completions?stream=true&compatibilityMode=ai-sdk-5`,headers:_({"x-algolia-application-id":e,"x-algolia-api-key":t},i?{"x-algolia-secure-user-token":i}:{}),body:{algolia:o},prepareSendMessagesRequest(e){let{id:t,messages:n,body:r}=e,i=pn(e,jA),a=lA(n);return _(_({},i),{},{body:_({id:t,messages:a},r)})}})},NA=({agentId:e,apiKey:t,appId:n,tools:r=aA,searchParameters:i,memory:a,indices:o})=>{let s=R(new AbortController),c=z(()=>MA({apiKey:t,appId:n,agentId:e,searchParameters:i,userToken:a==null?void 0:a.userToken,indices:o}),[t,n,e,i,a==null?void 0:a.userToken,o]),l=R(c);l.current=c;let u=R(r);u.current=r;let d=R(null),f=Le(({toolCall:e})=>{let t=u.current[e.toolName];t!=null&&t.onToolCall&&t.onToolCall(_(_({},e),{},{addToolOutput:async({output:t})=>{d.current&&await d.current({output:t,tool:e.toolName,toolCallId:e.toolCallId})}}))},[]),p=Le((e,t=OE())=>new lk({id:t,messages:e,sendAutomaticallyWhen:HO,transport:l.current,onToolCall:f}),[f]),[m,h]=Me(()=>p()),g=R(m);g.current=m;let{messages:v,status:y,setMessages:b,error:x,stop:S,addToolOutput:C}=uk({chat:m});Pe(()=>{d.current=C},[C]);let w=R(Gr({key:`__DOCSEARCH_ASKAI_CONVERSATIONS__${n}`,limit:10})).current,T=Le(async(r,{thumbs:i,tags:a,notes:o})=>{var c;if(e){if((await AA({agentId:e,vote:i,messageId:r,appId:n,apiKey:t,abortSignal:s.current.signal,notes:o,tags:a})).status>=300)throw Error(`Failed, try again later.`);(c=w.addFeedback)==null||c.call(w,r,i===1?`like`:`dislike`,{tags:a,notes:o})}},[e,n,t,w]),E=Le(async()=>{s.current.abort(),await S()},[S]),D=z(()=>{let e=[];for(let n=0;n<v.length;n++)if(v[n].role===`user`){var t;let r=v[n],i=((t=v[n+1])==null?void 0:t.role)===`assistant`?v[n+1]:null;e.push({id:r.id,userMessage:r,assistantMessage:i}),i&&n++}return e},[v]),O=y===`streaming`||y===`submitted`,k=z(()=>{if(x)return kA(x)},[x]),A=Le((e,t)=>{let n=p(e,t);g.current=n,h(n)},[p]),j=Le(()=>{A()},[A]),M=Le((e,t)=>{A(e,t)},[A]),N=Le((...e)=>g.current.sendMessage(...e),[]);return{chatId:m.id,messages:v,sendMessage:N,status:y,setMessages:b,askAiError:k,stopAskAiStreaming:E,isStreaming:O,exchanges:D,conversations:w,sendFeedback:T,startNewConversation:j,restoreConversation:M}},PA=({agentId:e,searchClient:t,suggestedQuestionsEnabled:n=!1})=>{let[r,i]=Me([]);return Pe(()=>{n&&e&&e!==``&&(async()=>{let{results:n}=await t.search({requests:[{indexName:`algolia_ask_ai_suggested_questions`,filters:`state:published AND assistantId:${e}`,hitsPerPage:3}]}),r=n[0];i(r.hits)})()},[n,e,t]),r};function FA(e){return{current:e}}function IA(e,t){var n=void 0;return function(){for(var r=arguments.length,i=Array(r),a=0;a<r;a++)i[a]=arguments[a];n&&clearTimeout(n),n=setTimeout(function(){return e.apply(void 0,i)},t)}}function LA(e){return e.reduce(function(e,t){return e.concat(t)},[])}var RA=0;function zA(){return`autocomplete-${RA++}`}function BA(e){return e.collections.length===0?0:e.collections.reduce(function(e,t){return e+t.items.length},0)}function VA(e){return e!==Object(e)}function HA(e,t){if(e===t)return!0;if(VA(e)||VA(t)||typeof e==`function`||typeof t==`function`)return e===t;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n=0,r=Object.keys(e);n<r.length;n++){var i=r[n];if(!(i in t)||!HA(e[i],t[i]))return!1}return!0}var UA=function(){};function WA(e){if(typeof window<`u`)return e({window})}var GA=[{segment:`autocomplete-core`,version:`1.19.2`}];function KA(e){var t=e.item,n=e.items,r=n===void 0?[]:n;return{index:t.__autocomplete_indexName,items:[t],positions:[1+r.findIndex(function(e){return e.objectID===t.objectID})],queryID:t.__autocomplete_queryID,algoliaSource:[`autocomplete`]}}function qA(e,t){return QA(e)||ZA(e,t)||YA(e,t)||JA()}function JA(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
171
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function YA(e,t){if(e){if(typeof e==`string`)return XA(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return XA(e,t)}}function XA(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ZA(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function QA(e){if(Array.isArray(e))return e}function $A(e){var t=qA((e.version||``).split(`.`).map(Number),2),n=t[0],r=t[1];return n>=3||n===2&&r>=4||n===1&&r>=10}var ej=[`items`],tj=[`items`];function nj(e){"@babel/helpers - typeof";return nj=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},nj(e)}function rj(e){return sj(e)||oj(e)||aj(e)||ij()}function ij(){throw TypeError(`Invalid attempt to spread non-iterable instance.
172
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function aj(e,t){if(e){if(typeof e==`string`)return cj(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return cj(e,t)}}function oj(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function sj(e){if(Array.isArray(e))return cj(e)}function cj(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function lj(e,t){if(e==null)return{};var n=uj(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function uj(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function dj(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function fj(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?dj(Object(n),!0).forEach(function(t){pj(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dj(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function pj(e,t,n){return t=mj(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mj(e){var t=hj(e,`string`);return nj(t)===`symbol`?t:String(t)}function hj(e,t){if(nj(e)!==`object`||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(nj(r)!==`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function gj(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:20,n=[],r=0;r<e.objectIDs.length;r+=t)n.push(fj(fj({},e),{},{objectIDs:e.objectIDs.slice(r,r+t)}));return n}function _j(e){return e.map(function(e){var t=e.items,n=lj(e,ej);return fj(fj({},n),{},{objectIDs:(t==null?void 0:t.map(function(e){return e.objectID}))||n.objectIDs})})}function vj(e){var t=$A(e);function n(n,r,i){if(t&&i!==void 0){var a=i[0].__autocomplete_algoliaCredentials,o={"X-Algolia-Application-Id":a.appId,"X-Algolia-API-Key":a.apiKey};e.apply(void 0,[n].concat(rj(r),[{headers:o}]))}else e.apply(void 0,[n].concat(rj(r)))}return{init:function(t,n){e(`init`,{appId:t,apiKey:n})},setAuthenticatedUserToken:function(t){e(`setAuthenticatedUserToken`,t)},setUserToken:function(t){e(`setUserToken`,t)},clickedObjectIDsAfterSearch:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];t.length>0&&n(`clickedObjectIDsAfterSearch`,_j(t),t[0].items)},clickedObjectIDs:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];t.length>0&&n(`clickedObjectIDs`,_j(t),t[0].items)},clickedFilters:function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];n.length>0&&e.apply(void 0,[`clickedFilters`].concat(n))},convertedObjectIDsAfterSearch:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];t.length>0&&n(`convertedObjectIDsAfterSearch`,_j(t),t[0].items)},convertedObjectIDs:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];t.length>0&&n(`convertedObjectIDs`,_j(t),t[0].items)},convertedFilters:function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];n.length>0&&e.apply(void 0,[`convertedFilters`].concat(n))},viewedObjectIDs:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];t.length>0&&t.reduce(function(e,t){var n=t.items,r=lj(t,tj);return[].concat(rj(e),rj(gj(fj(fj({},r),{},{objectIDs:(n==null?void 0:n.map(function(e){return e.objectID}))||r.objectIDs})).map(function(e){return{items:n,payload:e}})))},[]).forEach(function(e){var t=e.items,r=e.payload;return n(`viewedObjectIDs`,[r],t)})},viewedFilters:function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];n.length>0&&e.apply(void 0,[`viewedFilters`].concat(n))}}}function yj(e){var t=e.items.reduce(function(e,t){var n;return e[t.__autocomplete_indexName]=((n=e[t.__autocomplete_indexName])==null?[]:n).concat(t),e},{});return Object.keys(t).map(function(e){return{index:e,items:t[e],algoliaSource:[`autocomplete`]}})}function bj(e){return e.objectID&&e.__autocomplete_indexName&&e.__autocomplete_queryID}function xj(e){"@babel/helpers - typeof";return xj=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},xj(e)}function Sj(e){return Ej(e)||Tj(e)||wj(e)||Cj()}function Cj(){throw TypeError(`Invalid attempt to spread non-iterable instance.
173
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function wj(e,t){if(e){if(typeof e==`string`)return Dj(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Dj(e,t)}}function Tj(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function Ej(e){if(Array.isArray(e))return Dj(e)}function Dj(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Oj(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function kj(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Oj(Object(n),!0).forEach(function(t){Aj(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Oj(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Aj(e,t,n){return t=jj(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function jj(e){var t=Mj(e,`string`);return xj(t)===`symbol`?t:String(t)}function Mj(e,t){if(xj(e)!==`object`||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(xj(r)!==`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Nj=400,Pj=`2.15.0`,Fj=`https://cdn.jsdelivr.net/npm/search-insights@${Pj}/dist/search-insights.min.js`,Ij=IA(function(e){var t=e.onItemsChange,n=e.items,r=e.insights,i=e.state;t({insights:r,insightsEvents:yj({items:n}).map(function(e){return kj({eventName:`Items Viewed`},e)}),state:i})},Nj);function Lj(e){var t=zj(e),n=t.insightsClient,r=t.insightsInitParams,i=t.onItemsChange,a=t.onSelect,o=t.onActive,s=t.__autocomplete_clickAnalytics,c=n;if(n||WA(function(e){var t=e.window,n=t.AlgoliaAnalyticsObject||`aa`;typeof n==`string`&&(c=t[n]),c||(t.AlgoliaAnalyticsObject=n,t[n]||(t[n]=function(){t[n].queue||(t[n].queue=[]);for(var e=arguments.length,r=Array(e),i=0;i<e;i++)r[i]=arguments[i];t[n].queue.push(r)}),t[n].version=Pj,c=t[n],Bj(t))}),!c)return{};r&&c(`init`,kj({partial:!0},r));var l=vj(c),u=FA([]),d=IA(function(e){var t=e.state;if(t.isOpen){var n=t.collections.reduce(function(e,t){return[].concat(Sj(e),Sj(t.items))},[]).filter(bj);HA(u.current.map(function(e){return e.objectID}),n.map(function(e){return e.objectID}))||(u.current=n,n.length>0&&Ij({onItemsChange:i,items:n,insights:l,state:t}))}},0);return{name:`aa.algoliaInsightsPlugin`,subscribe:function(e){var t=e.setContext,n=e.onSelect,r=e.onActive;function i(e){t({algoliaInsightsPlugin:{__algoliaSearchParameters:kj(kj({},s?{clickAnalytics:!0}:{}),e?{userToken:Vj(e)}:{}),insights:l}})}c(`addAlgoliaAgent`,`insights-plugin`),i(),c(`onUserTokenChange`,function(e){i(e)}),c(`getUserToken`,null,function(e,t){i(t)}),n(function(e){var t=e.item,n=e.state,r=e.event,i=e.source;bj(t)&&a({state:n,event:r,insights:l,item:t,insightsEvents:[kj({eventName:`Item Selected`},KA({item:t,items:i.getItems().filter(bj)}))]})}),r(function(e){var t=e.item,n=e.source,r=e.state,i=e.event;bj(t)&&o({state:r,event:i,insights:l,item:t,insightsEvents:[kj({eventName:`Item Active`},KA({item:t,items:n.getItems().filter(bj)}))]})})},onStateChange:function(e){var t=e.state;d({state:t})},__autocomplete_pluginOptions:e}}function Rj(){var e,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0;return[].concat(Sj(t),[`autocomplete-internal`],Sj((e=n.algoliaInsightsPlugin)!=null&&e.__automaticInsights?[`autocomplete-automatic`]:[]))}function zj(e){return kj({onItemsChange:function(e){var t=e.insights,n=e.insightsEvents,r=e.state;t.viewedObjectIDs.apply(t,Sj(n.map(function(e){return kj(kj({},e),{},{algoliaSource:Rj(e.algoliaSource,r.context)})})))},onSelect:function(e){var t=e.insights,n=e.insightsEvents,r=e.state;t.clickedObjectIDsAfterSearch.apply(t,Sj(n.map(function(e){return kj(kj({},e),{},{algoliaSource:Rj(e.algoliaSource,r.context)})})))},onActive:UA,__autocomplete_clickAnalytics:!0},e)}function Bj(e){var t=`[Autocomplete]: Could not load search-insights.js. Please load it manually following https://alg.li/insights-autocomplete`;try{var n=e.document.createElement(`script`);n.async=!0,n.src=Fj,n.onerror=function(){console.error(t)},document.body.appendChild(n)}catch(e){console.error(t)}}function Vj(e){return typeof e==`number`?e.toString():e}function Hj(e,t){var n=t;return{then:function(t,r){return Hj(e.then(Gj(t,n,e),Gj(r,n,e)),n)},catch:function(t){return Hj(e.catch(Gj(t,n,e)),n)},finally:function(t){return t&&n.onCancelList.push(t),Hj(e.finally(Gj(t&&function(){return n.onCancelList=[],t()},n,e)),n)},cancel:function(){n.isCanceled=!0;var e=n.onCancelList;n.onCancelList=[],e.forEach(function(e){e()})},isCanceled:function(){return n.isCanceled===!0}}}function Uj(e){return Hj(new Promise(function(t,n){return e(t,n)}),{isCanceled:!1,onCancelList:[]})}Uj.resolve=function(e){return Wj(Promise.resolve(e))},Uj.reject=function(e){return Wj(Promise.reject(e))};function Wj(e){return Hj(e,{isCanceled:!1,onCancelList:[]})}function Gj(e,t,n){return e?function(n){return t.isCanceled?n:e(n)}:n}var Kj=!0,qj;function Jj(){var e=[];return{add:function(t){return e.push(t),t.finally(function(){e=e.filter(function(e){return e!==t})})},cancelAll:function(){e.forEach(function(e){return e.cancel()})},isEmpty:function(){return e.length===0},wait:function(t){return Kj?(Kj=!1,qj=t?Promise.race([Promise.all(e),new Promise(function(e){return setTimeout(e,t)})]):Promise.all(e),qj.then(function(){Kj=!0})):qj}}}function Yj(){var e=-1,t=-1,n=void 0;return function(r){e++;var i=e;return Promise.resolve(r).then(function(e){return n&&i<t?n:(t=i,n=e,e)})}}function Xj(e,t,n,r){if(!n)return null;if(e<0&&(t===null||r!==null&&t===0))return n+e;var i=(t===null?-1:t)+e;return i<=-1||i>=n?r===null?null:0:i}function Zj(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Qj(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Zj(Object(n),!0).forEach(function(t){$j(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zj(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function $j(e,t,n){return t=eM(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eM(e){var t=tM(e,`string`);return nM(t)===`symbol`?t:String(t)}function tM(e,t){if(nM(e)!==`object`||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(nM(r)!==`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function nM(e){"@babel/helpers - typeof";return nM=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},nM(e)}function rM(e,t){var n=[];return Promise.resolve(e(t)).then(function(e){return Promise.all(e.filter(function(e){return!!e}).map(function(e){if(e.sourceId,n.includes(e.sourceId))throw Error(`[Autocomplete] The \`sourceId\` ${JSON.stringify(e.sourceId)} is not unique.`);n.push(e.sourceId);var t={getItemInputValue:function(e){return e.state.query},getItemUrl:function(){},onSelect:function(e){var t=e.setIsOpen;t(!1)},onActive:UA,onResolve:UA};Object.keys(t).forEach(function(e){t[e].__default=!0});var r=Qj(Qj({},t),e);return Promise.resolve(r)}))})}function iM(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=aM(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
174
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,s=e},f:function(){try{!a&&n.return!=null&&n.return()}finally{if(o)throw s}}}}function aM(e,t){if(e){if(typeof e==`string`)return oM(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return oM(e,t)}}function oM(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var sM=function(e,t){var n=!1,r=[],i=iM(e),a;try{for(i.s();!(a=i.n()).done;){var o,s,c,l=(o=a.value.__autocomplete_pluginOptions)==null||(s=(c=o).awaitSubmit)==null?void 0:s.call(c);if(typeof l==`number`)r.push(l);else if(l===!0){n=!0;break}}}catch(e){i.e(e)}finally{i.f()}if(n)return t.wait();if(r.length>0)return t.wait(Math.max.apply(Math,r))};function cM(e){var t=e.collections.map(function(e){return e.items.length}).reduce(function(e,t,n){var r=(e[n-1]||0)+t;return e.push(r),e},[]).reduce(function(t,n){return n<=e.activeItemId?t+1:t},0);return e.collections[t]}function lM(e){for(var t=e.state,n=e.collection,r=!1,i=0,a=0;r===!1;){var o=t.collections[i];if(o===n){r=!0;break}a+=o.items.length,i++}return t.activeItemId-a}function uM(e){var t=cM(e);if(!t)return null;var n=t.items[lM({state:e,collection:t})],r=t.source;return{item:n,itemInputValue:r.getItemInputValue({item:n,state:e}),itemUrl:r.getItemUrl({item:n,state:e}),source:r}}function dM(e,t,n){return[e,n==null?void 0:n.sourceId,t].filter(Boolean).join(`-`).replace(/\s/g,``)}function fM(e,t){return e===t||e.contains(t)}var pM=/((gt|sm)-|galaxy nexus)|samsung[- ]|samsungbrowser/i;function mM(e){return!!(e&&e.match(pM))}function hM(e){return{results:e,hits:e.map(function(e){return e.hits}).filter(Boolean),facetHits:e.map(function(e){var t;return(t=e.facetHits)==null?void 0:t.map(function(e){return{label:e.value,count:e.count,_highlightResult:{label:{value:e.highlighted}}}})}).filter(Boolean)}}function gM(e){return e.nativeEvent||e}function _M(e){"@babel/helpers - typeof";return _M=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},_M(e)}function vM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function yM(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?vM(Object(n),!0).forEach(function(t){bM(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vM(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function bM(e,t,n){return t=xM(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xM(e){var t=SM(e,`string`);return _M(t)===`symbol`?t:String(t)}function SM(e,t){if(_M(e)!==`object`||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(_M(r)!==`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function CM(e,t,n){var r=t.initialState;return{getState:function(){return r},dispatch:function(i,a){var o=yM({},r);r=e(r,{type:i,props:t,payload:a}),n({state:r,prevState:o})},pendingRequests:Jj()}}function wM(e){"@babel/helpers - typeof";return wM=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},wM(e)}function TM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function EM(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?TM(Object(n),!0).forEach(function(t){DM(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):TM(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function DM(e,t,n){return t=OM(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function OM(e){var t=kM(e,`string`);return wM(t)===`symbol`?t:String(t)}function kM(e,t){if(wM(e)!==`object`||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(wM(r)!==`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function AM(e){var t=e.store;return{setActiveItemId:function(e){t.dispatch(`setActiveItemId`,e)},setQuery:function(e){t.dispatch(`setQuery`,e)},setCollections:function(e){var n=0,r=e.map(function(e){return EM(EM({},e),{},{items:LA(e.items).map(function(e){return EM(EM({},e),{},{__autocomplete_id:n++})})})});t.dispatch(`setCollections`,r)},setIsOpen:function(e){t.dispatch(`setIsOpen`,e)},setStatus:function(e){t.dispatch(`setStatus`,e)},setContext:function(e){t.dispatch(`setContext`,e)}}}function jM(e){"@babel/helpers - typeof";return jM=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},jM(e)}function MM(e){return IM(e)||FM(e)||PM(e)||NM()}function NM(){throw TypeError(`Invalid attempt to spread non-iterable instance.
175
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function PM(e,t){if(e){if(typeof e==`string`)return LM(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return LM(e,t)}}function FM(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function IM(e){if(Array.isArray(e))return LM(e)}function LM(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function RM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zM(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?RM(Object(n),!0).forEach(function(t){BM(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):RM(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function BM(e,t,n){return t=VM(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function VM(e){var t=HM(e,`string`);return jM(t)===`symbol`?t:String(t)}function HM(e,t){if(jM(e)!==`object`||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(jM(r)!==`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function UM(e,t){var n,r=typeof window<`u`?window:{},i=e.plugins||[];return zM(zM({debug:!1,openOnFocus:!1,enterKeyHint:void 0,ignoreCompositionEvents:!1,placeholder:``,autoFocus:!1,defaultActiveItemId:null,stallThreshold:300,insights:void 0,environment:r,shouldPanelOpen:function(e){var t=e.state;return BA(t)>0},reshape:function(e){return e.sources}},e),{},{id:(n=e.id)==null?zA():n,plugins:i,initialState:zM({activeItemId:null,query:``,completion:null,collections:[],isOpen:!1,status:`idle`,context:{}},e.initialState),onStateChange:function(t){var n;(n=e.onStateChange)==null||n.call(e,t),i.forEach(function(e){var n;return(n=e.onStateChange)==null?void 0:n.call(e,t)})},onSubmit:function(t){var n;(n=e.onSubmit)==null||n.call(e,t),i.forEach(function(e){var n;return(n=e.onSubmit)==null?void 0:n.call(e,t)})},onReset:function(t){var n;(n=e.onReset)==null||n.call(e,t),i.forEach(function(e){var n;return(n=e.onReset)==null?void 0:n.call(e,t)})},getSources:function(n){return Promise.all([].concat(MM(i.map(function(e){return e.getSources})),[e.getSources]).filter(Boolean).map(function(e){return rM(e,n)})).then(function(e){return LA(e)}).then(function(e){return e.map(function(e){return zM(zM({},e),{},{onSelect:function(n){e.onSelect(n),t.forEach(function(e){var t;return(t=e.onSelect)==null?void 0:t.call(e,n)})},onActive:function(n){e.onActive(n),t.forEach(function(e){var t;return(t=e.onActive)==null?void 0:t.call(e,n)})},onResolve:function(n){e.onResolve(n),t.forEach(function(e){var t;return(t=e.onResolve)==null?void 0:t.call(e,n)})}})})})},navigator:zM({navigate:function(e){var t=e.itemUrl;r.location.assign(t)},navigateNewTab:function(e){var t=e.itemUrl,n=r.open(t,`_blank`,`noopener`);n==null||n.focus()},navigateNewWindow:function(e){var t=e.itemUrl;r.open(t,`_blank`,`noopener`)}},e.navigator)})}function WM(e){"@babel/helpers - typeof";return WM=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},WM(e)}function GM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function KM(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?GM(Object(n),!0).forEach(function(t){qM(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):GM(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function qM(e,t,n){return t=JM(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function JM(e){var t=YM(e,`string`);return WM(t)===`symbol`?t:String(t)}function YM(e,t){if(WM(e)!==`object`||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(WM(r)!==`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function XM(e){var t=e.collections,n=e.props,r=e.state,i=t.reduce(function(e,t){return KM(KM({},e),{},qM({},t.source.sourceId,KM(KM({},t.source),{},{getItems:function(){return LA(t.items)}})))},{}),a=n.plugins.reduce(function(e,t){return t.reshape?t.reshape(e):e},{sourcesBySourceId:i,state:r}).sourcesBySourceId;return LA(n.reshape({sourcesBySourceId:a,sources:Object.values(a),state:r})).filter(Boolean).map(function(e){return{source:e,items:e.getItems()}})}function ZM(e){"@babel/helpers - typeof";return ZM=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},ZM(e)}function QM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function $M(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?QM(Object(n),!0).forEach(function(t){eN(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):QM(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function eN(e,t,n){return t=tN(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tN(e){var t=nN(e,`string`);return ZM(t)===`symbol`?t:String(t)}function nN(e,t){if(ZM(e)!==`object`||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(ZM(r)!==`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function rN(e){return sN(e)||oN(e)||aN(e)||iN()}function iN(){throw TypeError(`Invalid attempt to spread non-iterable instance.
176
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function aN(e,t){if(e){if(typeof e==`string`)return cN(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return cN(e,t)}}function oN(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function sN(e){if(Array.isArray(e))return cN(e)}function cN(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function lN(e){return!!e.execute}function uN(e){return!!(e!=null&&e.execute)}function dN(e,t,n){if(uN(e)){var r=e.requesterId===`algolia`?Object.assign.apply(Object,[{}].concat(rN(Object.keys(n.context).map(function(e){var t;return(t=n.context[e])==null?void 0:t.__algoliaSearchParameters})))):{};return $M($M({},e),{},{requests:e.queries.map(function(n){return{query:e.requesterId===`algolia`?$M($M({},n),{},{params:$M($M({},r),n.params)}):n,sourceId:t,transformResponse:e.transformResponse}})})}return{items:e,sourceId:t}}function fN(e){var t=e.reduce(function(e,t){if(!lN(t))return e.push(t),e;var n=t.searchClient,r=t.execute,i=t.requesterId,a=t.requests,o=e.find(function(e){return lN(t)&&lN(e)&&e.searchClient===n&&!!i&&e.requesterId===i});if(o){var s;(s=o.items).push.apply(s,rN(a))}else{var c={execute:r,requesterId:i,items:a,searchClient:n};e.push(c)}return e},[]).map(function(e){if(!lN(e))return Promise.resolve(e);var t=e,n=t.execute,r=t.items,i=t.searchClient;return n({searchClient:i,requests:r})});return Promise.all(t).then(function(e){return LA(e)})}function pN(e,t,n){return t.map(function(t){var r=e.filter(function(e){return e.sourceId===t.sourceId}),i=r.map(function(e){return e.items}),a=r[0].transformResponse,o=a?a(hM(i)):i;return t.onResolve({source:t,results:i,items:o,state:n.getState()}),o.every(Boolean),`${t.sourceId}${JSON.stringify(void 0)}`,{source:t,items:o}})}function mN(e){"@babel/helpers - typeof";return mN=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},mN(e)}var hN=[`event`,`nextState`,`props`,`query`,`refresh`,`store`];function gN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _N(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?gN(Object(n),!0).forEach(function(t){vN(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gN(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function vN(e,t,n){return t=yN(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function yN(e){var t=bN(e,`string`);return mN(t)===`symbol`?t:String(t)}function bN(e,t){if(mN(e)!==`object`||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(mN(r)!==`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function xN(e,t){if(e==null)return{};var n=SN(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function SN(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var CN=null,wN=Yj();function TN(e){var t=e.event,n=e.nextState,r=n===void 0?{}:n,i=e.props,a=e.query,o=e.refresh,s=e.store,c=xN(e,hN);CN&&i.environment.clearTimeout(CN);var l=c.setCollections,u=c.setIsOpen,d=c.setQuery,f=c.setActiveItemId,p=c.setStatus,m=c.setContext;if(d(a),f(i.defaultActiveItemId),!a&&i.openOnFocus===!1){var h,g=s.getState().collections.map(function(e){return _N(_N({},e),{},{items:[]})});p(`idle`),l(g),u((h=r.isOpen)==null?i.shouldPanelOpen({state:s.getState()}):h);var _=Wj(wN(g).then(function(){return Promise.resolve()}));return s.pendingRequests.add(_)}p(`loading`),CN=i.environment.setTimeout(function(){p(`stalled`)},i.stallThreshold);var v=Wj(wN(i.getSources(_N({query:a,refresh:o,state:s.getState()},c)).then(function(e){return Promise.all(e.map(function(e){return Promise.resolve(e.getItems(_N({query:a,refresh:o,state:s.getState()},c))).then(function(t){return dN(t,e.sourceId,s.getState())})})).then(fN).then(function(t){var n=t.some(function(e){var t=e.items;return EN(t)});if(n){var r;m({algoliaInsightsPlugin:_N(_N({},((r=s.getState().context)==null?void 0:r.algoliaInsightsPlugin)||{}),{},{__automaticInsights:n})})}return pN(t,e,s)}).then(function(e){return XM({collections:e,props:i,state:s.getState()})})}))).then(function(e){var n;p(`idle`),l(e);var d=i.shouldPanelOpen({state:s.getState()});u((n=r.isOpen)==null?i.openOnFocus&&!a&&d||d:n);var f=uM(s.getState());if(s.getState().activeItemId!==null&&f){var m=f.item,h=f.itemInputValue,g=f.itemUrl,_=f.source;_.onActive(_N({event:t,item:m,itemInputValue:h,itemUrl:g,refresh:o,source:_,state:s.getState()},c))}}).finally(function(){p(`idle`),CN&&i.environment.clearTimeout(CN)});return s.pendingRequests.add(v)}function EN(e){return!Array.isArray(e)&&!!(e!=null&&e._automaticInsights)}function DN(e){"@babel/helpers - typeof";return DN=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},DN(e)}var ON=[`event`,`props`,`refresh`,`store`];function kN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function AN(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?kN(Object(n),!0).forEach(function(t){jN(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kN(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function jN(e,t,n){return t=MN(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function MN(e){var t=NN(e,`string`);return DN(t)===`symbol`?t:String(t)}function NN(e,t){if(DN(e)!==`object`||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(DN(r)!==`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function PN(e,t){if(e==null)return{};var n=FN(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function FN(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function IN(e){var t=e.event,n=e.props,r=e.refresh,i=e.store,a=PN(e,ON);if(t.key===`ArrowUp`||t.key===`ArrowDown`){var o=function(){var e=uM(i.getState()),t=n.environment.document.getElementById(dM(n.id,`item-${i.getState().activeItemId}`,e==null?void 0:e.source));t&&(t.scrollIntoViewIfNeeded?t.scrollIntoViewIfNeeded(!1):t.scrollIntoView(!1))},s=function(){var e=uM(i.getState());if(i.getState().activeItemId!==null&&e){var n=e.item,o=e.itemInputValue,s=e.itemUrl,c=e.source;c.onActive(AN({event:t,item:n,itemInputValue:o,itemUrl:s,refresh:r,source:c,state:i.getState()},a))}};t.preventDefault(),i.getState().isOpen===!1&&(n.openOnFocus||i.getState().query)?TN(AN({event:t,props:n,query:i.getState().query,refresh:r,store:i},a)).then(function(){i.dispatch(t.key,{nextActiveItemId:n.defaultActiveItemId}),s(),setTimeout(o,0)}):(i.dispatch(t.key,{}),s(),o())}else if(t.key===`Escape`)t.preventDefault(),i.dispatch(t.key,null),i.pendingRequests.cancelAll();else if(t.key===`Tab`)i.dispatch(`blur`,null),i.pendingRequests.cancelAll();else if(t.key===`Enter`){if(i.getState().activeItemId===null||i.getState().collections.every(function(e){return e.items.length===0})){var c=sM(n.plugins,i.pendingRequests);c===void 0?n.debug||i.pendingRequests.cancelAll():c.then(i.pendingRequests.cancelAll);return}t.preventDefault();var l=uM(i.getState()),u=l.item,d=l.itemInputValue,f=l.itemUrl,p=l.source;if(t.metaKey||t.ctrlKey)f!==void 0&&(p.onSelect(AN({event:t,item:u,itemInputValue:d,itemUrl:f,refresh:r,source:p,state:i.getState()},a)),n.navigator.navigateNewTab({itemUrl:f,item:u,state:i.getState()}));else if(t.shiftKey)f!==void 0&&(p.onSelect(AN({event:t,item:u,itemInputValue:d,itemUrl:f,refresh:r,source:p,state:i.getState()},a)),n.navigator.navigateNewWindow({itemUrl:f,item:u,state:i.getState()}));else if(!t.altKey){if(f!==void 0){p.onSelect(AN({event:t,item:u,itemInputValue:d,itemUrl:f,refresh:r,source:p,state:i.getState()},a)),n.navigator.navigate({itemUrl:f,item:u,state:i.getState()});return}TN(AN({event:t,nextState:{isOpen:!1},props:n,query:d,refresh:r,store:i},a)).then(function(){p.onSelect(AN({event:t,item:u,itemInputValue:d,itemUrl:f,refresh:r,source:p,state:i.getState()},a))})}}}function LN(e){"@babel/helpers - typeof";return LN=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},LN(e)}var RN=[`props`,`refresh`,`store`],zN=[`inputElement`,`formElement`,`panelElement`],BN=[`inputElement`],VN=[`inputElement`,`maxLength`],HN=[`source`],UN=[`item`,`source`];function WN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function GN(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?WN(Object(n),!0).forEach(function(t){KN(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):WN(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function KN(e,t,n){return t=qN(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qN(e){var t=JN(e,`string`);return LN(t)===`symbol`?t:String(t)}function JN(e,t){if(LN(e)!==`object`||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(LN(r)!==`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function YN(e,t){if(e==null)return{};var n=XN(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function XN(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function ZN(e){var t=e.props,n=e.refresh,r=e.store,i=YN(e,RN);return{getEnvironmentProps:function(e){var n=e.inputElement,i=e.formElement,a=e.panelElement,o=YN(e,zN);function s(e){!(r.getState().isOpen||!r.pendingRequests.isEmpty())||e.target===n||[i,a].some(function(t){return fM(t,e.target)})===!1&&(r.dispatch(`blur`,null),t.debug||r.pendingRequests.cancelAll())}return GN({onTouchStart:s,onMouseDown:s,onTouchMove:function(e){r.getState().isOpen===!1||n!==t.environment.document.activeElement||e.target===n||n.blur()}},o)},getRootProps:function(e){return GN({role:`combobox`,"aria-expanded":r.getState().isOpen,"aria-haspopup":`listbox`,"aria-controls":r.getState().isOpen?r.getState().collections.map(function(e){var n=e.source;return dM(t.id,`list`,n)}).join(` `):void 0,"aria-labelledby":dM(t.id,`label`)},e)},getFormProps:function(e){e.inputElement;var a=YN(e,BN),o=function(a){var o;t.onSubmit(GN({event:a,refresh:n,state:r.getState()},i)),r.dispatch(`submit`,null),(o=e.inputElement)==null||o.blur()};return GN({action:``,noValidate:!0,role:`search`,onSubmit:function(e){e.preventDefault();var n=sM(t.plugins,r.pendingRequests);n===void 0?o(e):n.then(function(){return o(e)})},onReset:function(a){var o;a.preventDefault(),t.onReset(GN({event:a,refresh:n,state:r.getState()},i)),r.dispatch(`reset`,null),(o=e.inputElement)==null||o.focus()}},a)},getLabelProps:function(e){return GN({htmlFor:dM(t.id,`input`),id:dM(t.id,`label`)},e)},getInputProps:function(e){var a;function o(e){(t.openOnFocus||r.getState().query)&&TN(GN({event:e,props:t,query:r.getState().completion||r.getState().query,refresh:n,store:r},i)),r.dispatch(`focus`,null)}var s=e||{};s.inputElement;var c=s.maxLength,l=c===void 0?512:c,u=YN(s,VN),d=uM(r.getState()),f=mM(((a=t.environment.navigator)==null?void 0:a.userAgent)||``),p=t.enterKeyHint||(d!=null&&d.itemUrl&&!f?`go`:`search`);return GN({"aria-autocomplete":`both`,"aria-activedescendant":r.getState().isOpen&&r.getState().activeItemId!==null?dM(t.id,`item-${r.getState().activeItemId}`,d==null?void 0:d.source):void 0,"aria-controls":r.getState().isOpen?r.getState().collections.filter(function(e){return e.items.length>0}).map(function(e){var n=e.source;return dM(t.id,`list`,n)}).join(` `):void 0,"aria-labelledby":dM(t.id,`label`),value:r.getState().completion||r.getState().query,id:dM(t.id,`input`),autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`off`,enterKeyHint:p,spellCheck:`false`,autoFocus:t.autoFocus,placeholder:t.placeholder,maxLength:l,type:`search`,onChange:function(e){var a=e.currentTarget.value;if(t.ignoreCompositionEvents&&gM(e).isComposing){i.setQuery(a);return}TN(GN({event:e,props:t,query:a.slice(0,l),refresh:n,store:r},i))},onCompositionEnd:function(e){TN(GN({event:e,props:t,query:e.currentTarget.value.slice(0,l),refresh:n,store:r},i))},onKeyDown:function(e){gM(e).isComposing||IN(GN({event:e,props:t,refresh:n,store:r},i))},onFocus:o,onBlur:UA,onClick:function(n){e.inputElement===t.environment.document.activeElement&&!r.getState().isOpen&&o(n)}},u)},getPanelProps:function(e){return GN({onMouseDown:function(e){e.preventDefault()},onMouseLeave:function(){r.dispatch(`mouseleave`,null)}},e)},getListProps:function(e){var n=e||{},r=n.source,i=YN(n,HN);return GN({role:`listbox`,"aria-labelledby":dM(t.id,`label`),id:dM(t.id,`list`,r)},i)},getItemProps:function(e){var a=e.item,o=e.source,s=YN(e,UN);return GN({id:dM(t.id,`item-${a.__autocomplete_id}`,o),role:`option`,"aria-selected":r.getState().activeItemId===a.__autocomplete_id,onMouseMove:function(e){if(a.__autocomplete_id!==r.getState().activeItemId){r.dispatch(`mousemove`,a.__autocomplete_id);var t=uM(r.getState());if(r.getState().activeItemId!==null&&t){var o=t.item,s=t.itemInputValue,c=t.itemUrl,l=t.source;l.onActive(GN({event:e,item:o,itemInputValue:s,itemUrl:c,refresh:n,source:l,state:r.getState()},i))}}},onMouseDown:function(e){e.preventDefault()},onClick:function(e){var s=o.getItemInputValue({item:a,state:r.getState()}),c=o.getItemUrl({item:a,state:r.getState()});(c?Promise.resolve():TN(GN({event:e,nextState:{isOpen:!1},props:t,query:s,refresh:n,store:r},i))).then(function(){o.onSelect(GN({event:e,item:a,itemInputValue:s,itemUrl:c,refresh:n,source:o,state:r.getState()},i))})}},s)}}}function QN(e){"@babel/helpers - typeof";return QN=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},QN(e)}function $N(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function eP(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?$N(Object(n),!0).forEach(function(t){tP(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$N(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function tP(e,t,n){return t=nP(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nP(e){var t=rP(e,`string`);return QN(t)===`symbol`?t:String(t)}function rP(e,t){if(QN(e)!==`object`||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(QN(r)!==`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function iP(e){var t,n,r,i,a=e.plugins,o=e.options,s=(t=(((n=o.__autocomplete_metadata)==null?void 0:n.userAgents)||[])[0])==null?void 0:t.segment,c=s?tP({},s,Object.keys(((r=o.__autocomplete_metadata)==null?void 0:r.options)||{})):{};return{plugins:a.map(function(e){return{name:e.name,options:Object.keys(e.__autocomplete_pluginOptions||[])}}),options:eP({"autocomplete-core":Object.keys(o)},c),ua:GA.concat(((i=o.__autocomplete_metadata)==null?void 0:i.userAgents)||[])}}function aP(e){var t,n,r=e.metadata,i=e.environment;if(!((t=i.navigator)==null||(n=t.userAgent)==null)&&n.includes(`Algolia Crawler`)){var a=i.document.createElement(`meta`),o=i.document.querySelector(`head`);a.name=`algolia:metadata`,setTimeout(function(){a.content=JSON.stringify(r),o.appendChild(a)},0)}}function oP(e){var t,n=e.state;return n.isOpen===!1||n.activeItemId===null?null:((t=uM(n))==null?void 0:t.itemInputValue)||null}function sP(e){"@babel/helpers - typeof";return sP=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},sP(e)}function cP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function lP(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?cP(Object(n),!0).forEach(function(t){uP(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cP(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function uP(e,t,n){return t=dP(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function dP(e){var t=fP(e,`string`);return sP(t)===`symbol`?t:String(t)}function fP(e,t){if(sP(e)!==`object`||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(sP(r)!==`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var pP=function(e,t){switch(t.type){case`setActiveItemId`:return lP(lP({},e),{},{activeItemId:t.payload});case`setQuery`:return lP(lP({},e),{},{query:t.payload,completion:null});case`setCollections`:return lP(lP({},e),{},{collections:t.payload});case`setIsOpen`:return lP(lP({},e),{},{isOpen:t.payload});case`setStatus`:return lP(lP({},e),{},{status:t.payload});case`setContext`:return lP(lP({},e),{},{context:lP(lP({},e.context),t.payload)});case`ArrowDown`:var n=lP(lP({},e),{},{activeItemId:t.payload.hasOwnProperty(`nextActiveItemId`)?t.payload.nextActiveItemId:Xj(1,e.activeItemId,BA(e),t.props.defaultActiveItemId)});return lP(lP({},n),{},{completion:oP({state:n})});case`ArrowUp`:var r=lP(lP({},e),{},{activeItemId:Xj(-1,e.activeItemId,BA(e),t.props.defaultActiveItemId)});return lP(lP({},r),{},{completion:oP({state:r})});case`Escape`:return e.isOpen?lP(lP({},e),{},{activeItemId:null,isOpen:!1,completion:null}):lP(lP({},e),{},{activeItemId:null,query:``,status:`idle`,collections:[]});case`submit`:return lP(lP({},e),{},{activeItemId:null,isOpen:!1,status:`idle`});case`reset`:return lP(lP({},e),{},{activeItemId:t.props.openOnFocus===!0?t.props.defaultActiveItemId:null,status:`idle`,completion:null,query:``});case`focus`:return lP(lP({},e),{},{activeItemId:t.props.defaultActiveItemId,isOpen:(t.props.openOnFocus||!!e.query)&&t.props.shouldPanelOpen({state:e})});case`blur`:return t.props.debug?e:lP(lP({},e),{},{isOpen:!1,activeItemId:null});case`mousemove`:return lP(lP({},e),{},{activeItemId:t.payload});case`mouseleave`:return lP(lP({},e),{},{activeItemId:t.props.defaultActiveItemId});default:return`${JSON.stringify(t.type)}`,e}};function mP(e){"@babel/helpers - typeof";return mP=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},mP(e)}function hP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function gP(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?hP(Object(n),!0).forEach(function(t){_P(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hP(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function _P(e,t,n){return t=vP(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vP(e){var t=yP(e,`string`);return mP(t)===`symbol`?t:String(t)}function yP(e,t){if(mP(e)!==`object`||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(mP(r)!==`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function bP(e){var t=[],n=UM(e,t),r=CM(pP,n,o),i=AM({store:r}),a=ZN(gP({props:n,refresh:s,store:r,navigator:n.navigator},i));function o(e){var t,r,a=e.prevState,o=e.state;if(n.onStateChange(gP({prevState:a,state:o,refresh:s,navigator:n.navigator},i)),!l()&&(t=o.context)!=null&&(r=t.algoliaInsightsPlugin)!=null&&r.__automaticInsights&&n.insights!==!1){var u=Lj({__autocomplete_clickAnalytics:!1});n.plugins.push(u),c([u])}}function s(){return TN(gP({event:new Event(`input`),nextState:{isOpen:r.getState().isOpen},props:n,navigator:n.navigator,query:r.getState().query,refresh:s,store:r},i))}function c(e){e.forEach(function(e){var r;return(r=e.subscribe)==null?void 0:r.call(e,gP(gP({},i),{},{navigator:n.navigator,refresh:s,onSelect:function(e){t.push({onSelect:e})},onActive:function(e){t.push({onActive:e})},onResolve:function(e){t.push({onResolve:e})}}))})}function l(){return n.plugins.some(function(e){return e.name===`aa.algoliaInsightsPlugin`})}if(n.insights&&!l()){var u=typeof n.insights==`boolean`?{}:n.insights;n.plugins.push(Lj(u))}return c(n.plugins),aP({metadata:iP({plugins:n.plugins,options:e}),environment:n.environment}),gP(gP({refresh:s,navigator:n.navigator},a),i)}V();function xP(){return B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},B.createElement(`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`}))}let SP={before:`Searched for `,separator:`, `,lastSeparator:` and `,after:``};function CP({queries:e,translations:t,onSearchQueryClick:n}){if(e.length===0)return null;if(typeof t.aggregatedToolCallNode==`function`)return B.createElement(B.Fragment,null,t.aggregatedToolCallNode(e,n));let{before:r=``,separator:i=`, `,lastSeparator:a=` and `,after:o=``}=(t.aggregatedToolCallText?t.aggregatedToolCallText(e):SP)||{};return B.createElement(`div`,{className:`DocSearch-AskAiScreen-MessageContent-Tool Tool--AggregatedResult`},B.createElement(dn,{size:18}),B.createElement(`span`,null,r&&B.createElement(`span`,null,r),e.map((t,r)=>B.createElement(E,{key:t+r},B.createElement(`span`,{role:`button`,tabIndex:0,className:`DocSearch-AskAiScreen-MessageContent-Tool-Query`,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n(t))},onClick:()=>n(t)},`"`,t,`"`),r<e.length-2&&i,r===e.length-2&&a)),o&&B.createElement(`span`,null,o)))}let wP=[`translations`];function TP(e){let{preToolCallText:t=`Searching...`,duringToolCallText:n=`Searching...`,afterToolCallText:r=`Searched for`,savedMemoryToolResultText:i=`Saved to memory`,memoryToolResultText:a=`Used memory to enhance results`}=e;return{preToolCallText:t,searchingText:n,toolCallResultText:r,savedMemoryToolResultText:i,memoryToolResultText:a}}function EP({disclaimerText:e}){return B.createElement(`p`,{className:`DocSearch-AskAiScreen-Disclaimer`},B.createElement(Dr,null),` `,e)}function DP({exchange:e,askAiError:t,isLastExchange:n,loadingStatus:r,onSearchQueryClick:i,translations:a,tools:o,conversations:s,onFeedback:c,memoryEnabled:l,onSelectPromptSuggestion:u}){var d,f;let{userMessage:p,assistantMessage:m}=e,{stoppedStreamingText:h=`You stopped this response`,errorTitleText:g=`Chat error`,relatedSourcesText:_,relatedSourcesTextPlural:v,suggestedPromptsTitleText:y=`Suggested prompts`}=a,b=z(()=>TP(a),[a]),x=eA(t),S=z(()=>Qk(m),[m]),C=z(()=>Qk(p),[p]),w=B.useMemo(()=>Xk(m),[m]),T=B.useMemo(()=>xA((m==null?void 0:m.parts)||[]),[m]),E=z(()=>n?uA((m==null?void 0:m.parts)||[]):[],[m,n]),D=((d=p.metadata)==null?void 0:d.stopped)||(m==null||(f=m.metadata)==null?void 0:f.stopped),O=!D&&(!n||n&&r===`ready`&&!!m),k=[`submitted`,`streaming`].includes(r)&&n&&!T.some(e=>e.type!==`step-start`),A=(m==null?void 0:m.id)||e.id;return B.createElement(`div`,{className:`DocSearch-AskAiScreen-Response-Container`},B.createElement(`div`,{className:`DocSearch-AskAiScreen-Response`},B.createElement(`div`,{className:`DocSearch-AskAiScreen-Message DocSearch-AskAiScreen-Message--user`},B.createElement(`p`,{className:`DocSearch-AskAiScreen-Query`},C==null?``:C)),B.createElement(`div`,{className:`DocSearch-AskAiScreen-Message DocSearch-AskAiScreen-Message--assistant`},B.createElement(`div`,{className:`DocSearch-AskAiScreen-MessageContent`},r===`error`&&t&&n&&!x&&B.createElement(`div`,{className:`DocSearch-AskAiScreen-Error`,role:`alert`},B.createElement(dk,{"aria-hidden":`true`}),B.createElement(`div`,{className:`DocSearch-AskAiScreen-Error-Content`},B.createElement(`h4`,{className:`DocSearch-AskAiScreen-Error-Title`},g),B.createElement(bA,{content:t.message,copyButtonText:``,copyButtonCopiedText:``,isStreaming:!1}))),k&&B.createElement(`div`,{className:`DocSearch-AskAiScreen-MessageContent-Thinking`,role:`status`},B.createElement(`span`,{className:`DocSearch-shimmer`},a.thinkingText||`Thinking...`),B.createElement(`span`,{className:`DocSearch-AskAi-Thinking-Skeleton DocSearch-shimmer`}),B.createElement(`span`,{className:`DocSearch-AskAi-Thinking-Skeleton DocSearch-AskAi-Thinking-Skeleton--short DocSearch-shimmer`})),T.map((e,t)=>{let n=t;return typeof e==`string`?B.createElement(bA,{key:n,content:e,copyButtonText:a.copyButtonText||`Copy`,copyButtonCopiedText:a.copyButtonCopiedText||`Copied!`,isStreaming:r===`streaming`}):oA(e)?B.createElement(_A,{key:n,translations:b,part:e,tools:o,memoryEnabled:l,onSearchQueryClick:i}):e.type===`aggregated-tool-call`?B.createElement(CP,{key:n,queries:e.queries,translations:a,onSearchQueryClick:i}):e.type===`reasoning`&&e.state===`streaming`?B.createElement(`div`,{key:n,className:`DocSearch-AskAiScreen-MessageContent-Reasoning DocSearch-shimmer`},B.createElement(Er,{className:`DocSearch-AskAiScreen-SmallerLoadingIcon`}),B.createElement(`span`,{className:`DocSearch-shimmer`},`Reasoning...`)):e.type===`text`?B.createElement(bA,{key:n,content:e.text,copyButtonText:a.copyButtonText||`Copy`,copyButtonCopiedText:a.copyButtonCopiedText||`Copied!`,isStreaming:e.state===`streaming`}):null})),D&&B.createElement(`p`,{className:`DocSearch-AskAiScreen-MessageContent-Stopped`},h)),B.createElement(`div`,{className:`DocSearch-AskAiScreen-Answer-Footer`},B.createElement(Mk,{links:w,titleText:_,pluralTitleText:v}),B.createElement(Sk,{id:A,showActions:O,latestAssistantMessageContent:S||null,translations:a,conversations:s,onFeedback:c})),E.length>0&&B.createElement(yk,{title:y,suggestions:E,onSelectPromptSuggestion:u})))}function OP(e){let{translations:t={}}=e,n=pn(e,wP),{disclaimerText:r=`Answers are generated with AI which can make mistakes.`,threadDepthExceededMessage:i=`This conversation is now closed to keep responses accurate.`,startNewConversationButtonText:a=`Start a new conversation`}=t,{messages:o,tools:s,askAiError:c,status:l,memoryEnabled:u}=n,d=z(()=>l===`error`&&eA(c),[l,c]),f=z(()=>iA(c),[c]),p=nA(c),m=z(()=>{let e=[];for(let n=0;n<o.length;n++)if(o[n].role===`user`){var t;let r=o[n],i=((t=o[n+1])==null?void 0:t.role)===`assistant`?o[n+1]:null;e.push({id:r.id,userMessage:r,assistantMessage:i}),i&&n++}return e},[o]),h=e=>{n.onAskAiToggle(!1),n.setQuery(e)},g=d&&(!$k(c)||o.some(e=>e.role===`assistant`));return B.createElement(`div`,{className:`DocSearch-AskAiScreen DocSearch-AskAiScreen-Container`},B.createElement(`div`,{id:n.promptBlockingErrorId,role:`alert`},g&&B.createElement(`div`,{className:`DocSearch-AskAiScreen-MessageContent DocSearch-AskAiScreen-Error DocSearch-AskAiScreen-Error--ThreadDepth`},B.createElement(`div`,{className:`DocSearch-AskAiScreen-Error-Content`},B.createElement(`p`,{className:`DocSearch-AskAiScreen-Error-Title`},f==null?$k(c)?i:`This conversation cannot continue.`:f),p&&B.createElement(`p`,null,B.createElement(`button`,{type:`button`,className:`DocSearch-ThreadDepthError-Link`,onClick:n.onNewConversation},a),` `,`to continue.`)))),B.createElement(EP,{disclaimerText:r}),B.createElement(`div`,{className:`DocSearch-AskAiScreen-Body`},B.createElement(`div`,{className:`DocSearch-AskAiScreen-ExchangesList`},m.slice().reverse().map((e,r)=>B.createElement(DP,{key:e.id,exchange:e,askAiError:n.askAiError,isLastExchange:r===0,loadingStatus:n.status,translations:t,tools:s,conversations:n.conversations,memoryEnabled:u,onSearchQueryClick:h,onFeedback:n.onFeedback,onSelectPromptSuggestion:n.onSelectPromptSuggestion})))))}let kP=[`translations`];function AP(e){let{translations:t={}}=e,n=pn(e,kP),{recentConversationsTitle:r=`Resume AI conversations`,removeRecentConversationButtonTitle:i=`Remove this conversation from history`}=t,a=xp(n.state,`recentConversations`);return a?B.createElement(Fm,_(_({},n),{},{title:r,collection:a,renderIcon:()=>B.createElement(`div`,{className:`DocSearch-Hit-icon DocSearch-Hit-icon--start`},B.createElement(xP,null)),renderAction:({item:e})=>B.createElement(`div`,{className:`DocSearch-Hit-action`},B.createElement(`button`,{className:`DocSearch-Hit-action-button`,title:i,type:`submit`,onClick:t=>{t.preventDefault(),t.stopPropagation(),n.conversations.remove(e),n.refresh()}},B.createElement(jr,null)))})):null}let jP=[`translations`];function MP(e){let{translations:t={}}=e,n=pn(e,jP);return B.createElement(`div`,{className:`DocSearch-Dropdown-Container`},B.createElement(AP,_(_({},n),{},{translations:t})),B.createElement(Bm,_(_({},n),{},{translations:t})))}let NP=[`onAskAiToggle`];function PP(e){let{onAskAiToggle:t}=e,n=pn(e,NP),r=B.useMemo(()=>xp(n.state,`recentConversations`),[n.state]);return B.useEffect(()=>{(!r||r.items.length===0)&&t(!0)},[r,t]),r?B.createElement(`div`,{className:`DocSearch-Dropdown-Container DocSearch-Conversation-History`},B.createElement(Fm,_(_({},n),{},{key:r.source.sourceId,title:``,translations:n.translations,collection:r,renderIcon:()=>B.createElement(`div`,{className:`DocSearch-Hit-icon`},B.createElement(Dr,null)),renderAction:({item:e})=>B.createElement(`div`,{className:`DocSearch-Hit-action`},B.createElement(`button`,{type:`button`,className:`DocSearch-Hit-action-button`,onClick:t=>{t.preventDefault(),t.stopPropagation(),n.conversations.remove(e),n.refresh()}},B.createElement(jr,null)))}))):null}function FP({translations:e={},suggestedQuestions:t=[],selectSuggestedQuestion:n}){let{newConversationTitle:r=`How can I help you today?`,newConversationDescription:i=`I search through your documentation to help you find setup guides, feature details and troubleshooting tips, fast.`}=e;return B.createElement(`div`,{className:`DocSearch-NewConversationScreen`},B.createElement(`h3`,{className:`DocSearch-NewConversationScreen-Title`},r),B.createElement(`p`,{className:`DocSearch-NewConversationScreen-Description`},i),B.createElement(`div`,{className:`DocSearch-NewConversationScreen-SuggestedQuestions`},t.map(e=>B.createElement(`button`,{key:e.objectID,type:`button`,className:`DocSearch-NewConversationScreen-SuggestedQuestion`,onClick:()=>n(e)},e.question))))}let IP=[`translations`,`selectAskAiQuestion`],LP=B.memo(e=>{var t;let{translations:n={},selectAskAiQuestion:r}=e,i=pn(e,IP),a=B.useCallback(e=>{r(!0,e)},[r]);return i.canHandleAskAi&&i.isAskAiActive&&i.askAiState===`conversation-history`?B.createElement(PP,_({selectAskAiQuestion:r},i)):i.canHandleAskAi&&i.isAskAiActive&&i.askAiState===`new-conversation`?B.createElement(FP,{translations:n==null?void 0:n.newConversation,selectSuggestedQuestion:i.selectSuggestedQuestion,suggestedQuestions:i.suggestedQuestions}):i.isAskAiActive&&i.canHandleAskAi?B.createElement(OP,_(_({},i),{},{messages:i.messages,tools:i.tools,status:i.status,askAiError:i.askAiError,translations:n==null?void 0:n.askAiScreen,memoryEnabled:i.memoryEnabled,selectAskAiQuestion:r,onSelectPromptSuggestion:a})):((t=i.state)==null?void 0:t.status)===`error`?B.createElement(Vm,{translations:n==null?void 0:n.errorScreen}):jp(i.state.query)?B.createElement(MP,_(_({},i),{},{hasCollections:i.hasCollections,translations:n==null?void 0:n.startScreen,selectAskAiQuestion:r})):!i.hasCollections&&!i.canHandleAskAi?B.createElement(Um,_(_({},i),{},{translations:n==null?void 0:n.noResultsScreen})):B.createElement(B.Fragment,null,B.createElement(qm,_(_({},i),{},{translations:n==null?void 0:n.resultsScreen})),i.canHandleAskAi&&!i.hasCollections&&B.createElement(Um,_(_({},i),{},{translations:n==null?void 0:n.noResultsScreen})))},function(e,t){if(e.isAskAiActive!==t.isAskAiActive||e.askAiState!==t.askAiState||e.canHandleAskAi!==t.canHandleAskAi)return!1;let n=t.state.status===`loading`||t.state.status===`stalled`,r=t.state.status===`idle`&&!jp(t.state.query)&&e.state.query!==t.state.query&&e.state.collections===t.state.collections;return n||r});function RP({heading:e,shimmer:t=!1}){return B.createElement(`span`,{className:`DocSearch-Modal-heading${t?` DocSearch-shimmer`:``}`},e)}let zP=[`translations`,`askAiState`,`onAskAiToggle`,`setAskAiState`];function BP(e){let{translations:t={},askAiState:n,onAskAiToggle:r,setAskAiState:i}=e,a=pn(e,zP),{clearButtonTitle:o=`Clear`,clearButtonAriaLabel:s=`Clear the query`,closeButtonText:c=`Close`,closeButtonAriaLabel:l=`Close`,searchInputLabel:u=`Search`,backToKeywordSearchButtonText:d=`Back to keyword search`,backToKeywordSearchButtonAriaLabel:f=`Back to keyword search`,placeholderTextAskAiStreaming:p=`Answering...`,newConversationPlaceholder:m=`Ask a question`,conversationHistoryTitle:h=`My conversation history`,startNewConversationText:g=`Start a new conversation`,viewConversationHistoryText:v=`Conversation history`,threadDepthErrorPlaceholder:y=`Conversation limit reached`}=t,b=B.useMemo(()=>{let e=xp(a.state,`recentConversations`);return e?e.items.length>0:!1},[a.state]),x=a.getInputProps({inputElement:a.inputRef.current,autoFocus:a.autoFocus}),S=new Set([`ArrowUp`,`ArrowDown`,`Enter`]),C=x.onKeyDown,w=x.onChange,T=a.askAiStatus===`streaming`||a.askAiStatus===`submitted`,E=a.isAskAiActive&&n!==`conversation-history`,D=!!a.promptBlockingChrome,O=a.placeholder;n===`new-conversation`&&(O=m),a.promptBlockingChrome===`full`&&a.isAskAiActive&&(O=y);let k=null;T&&(k=p),n===`conversation-history`&&(k=h),B.useEffect(()=>{a.askAiStatus!==`streaming`&&a.askAiStatus!==`submitted`&&a.inputRef.current&&a.inputRef.current.focus()},[a.askAiStatus,a.inputRef]);let A={enterKeyHint:a.isAskAiActive?`enter`:`search`,onKeyDown:e=>{if(D&&a.isAskAiActive&&S.has(e.key)){e.preventDefault(),e.stopPropagation();return}let t=!1;if(a.isAskAiActive&&S.has(e.key)&&(e.key===`Enter`&&!T&&!jp(a.state.query)&&a.onAskAgain(a.state.query),t=!0),t){e.preventDefault(),e.stopPropagation();return}C==null||C(e)},onChange:e=>{if(D&&a.isAskAiActive){e.preventDefault();return}if(a.isAskAiActive){a.setQuery(e.currentTarget.value),e.preventDefault(),e.stopPropagation();return}w==null||w(e)},disabled:T,readOnly:D&&a.isAskAiActive,"aria-disabled":D&&a.isAskAiActive,"aria-describedby":D&&a.isAskAiActive?a.promptBlockingErrorId:void 0},j=B.useCallback(()=>{if(D){a.onNewConversation();return}if(n===`conversation-history`){r(!0),i(`initial`);return}r(!1)},[n,D,r,i,a]),M=a.isAskAiActive?B.createElement(`button`,{type:`button`,tabIndex:0,className:`DocSearch-Action DocSearch-AskAi-Return`,title:D?g:d,"aria-label":D?g:f,onClick:j},B.createElement(vk,null)):void 0,N=k?B.createElement(RP,{heading:k,shimmer:T}):null,P=B.createElement(B.Fragment,null,!a.isAskAiActive&&B.createElement(B.Fragment,null,B.createElement(`button`,{className:`DocSearch-Clear`,type:`reset`,"aria-label":s,hidden:!a.state.query,tabIndex:a.state.query?0:-1,"aria-hidden":a.state.query?`false`:`true`},o),a.state.query&&B.createElement(`div`,{className:`DocSearch-Divider`})),T&&B.createElement(B.Fragment,null,B.createElement(`button`,{type:`button`,className:`DocSearch-Action DocSearch-StopStreaming`,onClick:a.onStopAskAiStreaming},B.createElement(fk,null)),B.createElement(`div`,{className:`DocSearch-Divider`})),E&&B.createElement(B.Fragment,null,B.createElement(wA,null,B.createElement(wA.Trigger,{className:`DocSearch-Action`},B.createElement(pk,null)),B.createElement(wA.Content,null,B.createElement(wA.Item,{onClick:a.onNewConversation},B.createElement(hk,null),g),b&&B.createElement(wA.Item,{onClick:a.onViewConversationHistory},B.createElement(mk,null),v))),B.createElement(`div`,{className:`DocSearch-Divider`})));return B.createElement(cm,_(_({},a),{},{placeholder:O,clearButtonTitle:o,clearButtonAriaLabel:s,closeButtonText:c,closeButtonAriaLabel:l,searchInputLabel:u,leadingElement:M,inputOverlay:N,hideInput:!!k,actionsBeforeClose:P,inputProps:A}))}let VP={value:``,matchLevel:`none`,matchedWords:[]},HP={lvl0:VP,lvl1:VP,lvl2:VP,lvl3:VP,lvl4:VP,lvl5:VP,lvl6:VP},UP={content:VP,hierarchy:HP,hierarchy_camel:[]},WP={content:VP,hierarchy:HP,hierarchy_camel:[]};function GP({conversations:e,disableUserPersonalization:t,setMessages:n,onAskAiToggle:r}){return[{sourceId:bp.recentConversations,getItems(){return t?[]:e.getAll().slice(0,3)},onSelect({item:e}){e.messages&&(n(e.messages),r(!0))}}]}function KP({query:e,objectID:t,lvl0:n}){return{type:`askAI`,query:e,url_without_anchor:``,objectID:t,content:null,url:``,anchor:null,hierarchy:{lvl0:n,lvl1:e,lvl2:null,lvl3:null,lvl4:null,lvl5:null,lvl6:null},_highlightResult:UP,_snippetResult:WP,__docsearch_parent:null}}async function qP({query:e,indexName:t,searchClient:n,hitsPerPage:r=3}){try{let{results:i}=await n.search({requests:[{query:e,indexName:t,hitsPerPage:r,attributesToRetrieve:[`prompt`]}]});return i[0].hits.map(e=>KP({query:e.prompt,objectID:e.objectID,lvl0:`Prompt Suggestions`}))}catch(e){return[]}}async function JP({query:e,handleSelectAskAiQuestion:t,promptSuggestionsOptions:n,searchClient:r}){let i=n?await qP({query:e,indexName:n.indexName,hitsPerPage:n.hitsPerPage,searchClient:r}):[];return[{sourceId:bp.askAI,getItems(){return[KP({query:e,objectID:`ask-ai-button`,lvl0:`Ask AI`}),...i]},onSelect({item:e}){e.type===`askAI`&&e.query&&t(!0,e.query)}}]}let YP=`appId.apiKey.askAi.maxResultsPerGroup.theme.onClose.transformItems.hitComponent.resultsFooterComponent.navigator.initialScrollY.transformSearchClient.disableUserPersonalization.initialQuery.translations.getMissingResultsUrl.insights.onAskAiToggle.interceptAskAiEvent.isAskAiActive.recentSearchesLimit.recentSearchesWithFavoritesLimit.indices.facets.isHybridModeSupported.footerAction`.split(`.`),XP=[`footer`,`searchBox`,`facets`];function ZP(e){var t,n,r,i;let{appId:a,apiKey:o,askAi:s,maxResultsPerGroup:c,theme:l,onClose:u=Mp,transformItems:d=kp,hitComponent:f=fm,resultsFooterComponent:p=()=>null,navigator:m,initialScrollY:h=0,transformSearchClient:g=kp,disableUserPersonalization:v=!1,initialQuery:y=``,translations:b={},getMissingResultsUrl:x,insights:S=!1,onAskAiToggle:C,interceptAskAiEvent:w,isAskAiActive:T=!1,recentSearchesLimit:E=7,recentSearchesWithFavoritesLimit:D=4,indices:O,facets:k,isHybridModeSupported:A=!1,footerAction:j}=e,M=pn(e,YP),{footer:N,searchBox:P,facets:ee}=b,te=pn(b,XP),[F,ne]=B.useState({query:``,collections:[],completion:null,context:{},isOpen:!1,activeItemId:null,status:`idle`}),re=!!s,ie=(b==null||(t=b.searchBox)==null?void 0:t.placeholderText)||M.placeholder||`Search docs`;if(re){var ae;ie=(b==null||(ae=b.searchBox)==null?void 0:ae.placeholderText)||`Search docs or ask AI a question`}if(T){var oe;ie=(b==null||(oe=b.searchBox)==null?void 0:oe.placeholderTextAskAi)||`Ask another question...`}let{containerRef:se,modalRef:ce,formElementRef:I,dropdownRef:le,inputRef:ue}=xm(),de=B.useId(),{initialQuery:fe,initialQueryFromSelection:pe}=gm(y),me=Kr(a,o,g),L=typeof s==`object`?s:null,he=L?L.agentId:s,ge=L==null?void 0:L.searchParameters,[_e,ve]=B.useState(`initial`),ye=PA({agentId:he,searchClient:me,suggestedQuestionsEnabled:L==null?void 0:L.suggestedQuestions}),be=(n=L==null||(r=L.memory)==null?void 0:r.enabled)!=null&&n,xe=(i=L==null?void 0:L.tools)==null?aA:i,Se=B.useMemo(()=>Zm({indices:O}),[O]),Ce=Se[0].name,we=B.useRef(void 0),{visibleFacets:Te,facetSelections:Ee,facetSelectionsRef:De,handleFacetSelectionChange:Oe,clearFacetSelections:ke}=mm({facets:k,indexes:Se,searchClient:me,onSelectionsChange:()=>{var e;return(e=we.current)==null?void 0:e.refresh()}}),{favoriteSearches:Ae,recentSearches:je}=Tm({defaultIndexName:Ce,recentSearchesLimit:E,recentSearchesWithFavoritesLimit:D}),[Me,Ne]=B.useState(!1),{chatId:Pe,messages:Fe,status:R,setMessages:Ie,sendMessage:z,stopAskAiStreaming:Le,askAiError:Re,sendFeedback:ze,conversations:Be,startNewConversation:Ve,restoreConversation:He}=NA({agentId:he,apiKey:(L==null?void 0:L.apiKey)||o,appId:(L==null?void 0:L.appId)||a,searchParameters:ge,tools:xe,memory:L==null?void 0:L.memory,indices:L==null?void 0:L.indices}),Ue=B.useRef(R);B.useEffect(()=>{if(!v){if(Ue.current===`streaming`&&R===`ready`){Me&&Fe.at(-1)&&(Fe.at(-1).metadata={stopped:!0});for(let e of Fe[0].parts)e.type===`text`&&Be.add(Zk(e.text,Fe,Pe))}Ue.current=R}},[R,Fe,Be,v,Me,Pe]);let We=B.useMemo(()=>R===`error`&&eA(Re),[R,Re])&&(!$k(Re)||Fe.some(e=>e.role===`assistant`)),Ge=B.useMemo(()=>{if(!(!We||_e===`new-conversation`||_e===`conversation-history`))return tA(Re)?`minimal`:`full`},[Re,_e,We]),Ke=wm({favoriteSearches:Ae,recentSearches:je,disableUserPersonalization:v}),qe=hm(F),Je=B.useCallback((e,t,n=void 0)=>{if(e){let e={query:t,suggestedQuestionId:n==null?void 0:n.objectID};if(w!=null&&w(e)){we.current&&we.current.setQuery(``);return}}if(e&&_e===`new-conversation`&&ve(`initial`),C(e,{query:t,suggestedQuestionId:n==null?void 0:n.objectID}),A)return;Ne(!1);let r={};if(n&&(r.body={suggestedQuestionId:n.objectID}),z({role:`user`,parts:[{type:`text`,text:t}]},r),le.current){let e=le.current;typeof e.scrollTo==`function`?e.scrollTo({top:0,behavior:`smooth`}):e.scrollTop=0}we.current&&we.current.setQuery(``)},[_e,C,A,z,le,w]),Ye=B.useCallback(async(e,t)=>{!he||!a||await ze(e,t)},[he,a,ze]);we.current||(we.current=bP({id:`docsearch`,defaultActiveItemId:0,openOnFocus:!0,initialState:{query:fe,context:{searchSuggestions:[]}},insights:!!S,navigator:m,onStateChange(e){ne(e.state)},async getSources({query:e,state:t,setContext:n,setStatus:r}){if(jp(e)){let e=Ym({recentSearches:je,favoriteSearches:Ae,saveRecentSearch:Ke,onClose:u,disableUserPersonalization:v});return[...re?GP({conversations:Be,disableUserPersonalization:v,setMessages:Ie,onAskAiToggle:C}):[],...e]}let i=Xm({query:e,state:{context:t.context},setContext:n,setStatus:r,searchClient:me,indexes:Se,insights:!!S,appId:a,apiKey:o,maxResultsPerGroup:c,transformItems:d,saveRecentSearch:Ke,onClose:u,facetSelections:De}),s=re?JP({query:e,handleSelectAskAiQuestion:Je,promptSuggestionsOptions:L==null?void 0:L.promptSuggestions,searchClient:me}):Promise.resolve([]),[l,f]=await Promise.all([s,i]);return[...l,...f]}}));let Xe=we.current,{getEnvironmentProps:Ze,getRootProps:Qe,refresh:$e}=Xe;bm({getEnvironmentProps:Ze,containerRef:se,dropdownRef:le,formElementRef:I,inputRef:ue,initialScrollY:h,modalRef:ce,theme:l}),B.useEffect(()=>{le.current&&!T&&Ip(le.current)},[F.query,T,le]),Sm({initialQuery:fe,inputRef:ue,refresh:$e});let et=Fe.length>0;B.useEffect(()=>{T||(Xe.refresh(),et&&Ve())},[T,Xe,Ve,et]),B.useEffect(()=>{ve(`initial`)},[T,ve]);let tt=async()=>{Ne(!0),await Le()},nt=()=>{Ve(),ve(`new-conversation`)},rt=()=>{ve(`conversation-history`)},it=e=>{Je(!0,e.question,e)},at=!0,ot=F.collections.some(e=>e.source.sourceId!==bp.askAI&&e.items.length>0);return F.status===`idle`&&ot===!1&&jp(F.query)&&!T&&(at=!1),B.createElement(lm,{state:F,containerRef:se,modalRef:ce,formElementRef:I,dropdownRef:le,getRootProps:Qe,showDropdown:at,searchBox:B.createElement(BP,_(_({},Xe),{},{state:F,placeholder:ie||`Search docs`,autoFocus:jp(fe),inputRef:ue,isFromSelection:!!fe&&fe===pe,translations:P,isAskAiActive:T,askAiStatus:R,askAiError:Re,askAiState:_e,setAskAiState:ve,promptBlockingChrome:Ge,promptBlockingErrorId:de,onClose:u,onAskAiToggle:C,onAskAgain:e=>{Je(!0,e)},onStopAskAiStreaming:tt,onNewConversation:nt,onViewConversationHistory:rt})),filterBar:!T&&!jp(F.query)?B.createElement(om,{facets:Te,selections:Ee,translations:ee,clearSelections:ke,onSelectionChange:Oe}):null,screenState:B.createElement(LP,_(_({},Xe),{},{indexName:Ce,state:F,hitComponent:f,resultsFooterComponent:p,disableUserPersonalization:v,recentSearches:je,favoriteSearches:Ae,conversations:Be,inputRef:ue,translations:te,getMissingResultsUrl:x,isAskAiActive:T,canHandleAskAi:re,messages:Fe,tools:xe,askAiError:Re,status:R,hasCollections:ot,askAiState:_e,selectAskAiQuestion:Je,suggestedQuestions:ye,selectSuggestedQuestion:it,memoryEnabled:be,resultBadgeKey:M.resultBadgeKey,promptBlockingErrorId:de,onAskAiToggle:C,onNewConversation:nt,onItemClick:(e,t)=>{if(e.type===`askAI`&&e.query){if(e.anchor===`stored`&&`messages`in e){let n=e.messages;He(n,e.chatId);let r={query:e.query,messageId:n[0].id};if(w!=null&&w(r)){we.current&&we.current.setQuery(``),t.preventDefault();return}C(!0,r)}else Je(!0,e.query);ve(`initial`),t.preventDefault();return}qe(e),Ke(e),Ap(t)||u()},onFeedback:Ye})),footer:B.createElement(dm,{translations:N,isAskAiActive:T,footerAction:j}),onClose:u})}function QP(e){"@babel/helpers - typeof";return QP=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},QP(e)}function $P(e,t){if(QP(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(QP(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function eF(e){var t=$P(e,`string`);return QP(t)==`symbol`?t:t+``}function tF(e,t,n){return(t=eF(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nF(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function rF(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?nF(Object(n),!0).forEach(function(t){tF(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nF(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}let iF={"Ctrl/Cmd+K":!0,"/":!0,"Ctrl/Cmd+I":!0};function aF(e){return rF(rF({},iF),e)}V();function oF(e){let t=e.composedPath()[0],n=t.tagName;return t.isContentEditable||n===`INPUT`||n===`SELECT`||n===`TEXTAREA`||n===`BUTTON`}function sF({isOpen:e,isAskAiActive:t,onAskAiToggle:n,onClose:r,onOpen:i,keyboardShortcuts:a=iF}){B.useEffect(()=>{function o(o){var s;if(e&&o.code===`Escape`&&t){n(!1);return}let c=a[`Ctrl/Cmd+K`]&&((s=o.key)==null?void 0:s.toLowerCase())===`k`&&(o.metaKey||o.ctrlKey),l=a[`/`]&&o.key===`/`;(o.code===`Escape`&&e||c||!oF(o)&&l&&!e)&&(o.preventDefault(),e?r():document.body.classList.contains(`DocSearch--active`)||i())}return window.addEventListener(`keydown`,o),()=>{window.removeEventListener(`keydown`,o)}},[e,t,a,i,r,n])}V();let cF=()=>{let[e,t]=B.useState(!1);return B.useEffect(()=>{let e=()=>{let e=window.matchMedia(`(max-width: 768px)`);t(e.matches)};return e(),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`resize`,e)}},[]),e};function lF(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function uF(e,t){if(e==null)return{};var n,r,i=lF(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}let dF=[`children`,`appId`,`apiKey`,`theme`,`onReady`,`onOpen`,`onClose`,`onSidepanelOpen`,`onSidepanelClose`],fF=B.createContext(void 0);fF.displayName=`DocSearchContext`;function pF(e,t){let{children:n,appId:r,apiKey:i,theme:a,onReady:o,onOpen:s,onClose:c,onSidepanelOpen:l,onSidepanelClose:u}=e,d=uF(e,dF),[f,p]=B.useState(`ready`),[m,h]=B.useState(d.initialQuery||``),g=B.useRef(null),_=aF(d.keyboardShortcuts),[v,y]=B.useState(),[b,x]=B.useState(()=>new Set),S=cF(),C=B.useRef(`ready`),w=[`modal-search`,`modal-askai`].includes(f),T=f===`modal-askai`,E=!S&&b.has(`sidepanel`),D=f===`sidepanel`;B.useEffect(()=>{o==null||o()},[o]),B.useEffect(()=>{let e=C.current,t=f;(t===`modal-search`||t===`modal-askai`)&&e!==`modal-search`&&e!==`modal-askai`&&(s==null||s()),t===`ready`&&(e===`modal-search`||e===`modal-askai`)&&(c==null||c()),t===`sidepanel`&&e!==`sidepanel`&&(l==null||l()),t!==`sidepanel`&&e===`sidepanel`&&(u==null||u()),C.current=t},[f,s,c,l,u]);let O=B.useCallback(()=>{p(`modal-search`)},[]),k=B.useCallback(()=>{var e,t;p(`ready`),(e=g.current)==null||e.focus(),h((t=d.initialQuery)==null?``:t)},[p,d.initialQuery]),A=B.useCallback((e,t)=>{if(!S&&e&&E){y(t),p(`sidepanel`);return}p(e?`modal-askai`:`modal-search`)},[p,S,E]),j=B.useCallback(e=>{b.has(`sidepanel`)&&(y(e),p(`sidepanel`))},[p,b]),M=B.useCallback(e=>{p(`modal-search`),h(e.key)},[p,h]),N=B.useCallback(e=>{b.has(e)||x(t=>{let n=new Set(t);return n.add(e),n})},[b]);B.useImperativeHandle(t,()=>({open:O,close:k,openAskAi:e=>A(!0,e),openSidepanel:j,get isReady(){return!0},get isOpen(){return w},get isSidepanelOpen(){return D},get isSidepanelSupported(){return E}}),[O,k,A,j,w,D,E]),mn({theme:a}),sF({isOpen:w,onOpen:O,onClose:k,onAskAiToggle:A,onInput:M,isAskAiActive:T,searchButtonRef:g,keyboardShortcuts:_});let P=B.useMemo(()=>({appId:r,apiKey:i,docsearchState:f,setDocsearchState:p,searchButtonRef:g,initialQuery:m,keyboardShortcuts:_,openModal:O,closeModal:k,isAskAiActive:T,isModalActive:w,onAskAiToggle:A,initialAskAiMessage:v,registerView:N,isHybridModeSupported:E}),[r,i,f,g,m,_,O,k,T,w,A,v,N,E]);return B.createElement(fF.Provider,{value:P},n)}let mF=B.forwardRef(pF);mF.displayName=`DocSearch`;function hF(){let e=B.useContext(fF);if(e===void 0)throw Error("`useDocSearch` must be used within the `DocSearch` provider");return e}V();let gF=[`appId`,`apiKey`];function _F(e,t){let{appId:n,apiKey:r}=e,i=pn(e,gF);return B.createElement(mF,_(_({},i),{},{appId:n,apiKey:r,ref:t}),B.createElement(yF,i))}let vF=B.forwardRef(_F);function yF(e){var t,n,r;let{searchButtonRef:i,keyboardShortcuts:a,isModalActive:o,isAskAiActive:s,initialQuery:c,onAskAiToggle:l,openModal:u,closeModal:d,isHybridModeSupported:f,appId:p,apiKey:m}=hF();if(!p||!m)throw Error("`DocSearchAI` requires `appId` and `apiKey` props.");return B.createElement(B.Fragment,null,B.createElement(_n,{keyboardShortcuts:a,ref:i,translations:(t=e.translations)==null?void 0:t.button,onClick:u}),o&&Et(B.createElement(ZP,_(_({},e),{},{appId:p,apiKey:m,initialScrollY:window.scrollY,initialQuery:c,translations:e==null||(n=e.translations)==null?void 0:n.modal,isAskAiActive:s,isHybridModeSupported:f,onAskAiToggle:l,onClose:d})),(r=e.portalContainer)==null?document.body:r))}var bF=function(e,t,n,r){var i;t[0]=0;for(var a=1;a<t.length;a++){var o=t[a++],s=t[a]?(t[0]|=o?1:2,n[t[a++]]):t[++a];o===3?r[0]=s:o===4?r[1]=Object.assign(r[1]||{},s):o===5?(r[1]=r[1]||{})[t[++a]]=s:o===6?r[1][t[++a]]+=s+``:o?(i=e.apply(s,bF(e,s,n,[``,null])),r.push(i),s[0]?t[0]|=2:(t[a-2]=0,t[a]=i)):r.push(s)}return r},xF=new Map;function SF(e){var t=xF.get(this);return t||(t=new Map,xF.set(this,t)),(t=bF(this,t.get(e)||(t.set(e,t=function(e){for(var t,n,r=1,i=``,a=``,o=[0],s=function(e){r===1&&(e||(i=i.replace(/^\s*\n\s*|\s*\n\s*$/g,``)))?o.push(0,e,i):r===3&&(e||i)?(o.push(3,e,i),r=2):r===2&&i===`...`&&e?o.push(4,e,0):r===2&&i&&!e?o.push(5,0,!0,i):r>=5&&((i||!e&&r===5)&&(o.push(r,0,i,n),r=6),e&&(o.push(r,e,0,n),r=6)),i=``},c=0;c<e.length;c++){c&&(r===1&&s(),s(c));for(var l=0;l<e[c].length;l++)t=e[c][l],r===1?t===`<`?(s(),o=[o],r=3):i+=t:r===4?i===`--`&&t===`>`?(r=1,i=``):i=t+i[0]:a?t===a?a=``:i+=t:t===`"`||t===`'`?a=t:t===`>`?(s(),r=1):r&&(t===`=`?(r=5,n=i,i=``):t===`/`&&(r<5||e[c][l+1]===`>`)?(s(),r===3&&(o=o[0]),r=o,(o=o[0]).push(2,0,r),r=0):t===` `||t===` `||t===`
177
- `||t===`\r`?(s(),r=2):i+=t),r===3&&i===`!--`&&(r=4,o=o[0])}return s(),o}(e)),t),arguments,[])).length>1?t:t[0]}V();let CF=[`container`,`environment`,`transformSearchClient`,`hitComponent`,`resultsFooterComponent`,`footerAction`];function wF(e,t){if(typeof e!=`string`)return e;if(!t)throw Error(`Cannot resolve a selector without a browser environment.`);let n=t.document.querySelector(e);if(!n)throw Error(`Container selector did not match any element: "${e}"`);return n}let TF=SF.bind(C);function EF(e){if(e)return t=>{let n=e(t,{html:TF});return Nt(n)?n:typeof n==`function`?n(t):typeof n==`string`?C(`span`,null,n):n}}function DF(e,t){return n=>{let r=n,{container:i,environment:a,transformSearchClient:o,hitComponent:s,resultsFooterComponent:c,footerAction:l}=r,u=vr(r,CF),d=wF(i,a||(typeof window<`u`?window:void 0)),f=T(),p=!1,m=EF(l);return Dt(C(e,U(U({},u),{},{ref:f,hitComponent:EF(s),resultsFooterComponent:EF(c),footerAction:m?C(m,null):void 0,transformSearchClient:e=>(typeof e==`object`&&e&&`addAlgoliaAgent`in e&&typeof e.addAlgoliaAgent==`function`&&e.addAlgoliaAgent(`docsearch.js`,t),typeof o==`function`?o(e):e)})),d),p=!0,{open(){var e;(e=f.current)==null||e.open()},close(){var e;(e=f.current)==null||e.close()},openAskAi(e){var t;(t=f.current)==null||t.openAskAi(e)},get isReady(){return p},get isOpen(){var e,t;return(e=(t=f.current)==null?void 0:t.isOpen)!=null&&e},destroy(){Lt(d),p=!1}}}}return DF(vF,yn)});
170
+ `},yA.link=({href:e,title:t,text:n})=>{let r=Kk(Xk(e)),i=Kk(n);return r?`<a href="${r}"${t?` title="${Kk(t)}"`:``} target="_blank" rel="noopener noreferrer">${i}</a>`:i},yA.image=({href:e,title:t,text:n})=>{let r=Kk(Xk(e));if(!r)return Kk(n);let i=t?` title="${Kk(t)}"`:``;return`<img src="${r}" alt="${Kk(n)}"${i} />`},yA.html=({text:e})=>Kk(e);function bA(e){return UO.parse(e,{gfm:!0,breaks:!0,renderer:yA})}let xA=vt(({content:e,copyButtonText:t,copyButtonCopiedText:n,isStreaming:r})=>{let i=z(()=>bA(e),[e]),a=R(null);return Pe(()=>{let e=a.current;if(!e)return;Array.from(e.querySelectorAll(`.DocSearch-CodeSnippet-CopyButton`)).forEach(e=>{let n=e.querySelector(`.DocSearch-CodeSnippet-CopyButton-Label`);n&&(n.textContent=t),e.classList.remove(`DocSearch-CodeSnippet-CopyButton--copied`)});function r(e){var r;let i=e.target.closest(`.DocSearch-CodeSnippet-CopyButton`);if(!i)return;let a=(r=i.getAttribute(`data-code`))==null?``:r;navigator.clipboard.writeText(decodeURIComponent(a)).catch(()=>{});let o=i.querySelector(`.DocSearch-CodeSnippet-CopyButton-Label`);if(!o)return;i.classList.add(`DocSearch-CodeSnippet-CopyButton--copied`);let s=t;o.textContent=n,setTimeout(()=>{i.classList.remove(`DocSearch-CodeSnippet-CopyButton--copied`),o.textContent=s},1500)}return e.addEventListener(`click`,r),()=>{e.removeEventListener(`click`,r)}},[i,t,n]),B.createElement(`div`,{ref:a,className:`DocSearch-Markdown-Content ${r?`DocSearch-Markdown-Content--streaming`:``}`,dangerouslySetInnerHTML:{__html:i}})});xA.displayName=`MemoizedMarkdown`;function SA(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n];if(lA(r)){let r=[],i,a=n;for(;a<e.length;){let t=e[a];if(lA(t)){let e=fA(t);r.push(...e),e.length>0&&(i=t),a++}else break}r.length>1?t.push({type:`aggregated-tool-call`,queries:r}):r.length===1&&i&&t.push(i),n=a-1}else t.push(r)}return t}let CA=[`children`,`className`,`onClick`],wA=B.createContext({open:!1,setOpen:e=>{}});function TA({children:e}){let[t,n]=B.useState(!1),r=B.useRef(null);return B.useEffect(()=>{function e(e){var t;(t=r.current)!=null&&t.contains(e.target)||n(!1)}return t&&window.addEventListener(`click`,e),function(){window.removeEventListener(`click`,e)}},[t]),B.createElement(wA.Provider,{value:{open:t,setOpen:n}},B.createElement(`div`,{ref:r,className:`DocSearch-Menu`},e))}function EA({children:e,className:t=``,disabled:n}){let{open:r,setOpen:i}=B.useContext(wA);function a(){n||i(!r)}return B.createElement(`button`,{type:`button`,className:`DocSearch-Menu-trigger ${t}${n?` disabled`:``}`,"aria-disabled":n,onClick:()=>a()},e)}TA.Trigger=EA;function DA({children:e}){let{open:t}=B.useContext(wA);return B.createElement(`div`,{className:`DocSearch-Menu-content${t?` open`:``}`},e)}TA.Content=DA;function OA(e){let{children:t,className:n=``,onClick:r}=e,i=pn(e,CA),{setOpen:a}=B.useContext(wA);return B.createElement(`button`,_({type:`button`,className:`DocSearch-Menu-item ${n}`,onClick:e=>{r&&(r(e),a(!1))}},i),t)}TA.Item=OA;let kA=e=>`https://${e}.algolia.net/agent-studio/1`,AA=e=>{var t;let n=e.message,r;try{r=JSON.parse(n)}catch(e){return Error(n)}let i=0;for(;typeof r==`string`&&i<10;){i+=1;let e=r.trim();try{r=JSON.parse(e)}catch(t){return Error(e)}}if(!r||typeof r!=`object`||Array.isArray(r))return Error(n);let a=r,o=r,s=n;if(o.name===`ValidationError`){let e=o;if(e.detail&&e.detail.length>0){let{msg:t,loc:n}=e.detail[0];s=`${t}: ${n.at(-1)}`}}else{var c,l;s=(c=(l=Fk(a,`message`))==null?Fk(a,`error`):l)==null?n:c}let u=(t=o.code)==null?o.errorCode:t;return typeof u==`string`&&u.trim()&&!s.toUpperCase().includes(u.trim().toUpperCase())&&(s=`${s} (${u.trim()})`),Error(s)},jA=({agentId:e,vote:t,messageId:n,appId:r,apiKey:i,abortSignal:a,notes:o,tags:s})=>{let c=new Headers;c.set(`x-algolia-application-id`,r),c.set(`x-algolia-api-key`,i),c.set(`content-type`,`application/json`);let l=`${kA(r)}/feedback`;return fetch(l,{method:`POST`,body:JSON.stringify(_(_({messageId:n,agentId:e,vote:t},o?{notes:o}:{}),s&&s.length>0?{tags:s}:{})),headers:c,signal:a})},MA=[`id`,`messages`,`body`],NA=({appId:e,apiKey:t,agentId:n,searchParameters:r,userToken:i,indices:a})=>{let o={};return r&&(o.searchParameters=r),a&&a.length>0&&(o.indices=a),new pD({api:`${kA(e)}/agents/${n}/completions?stream=true&compatibilityMode=ai-sdk-5`,headers:_({"x-algolia-application-id":e,"x-algolia-api-key":t},i?{"x-algolia-secure-user-token":i}:{}),body:{algolia:o},prepareSendMessagesRequest(e){let{id:t,messages:n,body:r}=e,i=pn(e,MA),a=uA(n);return _(_({},i),{},{body:_({id:t,messages:a},r)})}})},PA=({agentId:e,apiKey:t,appId:n,tools:r=oA,searchParameters:i,memory:a,indices:o})=>{let s=R(new AbortController),c=z(()=>NA({apiKey:t,appId:n,agentId:e,searchParameters:i,userToken:a==null?void 0:a.userToken,indices:o}),[t,n,e,i,a==null?void 0:a.userToken,o]),l=R(c);l.current=c;let u=R(r);u.current=r;let d=R(null),f=Le(({toolCall:e})=>{let t=u.current[e.toolName];t!=null&&t.onToolCall&&t.onToolCall(_(_({},e),{},{addToolOutput:async({output:t})=>{d.current&&await d.current({output:t,tool:e.toolName,toolCallId:e.toolCallId})}}))},[]),p=Le((e,t=eT())=>new uk({id:t,messages:e,sendAutomaticallyWhen:hD,transport:l.current,onToolCall:f}),[f]),[m,h]=Me(()=>p()),g=R(m);g.current=m;let{messages:v,status:y,setMessages:b,error:x,stop:S,addToolOutput:C}=dk({chat:m});Pe(()=>{d.current=C},[C]);let w=R(Gr({key:`__DOCSEARCH_ASKAI_CONVERSATIONS__${n}`,limit:10})).current,T=Le(async(r,{thumbs:i,tags:a,notes:o})=>{var c;if(e){if((await jA({agentId:e,vote:i,messageId:r,appId:n,apiKey:t,abortSignal:s.current.signal,notes:o,tags:a})).status>=300)throw Error(`Failed, try again later.`);(c=w.addFeedback)==null||c.call(w,r,i===1?`like`:`dislike`,{tags:a,notes:o})}},[e,n,t,w]),E=Le(async()=>{s.current.abort(),await S()},[S]),D=z(()=>{let e=[];for(let n=0;n<v.length;n++)if(v[n].role===`user`){var t;let r=v[n],i=((t=v[n+1])==null?void 0:t.role)===`assistant`?v[n+1]:null;e.push({id:r.id,userMessage:r,assistantMessage:i}),i&&n++}return e},[v]),O=y===`streaming`||y===`submitted`,k=z(()=>{if(x)return AA(x)},[x]),A=Le((e,t)=>{let n=p(e,t);g.current=n,h(n)},[p]),j=Le(()=>{A()},[A]),M=Le((e,t)=>{A(e,t)},[A]),N=Le((...e)=>g.current.sendMessage(...e),[]);return{chatId:m.id,messages:v,sendMessage:N,status:y,setMessages:b,askAiError:k,stopAskAiStreaming:E,isStreaming:O,exchanges:D,conversations:w,sendFeedback:T,startNewConversation:j,restoreConversation:M}},FA=({agentId:e,searchClient:t,suggestedQuestionsEnabled:n=!1})=>{let[r,i]=Me([]);return Pe(()=>{n&&e&&e!==``&&(async()=>{let{results:n}=await t.search({requests:[{indexName:`algolia_ask_ai_suggested_questions`,filters:`state:published AND assistantId:${e}`,hitsPerPage:3}]}),r=n[0];i(r.hits)})()},[n,e,t]),r};function IA(e){return{current:e}}function LA(e,t){var n=void 0;return function(){for(var r=arguments.length,i=Array(r),a=0;a<r;a++)i[a]=arguments[a];n&&clearTimeout(n),n=setTimeout(function(){return e.apply(void 0,i)},t)}}function RA(e){return e.reduce(function(e,t){return e.concat(t)},[])}var zA=0;function BA(){return`autocomplete-${zA++}`}function VA(e){return e.collections.length===0?0:e.collections.reduce(function(e,t){return e+t.items.length},0)}function HA(e){return e!==Object(e)}function UA(e,t){if(e===t)return!0;if(HA(e)||HA(t)||typeof e==`function`||typeof t==`function`)return e===t;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n=0,r=Object.keys(e);n<r.length;n++){var i=r[n];if(!(i in t)||!UA(e[i],t[i]))return!1}return!0}var WA=function(){};function GA(e){if(typeof window<`u`)return e({window})}var KA=[{segment:`autocomplete-core`,version:`1.19.2`}];function qA(e){var t=e.item,n=e.items,r=n===void 0?[]:n;return{index:t.__autocomplete_indexName,items:[t],positions:[1+r.findIndex(function(e){return e.objectID===t.objectID})],queryID:t.__autocomplete_queryID,algoliaSource:[`autocomplete`]}}function JA(e,t){return $A(e)||QA(e,t)||XA(e,t)||YA()}function YA(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
171
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function XA(e,t){if(e){if(typeof e==`string`)return ZA(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ZA(e,t)}}function ZA(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function QA(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function $A(e){if(Array.isArray(e))return e}function ej(e){var t=JA((e.version||``).split(`.`).map(Number),2),n=t[0],r=t[1];return n>=3||n===2&&r>=4||n===1&&r>=10}var tj=[`items`],nj=[`items`];function rj(e){"@babel/helpers - typeof";return rj=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},rj(e)}function ij(e){return cj(e)||sj(e)||oj(e)||aj()}function aj(){throw TypeError(`Invalid attempt to spread non-iterable instance.
172
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function oj(e,t){if(e){if(typeof e==`string`)return lj(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return lj(e,t)}}function sj(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function cj(e){if(Array.isArray(e))return lj(e)}function lj(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function uj(e,t){if(e==null)return{};var n=dj(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function dj(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function fj(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function pj(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?fj(Object(n),!0).forEach(function(t){mj(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fj(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function mj(e,t,n){return t=hj(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function hj(e){var t=gj(e,`string`);return rj(t)===`symbol`?t:String(t)}function gj(e,t){if(rj(e)!==`object`||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(rj(r)!==`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function _j(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:20,n=[],r=0;r<e.objectIDs.length;r+=t)n.push(pj(pj({},e),{},{objectIDs:e.objectIDs.slice(r,r+t)}));return n}function vj(e){return e.map(function(e){var t=e.items,n=uj(e,tj);return pj(pj({},n),{},{objectIDs:(t==null?void 0:t.map(function(e){return e.objectID}))||n.objectIDs})})}function yj(e){var t=ej(e);function n(n,r,i){if(t&&i!==void 0){var a=i[0].__autocomplete_algoliaCredentials,o={"X-Algolia-Application-Id":a.appId,"X-Algolia-API-Key":a.apiKey};e.apply(void 0,[n].concat(ij(r),[{headers:o}]))}else e.apply(void 0,[n].concat(ij(r)))}return{init:function(t,n){e(`init`,{appId:t,apiKey:n})},setAuthenticatedUserToken:function(t){e(`setAuthenticatedUserToken`,t)},setUserToken:function(t){e(`setUserToken`,t)},clickedObjectIDsAfterSearch:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];t.length>0&&n(`clickedObjectIDsAfterSearch`,vj(t),t[0].items)},clickedObjectIDs:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];t.length>0&&n(`clickedObjectIDs`,vj(t),t[0].items)},clickedFilters:function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];n.length>0&&e.apply(void 0,[`clickedFilters`].concat(n))},convertedObjectIDsAfterSearch:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];t.length>0&&n(`convertedObjectIDsAfterSearch`,vj(t),t[0].items)},convertedObjectIDs:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];t.length>0&&n(`convertedObjectIDs`,vj(t),t[0].items)},convertedFilters:function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];n.length>0&&e.apply(void 0,[`convertedFilters`].concat(n))},viewedObjectIDs:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];t.length>0&&t.reduce(function(e,t){var n=t.items,r=uj(t,nj);return[].concat(ij(e),ij(_j(pj(pj({},r),{},{objectIDs:(n==null?void 0:n.map(function(e){return e.objectID}))||r.objectIDs})).map(function(e){return{items:n,payload:e}})))},[]).forEach(function(e){var t=e.items,r=e.payload;return n(`viewedObjectIDs`,[r],t)})},viewedFilters:function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];n.length>0&&e.apply(void 0,[`viewedFilters`].concat(n))}}}function bj(e){var t=e.items.reduce(function(e,t){var n;return e[t.__autocomplete_indexName]=((n=e[t.__autocomplete_indexName])==null?[]:n).concat(t),e},{});return Object.keys(t).map(function(e){return{index:e,items:t[e],algoliaSource:[`autocomplete`]}})}function xj(e){return e.objectID&&e.__autocomplete_indexName&&e.__autocomplete_queryID}function Sj(e){"@babel/helpers - typeof";return Sj=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Sj(e)}function Cj(e){return Dj(e)||Ej(e)||Tj(e)||wj()}function wj(){throw TypeError(`Invalid attempt to spread non-iterable instance.
173
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Tj(e,t){if(e){if(typeof e==`string`)return Oj(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Oj(e,t)}}function Ej(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function Dj(e){if(Array.isArray(e))return Oj(e)}function Oj(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function kj(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Aj(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?kj(Object(n),!0).forEach(function(t){jj(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kj(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function jj(e,t,n){return t=Mj(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Mj(e){var t=Nj(e,`string`);return Sj(t)===`symbol`?t:String(t)}function Nj(e,t){if(Sj(e)!==`object`||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Sj(r)!==`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Pj=400,Fj=`2.15.0`,Ij=`https://cdn.jsdelivr.net/npm/search-insights@${Fj}/dist/search-insights.min.js`,Lj=LA(function(e){var t=e.onItemsChange,n=e.items,r=e.insights,i=e.state;t({insights:r,insightsEvents:bj({items:n}).map(function(e){return Aj({eventName:`Items Viewed`},e)}),state:i})},Pj);function Rj(e){var t=Bj(e),n=t.insightsClient,r=t.insightsInitParams,i=t.onItemsChange,a=t.onSelect,o=t.onActive,s=t.__autocomplete_clickAnalytics,c=n;if(n||GA(function(e){var t=e.window,n=t.AlgoliaAnalyticsObject||`aa`;typeof n==`string`&&(c=t[n]),c||(t.AlgoliaAnalyticsObject=n,t[n]||(t[n]=function(){t[n].queue||(t[n].queue=[]);for(var e=arguments.length,r=Array(e),i=0;i<e;i++)r[i]=arguments[i];t[n].queue.push(r)}),t[n].version=Fj,c=t[n],Vj(t))}),!c)return{};r&&c(`init`,Aj({partial:!0},r));var l=yj(c),u=IA([]),d=LA(function(e){var t=e.state;if(t.isOpen){var n=t.collections.reduce(function(e,t){return[].concat(Cj(e),Cj(t.items))},[]).filter(xj);UA(u.current.map(function(e){return e.objectID}),n.map(function(e){return e.objectID}))||(u.current=n,n.length>0&&Lj({onItemsChange:i,items:n,insights:l,state:t}))}},0);return{name:`aa.algoliaInsightsPlugin`,subscribe:function(e){var t=e.setContext,n=e.onSelect,r=e.onActive;function i(e){t({algoliaInsightsPlugin:{__algoliaSearchParameters:Aj(Aj({},s?{clickAnalytics:!0}:{}),e?{userToken:Hj(e)}:{}),insights:l}})}c(`addAlgoliaAgent`,`insights-plugin`),i(),c(`onUserTokenChange`,function(e){i(e)}),c(`getUserToken`,null,function(e,t){i(t)}),n(function(e){var t=e.item,n=e.state,r=e.event,i=e.source;xj(t)&&a({state:n,event:r,insights:l,item:t,insightsEvents:[Aj({eventName:`Item Selected`},qA({item:t,items:i.getItems().filter(xj)}))]})}),r(function(e){var t=e.item,n=e.source,r=e.state,i=e.event;xj(t)&&o({state:r,event:i,insights:l,item:t,insightsEvents:[Aj({eventName:`Item Active`},qA({item:t,items:n.getItems().filter(xj)}))]})})},onStateChange:function(e){var t=e.state;d({state:t})},__autocomplete_pluginOptions:e}}function zj(){var e,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0;return[].concat(Cj(t),[`autocomplete-internal`],Cj((e=n.algoliaInsightsPlugin)!=null&&e.__automaticInsights?[`autocomplete-automatic`]:[]))}function Bj(e){return Aj({onItemsChange:function(e){var t=e.insights,n=e.insightsEvents,r=e.state;t.viewedObjectIDs.apply(t,Cj(n.map(function(e){return Aj(Aj({},e),{},{algoliaSource:zj(e.algoliaSource,r.context)})})))},onSelect:function(e){var t=e.insights,n=e.insightsEvents,r=e.state;t.clickedObjectIDsAfterSearch.apply(t,Cj(n.map(function(e){return Aj(Aj({},e),{},{algoliaSource:zj(e.algoliaSource,r.context)})})))},onActive:WA,__autocomplete_clickAnalytics:!0},e)}function Vj(e){var t=`[Autocomplete]: Could not load search-insights.js. Please load it manually following https://alg.li/insights-autocomplete`;try{var n=e.document.createElement(`script`);n.async=!0,n.src=Ij,n.onerror=function(){console.error(t)},document.body.appendChild(n)}catch(e){console.error(t)}}function Hj(e){return typeof e==`number`?e.toString():e}function Uj(e,t){var n=t;return{then:function(t,r){return Uj(e.then(Kj(t,n,e),Kj(r,n,e)),n)},catch:function(t){return Uj(e.catch(Kj(t,n,e)),n)},finally:function(t){return t&&n.onCancelList.push(t),Uj(e.finally(Kj(t&&function(){return n.onCancelList=[],t()},n,e)),n)},cancel:function(){n.isCanceled=!0;var e=n.onCancelList;n.onCancelList=[],e.forEach(function(e){e()})},isCanceled:function(){return n.isCanceled===!0}}}function Wj(e){return Uj(new Promise(function(t,n){return e(t,n)}),{isCanceled:!1,onCancelList:[]})}Wj.resolve=function(e){return Gj(Promise.resolve(e))},Wj.reject=function(e){return Gj(Promise.reject(e))};function Gj(e){return Uj(e,{isCanceled:!1,onCancelList:[]})}function Kj(e,t,n){return e?function(n){return t.isCanceled?n:e(n)}:n}var qj=!0,Jj;function Yj(){var e=[];return{add:function(t){return e.push(t),t.finally(function(){e=e.filter(function(e){return e!==t})})},cancelAll:function(){e.forEach(function(e){return e.cancel()})},isEmpty:function(){return e.length===0},wait:function(t){return qj?(qj=!1,Jj=t?Promise.race([Promise.all(e),new Promise(function(e){return setTimeout(e,t)})]):Promise.all(e),Jj.then(function(){qj=!0})):Jj}}}function Xj(){var e=-1,t=-1,n=void 0;return function(r){e++;var i=e;return Promise.resolve(r).then(function(e){return n&&i<t?n:(t=i,n=e,e)})}}function Zj(e,t,n,r){if(!n)return null;if(e<0&&(t===null||r!==null&&t===0))return n+e;var i=(t===null?-1:t)+e;return i<=-1||i>=n?r===null?null:0:i}function Qj(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function $j(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Qj(Object(n),!0).forEach(function(t){eM(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qj(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function eM(e,t,n){return t=tM(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tM(e){var t=nM(e,`string`);return rM(t)===`symbol`?t:String(t)}function nM(e,t){if(rM(e)!==`object`||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(rM(r)!==`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function rM(e){"@babel/helpers - typeof";return rM=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},rM(e)}function iM(e,t){var n=[];return Promise.resolve(e(t)).then(function(e){return Promise.all(e.filter(function(e){return!!e}).map(function(e){if(e.sourceId,n.includes(e.sourceId))throw Error(`[Autocomplete] The \`sourceId\` ${JSON.stringify(e.sourceId)} is not unique.`);n.push(e.sourceId);var t={getItemInputValue:function(e){return e.state.query},getItemUrl:function(){},onSelect:function(e){var t=e.setIsOpen;t(!1)},onActive:WA,onResolve:WA};Object.keys(t).forEach(function(e){t[e].__default=!0});var r=$j($j({},t),e);return Promise.resolve(r)}))})}function aM(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=oM(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
174
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,s=e},f:function(){try{!a&&n.return!=null&&n.return()}finally{if(o)throw s}}}}function oM(e,t){if(e){if(typeof e==`string`)return sM(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return sM(e,t)}}function sM(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var cM=function(e,t){var n=!1,r=[],i=aM(e),a;try{for(i.s();!(a=i.n()).done;){var o,s,c,l=(o=a.value.__autocomplete_pluginOptions)==null||(s=(c=o).awaitSubmit)==null?void 0:s.call(c);if(typeof l==`number`)r.push(l);else if(l===!0){n=!0;break}}}catch(e){i.e(e)}finally{i.f()}if(n)return t.wait();if(r.length>0)return t.wait(Math.max.apply(Math,r))};function lM(e){var t=e.collections.map(function(e){return e.items.length}).reduce(function(e,t,n){var r=(e[n-1]||0)+t;return e.push(r),e},[]).reduce(function(t,n){return n<=e.activeItemId?t+1:t},0);return e.collections[t]}function uM(e){for(var t=e.state,n=e.collection,r=!1,i=0,a=0;r===!1;){var o=t.collections[i];if(o===n){r=!0;break}a+=o.items.length,i++}return t.activeItemId-a}function dM(e){var t=lM(e);if(!t)return null;var n=t.items[uM({state:e,collection:t})],r=t.source;return{item:n,itemInputValue:r.getItemInputValue({item:n,state:e}),itemUrl:r.getItemUrl({item:n,state:e}),source:r}}function fM(e,t,n){return[e,n==null?void 0:n.sourceId,t].filter(Boolean).join(`-`).replace(/\s/g,``)}function pM(e,t){return e===t||e.contains(t)}var mM=/((gt|sm)-|galaxy nexus)|samsung[- ]|samsungbrowser/i;function hM(e){return!!(e&&e.match(mM))}function gM(e){return{results:e,hits:e.map(function(e){return e.hits}).filter(Boolean),facetHits:e.map(function(e){var t;return(t=e.facetHits)==null?void 0:t.map(function(e){return{label:e.value,count:e.count,_highlightResult:{label:{value:e.highlighted}}}})}).filter(Boolean)}}function _M(e){return e.nativeEvent||e}function vM(e){"@babel/helpers - typeof";return vM=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},vM(e)}function yM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function bM(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?yM(Object(n),!0).forEach(function(t){xM(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yM(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function xM(e,t,n){return t=SM(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function SM(e){var t=CM(e,`string`);return vM(t)===`symbol`?t:String(t)}function CM(e,t){if(vM(e)!==`object`||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(vM(r)!==`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function wM(e,t,n){var r=t.initialState;return{getState:function(){return r},dispatch:function(i,a){var o=bM({},r);r=e(r,{type:i,props:t,payload:a}),n({state:r,prevState:o})},pendingRequests:Yj()}}function TM(e){"@babel/helpers - typeof";return TM=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},TM(e)}function EM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function DM(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?EM(Object(n),!0).forEach(function(t){OM(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):EM(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function OM(e,t,n){return t=kM(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function kM(e){var t=AM(e,`string`);return TM(t)===`symbol`?t:String(t)}function AM(e,t){if(TM(e)!==`object`||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(TM(r)!==`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function jM(e){var t=e.store;return{setActiveItemId:function(e){t.dispatch(`setActiveItemId`,e)},setQuery:function(e){t.dispatch(`setQuery`,e)},setCollections:function(e){var n=0,r=e.map(function(e){return DM(DM({},e),{},{items:RA(e.items).map(function(e){return DM(DM({},e),{},{__autocomplete_id:n++})})})});t.dispatch(`setCollections`,r)},setIsOpen:function(e){t.dispatch(`setIsOpen`,e)},setStatus:function(e){t.dispatch(`setStatus`,e)},setContext:function(e){t.dispatch(`setContext`,e)}}}function MM(e){"@babel/helpers - typeof";return MM=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},MM(e)}function NM(e){return LM(e)||IM(e)||FM(e)||PM()}function PM(){throw TypeError(`Invalid attempt to spread non-iterable instance.
175
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function FM(e,t){if(e){if(typeof e==`string`)return RM(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return RM(e,t)}}function IM(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function LM(e){if(Array.isArray(e))return RM(e)}function RM(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function zM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function BM(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?zM(Object(n),!0).forEach(function(t){VM(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zM(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function VM(e,t,n){return t=HM(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function HM(e){var t=UM(e,`string`);return MM(t)===`symbol`?t:String(t)}function UM(e,t){if(MM(e)!==`object`||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(MM(r)!==`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function WM(e,t){var n,r=typeof window<`u`?window:{},i=e.plugins||[];return BM(BM({debug:!1,openOnFocus:!1,enterKeyHint:void 0,ignoreCompositionEvents:!1,placeholder:``,autoFocus:!1,defaultActiveItemId:null,stallThreshold:300,insights:void 0,environment:r,shouldPanelOpen:function(e){var t=e.state;return VA(t)>0},reshape:function(e){return e.sources}},e),{},{id:(n=e.id)==null?BA():n,plugins:i,initialState:BM({activeItemId:null,query:``,completion:null,collections:[],isOpen:!1,status:`idle`,context:{}},e.initialState),onStateChange:function(t){var n;(n=e.onStateChange)==null||n.call(e,t),i.forEach(function(e){var n;return(n=e.onStateChange)==null?void 0:n.call(e,t)})},onSubmit:function(t){var n;(n=e.onSubmit)==null||n.call(e,t),i.forEach(function(e){var n;return(n=e.onSubmit)==null?void 0:n.call(e,t)})},onReset:function(t){var n;(n=e.onReset)==null||n.call(e,t),i.forEach(function(e){var n;return(n=e.onReset)==null?void 0:n.call(e,t)})},getSources:function(n){return Promise.all([].concat(NM(i.map(function(e){return e.getSources})),[e.getSources]).filter(Boolean).map(function(e){return iM(e,n)})).then(function(e){return RA(e)}).then(function(e){return e.map(function(e){return BM(BM({},e),{},{onSelect:function(n){e.onSelect(n),t.forEach(function(e){var t;return(t=e.onSelect)==null?void 0:t.call(e,n)})},onActive:function(n){e.onActive(n),t.forEach(function(e){var t;return(t=e.onActive)==null?void 0:t.call(e,n)})},onResolve:function(n){e.onResolve(n),t.forEach(function(e){var t;return(t=e.onResolve)==null?void 0:t.call(e,n)})}})})})},navigator:BM({navigate:function(e){var t=e.itemUrl;r.location.assign(t)},navigateNewTab:function(e){var t=e.itemUrl,n=r.open(t,`_blank`,`noopener`);n==null||n.focus()},navigateNewWindow:function(e){var t=e.itemUrl;r.open(t,`_blank`,`noopener`)}},e.navigator)})}function GM(e){"@babel/helpers - typeof";return GM=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},GM(e)}function KM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function qM(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?KM(Object(n),!0).forEach(function(t){JM(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):KM(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function JM(e,t,n){return t=YM(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function YM(e){var t=XM(e,`string`);return GM(t)===`symbol`?t:String(t)}function XM(e,t){if(GM(e)!==`object`||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(GM(r)!==`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function ZM(e){var t=e.collections,n=e.props,r=e.state,i=t.reduce(function(e,t){return qM(qM({},e),{},JM({},t.source.sourceId,qM(qM({},t.source),{},{getItems:function(){return RA(t.items)}})))},{}),a=n.plugins.reduce(function(e,t){return t.reshape?t.reshape(e):e},{sourcesBySourceId:i,state:r}).sourcesBySourceId;return RA(n.reshape({sourcesBySourceId:a,sources:Object.values(a),state:r})).filter(Boolean).map(function(e){return{source:e,items:e.getItems()}})}function QM(e){"@babel/helpers - typeof";return QM=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},QM(e)}function $M(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function eN(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?$M(Object(n),!0).forEach(function(t){tN(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$M(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function tN(e,t,n){return t=nN(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nN(e){var t=rN(e,`string`);return QM(t)===`symbol`?t:String(t)}function rN(e,t){if(QM(e)!==`object`||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(QM(r)!==`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function iN(e){return cN(e)||sN(e)||oN(e)||aN()}function aN(){throw TypeError(`Invalid attempt to spread non-iterable instance.
176
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function oN(e,t){if(e){if(typeof e==`string`)return lN(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return lN(e,t)}}function sN(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function cN(e){if(Array.isArray(e))return lN(e)}function lN(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function uN(e){return!!e.execute}function dN(e){return!!(e!=null&&e.execute)}function fN(e,t,n){if(dN(e)){var r=e.requesterId===`algolia`?Object.assign.apply(Object,[{}].concat(iN(Object.keys(n.context).map(function(e){var t;return(t=n.context[e])==null?void 0:t.__algoliaSearchParameters})))):{};return eN(eN({},e),{},{requests:e.queries.map(function(n){return{query:e.requesterId===`algolia`?eN(eN({},n),{},{params:eN(eN({},r),n.params)}):n,sourceId:t,transformResponse:e.transformResponse}})})}return{items:e,sourceId:t}}function pN(e){var t=e.reduce(function(e,t){if(!uN(t))return e.push(t),e;var n=t.searchClient,r=t.execute,i=t.requesterId,a=t.requests,o=e.find(function(e){return uN(t)&&uN(e)&&e.searchClient===n&&!!i&&e.requesterId===i});if(o){var s;(s=o.items).push.apply(s,iN(a))}else{var c={execute:r,requesterId:i,items:a,searchClient:n};e.push(c)}return e},[]).map(function(e){if(!uN(e))return Promise.resolve(e);var t=e,n=t.execute,r=t.items,i=t.searchClient;return n({searchClient:i,requests:r})});return Promise.all(t).then(function(e){return RA(e)})}function mN(e,t,n){return t.map(function(t){var r=e.filter(function(e){return e.sourceId===t.sourceId}),i=r.map(function(e){return e.items}),a=r[0].transformResponse,o=a?a(gM(i)):i;return t.onResolve({source:t,results:i,items:o,state:n.getState()}),o.every(Boolean),`${t.sourceId}${JSON.stringify(void 0)}`,{source:t,items:o}})}function hN(e){"@babel/helpers - typeof";return hN=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},hN(e)}var gN=[`event`,`nextState`,`props`,`query`,`refresh`,`store`];function _N(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function vN(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?_N(Object(n),!0).forEach(function(t){yN(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_N(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function yN(e,t,n){return t=bN(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bN(e){var t=xN(e,`string`);return hN(t)===`symbol`?t:String(t)}function xN(e,t){if(hN(e)!==`object`||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(hN(r)!==`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function SN(e,t){if(e==null)return{};var n=CN(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function CN(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var wN=null,TN=Xj();function EN(e){var t=e.event,n=e.nextState,r=n===void 0?{}:n,i=e.props,a=e.query,o=e.refresh,s=e.store,c=SN(e,gN);wN&&i.environment.clearTimeout(wN);var l=c.setCollections,u=c.setIsOpen,d=c.setQuery,f=c.setActiveItemId,p=c.setStatus,m=c.setContext;if(d(a),f(i.defaultActiveItemId),!a&&i.openOnFocus===!1){var h,g=s.getState().collections.map(function(e){return vN(vN({},e),{},{items:[]})});p(`idle`),l(g),u((h=r.isOpen)==null?i.shouldPanelOpen({state:s.getState()}):h);var _=Gj(TN(g).then(function(){return Promise.resolve()}));return s.pendingRequests.add(_)}p(`loading`),wN=i.environment.setTimeout(function(){p(`stalled`)},i.stallThreshold);var v=Gj(TN(i.getSources(vN({query:a,refresh:o,state:s.getState()},c)).then(function(e){return Promise.all(e.map(function(e){return Promise.resolve(e.getItems(vN({query:a,refresh:o,state:s.getState()},c))).then(function(t){return fN(t,e.sourceId,s.getState())})})).then(pN).then(function(t){var n=t.some(function(e){var t=e.items;return DN(t)});if(n){var r;m({algoliaInsightsPlugin:vN(vN({},((r=s.getState().context)==null?void 0:r.algoliaInsightsPlugin)||{}),{},{__automaticInsights:n})})}return mN(t,e,s)}).then(function(e){return ZM({collections:e,props:i,state:s.getState()})})}))).then(function(e){var n;p(`idle`),l(e);var d=i.shouldPanelOpen({state:s.getState()});u((n=r.isOpen)==null?i.openOnFocus&&!a&&d||d:n);var f=dM(s.getState());if(s.getState().activeItemId!==null&&f){var m=f.item,h=f.itemInputValue,g=f.itemUrl,_=f.source;_.onActive(vN({event:t,item:m,itemInputValue:h,itemUrl:g,refresh:o,source:_,state:s.getState()},c))}}).finally(function(){p(`idle`),wN&&i.environment.clearTimeout(wN)});return s.pendingRequests.add(v)}function DN(e){return!Array.isArray(e)&&!!(e!=null&&e._automaticInsights)}function ON(e){"@babel/helpers - typeof";return ON=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},ON(e)}var kN=[`event`,`props`,`refresh`,`store`];function AN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function jN(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?AN(Object(n),!0).forEach(function(t){MN(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):AN(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function MN(e,t,n){return t=NN(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function NN(e){var t=PN(e,`string`);return ON(t)===`symbol`?t:String(t)}function PN(e,t){if(ON(e)!==`object`||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(ON(r)!==`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function FN(e,t){if(e==null)return{};var n=IN(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function IN(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function LN(e){var t=e.event,n=e.props,r=e.refresh,i=e.store,a=FN(e,kN);if(t.key===`ArrowUp`||t.key===`ArrowDown`){var o=function(){var e=dM(i.getState()),t=n.environment.document.getElementById(fM(n.id,`item-${i.getState().activeItemId}`,e==null?void 0:e.source));t&&(t.scrollIntoViewIfNeeded?t.scrollIntoViewIfNeeded(!1):t.scrollIntoView(!1))},s=function(){var e=dM(i.getState());if(i.getState().activeItemId!==null&&e){var n=e.item,o=e.itemInputValue,s=e.itemUrl,c=e.source;c.onActive(jN({event:t,item:n,itemInputValue:o,itemUrl:s,refresh:r,source:c,state:i.getState()},a))}};t.preventDefault(),i.getState().isOpen===!1&&(n.openOnFocus||i.getState().query)?EN(jN({event:t,props:n,query:i.getState().query,refresh:r,store:i},a)).then(function(){i.dispatch(t.key,{nextActiveItemId:n.defaultActiveItemId}),s(),setTimeout(o,0)}):(i.dispatch(t.key,{}),s(),o())}else if(t.key===`Escape`)t.preventDefault(),i.dispatch(t.key,null),i.pendingRequests.cancelAll();else if(t.key===`Tab`)i.dispatch(`blur`,null),i.pendingRequests.cancelAll();else if(t.key===`Enter`){if(i.getState().activeItemId===null||i.getState().collections.every(function(e){return e.items.length===0})){var c=cM(n.plugins,i.pendingRequests);c===void 0?n.debug||i.pendingRequests.cancelAll():c.then(i.pendingRequests.cancelAll);return}t.preventDefault();var l=dM(i.getState()),u=l.item,d=l.itemInputValue,f=l.itemUrl,p=l.source;if(t.metaKey||t.ctrlKey)f!==void 0&&(p.onSelect(jN({event:t,item:u,itemInputValue:d,itemUrl:f,refresh:r,source:p,state:i.getState()},a)),n.navigator.navigateNewTab({itemUrl:f,item:u,state:i.getState()}));else if(t.shiftKey)f!==void 0&&(p.onSelect(jN({event:t,item:u,itemInputValue:d,itemUrl:f,refresh:r,source:p,state:i.getState()},a)),n.navigator.navigateNewWindow({itemUrl:f,item:u,state:i.getState()}));else if(!t.altKey){if(f!==void 0){p.onSelect(jN({event:t,item:u,itemInputValue:d,itemUrl:f,refresh:r,source:p,state:i.getState()},a)),n.navigator.navigate({itemUrl:f,item:u,state:i.getState()});return}EN(jN({event:t,nextState:{isOpen:!1},props:n,query:d,refresh:r,store:i},a)).then(function(){p.onSelect(jN({event:t,item:u,itemInputValue:d,itemUrl:f,refresh:r,source:p,state:i.getState()},a))})}}}function RN(e){"@babel/helpers - typeof";return RN=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},RN(e)}var zN=[`props`,`refresh`,`store`],BN=[`inputElement`,`formElement`,`panelElement`],VN=[`inputElement`],HN=[`inputElement`,`maxLength`],UN=[`source`],WN=[`item`,`source`];function GN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function KN(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?GN(Object(n),!0).forEach(function(t){qN(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):GN(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function qN(e,t,n){return t=JN(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function JN(e){var t=YN(e,`string`);return RN(t)===`symbol`?t:String(t)}function YN(e,t){if(RN(e)!==`object`||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(RN(r)!==`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function XN(e,t){if(e==null)return{};var n=ZN(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function ZN(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function QN(e){var t=e.props,n=e.refresh,r=e.store,i=XN(e,zN);return{getEnvironmentProps:function(e){var n=e.inputElement,i=e.formElement,a=e.panelElement,o=XN(e,BN);function s(e){!(r.getState().isOpen||!r.pendingRequests.isEmpty())||e.target===n||[i,a].some(function(t){return pM(t,e.target)})===!1&&(r.dispatch(`blur`,null),t.debug||r.pendingRequests.cancelAll())}return KN({onTouchStart:s,onMouseDown:s,onTouchMove:function(e){r.getState().isOpen===!1||n!==t.environment.document.activeElement||e.target===n||n.blur()}},o)},getRootProps:function(e){return KN({role:`combobox`,"aria-expanded":r.getState().isOpen,"aria-haspopup":`listbox`,"aria-controls":r.getState().isOpen?r.getState().collections.map(function(e){var n=e.source;return fM(t.id,`list`,n)}).join(` `):void 0,"aria-labelledby":fM(t.id,`label`)},e)},getFormProps:function(e){e.inputElement;var a=XN(e,VN),o=function(a){var o;t.onSubmit(KN({event:a,refresh:n,state:r.getState()},i)),r.dispatch(`submit`,null),(o=e.inputElement)==null||o.blur()};return KN({action:``,noValidate:!0,role:`search`,onSubmit:function(e){e.preventDefault();var n=cM(t.plugins,r.pendingRequests);n===void 0?o(e):n.then(function(){return o(e)})},onReset:function(a){var o;a.preventDefault(),t.onReset(KN({event:a,refresh:n,state:r.getState()},i)),r.dispatch(`reset`,null),(o=e.inputElement)==null||o.focus()}},a)},getLabelProps:function(e){return KN({htmlFor:fM(t.id,`input`),id:fM(t.id,`label`)},e)},getInputProps:function(e){var a;function o(e){(t.openOnFocus||r.getState().query)&&EN(KN({event:e,props:t,query:r.getState().completion||r.getState().query,refresh:n,store:r},i)),r.dispatch(`focus`,null)}var s=e||{};s.inputElement;var c=s.maxLength,l=c===void 0?512:c,u=XN(s,HN),d=dM(r.getState()),f=hM(((a=t.environment.navigator)==null?void 0:a.userAgent)||``),p=t.enterKeyHint||(d!=null&&d.itemUrl&&!f?`go`:`search`);return KN({"aria-autocomplete":`both`,"aria-activedescendant":r.getState().isOpen&&r.getState().activeItemId!==null?fM(t.id,`item-${r.getState().activeItemId}`,d==null?void 0:d.source):void 0,"aria-controls":r.getState().isOpen?r.getState().collections.filter(function(e){return e.items.length>0}).map(function(e){var n=e.source;return fM(t.id,`list`,n)}).join(` `):void 0,"aria-labelledby":fM(t.id,`label`),value:r.getState().completion||r.getState().query,id:fM(t.id,`input`),autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`off`,enterKeyHint:p,spellCheck:`false`,autoFocus:t.autoFocus,placeholder:t.placeholder,maxLength:l,type:`search`,onChange:function(e){var a=e.currentTarget.value;if(t.ignoreCompositionEvents&&_M(e).isComposing){i.setQuery(a);return}EN(KN({event:e,props:t,query:a.slice(0,l),refresh:n,store:r},i))},onCompositionEnd:function(e){EN(KN({event:e,props:t,query:e.currentTarget.value.slice(0,l),refresh:n,store:r},i))},onKeyDown:function(e){_M(e).isComposing||LN(KN({event:e,props:t,refresh:n,store:r},i))},onFocus:o,onBlur:WA,onClick:function(n){e.inputElement===t.environment.document.activeElement&&!r.getState().isOpen&&o(n)}},u)},getPanelProps:function(e){return KN({onMouseDown:function(e){e.preventDefault()},onMouseLeave:function(){r.dispatch(`mouseleave`,null)}},e)},getListProps:function(e){var n=e||{},r=n.source,i=XN(n,UN);return KN({role:`listbox`,"aria-labelledby":fM(t.id,`label`),id:fM(t.id,`list`,r)},i)},getItemProps:function(e){var a=e.item,o=e.source,s=XN(e,WN);return KN({id:fM(t.id,`item-${a.__autocomplete_id}`,o),role:`option`,"aria-selected":r.getState().activeItemId===a.__autocomplete_id,onMouseMove:function(e){if(a.__autocomplete_id!==r.getState().activeItemId){r.dispatch(`mousemove`,a.__autocomplete_id);var t=dM(r.getState());if(r.getState().activeItemId!==null&&t){var o=t.item,s=t.itemInputValue,c=t.itemUrl,l=t.source;l.onActive(KN({event:e,item:o,itemInputValue:s,itemUrl:c,refresh:n,source:l,state:r.getState()},i))}}},onMouseDown:function(e){e.preventDefault()},onClick:function(e){var s=o.getItemInputValue({item:a,state:r.getState()}),c=o.getItemUrl({item:a,state:r.getState()});(c?Promise.resolve():EN(KN({event:e,nextState:{isOpen:!1},props:t,query:s,refresh:n,store:r},i))).then(function(){o.onSelect(KN({event:e,item:a,itemInputValue:s,itemUrl:c,refresh:n,source:o,state:r.getState()},i))})}},s)}}}function $N(e){"@babel/helpers - typeof";return $N=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},$N(e)}function eP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function tP(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?eP(Object(n),!0).forEach(function(t){nP(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):eP(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function nP(e,t,n){return t=rP(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function rP(e){var t=iP(e,`string`);return $N(t)===`symbol`?t:String(t)}function iP(e,t){if($N(e)!==`object`||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if($N(r)!==`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function aP(e){var t,n,r,i,a=e.plugins,o=e.options,s=(t=(((n=o.__autocomplete_metadata)==null?void 0:n.userAgents)||[])[0])==null?void 0:t.segment,c=s?nP({},s,Object.keys(((r=o.__autocomplete_metadata)==null?void 0:r.options)||{})):{};return{plugins:a.map(function(e){return{name:e.name,options:Object.keys(e.__autocomplete_pluginOptions||[])}}),options:tP({"autocomplete-core":Object.keys(o)},c),ua:KA.concat(((i=o.__autocomplete_metadata)==null?void 0:i.userAgents)||[])}}function oP(e){var t,n,r=e.metadata,i=e.environment;if(!((t=i.navigator)==null||(n=t.userAgent)==null)&&n.includes(`Algolia Crawler`)){var a=i.document.createElement(`meta`),o=i.document.querySelector(`head`);a.name=`algolia:metadata`,setTimeout(function(){a.content=JSON.stringify(r),o.appendChild(a)},0)}}function sP(e){var t,n=e.state;return n.isOpen===!1||n.activeItemId===null?null:((t=dM(n))==null?void 0:t.itemInputValue)||null}function cP(e){"@babel/helpers - typeof";return cP=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},cP(e)}function lP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function uP(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?lP(Object(n),!0).forEach(function(t){dP(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lP(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function dP(e,t,n){return t=fP(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fP(e){var t=pP(e,`string`);return cP(t)===`symbol`?t:String(t)}function pP(e,t){if(cP(e)!==`object`||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(cP(r)!==`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var mP=function(e,t){switch(t.type){case`setActiveItemId`:return uP(uP({},e),{},{activeItemId:t.payload});case`setQuery`:return uP(uP({},e),{},{query:t.payload,completion:null});case`setCollections`:return uP(uP({},e),{},{collections:t.payload});case`setIsOpen`:return uP(uP({},e),{},{isOpen:t.payload});case`setStatus`:return uP(uP({},e),{},{status:t.payload});case`setContext`:return uP(uP({},e),{},{context:uP(uP({},e.context),t.payload)});case`ArrowDown`:var n=uP(uP({},e),{},{activeItemId:t.payload.hasOwnProperty(`nextActiveItemId`)?t.payload.nextActiveItemId:Zj(1,e.activeItemId,VA(e),t.props.defaultActiveItemId)});return uP(uP({},n),{},{completion:sP({state:n})});case`ArrowUp`:var r=uP(uP({},e),{},{activeItemId:Zj(-1,e.activeItemId,VA(e),t.props.defaultActiveItemId)});return uP(uP({},r),{},{completion:sP({state:r})});case`Escape`:return e.isOpen?uP(uP({},e),{},{activeItemId:null,isOpen:!1,completion:null}):uP(uP({},e),{},{activeItemId:null,query:``,status:`idle`,collections:[]});case`submit`:return uP(uP({},e),{},{activeItemId:null,isOpen:!1,status:`idle`});case`reset`:return uP(uP({},e),{},{activeItemId:t.props.openOnFocus===!0?t.props.defaultActiveItemId:null,status:`idle`,completion:null,query:``});case`focus`:return uP(uP({},e),{},{activeItemId:t.props.defaultActiveItemId,isOpen:(t.props.openOnFocus||!!e.query)&&t.props.shouldPanelOpen({state:e})});case`blur`:return t.props.debug?e:uP(uP({},e),{},{isOpen:!1,activeItemId:null});case`mousemove`:return uP(uP({},e),{},{activeItemId:t.payload});case`mouseleave`:return uP(uP({},e),{},{activeItemId:t.props.defaultActiveItemId});default:return`${JSON.stringify(t.type)}`,e}};function hP(e){"@babel/helpers - typeof";return hP=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},hP(e)}function gP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _P(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?gP(Object(n),!0).forEach(function(t){vP(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gP(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function vP(e,t,n){return t=yP(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function yP(e){var t=bP(e,`string`);return hP(t)===`symbol`?t:String(t)}function bP(e,t){if(hP(e)!==`object`||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(hP(r)!==`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function xP(e){var t=[],n=WM(e,t),r=wM(mP,n,o),i=jM({store:r}),a=QN(_P({props:n,refresh:s,store:r,navigator:n.navigator},i));function o(e){var t,r,a=e.prevState,o=e.state;if(n.onStateChange(_P({prevState:a,state:o,refresh:s,navigator:n.navigator},i)),!l()&&(t=o.context)!=null&&(r=t.algoliaInsightsPlugin)!=null&&r.__automaticInsights&&n.insights!==!1){var u=Rj({__autocomplete_clickAnalytics:!1});n.plugins.push(u),c([u])}}function s(){return EN(_P({event:new Event(`input`),nextState:{isOpen:r.getState().isOpen},props:n,navigator:n.navigator,query:r.getState().query,refresh:s,store:r},i))}function c(e){e.forEach(function(e){var r;return(r=e.subscribe)==null?void 0:r.call(e,_P(_P({},i),{},{navigator:n.navigator,refresh:s,onSelect:function(e){t.push({onSelect:e})},onActive:function(e){t.push({onActive:e})},onResolve:function(e){t.push({onResolve:e})}}))})}function l(){return n.plugins.some(function(e){return e.name===`aa.algoliaInsightsPlugin`})}if(n.insights&&!l()){var u=typeof n.insights==`boolean`?{}:n.insights;n.plugins.push(Rj(u))}return c(n.plugins),oP({metadata:aP({plugins:n.plugins,options:e}),environment:n.environment}),_P(_P({refresh:s,navigator:n.navigator},a),i)}V();function SP(){return B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},B.createElement(`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`}))}let CP={before:`Searched for `,separator:`, `,lastSeparator:` and `,after:``};function wP({queries:e,translations:t,onSearchQueryClick:n}){if(e.length===0)return null;if(typeof t.aggregatedToolCallNode==`function`)return B.createElement(B.Fragment,null,t.aggregatedToolCallNode(e,n));let{before:r=``,separator:i=`, `,lastSeparator:a=` and `,after:o=``}=(t.aggregatedToolCallText?t.aggregatedToolCallText(e):CP)||{};return B.createElement(`div`,{className:`DocSearch-AskAiScreen-MessageContent-Tool Tool--AggregatedResult`},B.createElement(dn,{size:18}),B.createElement(`span`,null,r&&B.createElement(`span`,null,r),e.map((t,r)=>B.createElement(E,{key:t+r},B.createElement(`span`,{role:`button`,tabIndex:0,className:`DocSearch-AskAiScreen-MessageContent-Tool-Query`,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n(t))},onClick:()=>n(t)},`"`,t,`"`),r<e.length-2&&i,r===e.length-2&&a)),o&&B.createElement(`span`,null,o)))}let TP=[`translations`];function EP(e){let{preToolCallText:t=`Searching...`,duringToolCallText:n=`Searching...`,afterToolCallText:r=`Searched for`,savedMemoryToolResultText:i=`Saved to memory`,memoryToolResultText:a=`Used memory to enhance results`}=e;return{preToolCallText:t,searchingText:n,toolCallResultText:r,savedMemoryToolResultText:i,memoryToolResultText:a}}function DP({disclaimerText:e}){return B.createElement(`p`,{className:`DocSearch-AskAiScreen-Disclaimer`},B.createElement(Dr,null),` `,e)}function OP({exchange:e,askAiError:t,isLastExchange:n,loadingStatus:r,onSearchQueryClick:i,translations:a,tools:o,conversations:s,onFeedback:c,memoryEnabled:l,onSelectPromptSuggestion:u}){var d,f;let{userMessage:p,assistantMessage:m}=e,{stoppedStreamingText:h=`You stopped this response`,errorTitleText:g=`Chat error`,relatedSourcesText:_,relatedSourcesTextPlural:v,suggestedPromptsTitleText:y=`Suggested prompts`}=a,b=z(()=>EP(a),[a]),x=tA(t),S=z(()=>$k(m),[m]),C=z(()=>$k(p),[p]),w=B.useMemo(()=>Zk(m),[m]),T=B.useMemo(()=>SA((m==null?void 0:m.parts)||[]),[m]),E=z(()=>n?dA((m==null?void 0:m.parts)||[]):[],[m,n]),D=((d=p.metadata)==null?void 0:d.stopped)||(m==null||(f=m.metadata)==null?void 0:f.stopped),O=!D&&(!n||n&&r===`ready`&&!!m),k=[`submitted`,`streaming`].includes(r)&&n&&!T.some(e=>e.type!==`step-start`),A=(m==null?void 0:m.id)||e.id;return B.createElement(`div`,{className:`DocSearch-AskAiScreen-Response-Container`},B.createElement(`div`,{className:`DocSearch-AskAiScreen-Response`},B.createElement(`div`,{className:`DocSearch-AskAiScreen-Message DocSearch-AskAiScreen-Message--user`},B.createElement(`p`,{className:`DocSearch-AskAiScreen-Query`},C==null?``:C)),B.createElement(`div`,{className:`DocSearch-AskAiScreen-Message DocSearch-AskAiScreen-Message--assistant`},B.createElement(`div`,{className:`DocSearch-AskAiScreen-MessageContent`},r===`error`&&t&&n&&!x&&B.createElement(`div`,{className:`DocSearch-AskAiScreen-Error`,role:`alert`},B.createElement(fk,{"aria-hidden":`true`}),B.createElement(`div`,{className:`DocSearch-AskAiScreen-Error-Content`},B.createElement(`h4`,{className:`DocSearch-AskAiScreen-Error-Title`},g),B.createElement(xA,{content:t.message,copyButtonText:``,copyButtonCopiedText:``,isStreaming:!1}))),k&&B.createElement(`div`,{className:`DocSearch-AskAiScreen-MessageContent-Thinking`,role:`status`},B.createElement(`span`,{className:`DocSearch-shimmer`},a.thinkingText||`Thinking...`),B.createElement(`span`,{className:`DocSearch-AskAi-Thinking-Skeleton DocSearch-shimmer`}),B.createElement(`span`,{className:`DocSearch-AskAi-Thinking-Skeleton DocSearch-AskAi-Thinking-Skeleton--short DocSearch-shimmer`})),T.map((e,t)=>{let n=t;return typeof e==`string`?B.createElement(xA,{key:n,content:e,copyButtonText:a.copyButtonText||`Copy`,copyButtonCopiedText:a.copyButtonCopiedText||`Copied!`,isStreaming:r===`streaming`}):sA(e)?B.createElement(vA,{key:n,translations:b,part:e,tools:o,memoryEnabled:l,onSearchQueryClick:i}):e.type===`aggregated-tool-call`?B.createElement(wP,{key:n,queries:e.queries,translations:a,onSearchQueryClick:i}):e.type===`reasoning`&&e.state===`streaming`?B.createElement(`div`,{key:n,className:`DocSearch-AskAiScreen-MessageContent-Reasoning DocSearch-shimmer`},B.createElement(Er,{className:`DocSearch-AskAiScreen-SmallerLoadingIcon`}),B.createElement(`span`,{className:`DocSearch-shimmer`},`Reasoning...`)):e.type===`text`?B.createElement(xA,{key:n,content:e.text,copyButtonText:a.copyButtonText||`Copy`,copyButtonCopiedText:a.copyButtonCopiedText||`Copied!`,isStreaming:e.state===`streaming`}):null})),D&&B.createElement(`p`,{className:`DocSearch-AskAiScreen-MessageContent-Stopped`},h)),B.createElement(`div`,{className:`DocSearch-AskAiScreen-Answer-Footer`},B.createElement(Nk,{links:w,titleText:_,pluralTitleText:v}),B.createElement(Ck,{id:A,showActions:O,latestAssistantMessageContent:S||null,translations:a,conversations:s,onFeedback:c})),E.length>0&&B.createElement(bk,{title:y,suggestions:E,onSelectPromptSuggestion:u})))}function kP(e){let{translations:t={}}=e,n=pn(e,TP),{disclaimerText:r=`Answers are generated with AI which can make mistakes.`,threadDepthExceededMessage:i=`This conversation is now closed to keep responses accurate.`,startNewConversationButtonText:a=`Start a new conversation`}=t,{messages:o,tools:s,askAiError:c,status:l,memoryEnabled:u}=n,d=z(()=>l===`error`&&tA(c),[l,c]),f=z(()=>aA(c),[c]),p=rA(c),m=z(()=>{let e=[];for(let n=0;n<o.length;n++)if(o[n].role===`user`){var t;let r=o[n],i=((t=o[n+1])==null?void 0:t.role)===`assistant`?o[n+1]:null;e.push({id:r.id,userMessage:r,assistantMessage:i}),i&&n++}return e},[o]),h=e=>{n.onAskAiToggle(!1),n.setQuery(e)},g=d&&(!eA(c)||o.some(e=>e.role===`assistant`));return B.createElement(`div`,{className:`DocSearch-AskAiScreen DocSearch-AskAiScreen-Container`},B.createElement(`div`,{id:n.promptBlockingErrorId,role:`alert`},g&&B.createElement(`div`,{className:`DocSearch-AskAiScreen-MessageContent DocSearch-AskAiScreen-Error DocSearch-AskAiScreen-Error--ThreadDepth`},B.createElement(`div`,{className:`DocSearch-AskAiScreen-Error-Content`},B.createElement(`p`,{className:`DocSearch-AskAiScreen-Error-Title`},f==null?eA(c)?i:`This conversation cannot continue.`:f),p&&B.createElement(`p`,null,B.createElement(`button`,{type:`button`,className:`DocSearch-ThreadDepthError-Link`,onClick:n.onNewConversation},a),` `,`to continue.`)))),B.createElement(DP,{disclaimerText:r}),B.createElement(`div`,{className:`DocSearch-AskAiScreen-Body`},B.createElement(`div`,{className:`DocSearch-AskAiScreen-ExchangesList`},m.slice().reverse().map((e,r)=>B.createElement(OP,{key:e.id,exchange:e,askAiError:n.askAiError,isLastExchange:r===0,loadingStatus:n.status,translations:t,tools:s,conversations:n.conversations,memoryEnabled:u,onSearchQueryClick:h,onFeedback:n.onFeedback,onSelectPromptSuggestion:n.onSelectPromptSuggestion})))))}let AP=[`translations`];function jP(e){let{translations:t={}}=e,n=pn(e,AP),{recentConversationsTitle:r=`Resume AI conversations`,removeRecentConversationButtonTitle:i=`Remove this conversation from history`}=t,a=xp(n.state,`recentConversations`);return a?B.createElement(Fm,_(_({},n),{},{title:r,collection:a,renderIcon:()=>B.createElement(`div`,{className:`DocSearch-Hit-icon DocSearch-Hit-icon--start`},B.createElement(SP,null)),renderAction:({item:e})=>B.createElement(`div`,{className:`DocSearch-Hit-action`},B.createElement(`button`,{className:`DocSearch-Hit-action-button`,title:i,type:`submit`,onClick:t=>{t.preventDefault(),t.stopPropagation(),n.conversations.remove(e),n.refresh()}},B.createElement(jr,null)))})):null}let MP=[`translations`];function NP(e){let{translations:t={}}=e,n=pn(e,MP);return B.createElement(`div`,{className:`DocSearch-Dropdown-Container`},B.createElement(jP,_(_({},n),{},{translations:t})),B.createElement(Bm,_(_({},n),{},{translations:t})))}let PP=[`onAskAiToggle`];function FP(e){let{onAskAiToggle:t}=e,n=pn(e,PP),r=B.useMemo(()=>xp(n.state,`recentConversations`),[n.state]);return B.useEffect(()=>{(!r||r.items.length===0)&&t(!0)},[r,t]),r?B.createElement(`div`,{className:`DocSearch-Dropdown-Container DocSearch-Conversation-History`},B.createElement(Fm,_(_({},n),{},{key:r.source.sourceId,title:``,translations:n.translations,collection:r,renderIcon:()=>B.createElement(`div`,{className:`DocSearch-Hit-icon`},B.createElement(Dr,null)),renderAction:({item:e})=>B.createElement(`div`,{className:`DocSearch-Hit-action`},B.createElement(`button`,{type:`button`,className:`DocSearch-Hit-action-button`,onClick:t=>{t.preventDefault(),t.stopPropagation(),n.conversations.remove(e),n.refresh()}},B.createElement(jr,null)))}))):null}function IP({translations:e={},suggestedQuestions:t=[],selectSuggestedQuestion:n}){let{newConversationTitle:r=`How can I help you today?`,newConversationDescription:i=`I search through your documentation to help you find setup guides, feature details and troubleshooting tips, fast.`}=e;return B.createElement(`div`,{className:`DocSearch-NewConversationScreen`},B.createElement(`h3`,{className:`DocSearch-NewConversationScreen-Title`},r),B.createElement(`p`,{className:`DocSearch-NewConversationScreen-Description`},i),B.createElement(`div`,{className:`DocSearch-NewConversationScreen-SuggestedQuestions`},t.map(e=>B.createElement(`button`,{key:e.objectID,type:`button`,className:`DocSearch-NewConversationScreen-SuggestedQuestion`,onClick:()=>n(e)},e.question))))}let LP=[`translations`,`selectAskAiQuestion`],RP=B.memo(e=>{var t;let{translations:n={},selectAskAiQuestion:r}=e,i=pn(e,LP),a=B.useCallback(e=>{r(!0,e)},[r]);return i.canHandleAskAi&&i.isAskAiActive&&i.askAiState===`conversation-history`?B.createElement(FP,_({selectAskAiQuestion:r},i)):i.canHandleAskAi&&i.isAskAiActive&&i.askAiState===`new-conversation`?B.createElement(IP,{translations:n==null?void 0:n.newConversation,selectSuggestedQuestion:i.selectSuggestedQuestion,suggestedQuestions:i.suggestedQuestions}):i.isAskAiActive&&i.canHandleAskAi?B.createElement(kP,_(_({},i),{},{messages:i.messages,tools:i.tools,status:i.status,askAiError:i.askAiError,translations:n==null?void 0:n.askAiScreen,memoryEnabled:i.memoryEnabled,selectAskAiQuestion:r,onSelectPromptSuggestion:a})):((t=i.state)==null?void 0:t.status)===`error`?B.createElement(Vm,{translations:n==null?void 0:n.errorScreen}):jp(i.state.query)?B.createElement(NP,_(_({},i),{},{hasCollections:i.hasCollections,translations:n==null?void 0:n.startScreen,selectAskAiQuestion:r})):!i.hasCollections&&!i.canHandleAskAi?B.createElement(Um,_(_({},i),{},{translations:n==null?void 0:n.noResultsScreen})):B.createElement(B.Fragment,null,B.createElement(qm,_(_({},i),{},{translations:n==null?void 0:n.resultsScreen})),i.canHandleAskAi&&!i.hasCollections&&B.createElement(Um,_(_({},i),{},{translations:n==null?void 0:n.noResultsScreen})))},function(e,t){if(e.isAskAiActive!==t.isAskAiActive||e.askAiState!==t.askAiState||e.canHandleAskAi!==t.canHandleAskAi)return!1;let n=t.state.status===`loading`||t.state.status===`stalled`,r=t.state.status===`idle`&&!jp(t.state.query)&&e.state.query!==t.state.query&&e.state.collections===t.state.collections;return n||r});function zP({heading:e,shimmer:t=!1}){return B.createElement(`span`,{className:`DocSearch-Modal-heading${t?` DocSearch-shimmer`:``}`},e)}let BP=[`translations`,`askAiState`,`onAskAiToggle`,`setAskAiState`];function VP(e){let{translations:t={},askAiState:n,onAskAiToggle:r,setAskAiState:i}=e,a=pn(e,BP),{clearButtonTitle:o=`Clear`,clearButtonAriaLabel:s=`Clear the query`,closeButtonText:c=`Close`,closeButtonAriaLabel:l=`Close`,searchInputLabel:u=`Search`,backToKeywordSearchButtonText:d=`Back to keyword search`,backToKeywordSearchButtonAriaLabel:f=`Back to keyword search`,placeholderTextAskAiStreaming:p=`Answering...`,newConversationPlaceholder:m=`Ask a question`,conversationHistoryTitle:h=`My conversation history`,startNewConversationText:g=`Start a new conversation`,viewConversationHistoryText:v=`Conversation history`,threadDepthErrorPlaceholder:y=`Conversation limit reached`}=t,b=B.useMemo(()=>{let e=xp(a.state,`recentConversations`);return e?e.items.length>0:!1},[a.state]),x=a.getInputProps({inputElement:a.inputRef.current,autoFocus:a.autoFocus}),S=new Set([`ArrowUp`,`ArrowDown`,`Enter`]),C=x.onKeyDown,w=x.onChange,T=a.askAiStatus===`streaming`||a.askAiStatus===`submitted`,E=a.isAskAiActive&&n!==`conversation-history`,D=!!a.promptBlockingChrome,O=a.placeholder;n===`new-conversation`&&(O=m),a.promptBlockingChrome===`full`&&a.isAskAiActive&&(O=y);let k=null;T&&(k=p),n===`conversation-history`&&(k=h),B.useEffect(()=>{a.askAiStatus!==`streaming`&&a.askAiStatus!==`submitted`&&a.inputRef.current&&a.inputRef.current.focus()},[a.askAiStatus,a.inputRef]);let A={enterKeyHint:a.isAskAiActive?`enter`:`search`,onKeyDown:e=>{if(D&&a.isAskAiActive&&S.has(e.key)){e.preventDefault(),e.stopPropagation();return}let t=!1;if(a.isAskAiActive&&S.has(e.key)&&(e.key===`Enter`&&!T&&!jp(a.state.query)&&a.onAskAgain(a.state.query),t=!0),t){e.preventDefault(),e.stopPropagation();return}C==null||C(e)},onChange:e=>{if(D&&a.isAskAiActive){e.preventDefault();return}if(a.isAskAiActive){a.setQuery(e.currentTarget.value),e.preventDefault(),e.stopPropagation();return}w==null||w(e)},disabled:T,readOnly:D&&a.isAskAiActive,"aria-disabled":D&&a.isAskAiActive,"aria-describedby":D&&a.isAskAiActive?a.promptBlockingErrorId:void 0},j=B.useCallback(()=>{if(D){a.onNewConversation();return}if(n===`conversation-history`){r(!0),i(`initial`);return}r(!1)},[n,D,r,i,a]),M=a.isAskAiActive?B.createElement(`button`,{type:`button`,tabIndex:0,className:`DocSearch-Action DocSearch-AskAi-Return`,title:D?g:d,"aria-label":D?g:f,onClick:j},B.createElement(yk,null)):void 0,N=k?B.createElement(zP,{heading:k,shimmer:T}):null,P=B.createElement(B.Fragment,null,!a.isAskAiActive&&B.createElement(B.Fragment,null,B.createElement(`button`,{className:`DocSearch-Clear`,type:`reset`,"aria-label":s,hidden:!a.state.query,tabIndex:a.state.query?0:-1,"aria-hidden":a.state.query?`false`:`true`},o),a.state.query&&B.createElement(`div`,{className:`DocSearch-Divider`})),T&&B.createElement(B.Fragment,null,B.createElement(`button`,{type:`button`,className:`DocSearch-Action DocSearch-StopStreaming`,onClick:a.onStopAskAiStreaming},B.createElement(pk,null)),B.createElement(`div`,{className:`DocSearch-Divider`})),E&&B.createElement(B.Fragment,null,B.createElement(TA,null,B.createElement(TA.Trigger,{className:`DocSearch-Action`},B.createElement(mk,null)),B.createElement(TA.Content,null,B.createElement(TA.Item,{onClick:a.onNewConversation},B.createElement(gk,null),g),b&&B.createElement(TA.Item,{onClick:a.onViewConversationHistory},B.createElement(hk,null),v))),B.createElement(`div`,{className:`DocSearch-Divider`})));return B.createElement(cm,_(_({},a),{},{placeholder:O,clearButtonTitle:o,clearButtonAriaLabel:s,closeButtonText:c,closeButtonAriaLabel:l,searchInputLabel:u,leadingElement:M,inputOverlay:N,hideInput:!!k,actionsBeforeClose:P,inputProps:A}))}let HP={value:``,matchLevel:`none`,matchedWords:[]},UP={lvl0:HP,lvl1:HP,lvl2:HP,lvl3:HP,lvl4:HP,lvl5:HP,lvl6:HP},WP={content:HP,hierarchy:UP,hierarchy_camel:[]},GP={content:HP,hierarchy:UP,hierarchy_camel:[]};function KP({conversations:e,disableUserPersonalization:t,setMessages:n,onAskAiToggle:r}){return[{sourceId:bp.recentConversations,getItems(){return t?[]:e.getAll().slice(0,3)},onSelect({item:e}){e.messages&&(n(e.messages),r(!0))}}]}function qP({query:e,objectID:t,lvl0:n}){return{type:`askAI`,query:e,url_without_anchor:``,objectID:t,content:null,url:``,anchor:null,hierarchy:{lvl0:n,lvl1:e,lvl2:null,lvl3:null,lvl4:null,lvl5:null,lvl6:null},_highlightResult:WP,_snippetResult:GP,__docsearch_parent:null}}async function JP({query:e,indexName:t,searchClient:n,hitsPerPage:r=3}){try{let{results:i}=await n.search({requests:[{query:e,indexName:t,hitsPerPage:r,attributesToRetrieve:[`prompt`]}]});return i[0].hits.map(e=>qP({query:e.prompt,objectID:e.objectID,lvl0:`Prompt Suggestions`}))}catch(e){return[]}}async function YP({query:e,handleSelectAskAiQuestion:t,promptSuggestionsOptions:n,searchClient:r}){let i=n?await JP({query:e,indexName:n.indexName,hitsPerPage:n.hitsPerPage,searchClient:r}):[];return[{sourceId:bp.askAI,getItems(){return[qP({query:e,objectID:`ask-ai-button`,lvl0:`Ask AI`}),...i]},onSelect({item:e}){e.type===`askAI`&&e.query&&t(!0,e.query)}}]}let XP=`appId.apiKey.askAi.maxResultsPerGroup.theme.onClose.transformItems.hitComponent.resultsFooterComponent.navigator.initialScrollY.transformSearchClient.disableUserPersonalization.initialQuery.translations.getMissingResultsUrl.insights.onAskAiToggle.interceptAskAiEvent.isAskAiActive.recentSearchesLimit.recentSearchesWithFavoritesLimit.indices.facets.isHybridModeSupported.footerAction`.split(`.`),ZP=[`footer`,`searchBox`,`facets`];function QP(e){var t,n,r,i;let{appId:a,apiKey:o,askAi:s,maxResultsPerGroup:c,theme:l,onClose:u=Mp,transformItems:d=kp,hitComponent:f=fm,resultsFooterComponent:p=()=>null,navigator:m,initialScrollY:h=0,transformSearchClient:g=kp,disableUserPersonalization:v=!1,initialQuery:y=``,translations:b={},getMissingResultsUrl:x,insights:S=!1,onAskAiToggle:C,interceptAskAiEvent:w,isAskAiActive:T=!1,recentSearchesLimit:E=7,recentSearchesWithFavoritesLimit:D=4,indices:O,facets:k,isHybridModeSupported:A=!1,footerAction:j}=e,M=pn(e,XP),{footer:N,searchBox:P,facets:ee}=b,te=pn(b,ZP),[F,ne]=B.useState({query:``,collections:[],completion:null,context:{},isOpen:!1,activeItemId:null,status:`idle`}),re=!!s,ie=(b==null||(t=b.searchBox)==null?void 0:t.placeholderText)||M.placeholder||`Search docs`;if(re){var ae;ie=(b==null||(ae=b.searchBox)==null?void 0:ae.placeholderText)||`Search docs or ask AI a question`}if(T){var oe;ie=(b==null||(oe=b.searchBox)==null?void 0:oe.placeholderTextAskAi)||`Ask another question...`}let{containerRef:se,modalRef:ce,formElementRef:I,dropdownRef:le,inputRef:ue}=xm(),de=B.useId(),{initialQuery:fe,initialQueryFromSelection:pe}=gm(y),me=Kr(a,o,g),L=typeof s==`object`?s:null,he=L?L.agentId:s,ge=L==null?void 0:L.searchParameters,[_e,ve]=B.useState(`initial`),ye=FA({agentId:he,searchClient:me,suggestedQuestionsEnabled:L==null?void 0:L.suggestedQuestions}),be=(n=L==null||(r=L.memory)==null?void 0:r.enabled)!=null&&n,xe=(i=L==null?void 0:L.tools)==null?oA:i,Se=B.useMemo(()=>Zm({indices:O}),[O]),Ce=Se[0].name,we=B.useRef(void 0),{visibleFacets:Te,facetSelections:Ee,facetSelectionsRef:De,handleFacetSelectionChange:Oe,clearFacetSelections:ke}=mm({facets:k,indexes:Se,searchClient:me,onSelectionsChange:()=>{var e;return(e=we.current)==null?void 0:e.refresh()}}),{favoriteSearches:Ae,recentSearches:je}=Tm({defaultIndexName:Ce,recentSearchesLimit:E,recentSearchesWithFavoritesLimit:D}),[Me,Ne]=B.useState(!1),{chatId:Pe,messages:Fe,status:R,setMessages:Ie,sendMessage:z,stopAskAiStreaming:Le,askAiError:Re,sendFeedback:ze,conversations:Be,startNewConversation:Ve,restoreConversation:He}=PA({agentId:he,apiKey:(L==null?void 0:L.apiKey)||o,appId:(L==null?void 0:L.appId)||a,searchParameters:ge,tools:xe,memory:L==null?void 0:L.memory,indices:L==null?void 0:L.indices}),Ue=B.useRef(R);B.useEffect(()=>{if(!v){if(Ue.current===`streaming`&&R===`ready`){Me&&Fe.at(-1)&&(Fe.at(-1).metadata={stopped:!0});for(let e of Fe[0].parts)e.type===`text`&&Be.add(Qk(e.text,Fe,Pe))}Ue.current=R}},[R,Fe,Be,v,Me,Pe]);let We=B.useMemo(()=>R===`error`&&tA(Re),[R,Re])&&(!eA(Re)||Fe.some(e=>e.role===`assistant`)),Ge=B.useMemo(()=>{if(!(!We||_e===`new-conversation`||_e===`conversation-history`))return nA(Re)?`minimal`:`full`},[Re,_e,We]),Ke=wm({favoriteSearches:Ae,recentSearches:je,disableUserPersonalization:v}),qe=hm(F),Je=B.useCallback((e,t,n=void 0)=>{if(e){let e={query:t,suggestedQuestionId:n==null?void 0:n.objectID};if(w!=null&&w(e)){we.current&&we.current.setQuery(``);return}}if(e&&_e===`new-conversation`&&ve(`initial`),C(e,{query:t,suggestedQuestionId:n==null?void 0:n.objectID}),A)return;Ne(!1);let r={};if(n&&(r.body={suggestedQuestionId:n.objectID}),z({role:`user`,parts:[{type:`text`,text:t}]},r),le.current){let e=le.current;typeof e.scrollTo==`function`?e.scrollTo({top:0,behavior:`smooth`}):e.scrollTop=0}we.current&&we.current.setQuery(``)},[_e,C,A,z,le,w]),Ye=B.useCallback(async(e,t)=>{!he||!a||await ze(e,t)},[he,a,ze]);we.current||(we.current=xP({id:`docsearch`,defaultActiveItemId:0,openOnFocus:!0,initialState:{query:fe,context:{searchSuggestions:[]}},insights:!!S,navigator:m,onStateChange(e){ne(e.state)},async getSources({query:e,state:t,setContext:n,setStatus:r}){if(jp(e)){let e=Ym({recentSearches:je,favoriteSearches:Ae,saveRecentSearch:Ke,onClose:u,disableUserPersonalization:v});return[...re?KP({conversations:Be,disableUserPersonalization:v,setMessages:Ie,onAskAiToggle:C}):[],...e]}let i=Xm({query:e,state:{context:t.context},setContext:n,setStatus:r,searchClient:me,indexes:Se,insights:!!S,appId:a,apiKey:o,maxResultsPerGroup:c,transformItems:d,saveRecentSearch:Ke,onClose:u,facetSelections:De}),s=re?YP({query:e,handleSelectAskAiQuestion:Je,promptSuggestionsOptions:L==null?void 0:L.promptSuggestions,searchClient:me}):Promise.resolve([]),[l,f]=await Promise.all([s,i]);return[...l,...f]}}));let Xe=we.current,{getEnvironmentProps:Ze,getRootProps:Qe,refresh:$e}=Xe;bm({getEnvironmentProps:Ze,containerRef:se,dropdownRef:le,formElementRef:I,inputRef:ue,initialScrollY:h,modalRef:ce,theme:l}),B.useEffect(()=>{le.current&&!T&&Ip(le.current)},[F.query,T,le]),Sm({initialQuery:fe,inputRef:ue,refresh:$e});let et=Fe.length>0,tt=B.useRef(T);B.useEffect(()=>{let e=tt.current;tt.current=T,T||(Xe.refresh(),e&&et&&Ve())},[T,Xe,Ve,et]),B.useEffect(()=>{ve(`initial`)},[T,ve]);let nt=async()=>{Ne(!0),await Le()},rt=()=>{Ve(),ve(`new-conversation`)},it=()=>{ve(`conversation-history`)},at=e=>{Je(!0,e.question,e)},ot=!0,st=F.collections.some(e=>e.source.sourceId!==bp.askAI&&e.items.length>0);return F.status===`idle`&&st===!1&&jp(F.query)&&!T&&(ot=!1),B.createElement(lm,{state:F,containerRef:se,modalRef:ce,formElementRef:I,dropdownRef:le,getRootProps:Qe,showDropdown:ot,searchBox:B.createElement(VP,_(_({},Xe),{},{state:F,placeholder:ie||`Search docs`,autoFocus:jp(fe),inputRef:ue,isFromSelection:!!fe&&fe===pe,translations:P,isAskAiActive:T,askAiStatus:R,askAiError:Re,askAiState:_e,setAskAiState:ve,promptBlockingChrome:Ge,promptBlockingErrorId:de,onClose:u,onAskAiToggle:C,onAskAgain:e=>{Je(!0,e)},onStopAskAiStreaming:nt,onNewConversation:rt,onViewConversationHistory:it})),filterBar:!T&&!jp(F.query)?B.createElement(om,{facets:Te,selections:Ee,translations:ee,clearSelections:ke,onSelectionChange:Oe}):null,screenState:B.createElement(RP,_(_({},Xe),{},{indexName:Ce,state:F,hitComponent:f,resultsFooterComponent:p,disableUserPersonalization:v,recentSearches:je,favoriteSearches:Ae,conversations:Be,inputRef:ue,translations:te,getMissingResultsUrl:x,isAskAiActive:T,canHandleAskAi:re,messages:Fe,tools:xe,askAiError:Re,status:R,hasCollections:st,askAiState:_e,selectAskAiQuestion:Je,suggestedQuestions:ye,selectSuggestedQuestion:at,memoryEnabled:be,resultBadgeKey:M.resultBadgeKey,promptBlockingErrorId:de,onAskAiToggle:C,onNewConversation:rt,onItemClick:(e,t)=>{if(e.type===`askAI`&&e.query){if(e.anchor===`stored`&&`messages`in e){let n=e.messages;He(n,e.chatId);let r={query:e.query,messageId:n[0].id};if(w!=null&&w(r)){we.current&&we.current.setQuery(``),t.preventDefault();return}C(!0,r)}else Je(!0,e.query);ve(`initial`),t.preventDefault();return}qe(e),Ke(e),Ap(t)||u()},onFeedback:Ye})),footer:B.createElement(dm,{translations:N,isAskAiActive:T,footerAction:j}),onClose:u})}function $P(e){"@babel/helpers - typeof";return $P=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},$P(e)}function eF(e,t){if($P(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if($P(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function tF(e){var t=eF(e,`string`);return $P(t)==`symbol`?t:t+``}function nF(e,t,n){return(t=tF(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function rF(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function iF(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?rF(Object(n),!0).forEach(function(t){nF(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rF(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}let aF={"Ctrl/Cmd+K":!0,"/":!0,"Ctrl/Cmd+I":!0};function oF(e){return iF(iF({},aF),e)}V();function sF(e){let t=e.composedPath()[0],n=t.tagName;return t.isContentEditable||n===`INPUT`||n===`SELECT`||n===`TEXTAREA`||n===`BUTTON`}function cF({isOpen:e,isAskAiActive:t,onAskAiToggle:n,onClose:r,onOpen:i,keyboardShortcuts:a=aF}){B.useEffect(()=>{function o(o){var s;if(e&&o.code===`Escape`&&t){n(!1);return}let c=a[`Ctrl/Cmd+K`]&&((s=o.key)==null?void 0:s.toLowerCase())===`k`&&(o.metaKey||o.ctrlKey),l=a[`/`]&&o.key===`/`;(o.code===`Escape`&&e||c||!sF(o)&&l&&!e)&&(o.preventDefault(),e?r():document.body.classList.contains(`DocSearch--active`)||i())}return window.addEventListener(`keydown`,o),()=>{window.removeEventListener(`keydown`,o)}},[e,t,a,i,r,n])}V();let lF=()=>{let[e,t]=B.useState(!1);return B.useEffect(()=>{let e=()=>{let e=window.matchMedia(`(max-width: 768px)`);t(e.matches)};return e(),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`resize`,e)}},[]),e};function uF(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function dF(e,t){if(e==null)return{};var n,r,i=uF(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}let fF=[`children`,`appId`,`apiKey`,`theme`,`onReady`,`onOpen`,`onClose`,`onSidepanelOpen`,`onSidepanelClose`],pF=B.createContext(void 0);pF.displayName=`DocSearchContext`;function mF(e,t){let{children:n,appId:r,apiKey:i,theme:a,onReady:o,onOpen:s,onClose:c,onSidepanelOpen:l,onSidepanelClose:u}=e,d=dF(e,fF),[f,p]=B.useState(`ready`),[m,h]=B.useState(d.initialQuery||``),g=B.useRef(null),_=oF(d.keyboardShortcuts),[v,y]=B.useState(),[b,x]=B.useState(()=>new Set),S=lF(),C=B.useRef(`ready`),w=[`modal-search`,`modal-askai`].includes(f),T=f===`modal-askai`,E=!S&&b.has(`sidepanel`),D=f===`sidepanel`;B.useEffect(()=>{o==null||o()},[o]),B.useEffect(()=>{let e=C.current,t=f;(t===`modal-search`||t===`modal-askai`)&&e!==`modal-search`&&e!==`modal-askai`&&(s==null||s()),t===`ready`&&(e===`modal-search`||e===`modal-askai`)&&(c==null||c()),t===`sidepanel`&&e!==`sidepanel`&&(l==null||l()),t!==`sidepanel`&&e===`sidepanel`&&(u==null||u()),C.current=t},[f,s,c,l,u]);let O=B.useCallback(()=>{p(`modal-search`)},[]),k=B.useCallback(()=>{var e,t;p(`ready`),(e=g.current)==null||e.focus(),h((t=d.initialQuery)==null?``:t)},[p,d.initialQuery]),A=B.useCallback((e,t)=>{if(!S&&e&&E){y(t),p(`sidepanel`);return}p(e?`modal-askai`:`modal-search`)},[p,S,E]),j=B.useCallback(e=>{b.has(`sidepanel`)&&(y(e),p(`sidepanel`))},[p,b]),M=B.useCallback(e=>{p(`modal-search`),h(e.key)},[p,h]),N=B.useCallback(e=>{b.has(e)||x(t=>{let n=new Set(t);return n.add(e),n})},[b]);B.useImperativeHandle(t,()=>({open:O,close:k,openAskAi:e=>A(!0,e),openSidepanel:j,get isReady(){return!0},get isOpen(){return w},get isSidepanelOpen(){return D},get isSidepanelSupported(){return E}}),[O,k,A,j,w,D,E]),mn({theme:a}),cF({isOpen:w,onOpen:O,onClose:k,onAskAiToggle:A,onInput:M,isAskAiActive:T,searchButtonRef:g,keyboardShortcuts:_});let P=B.useMemo(()=>({appId:r,apiKey:i,docsearchState:f,setDocsearchState:p,searchButtonRef:g,initialQuery:m,keyboardShortcuts:_,openModal:O,closeModal:k,isAskAiActive:T,isModalActive:w,onAskAiToggle:A,initialAskAiMessage:v,registerView:N,isHybridModeSupported:E}),[r,i,f,g,m,_,O,k,T,w,A,v,N,E]);return B.createElement(pF.Provider,{value:P},n)}let hF=B.forwardRef(mF);hF.displayName=`DocSearch`;function gF(){let e=B.useContext(pF);if(e===void 0)throw Error("`useDocSearch` must be used within the `DocSearch` provider");return e}V();let _F=[`appId`,`apiKey`];function vF(e,t){let{appId:n,apiKey:r}=e,i=pn(e,_F);return B.createElement(hF,_(_({},i),{},{appId:n,apiKey:r,ref:t}),B.createElement(bF,i))}let yF=B.forwardRef(vF);function bF(e){var t,n,r;let{searchButtonRef:i,keyboardShortcuts:a,isModalActive:o,isAskAiActive:s,initialQuery:c,onAskAiToggle:l,openModal:u,closeModal:d,isHybridModeSupported:f,appId:p,apiKey:m}=gF();if(!p||!m)throw Error("`DocSearchAI` requires `appId` and `apiKey` props.");return B.createElement(B.Fragment,null,B.createElement(_n,{keyboardShortcuts:a,ref:i,translations:(t=e.translations)==null?void 0:t.button,onClick:u}),o&&Et(B.createElement(QP,_(_({},e),{},{appId:p,apiKey:m,initialScrollY:window.scrollY,initialQuery:c,translations:e==null||(n=e.translations)==null?void 0:n.modal,isAskAiActive:s,isHybridModeSupported:f,onAskAiToggle:l,onClose:d})),(r=e.portalContainer)==null?document.body:r))}var xF=function(e,t,n,r){var i;t[0]=0;for(var a=1;a<t.length;a++){var o=t[a++],s=t[a]?(t[0]|=o?1:2,n[t[a++]]):t[++a];o===3?r[0]=s:o===4?r[1]=Object.assign(r[1]||{},s):o===5?(r[1]=r[1]||{})[t[++a]]=s:o===6?r[1][t[++a]]+=s+``:o?(i=e.apply(s,xF(e,s,n,[``,null])),r.push(i),s[0]?t[0]|=2:(t[a-2]=0,t[a]=i)):r.push(s)}return r},SF=new Map;function CF(e){var t=SF.get(this);return t||(t=new Map,SF.set(this,t)),(t=xF(this,t.get(e)||(t.set(e,t=function(e){for(var t,n,r=1,i=``,a=``,o=[0],s=function(e){r===1&&(e||(i=i.replace(/^\s*\n\s*|\s*\n\s*$/g,``)))?o.push(0,e,i):r===3&&(e||i)?(o.push(3,e,i),r=2):r===2&&i===`...`&&e?o.push(4,e,0):r===2&&i&&!e?o.push(5,0,!0,i):r>=5&&((i||!e&&r===5)&&(o.push(r,0,i,n),r=6),e&&(o.push(r,e,0,n),r=6)),i=``},c=0;c<e.length;c++){c&&(r===1&&s(),s(c));for(var l=0;l<e[c].length;l++)t=e[c][l],r===1?t===`<`?(s(),o=[o],r=3):i+=t:r===4?i===`--`&&t===`>`?(r=1,i=``):i=t+i[0]:a?t===a?a=``:i+=t:t===`"`||t===`'`?a=t:t===`>`?(s(),r=1):r&&(t===`=`?(r=5,n=i,i=``):t===`/`&&(r<5||e[c][l+1]===`>`)?(s(),r===3&&(o=o[0]),r=o,(o=o[0]).push(2,0,r),r=0):t===` `||t===` `||t===`
177
+ `||t===`\r`?(s(),r=2):i+=t),r===3&&i===`!--`&&(r=4,o=o[0])}return s(),o}(e)),t),arguments,[])).length>1?t:t[0]}V();let wF=[`container`,`environment`,`transformSearchClient`,`hitComponent`,`resultsFooterComponent`,`footerAction`];function TF(e,t){if(typeof e!=`string`)return e;if(!t)throw Error(`Cannot resolve a selector without a browser environment.`);let n=t.document.querySelector(e);if(!n)throw Error(`Container selector did not match any element: "${e}"`);return n}let EF=CF.bind(C);function DF(e){if(e)return t=>{let n=e(t,{html:EF});return Nt(n)?n:typeof n==`function`?n(t):typeof n==`string`?C(`span`,null,n):n}}function OF(e,t){return n=>{let r=n,{container:i,environment:a,transformSearchClient:o,hitComponent:s,resultsFooterComponent:c,footerAction:l}=r,u=vr(r,wF),d=TF(i,a||(typeof window<`u`?window:void 0)),f=T(),p=!1,m=DF(l);return Dt(C(e,U(U({},u),{},{ref:f,hitComponent:DF(s),resultsFooterComponent:DF(c),footerAction:m?C(m,null):void 0,transformSearchClient:e=>(typeof e==`object`&&e&&`addAlgoliaAgent`in e&&typeof e.addAlgoliaAgent==`function`&&e.addAlgoliaAgent(`docsearch.js`,t),typeof o==`function`?o(e):e)})),d),p=!0,{open(){var e;(e=f.current)==null||e.open()},close(){var e;(e=f.current)==null||e.close()},openAskAi(e){var t;(t=f.current)==null||t.openAskAi(e)},get isReady(){return p},get isOpen(){var e,t;return(e=(t=f.current)==null?void 0:t.isOpen)!=null&&e},destroy(){Lt(d),p=!1}}}}return OF(yF,yn)});
178
178
  //# sourceMappingURL=index.js.map