@skybridge/devtools 0.0.0-dev.affaabb → 0.0.0-dev.b05dbad
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.
|
@@ -9,7 +9,7 @@ Error generating stack: `+e.message+`
|
|
|
9
9
|
`).replace(jd,``)}function Nd(e,t){return t=Md(t),Md(e)===t}function Pd(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Rt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Rt(e,``+r);break;case`className`:St(e,`class`,r);break;case`tabIndex`:St(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:St(e,n,r);break;case`style`:Vt(e,r,o);break;case`data`:if(t!==`object`){St(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Gt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}else typeof o==`function`&&(n===`formAction`?(t!==`input`&&Pd(e,t,`name`,a.name,a,null),Pd(e,t,`formEncType`,a.formEncType,a,null),Pd(e,t,`formMethod`,a.formMethod,a,null),Pd(e,t,`formTarget`,a.formTarget,a,null)):(Pd(e,t,`encType`,a.encType,a,null),Pd(e,t,`method`,a.method,a,null),Pd(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Gt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Kt);break;case`onScroll`:r!=null&&bd(`scroll`,e);break;case`onScrollEnd`:r!=null&&bd(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Gt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:bd(`beforetoggle`,e),bd(`toggle`,e),xt(e,`popover`,r);break;case`xlinkActuate`:Ct(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Ct(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Ct(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Ct(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Ct(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Ct(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Ct(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Ct(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Ct(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:xt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Ut.get(n)||n,xt(e,n,r))}}function Fd(e,t,n,r,a,o){switch(n){case`style`:Vt(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Rt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Rt(e,``+r);break;case`onScroll`:r!=null&&bd(`scroll`,e);break;case`onScrollEnd`:r!=null&&bd(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Kt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!mt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[et]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):xt(e,n,r)}}}function Id(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:bd(`error`,e),bd(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Pd(e,t,o,s,n,null)}}a&&Pd(e,t,`srcSet`,n.srcSet,n,null),r&&Pd(e,t,`src`,n.src,n,null);return;case`input`:bd(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Pd(e,t,r,d,n,null)}}Nt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in bd(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Pd(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Ft(e,!!r,n,!0):Ft(e,!!r,t,!1);return;case`textarea`:for(s in bd(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Pd(e,t,s,c,n,null)}Lt(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Pd(e,t,l,r,n,null)}return;case`dialog`:bd(`beforetoggle`,e),bd(`toggle`,e),bd(`cancel`,e),bd(`close`,e);break;case`iframe`:case`object`:bd(`load`,e);break;case`video`:case`audio`:for(r=0;r<_d.length;r++)bd(_d[r],e);break;case`image`:bd(`error`,e),bd(`load`,e);break;case`details`:bd(`toggle`,e);break;case`embed`:case`source`:case`link`:bd(`error`,e),bd(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Pd(e,t,u,r,n,null)}return;default:if(Ht(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Fd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Pd(e,t,c,r,n,null))}function Ld(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Pd(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Pd(e,t,p,m,r,f)}}Mt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Pd(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Pd(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Ft(e,!!n,n?[]:``,!1):Ft(e,!!n,t,!0)):Ft(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Pd(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Pd(e,t,s,a,r,o)}It(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Pd(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Pd(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Pd(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Pd(e,t,u,p,r,m)}return;default:if(Ht(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Fd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Fd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Pd(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Pd(e,t,f,p,r,m)}function Rd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function zd(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Rd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Rd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Bd=null,Vd=null;function Hd(e){return e.nodeType===9?e:e.ownerDocument}function Ud(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Wd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Gd(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Kd=null;function qd(){var e=window.event;return e&&e.type===`popstate`?e===Kd?!1:(Kd=e,!0):(Kd=null,!1)}var Jd=typeof setTimeout==`function`?setTimeout:void 0,Yd=typeof clearTimeout==`function`?clearTimeout:void 0,Xd=typeof Promise==`function`?Promise:void 0,Zd=typeof queueMicrotask==`function`?queueMicrotask:Xd===void 0?Jd:function(e){return Xd.resolve(null).then(e).catch(Qd)};function Qd(e){setTimeout(function(){throw e})}function $d(e){return e===`head`}function ef(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Fp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)hf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,hf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[ot]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&hf(e.ownerDocument.body);n=i}while(n);Fp(t)}function tf(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function nf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:nf(n),st(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function rf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[ot])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=uf(e.nextSibling),e===null)break}return null}function af(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=uf(e.nextSibling),e===null))return null;return e}function of(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=uf(e.nextSibling),e===null))return null;return e}function sf(e){return e.data===`$?`||e.data===`$~`}function cf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function lf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function uf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var df=null;function ff(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return uf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function pf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function mf(e,t,n){switch(t=Hd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function hf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);st(e)}var gf=new Map,_f=new Set;function vf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var yf=L.d;L.d={f:bf,r:xf,D:wf,C:Tf,L:Ef,m:Df,X:kf,S:Of,M:Af};function bf(){var e=yf.f(),t=Su();return e||t}function xf(e){var t=lt(e);t!==null&&t.tag===5&&t.type===`form`?Ss(t):yf.r(e)}var Sf=typeof document>`u`?null:document;function Cf(e,t,n){var r=Sf;if(r&&typeof t==`string`&&t){var i=jt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),_f.has(i)||(_f.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Id(t,`link`,e),ft(t),r.head.appendChild(t)))}}function wf(e){yf.D(e),Cf(`dns-prefetch`,e,null)}function Tf(e,t){yf.C(e,t),Cf(`preconnect`,e,t)}function Ef(e,t,n){yf.L(e,t,n);var r=Sf;if(r&&e&&t){var i=`link[rel="preload"][as="`+jt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+jt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+jt(n.imageSizes)+`"]`)):i+=`[href="`+jt(e)+`"]`;var a=i;switch(t){case`style`:a=Mf(e);break;case`script`:a=If(e)}gf.has(a)||(e=f({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),gf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Nf(a))||t===`script`&&r.querySelector(Lf(a))||(t=r.createElement(`link`),Id(t,`link`,e),ft(t),r.head.appendChild(t)))}}function Df(e,t){yf.m(e,t);var n=Sf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+jt(r)+`"][href="`+jt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=If(e)}if(!gf.has(a)&&(e=f({rel:`modulepreload`,href:e},t),gf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Lf(a)))return}r=n.createElement(`link`),Id(r,`link`,e),ft(r),n.head.appendChild(r)}}}function Of(e,t,n){yf.S(e,t,n);var r=Sf;if(r&&e){var i=dt(r).hoistableStyles,a=Mf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Nf(a)))s.loading=5;else{e=f({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=gf.get(a))&&Bf(e,n);var c=o=r.createElement(`link`);ft(c),Id(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,zf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function kf(e,t){yf.X(e,t);var n=Sf;if(n&&e){var r=dt(n).hoistableScripts,i=If(e),a=r.get(i);a||(a=n.querySelector(Lf(i)),a||(e=f({src:e,async:!0},t),(t=gf.get(i))&&Vf(e,t),a=n.createElement(`script`),ft(a),Id(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Af(e,t){yf.M(e,t);var n=Sf;if(n&&e){var r=dt(n).hoistableScripts,i=If(e),a=r.get(i);a||(a=n.querySelector(Lf(i)),a||(e=f({src:e,async:!0,type:`module`},t),(t=gf.get(i))&&Vf(e,t),a=n.createElement(`script`),ft(a),Id(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function jf(e,t,n,r){var a=(a=te.current)?vf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Mf(n.href),n=dt(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Mf(n.href);var o=dt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Nf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),gf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},gf.set(e,n),o||Ff(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=If(n),n=dt(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Mf(e){return`href="`+jt(e)+`"`}function Nf(e){return`link[rel="stylesheet"][`+e+`]`}function Pf(e){return f({},e,{"data-precedence":e.precedence,precedence:null})}function Ff(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Id(t,`link`,n),ft(t),e.head.appendChild(t))}function If(e){return`[src="`+jt(e)+`"]`}function Lf(e){return`script[async]`+e}function Rf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+jt(n.href)+`"]`);if(r)return t.instance=r,ft(r),r;var a=f({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),ft(r),Id(r,`style`,a),zf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Mf(n.href);var o=e.querySelector(Nf(a));if(o)return t.state.loading|=4,t.instance=o,ft(o),o;r=Pf(n),(a=gf.get(a))&&Bf(r,a),o=(e.ownerDocument||e).createElement(`link`),ft(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Id(o,`link`,r),t.state.loading|=4,zf(o,n.precedence,e),t.instance=o;case`script`:return o=If(n.src),(a=e.querySelector(Lf(o)))?(t.instance=a,ft(a),a):(r=n,(a=gf.get(o))&&(r=f({},n),Vf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),ft(a),Id(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,zf(r,n.precedence,e));return t.instance}function zf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Bf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Vf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Hf=null;function Uf(e,t,n){if(Hf===null){var r=new Map,i=Hf=new Map;i.set(n,r)}else i=Hf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[ot]||a[$e]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Wf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Gf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Kf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function qf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Mf(r.href),a=t.querySelector(Nf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Xf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,ft(a);return}a=t.ownerDocument||t,r=Pf(r),(i=gf.get(i))&&Bf(r,i),a=a.createElement(`link`),ft(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Id(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Xf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Jf=0;function Yf(e,t){return e.stylesheets&&e.count===0&&Qf(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Qf(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Jf===0&&(Jf=62500*zd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Qf(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Jf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Xf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Qf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Zf=null;function Qf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Zf=new Map,t.forEach($f,e),Zf=null,Xf.call(e))}function $f(e,t){if(!(t.state.loading&4)){var n=Zf.get(e);if(n)var r=n.get(null);else{n=new Map,Zf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Xf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var ep={$$typeof:C,Provider:null,Consumer:null,_currentValue:R,_currentValue2:R,_threadCount:0};function tp(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=He(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=He(0),this.hiddenUpdates=He(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function np(e,t,n,r,i,a,o,s,c,l,u,d){return e=new tp(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ei(3,null,null,t),e.current=a,a.stateNode=e,t=ea(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Na(a),e}function rp(e){return e?(e=Qr,e):Qr}function ip(e,t,n,r,i,a){i=rp(i),r.context===null?r.context=i:r.pendingContext=i,r=Fa(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Ia(e,r,t),n!==null&&(_u(n,e,t),La(n,e,t))}function ap(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function op(e,t){ap(e,t),(e=e.alternate)&&ap(e,t)}function sp(e){if(e.tag===13||e.tag===31){var t=Yr(e,67108864);t!==null&&_u(t,e,67108864),op(e,67108864)}}function cp(e){if(e.tag===13||e.tag===31){var t=hu();t=Je(t);var n=Yr(e,t);n!==null&&_u(n,e,t),op(e,t)}}var lp=!0;function up(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=2,fp(e,t,n,r)}finally{L.p=a,I.T=i}}function dp(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=8,fp(e,t,n,r)}finally{L.p=a,I.T=i}}function fp(e,t,n,r){if(lp){var i=pp(r);if(i===null)Td(e,t,r,mp,n),Tp(e,r);else if(Dp(i,e,t,n,r))r.stopPropagation();else if(Tp(e,r),t&4&&-1<wp.indexOf(e)){for(;i!==null;){var a=lt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Re(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-je(o);s.entanglements[1]|=c,o&=~c}rd(a),!(Ll&6)&&(iu=ye()+500,id(0,!1))}}break;case 31:case 13:s=Yr(a,2),s!==null&&_u(s,a,2),Su(),op(a,2)}if(a=pp(r),a===null&&Td(e,t,r,mp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Td(e,t,r,null,n)}}function pp(e){return e=Jt(e),hp(e)}var mp=null;function hp(e){if(mp=null,e=ct(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return mp=e,null}function gp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(be()){case xe:return 2;case Se:return 8;case Ce:case we:return 32;case Te:return 268435456;default:return 32}default:return 32}}var _p=!1,vp=null,yp=null,bp=null,xp=new Map,Sp=new Map,Cp=[],wp=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Tp(e,t){switch(e){case`focusin`:case`focusout`:vp=null;break;case`dragenter`:case`dragleave`:yp=null;break;case`mouseover`:case`mouseout`:bp=null;break;case`pointerover`:case`pointerout`:xp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Sp.delete(t.pointerId)}}function Ep(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=lt(t),t!==null&&sp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Dp(e,t,n,r,i){switch(t){case`focusin`:return vp=Ep(vp,e,t,n,r,i),!0;case`dragenter`:return yp=Ep(yp,e,t,n,r,i),!0;case`mouseover`:return bp=Ep(bp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return xp.set(a,Ep(xp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Sp.set(a,Ep(Sp.get(a)||null,e,t,n,r,i)),!0}return!1}function Op(e){var t=ct(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,Ze(e.priority,function(){cp(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,Ze(e.priority,function(){cp(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function kp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=pp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);qt=r,n.target.dispatchEvent(r),qt=null}else return t=lt(n),t!==null&&sp(t),e.blockedOn=n,!1;t.shift()}return!0}function Ap(e,t,n){kp(e)&&n.delete(t)}function jp(){_p=!1,vp!==null&&kp(vp)&&(vp=null),yp!==null&&kp(yp)&&(yp=null),bp!==null&&kp(bp)&&(bp=null),xp.forEach(Ap),Sp.forEach(Ap)}function Mp(e,n){e.blockedOn===n&&(e.blockedOn=null,_p||(_p=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,jp)))}var Np=null;function Pp(e){Np!==e&&(Np=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Np===e&&(Np=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(hp(r||n)===null)continue;break}var a=lt(n);a!==null&&(e.splice(t,3),t-=3,bs(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Fp(e){function t(t){return Mp(t,e)}vp!==null&&Mp(vp,e),yp!==null&&Mp(yp,e),bp!==null&&Mp(bp,e),xp.forEach(t),Sp.forEach(t);for(var n=0;n<Cp.length;n++){var r=Cp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Cp.length&&(n=Cp[0],n.blockedOn===null);)Op(n),n.blockedOn===null&&Cp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[et]||null;if(typeof a==`function`)o||Pp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[et]||null)s=o.formAction;else if(hp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Pp(n)}}}function Ip(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Lp(e){this._internalRoot=e}Rp.prototype.render=Lp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;ip(n,hu(),e,t,null,null)},Rp.prototype.unmount=Lp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;ip(e.current,2,null,e,null,null),Su(),t[tt]=null}};function Rp(e){this._internalRoot=e}Rp.prototype.unstable_scheduleHydration=function(e){if(e){var t=Xe();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Cp.length&&t!==0&&t<Cp[n].priority;n++);Cp.splice(n,0,e),n===0&&Op(e)}};var zp=n.version;if(zp!==`19.2.4`)throw Error(i(527,zp,`19.2.4`));L.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:d(e),e=e===null?null:e.stateNode,e};var Bp={bundleType:0,version:`19.2.4`,rendererPackageName:`react-dom`,currentDispatcherRef:I,reconcilerVersion:`19.2.4`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Vp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Vp.isDisabled&&Vp.supportsFiber)try{Oe=Vp.inject(Bp),ke=Vp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Us,s=Ws,c=Gs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=np(e,1,!1,null,null,n,r,null,o,s,c,Ip),e[tt]=t.current,Cd(e),new Lp(t)}})),y=s(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=v()})),b=u(p(),1),x=y(),S=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},C=new class extends S{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},w={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},T=new class{#e=w;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function E(e){setTimeout(e,0)}var D=typeof window>`u`||`Deno`in globalThis;function O(){}function k(e,t){return typeof e==`function`?e(t):e}function A(e){return typeof e==`number`&&e>=0&&e!==1/0}function j(e,t){return Math.max(e+(t||0)-Date.now(),0)}function M(e,t){return typeof e==`function`?e(t):e}function N(e,t){return typeof e==`function`?e(t):e}function P(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==I(o,t.options))return!1}else if(!R(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function F(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(L(t.options.mutationKey)!==L(a))return!1}else if(!R(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function I(e,t){return(t?.queryKeyHashFn||L)(e)}function L(e){return JSON.stringify(e,(e,t)=>U(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function R(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>R(e[n],t[n])):!1}var z=Object.prototype.hasOwnProperty;function B(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=H(e)&&H(t);if(!r&&!(U(e)&&U(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:z.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=B(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function V(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function H(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function U(e){if(!ee(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!ee(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function ee(e){return Object.prototype.toString.call(e)===`[object Object]`}function W(e){return new Promise(t=>{T.setTimeout(t,e)})}function te(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:B(e,t)}function ne(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function re(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var ie=Symbol();function ae(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===ie?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function oe(e,t){return typeof e==`function`?e(...t):!!e}function se(e,t,n){let r=!1,i;return Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var ce=(()=>{let e=()=>D;return{isServer(){return e()},setIsServer(t){e=t}}})();function le(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var ue=E;function de(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=ue,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var fe=de(),pe=new class extends S{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function me(e){return Math.min(1e3*2**e,3e4)}function he(e){return(e??`online`)===`online`?pe.isOnline():!0}var ge=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function _e(e){let t=!1,n=0,r,i=le(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new ge(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>C.isFocused()&&(e.networkMode===`always`||pe.isOnline())&&e.canRun(),u=()=>he(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(ce.isServer()?0:3),o=e.retryDelay??me,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),W(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var ve=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),A(this.gcTime)&&(this.#e=T.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ce.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e&&=(T.clearTimeout(this.#e),void 0)}},ye=class extends ve{#e;#t;#n;#r;#i;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#r=e.client,this.#n=this.#r.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=Se(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#i?.promise}setOptions(e){if(this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Se(this.options);e.data!==void 0&&(this.setState(xe(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#n.remove(this)}setData(e,t){let n=te(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#c({type:`setState`,state:e,setStateOptions:t})}cancel(e){let t=this.#i?.promise;return this.#i?.cancel(e),t?t.then(O).catch(O):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#e}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>N(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ie||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>M(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!j(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#i&&(this.#o||this.#s()?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#n.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#s(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#i?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},i=()=>{let e=ae(this.options,t),n=(()=>{let e={client:this.#r,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#o=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:i};return r(e),e})();this.options.behavior?.onFetch(a,this),this.#t=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta}),this.#i=_e({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof ge&&e.revert&&this.setState({...this.#t,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#i.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#n.config.onSuccess?.(e,this),this.#n.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof ge){if(e.silent)return this.#i.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#n.config.onError?.(e,this),this.#n.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#c(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...be(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...xe(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}})(this.state),fe.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#n.notify({query:this,type:`updated`,action:e})})}};function be(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:he(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function xe(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Se(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Ce=class extends S{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=le(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Te(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ee(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ee(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof N(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!V(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&De(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||N(this.options.enabled,this.#t)!==N(t.enabled,this.#t)||M(this.options.staleTime,this.#t)!==M(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||N(this.options.enabled,this.#t)!==N(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return ke(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(O)),t}#g(){this.#b();let e=M(this.options.staleTime,this.#t);if(ce.isServer()||this.#r.isStale||!A(e))return;let t=j(this.#r.dataUpdatedAt,e)+1;this.#d=T.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(ce.isServer()||N(this.options.enabled,this.#t)===!1||!A(this.#p)||this.#p===0)&&(this.#f=T.setInterval(()=>{(this.options.refetchIntervalInBackground||C.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d&&=(T.clearTimeout(this.#d),void 0)}#x(){this.#f&&=(T.clearInterval(this.#f),void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Te(e,t),o=i&&De(e,n,t,r);(a||o)&&(l={...l,...be(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=te(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=te(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Oe(e,t),refetch:this.refetch,promise:this.#o,isEnabled:N(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{i(this.#o=x.promise=le())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a();break}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!V(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){fe.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function we(e,t){return N(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function Te(e,t){return we(e,t)||e.state.data!==void 0&&Ee(e,t,t.refetchOnMount)}function Ee(e,t,n){if(N(t.enabled,e)!==!1&&M(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Oe(e,t)}return!1}function De(e,t,n,r){return(e!==t||N(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Oe(e,n)}function Oe(e,t){return N(t.enabled,e)!==!1&&e.isStaleByTime(M(t.staleTime,e))}function ke(e,t){return!V(e.getCurrentResult(),t)}function Ae(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{se(e,()=>t.signal,()=>n=!0)},u=ae(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?re:ne;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Me:je,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:je(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function je(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Me(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Ne=class extends ve{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Pe(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=_e({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}})(this.state),fe.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Pe(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Fe=class extends S{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new Ne({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Ie(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Ie(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Ie(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=Ie(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){fe.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>F(t,e))}findAll(e={}){return this.getAll().filter(t=>F(e,t))}notify(e){fe.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return fe.batch(()=>Promise.all(e.map(e=>e.continue().catch(O))))}};function Ie(e){return e.options.scope?.id}var Le=class extends S{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),V(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&L(t.mutationKey)!==L(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Pe();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){fe.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},Re=class extends S{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??I(r,t),a=this.get(i);return a||(a=new ye({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){fe.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>P(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>P(e,t)):t}notify(e){fe.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){fe.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){fe.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ze=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Re,this.#t=e.mutationCache||new Fe,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=C.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=pe.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(M(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=k(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return fe.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;fe.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return fe.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=fe.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(O).catch(O)}invalidateQueries(e,t={}){return fe.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=fe.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(O)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(O)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(M(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(O).catch(O)}fetchInfiniteQuery(e){return e.behavior=Ae(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(O).catch(O)}ensureInfiniteQueryData(e){return e.behavior=Ae(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return pe.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(L(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{R(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(L(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{R(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=I(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===ie&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Be=s((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),G=s(((e,t)=>{t.exports=Be()}))(),Ve=b.createContext(void 0),He=e=>{let t=b.useContext(Ve);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Ue=({client:e,children:t})=>(b.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,G.jsx)(Ve.Provider,{value:e,children:t})),We=b.createContext(!1),Ge=()=>b.useContext(We);We.Provider;function Ke(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var qe=b.createContext(Ke()),Je=()=>b.useContext(qe),Ye=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?oe(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Xe=e=>{b.useEffect(()=>{e.clearReset()},[e])},Ze=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||oe(n,[e.error,r])),Qe=(e,t)=>t.state.data===void 0,$e=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},et=(e,t)=>e.isLoading&&e.isFetching&&!t,tt=(e,t)=>e?.suspense&&t.isPending,nt=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function rt(e,t,n){let r=Ge(),i=Je(),a=He(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?`isRestoring`:`optimistic`,$e(o),Ye(o,i,s),Xe(i);let c=!a.getQueryCache().get(o.queryHash),[l]=b.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&e.subscribed!==!1;if(b.useSyncExternalStore(b.useCallback(e=>{let t=d?l.subscribe(fe.batchCalls(e)):O;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),b.useEffect(()=>{l.setOptions(o)},[o,l]),tt(o,u))throw nt(o,l,i);if(Ze({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,u),o.experimental_prefetchInRender&&!ce.isServer()&&et(u,r)&&(c?nt(o,l,i):s?.promise)?.catch(O).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?u:l.trackResult(u)}function it(e,t){return rt({...e,enabled:!0,suspense:!0,throwOnError:Qe,placeholderData:void 0},Ce,t)}function at(e,t){let n=He(t),[r]=b.useState(()=>new Le(n,e));b.useEffect(()=>{r.setOptions(e)},[r,e]);let i=b.useSyncExternalStore(b.useCallback(e=>r.subscribe(fe.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=b.useCallback((e,t)=>{r.mutate(e,t).catch(O)},[r]);if(i.error&&oe(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var ot=ut();function st(e,...t){if(!ot)return;let n=lt(e,...t);performance.mark(n);try{console.log(e,...t)}catch{console.log(n)}}function ct(e,...t){ot&&console.warn(e,...t)}function lt(e,...t){return e.replace(/%[sfdO]/g,e=>{let n=t.shift();return e===`%O`&&n?JSON.stringify(n).replace(/"([^"]+)":/g,`$1:`):String(n)})}function ut(){if(typeof window>`u`)return({}.DEBUG||``).includes(`nuqs`);try{let e=`nuqs-localStorage-test`;if(typeof localStorage>`u`)return!1;localStorage.setItem(e,e);let t=localStorage.getItem(e)===e;return localStorage.removeItem(e),t&&(localStorage.getItem(`debug`)||``).includes(`nuqs`)}catch{return!1}}var dt={303:`Multiple adapter contexts detected. This might happen in monorepos.`,404:`nuqs requires an adapter to work with your framework.`,409:"Multiple versions of the library are loaded. This may lead to unexpected behavior. Currently using `%s`, but `%s` (via the %s adapter) was about to load on top.",414:`Max safe URL length exceeded. Some browsers may not be able to accept this URL. Consider limiting the amount of state stored in the URL.`,422:"Invalid options combination: `limitUrlUpdates: debounce` should be used in SSR scenarios, with `shallow: false`",429:"URL update rate-limited by the browser. Consider increasing `throttleMs` for key(s) `%s`. %O",500:`Empty search params cache. Search params can't be accessed in Layouts.`,501:"Search params cache already populated. Have you called `parse` twice?"};function ft(e){return`[nuqs] ${dt[e]}
|
|
10
10
|
See https://nuqs.dev/NUQS-${e}`}function pt(e){if(e.size===0)return``;let t=[];for(let[n,r]of e.entries()){let e=n.replace(/#/g,`%23`).replace(/&/g,`%26`).replace(/\+/g,`%2B`).replace(/=/g,`%3D`).replace(/\?/g,`%3F`);t.push(`${e}=${mt(r)}`)}return`?`+t.join(`&`)}function mt(e){return e.replace(/%/g,`%25`).replace(/\+/g,`%2B`).replace(/ /g,`+`).replace(/#/g,`%23`).replace(/&/g,`%26`).replace(/"/g,`%22`).replace(/'/g,`%27`).replace(/`/g,`%60`).replace(/</g,`%3C`).replace(/>/g,`%3E`).replace(/[\x00-\x1F]/g,e=>encodeURIComponent(e))}var ht=(0,b.createContext)({useAdapter(){throw Error(ft(404))}});ht.displayName=`NuqsAdapterContext`,ot&&typeof window<`u`&&(window.__NuqsAdapterContext&&window.__NuqsAdapterContext!==ht&&console.error(ft(303)),window.__NuqsAdapterContext=ht);function gt(e){return({children:t,defaultOptions:n,processUrlSearchParams:r,...i})=>(0,b.createElement)(ht.Provider,{...i,value:{useAdapter:e,defaultOptions:n,processUrlSearchParams:r}},t)}function _t(e){let t=(0,b.useContext)(ht);if(!(`useAdapter`in t))throw Error(ft(404));return t.useAdapter(e)}var vt=()=>(0,b.useContext)(ht).defaultOptions,yt=()=>(0,b.useContext)(ht).processUrlSearchParams;function bt(){if(typeof window>`u`||!window.GestureEvent)return 50;try{let e=navigator.userAgent?.match(/version\/([\d\.]+) safari/i);return parseFloat(e[1])>=17?120:320}catch{return 320}}function xt(e){return{method:`throttle`,timeMs:e}}var St=xt(bt());function Ct(e){return e===null||Array.isArray(e)&&e.length===0}function wt(e,t,n){if(typeof e==`string`)n.set(t,e);else{n.delete(t);for(let r of e)n.append(t,r);n.has(t)||n.set(t,``)}return n}function Tt(){let e=new Map;return{on(t,n){let r=e.get(t)||[];return r.push(n),e.set(t,r),()=>this.off(t,n)},off(t,n){let r=e.get(t);r&&e.set(t,r.filter(e=>e!==n))},emit(t,n){e.get(t)?.forEach(e=>e(n))}}}function Et(e,t,n){function r(){e(),n.removeEventListener(`abort`,a)}let i=setTimeout(r,t);function a(){clearTimeout(i),n.removeEventListener(`abort`,a)}n.addEventListener(`abort`,a)}function Dt(){let e=Promise;if(Promise.hasOwnProperty(`withResolvers`))return Promise.withResolvers();let t=()=>{},n=()=>{};return{promise:new e((e,r)=>{t=e,n=r}),resolve:t,reject:n}}function Ot(e,t){let n=t;for(let t=e.length-1;t>=0;t--){let r=e[t];if(!r)continue;let i=n;n=()=>r(i)}n()}function kt(){return new URLSearchParams(location.search)}var At=class{updateMap=new Map;options={history:`replace`,scroll:!1,shallow:!0};timeMs=St.timeMs;transitions=new Set;resolvers=null;controller=null;lastFlushedAt=0;resetQueueOnNextPush=!1;push({key:e,query:t,options:n},r=St.timeMs){this.resetQueueOnNextPush&&=(this.reset(),!1),st(`[nuqs gtq] Enqueueing %s=%s %O`,e,t,n),this.updateMap.set(e,t),n.history===`push`&&(this.options.history=`push`),n.scroll&&(this.options.scroll=!0),n.shallow===!1&&(this.options.shallow=!1),n.startTransition&&this.transitions.add(n.startTransition),(!Number.isFinite(this.timeMs)||r>this.timeMs)&&(this.timeMs=r)}getQueuedQuery(e){return this.updateMap.get(e)}getPendingPromise({getSearchParamsSnapshot:e=kt}){return this.resolvers?.promise??Promise.resolve(e())}flush({getSearchParamsSnapshot:e=kt,rateLimitFactor:t=1,...n},r){if(this.controller??=new AbortController,!Number.isFinite(this.timeMs))return st(`[nuqs gtq] Skipping flush due to throttleMs=Infinity`),Promise.resolve(e());if(this.resolvers)return this.resolvers.promise;this.resolvers=Dt();let i=()=>{this.lastFlushedAt=performance.now();let[t,i]=this.applyPendingUpdates({...n,autoResetQueueOnUpdate:n.autoResetQueueOnUpdate??!0,getSearchParamsSnapshot:e},r);i===null?(this.resolvers.resolve(t),this.resetQueueOnNextPush=!0):this.resolvers.reject(t),this.resolvers=null};return Et(()=>{let e=performance.now()-this.lastFlushedAt,n=this.timeMs,r=t*Math.max(0,n-e);st(`[nuqs gtq] Scheduling flush in %f ms. Throttled at %f ms (x%f)`,r,n,t),r===0?i():Et(i,r,this.controller.signal)},0,this.controller.signal),this.resolvers.promise}abort(){return this.controller?.abort(),this.controller=new AbortController,this.resolvers?.resolve(new URLSearchParams),this.resolvers=null,this.reset()}reset(){let e=Array.from(this.updateMap.keys());return st(`[nuqs gtq] Resetting queue %s`,JSON.stringify(Object.fromEntries(this.updateMap))),this.updateMap.clear(),this.transitions.clear(),this.options={history:`replace`,scroll:!1,shallow:!0},this.timeMs=St.timeMs,e}applyPendingUpdates(e,t){let{updateUrl:n,getSearchParamsSnapshot:r}=e,i=r();if(st(`[nuqs gtq] Applying %d pending update(s) on top of %s`,this.updateMap.size,i.toString()),this.updateMap.size===0)return[i,null];let a=Array.from(this.updateMap.entries()),o={...this.options},s=Array.from(this.transitions);e.autoResetQueueOnUpdate&&this.reset(),st(`[nuqs gtq] Flushing queue %O with options %O`,a,o);for(let[e,t]of a)t===null?i.delete(e):i=wt(t,e,i);t&&(i=t(i));try{return Ot(s,()=>{n(i,o)}),[i,null]}catch(e){return console.error(ft(429),a.map(([e])=>e).join(),e),[i,e]}}},jt=new At;function Mt(e,t,n){let r=(0,b.useCallback)(()=>{let t=Object.fromEntries(e.map(e=>[e,n(e)]));return[JSON.stringify(t),t]},[e.join(`,`),n]),i=(0,b.useRef)(null);return i.current===null&&(i.current=r()),(0,b.useSyncExternalStore)((0,b.useCallback)(n=>{let r=e.map(e=>t(e,n));return()=>r.forEach(e=>e())},[e.join(`,`),t]),()=>{let[e,t]=r();return i.current[0]===e?i.current[1]:(i.current=[e,t],t)},()=>i.current[1])}var Nt=class{callback;resolvers=Dt();controller=new AbortController;queuedValue=void 0;constructor(e){this.callback=e}abort(){this.controller.abort(),this.queuedValue=void 0}push(e,t){return this.queuedValue=e,this.controller.abort(),this.controller=new AbortController,Et(()=>{let t=this.resolvers;try{st(`[nuqs dq] Flushing debounce queue`,e);let n=this.callback(e);st(`[nuqs dq] Reset debounce queue %O`,this.queuedValue),this.queuedValue=void 0,this.resolvers=Dt(),n.then(e=>t.resolve(e)).catch(e=>t.reject(e))}catch(e){this.queuedValue=void 0,t.reject(e)}},t,this.controller.signal),this.resolvers.promise}},Pt=new class{throttleQueue;queues=new Map;queuedQuerySync=Tt();constructor(e=new At){this.throttleQueue=e}useQueuedQueries(e){return Mt(e,(e,t)=>this.queuedQuerySync.on(e,t),e=>this.getQueuedQuery(e))}push(e,t,n,r){if(!Number.isFinite(t)){let e=n.getSearchParamsSnapshot??kt;return Promise.resolve(e())}let i=e.key;if(!this.queues.has(i)){st("[nuqs dqc] Creating debounce queue for `%s`",i);let e=new Nt(e=>(this.throttleQueue.push(e),this.throttleQueue.flush(n,r).finally(()=>{this.queues.get(e.key)?.queuedValue===void 0&&(st("[nuqs dqc] Cleaning up empty queue for `%s`",e.key),this.queues.delete(e.key)),this.queuedQuerySync.emit(e.key)})));this.queues.set(i,e)}st(`[nuqs dqc] Enqueueing debounce update %O`,e);let a=this.queues.get(i).push(e,t);return this.queuedQuerySync.emit(i),a}abort(e){let t=this.queues.get(e);return t?(st(`[nuqs dqc] Aborting debounce queue %s=%s`,e,t.queuedValue?.query),this.queues.delete(e),t.abort(),this.queuedQuerySync.emit(e),e=>(e.then(t.resolvers.resolve,t.resolvers.reject),e)):e=>e}abortAll(){for(let[e,t]of this.queues.entries())st(`[nuqs dqc] Aborting debounce queue %s=%s`,e,t.queuedValue?.query),t.abort(),t.resolvers.resolve(new URLSearchParams),this.queuedQuerySync.emit(e);this.queues.clear()}getQueuedQuery(e){let t=this.queues.get(e)?.queuedValue?.query;return t===void 0?this.throttleQueue.getQueuedQuery(e):t}}(jt);function Ft(e,t){return e===t?!0:e===null||t===null||typeof e==`string`||typeof t==`string`||e.length!==t.length?!1:e.every((e,n)=>e===t[n])}function It(e,t,n){return r=>{if(!(t.length===0||t.some(t=>!Ft(r.getAll(t),e.getAll(t)))))return st("[nuqs `%s`] no change, returning previous",t.join(`,`),r),r;let i=Lt(e,t,n);return st(`[nuqs \`%s\`] subbed search params change
|
|
11
11
|
from %O
|
|
12
|
-
to %O`,t.join(`,`),r,i),i}}function Lt(e,t,n){if(t.length===0)return e;let r=n?new URLSearchParams(e):e;for(let n of e.keys())t.includes(n)||r.delete(n);return r}var Rt=`__nuqs__`,zt=Tt();function Bt(e){return function(t,n){let r=new URL(location.href);r.search=pt(t),st(`[nuqs react] Updating url: %s`,r),e&&n.shallow===!1?(n.history===`push`?location.assign:location.replace).call(location,r):(n.history===`push`?history.pushState:history.replaceState).call(history,history.state,Rt,r),zt.emit(`update`,t),n.scroll===!0&&window.scrollTo({top:0})}}var Vt=(0,b.createContext)({fullPageNavigationOnShallowFalseUpdates:!1});function Ht(e){let{fullPageNavigationOnShallowFalseUpdates:t}=(0,b.useContext)(Vt),[n,r]=(0,b.useState)(()=>typeof location>`u`?new URLSearchParams:Lt(new URLSearchParams(location.search),e,!1));return(0,b.useEffect)(()=>{let t=()=>{r(It(new URLSearchParams(location.search),e,!1))},n=t=>{r(It(t,e,!0))};return zt.on(`update`,n),window.addEventListener(`popstate`,t),()=>{zt.off(`update`,n),window.removeEventListener(`popstate`,t)}},[e.join(`&`)]),{searchParams:n,updateUrl:(0,b.useMemo)(()=>Bt(t),[t])}}var Ut=gt(Ht);function Wt({children:e,fullPageNavigationOnShallowFalseUpdates:t=!1,...n}){return(0,b.createElement)(Vt.Provider,{value:{fullPageNavigationOnShallowFalseUpdates:t}},(0,b.createElement)(Ut,{...n,children:e}))}var Gt=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Kt=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),qt=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Jt=e=>{let t=qt(e);return t.charAt(0).toUpperCase()+t.slice(1)},Yt={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`},Xt=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Zt=(0,b.createContext)({}),Qt=()=>(0,b.useContext)(Zt),$t=(0,b.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=Qt()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,b.createElement)(`svg`,{ref:c,...Yt,width:t??l??Yt.width,height:t??l??Yt.height,stroke:e??f,strokeWidth:m,className:Gt(`lucide`,p,i),...!a&&!Xt(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,b.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),en=(e,t)=>{let n=(0,b.forwardRef)(({className:n,...r},i)=>(0,b.createElement)($t,{ref:i,iconNode:t,className:Gt(`lucide-${Kt(Jt(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Jt(e),n},tn=en(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),nn=en(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),rn=en(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),an=en(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),on=en(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),K=en(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),sn=en(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),cn=en(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),ln=en(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),un=en(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),dn=en(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),fn=en(`plug-zap`,[[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m18 3-4 4h6l-4 4`,key:`16psg9`}]]),pn=en(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),mn=en(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),hn=en(`trash`,[[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),gn=en(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function _n(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function vn(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function yn(e){return e/100*window.innerHeight}function bn(e){return e/100*window.innerWidth}function xn(e){switch(typeof e){case`number`:return[e,`px`];case`string`:{let t=parseFloat(e);return e.endsWith(`%`)?[t,`%`]:e.endsWith(`px`)?[t,`px`]:e.endsWith(`rem`)?[t,`rem`]:e.endsWith(`em`)?[t,`em`]:e.endsWith(`vh`)?[t,`vh`]:e.endsWith(`vw`)?[t,`vw`]:[t,`%`]}}}function Sn({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=xn(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=vn(t,i);break;case`em`:r=_n(t,i);break;case`vh`:r=yn(i);break;case`vw`:r=bn(i);break}return r}function Cn(e){return parseFloat(e.toFixed(3))}function wn({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>(e+=t===`horizontal`?n.element.offsetWidth:n.element.offsetHeight,e),0)}function Tn(e){let{panels:t}=e,n=wn({group:e});return n===0?t.map(e=>({groupResizeBehavior:e.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:e.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let{element:t,panelConstraints:r}=e,i=0;r.collapsedSize!==void 0&&(i=Cn(Sn({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=Cn(Sn({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=Cn(Sn({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=Cn(Sn({groupSize:n,panelElement:t,styleProp:r.maxSize})/n*100)),{groupResizeBehavior:r.groupResizeBehavior,collapsedSize:i,collapsible:r.collapsible===!0,defaultSize:a,disabled:r.disabled,minSize:o,maxSize:s,panelId:e.id}})}function En(e,t=`Assertion error`){if(!e)throw Error(t)}function Dn(e,t){return Array.from(t).sort(e===`horizontal`?On:kn)}function On(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function kn(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function An(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function jn(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function Mn({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=jn(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return En(i,`No rect found`),i}var Nn;function Pn(){return Nn===void 0&&(Nn=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),Nn}function Fn(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=Dn(n,Array.from(t.children).filter(An).map(e=>({element:e}))).map(({element:e})=>e),o=[],s=!1,c=!1,l=-1,u=-1,d=0,f,p=[];{let e=-1;for(let t of a)t.hasAttribute(`data-panel`)&&(e++,t.hasAttribute(`data-disabled`)||(d++,l===-1&&(l=e),u=e))}if(d>1){let t=-1;for(let d of a)if(d.hasAttribute(`data-panel`)){t++;let i=r.find(e=>e.element===d);if(i){if(f){let r=f.element.getBoundingClientRect(),a=d.getBoundingClientRect(),m;if(c){let e=n===`horizontal`?new DOMRect(r.right,r.top,0,r.height):new DOMRect(r.left,r.bottom,r.width,0),t=n===`horizontal`?new DOMRect(a.left,a.top,0,a.height):new DOMRect(a.left,a.top,a.width,0);switch(p.length){case 0:m=[e,t];break;case 1:{let i=p[0];m=[i,Mn({orientation:n,rects:[r,a],targetRect:i.element.getBoundingClientRect()})===r?t:e];break}default:m=p;break}}else m=p.length?p:[n===`horizontal`?new DOMRect(r.right,a.top,a.left-r.right,a.height):new DOMRect(a.left,r.bottom,a.width,a.top-r.bottom)];for(let n of m){let r=`width`in n?n:n.element.getBoundingClientRect(),a=Pn()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(r.width<a){let e=a-r.width;r=new DOMRect(r.x-e/2,r.y,r.width+e,r.height)}if(r.height<a){let e=a-r.height;r=new DOMRect(r.x,r.y-e/2,r.width,r.height+e)}!s&&!(t<=l||t>u)&&o.push({group:e,groupSize:wn({group:e}),panels:[f,i],separator:`width`in n?void 0:n,rect:r}),s=!1}}c=!1,f=i,p=[]}}else if(d.hasAttribute(`data-separator`)){d.ariaDisabled!==null&&(s=!0);let e=i.find(e=>e.element===d);e?p.push(e):(f=void 0,p=[])}else c=!0}return o}var In=class{#e={};addListener(e,t){let n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){r===null&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(n!==void 0){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}},Ln=new Map,Rn=new In;function zn(e){Ln=new Map(Ln),Ln.delete(e)}function Bn(e,t){for(let[t]of Ln)if(t.id===e)return t}function Vn(e,t){for(let[t,n]of Ln)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Hn(){return Ln}function Un(e,t){return Rn.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function Wn(e,t){let n=Ln.get(e);Ln=new Map(Ln),Ln.set(e,t),Rn.emit(`groupChange`,{group:e,prev:n,next:t})}function Gn(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=jn(n,a.rect);switch(e){case`horizontal`:t.x<=i.x&&(r=a,i=t);break;case`vertical`:t.y<=i.y&&(r=a,i=t);break}}return r?{distance:i,hitRegion:r}:void 0}function Kn(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function qn(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:$n(e),b:$n(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();En(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:Qn(Zn(n.a)),b:Qn(Zn(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var Jn=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Yn(e){let t=getComputedStyle(er(e)??e).display;return t===`flex`||t===`inline-flex`}function Xn(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||Yn(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||Jn.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function Zn(e){let t=e.length;for(;t--;){let n=e[t];if(En(n,`Missing node`),Xn(n))return n}return null}function Qn(e){return e&&Number(getComputedStyle(e).zIndex)||0}function $n(e){let t=[];for(;e;)t.push(e),e=er(e);return t}function er(e){let{parentNode:t}=e;return Kn(t)?t.host:t}function tr(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function nr({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!An(n)||n.contains(e)||e.contains(n))return!0;if(qn(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(tr(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function rr(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=Fn(r),a=Gn(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&nr({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function ir(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function ar(e,t,n=0){return Math.abs(Cn(e)-Cn(t))<=n}function or(e,t){return ar(e,t)?0:e>t?1:-1}function sr({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:s=100,minSize:c=0}=t;if(o&&!e)return n;if(or(r,c)<0)if(a){let e=(i+c)/2;r=or(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=Cn(r),r}function cr({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(ar(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;En(u!=null,`Invalid first pivot index`),En(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];En(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(En(n!=null,`Previous layout not found for panel index ${t}`),ar(n,i)){let t=o-n;or(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];En(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(En(n!=null,`Previous layout not found for panel index ${t}`),ar(n,o)){let t=n-i;or(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];En(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&or(i,c)<0)if(e>0){let t=c-o,n=t/2;or(i+e,c)<0&&(e=or(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;or(i-e,c)<0&&(e=or(100+e,n)>0?0:-t)}break}}{let t=e<0?1:-1,r=e<0?d:u,i=0;for(;;){let e=s[r];En(e!=null,`Previous layout not found for panel index ${r}`);let a=sr({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e;if(i+=a,r+=t,r<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?u:d;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=s[t];En(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=sr({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!ar(i,c)&&(f+=i-c,l[t]=c,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(ir(c,l))return i;{let t=e<0?d:u,r=s[t];En(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=sr({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!ar(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];En(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=sr({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(ar(i,s)||(t-=s-i,l[r]=s),ar(t,0))break;e>0?r--:r++}}}if(!ar(Object.values(l).reduce((e,t)=>t+e,0),100,.1))return i;let p=Object.keys(i);return l.reduce((e,t,n)=>(e[p[n]]=t,e),{})}function lr(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||or(e[n],t[n])!==0)return!1;return!0}function ur({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],i=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(`, `)}`);if(!ar(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];En(t!=null,`No layout data found for index ${e}`),r[e]=100/i*t}let a=0;for(let e=0;e<t.length;e++){let i=n[e];En(i!=null,`No layout data found for index ${e}`);let o=r[e];En(o!=null,`No layout data found for index ${e}`);let s=sr({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!ar(a,0))for(let e=0;e<t.length;e++){let n=r[e];En(n!=null,`No layout data found for index ${e}`);let i=n+a,o=sr({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,ar(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function dr({groupId:e,panelId:t}){let n=()=>{let t=Hn();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,groupSize:o,separatorToPanels:s}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,groupSize:o,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=e=>{let r=a();if(e===r)return;let{defaultLayoutDeferred:i,derivedPanelConstraints:o,group:s,groupSize:c,layout:l,separatorToPanels:u}=n(),d=s.panels.findIndex(e=>e.id===t),f=d===s.panels.length-1,p=ur({layout:cr({delta:f?r-e:e-r,initialLayout:l,panelConstraints:o,pivotIndices:f?[d-1,d]:[d,d+1],prevLayout:l,trigger:`imperative-api`}),panelConstraints:o});lr(l,p)||Wn(s,{defaultLayoutDeferred:i,derivedPanelConstraints:o,groupSize:c,layout:p,separatorToPanels:u})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),s=a();e&&s!==t&&(n.expandToSize=s,o(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:s}=i(),c=a();if(e&&c===t){let e=s.expandToSize??n;e===0&&(e=1),o(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&ar(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=wn({group:t});o(Cn(Sn({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function fr(e){e.defaultPrevented||rr(e,Hn()).forEach(t=>{if(t.separator){let n=t.panels.find(e=>e.panelConstraints.defaultSize!==void 0);if(n){let r=n.panelConstraints.defaultSize,i=dr({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function pr(e){let t=Hn();for(let[n]of t)if(n.separators.some(t=>t.element===e))return n;throw Error(`Could not find parent Group for separator element`)}function mr({groupId:e}){let t=()=>{let t=Hn();for(let[n,r]of t)if(n.id===e)return{group:n,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,groupSize:a,layout:o,separatorToPanels:s}=t(),c=ur({layout:e,panelConstraints:r});return n?o:(lr(o,c)||Wn(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function hr(e,t){let n=pr(e),r=Vn(n.id,!0),i=n.separators.find(t=>t.element===e);En(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);En(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=mr({groupId:n.id}).getLayout(),c=ur({layout:cr({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});lr(s,c)||Wn(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function gr(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=pr(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&hr(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&hr(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&hr(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&hr(t,-5);break;case`End`:e.preventDefault(),hr(t,100);break;case`Enter`:{e.preventDefault();let n=pr(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=Vn(n.id,!0),o=n.separators.find(e=>e.element===t);En(o,`Matching separator not found`);let s=a.get(o);En(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(En(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];hr(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=pr(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);En(r!==null,`Index not found`),n[e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0].focus({preventScroll:!0});break}case`Home`:e.preventDefault(),hr(t,-100);break}}var _r={cursorFlags:0,state:`inactive`},vr=new In;function yr(){return _r}function br(e){return vr.addListener(`change`,e)}function xr(e){let t=_r,n={..._r};n.cursorFlags=e,_r=n,vr.emit(`change`,{prev:t,next:n})}function Sr(e){let t=_r;_r=e,vr.emit(`change`,{prev:t,next:e})}function Cr(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=Hn(),n=rr(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),Sr({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var wr=e=>e,Tr=()=>{},Er=1,Dr=2,Or=4,kr=8,Ar=3,jr=12,Mr;function Nr(){return Mr===void 0&&(Mr=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(Mr=!0)),Mr}function Pr({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case`active`:case`hover`:t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case`horizontal`:r++;break;case`vertical`:i++;break}})}if(!(r===0&&i===0)){switch(n){case`active`:if(e&&Nr()){let t=(e&Er)!==0,n=(e&Dr)!==0,r=(e&Or)!==0,i=(e&kr)!==0;if(t)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}break}return Nr()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var Fr=new WeakMap;function Ir(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Fr.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=yr();switch(r.state){case`active`:case`hover`:{let e=Pr({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(e=>e.group),state:r.state}),i=`*, *:hover {cursor: ${e} !important; }`;if(t===i)return;t=i,e?n.cssRules.length===0?n.insertRule(i):n.replaceSync(i):n.cssRules.length===1&&n.deleteRule(0);break}case`inactive`:t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}Fr.set(e,{prevStyle:t,styleSheet:n})}function Lr({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:a,prevCursorFlags:o}){let s=0;n.forEach(e=>{let{group:n,groupSize:o}=e,{orientation:c,panels:l}=n,{disableCursor:u}=n.mutableState,d=0;d=a?c===`horizontal`?(t.clientX-a.x)/o*100:(t.clientY-a.y)/o*100:c===`horizontal`?t.clientX<0?-100:100:t.clientY<0?-100:100;let f=r.get(n),p=i.get(n);if(!f||!p)return;let{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:_,separatorToPanels:v}=p;if(h&&_&&v){let t=cr({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(lr(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?Er:Dr;break;case`vertical`:s|=d<0?Or:kr;break}}else Wn(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&Ar:c|=s&Ar,t.movementY===0?c|=o&jr:c|=s&jr,xr(c),Ir(e)}function Rr(e){let t=Hn(),n=yr();switch(n.state){case`active`:Lr({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function zr(e){if(e.defaultPrevented)return;let t=yr(),n=Hn();switch(t.state){case`active`:if(e.buttons===0){Sr({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=Vn(e.group.id,!0);Wn(e.group,t)});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}Lr({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=rr(e,n);r.length===0?t.state!==`inactive`&&Sr({cursorFlags:0,state:`inactive`}):Sr({cursorFlags:0,hitRegions:r,state:`hover`}),Ir(e.currentTarget);break}}}function Br(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(yr().state){case`hover`:Sr({cursorFlags:0,state:`inactive`})}}function Vr(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=yr();switch(t.state){case`active`:Sr({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(Ir(e.currentTarget),t.hitRegions.forEach(e=>{let t=Vn(e.group.id,!0);Wn(e.group,t)}),e.preventDefault())}}function Hr(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=Cn(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=Cn((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function Ur(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=wn({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:Cn(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function Wr(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function Gr({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,a=0,o=!1,s=new Map,c=[];for(let l of e.panels){let e=r[l.id]??0;switch(l.panelConstraints.groupResizeBehavior){case`preserve-pixel-size`:{o=!0;let r=Cn(e/100*n/t*100);s.set(l.id,r),i+=r;break}default:c.push(l.id),a+=e;break}}if(!o||c.length===0)return r;let l=100-i,u={...r};if(s.forEach((e,t)=>{u[t]=e}),a>0)for(let e of c)u[e]=Cn((r[e]??0)/a*l);else{let e=Cn(l/c.length);for(let t of c)u[t]=e}return u}function Kr(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}var qr=new Map;function Jr(e){let t=!0;En(e.element.ownerDocument.defaultView,`Cannot register an unmounted Group`);let n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,a=new n(n=>{for(let r of n){let{borderBoxSize:n,target:i}=r;if(i===e.element){if(t){let t=wn({group:e});if(t===0)return;let n=Vn(e.id);if(!n)return;let r=Tn(e),i=n.defaultLayoutDeferred?Hr(r):n.layout,a=ur({layout:Gr({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&lr(n.layout,a)&&Wr(n.derivedPanelConstraints,r)&&n.groupSize===t)return;Wn(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else Ur(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{En(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&a.observe(e.element)});let o=wn({group:e}),s=Tn(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(Kr(e.panels,l)||(l=void 0));let u=ur({layout:e.mutableState.layouts[c]??l??Hr(s),panelConstraints:s}),d=e.element.ownerDocument;qr.set(d,(qr.get(d)??0)+1);let f=new Map;return Fn(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),Wn(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{En(!i.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),i.add(e.id),e.element.addEventListener(`keydown`,gr)}),qr.get(d)===1&&(d.addEventListener(`dblclick`,fr,!0),d.addEventListener(`pointerdown`,Cr,!0),d.addEventListener(`pointerleave`,Rr),d.addEventListener(`pointermove`,zr),d.addEventListener(`pointerout`,Br),d.addEventListener(`pointerup`,Vr,!0)),function(){t=!1,qr.set(d,Math.max(0,(qr.get(d)??0)-1)),zn(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,gr)}),qr.get(d)||(d.removeEventListener(`dblclick`,fr,!0),d.removeEventListener(`pointerdown`,Cr,!0),d.removeEventListener(`pointerleave`,Rr),d.removeEventListener(`pointermove`,zr),d.removeEventListener(`pointerout`,Br),d.removeEventListener(`pointerup`,Vr,!0)),a.disconnect()}}function Yr(){let[e,t]=(0,b.useState)({});return[e,(0,b.useCallback)(()=>t({}),[])]}function Xr(e){let t=(0,b.useId)();return`${e??t}`}var Zr=typeof window<`u`?b.useLayoutEffect:b.useEffect;function Qr(e){let t=(0,b.useRef)(e);return Zr(()=>{t.current=e},[e]),(0,b.useCallback)((...e)=>t.current?.(...e),[t])}function $r(...e){return Qr(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function ei(e){let t=(0,b.useRef)({...e});return Zr(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var ti=(0,b.createContext)(null);function ni(e,t){let n=(0,b.useRef)({getLayout:()=>({}),setLayout:wr});(0,b.useImperativeHandle)(t,()=>n.current,[]),Zr(()=>{Object.assign(n.current,mr({groupId:e}))})}function ri({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:o,id:s,onLayoutChange:c,onLayoutChanged:l,orientation:u=`horizontal`,resizeTargetMinimumSize:d={coarse:20,fine:10},style:f,...p}){let m=(0,b.useRef)({onLayoutChange:{},onLayoutChanged:{}}),h=Qr(e=>{lr(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=Qr(e=>{lr(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=Xr(s),v=(0,b.useRef)(null),[y,x]=Yr(),S=(0,b.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),C=$r(v,a);ni(_,o);let w=Qr((e,t)=>{let r=yr(),i=Bn(e),a=Vn(e);if(a){let e=!1;switch(r.state){case`active`:e=r.hitRegions.some(e=>e.group===i);break}return{flexGrow:a.layout[t]??1,pointerEvents:e?`none`:void 0}}if(n?.[t])return{flexGrow:n?.[t]}}),T=ei({defaultLayout:n,disableCursor:r}),E=(0,b.useMemo)(()=>({get disableCursor(){return!!T.disableCursor},getPanelStyles:w,id:_,orientation:u,registerPanel:e=>{let t=S.current;return t.panels=Dn(u,[...t.panels,e]),x(),()=>{t.panels=t.panels.filter(t=>t!==e),x()}},registerSeparator:e=>{let t=S.current;return t.separators=Dn(u,[...t.separators,e]),x(),()=>{t.separators=t.separators.filter(t=>t!==e),x()}},togglePanelDisabled:(e,t)=>{let n=S.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let r=Bn(_),i=Vn(_);r&&i&&Wn(r,{...i,derivedPanelConstraints:Tn(r)})},toggleSeparatorDisabled:(e,t)=>{let n=S.current.separators.find(t=>t.id===e);n&&(n.disabled=t)}}),[w,_,x,u,T]),D=(0,b.useRef)(null);return Zr(()=>{let e=v.current;if(e===null)return;let t=S.current,n;if(T.defaultLayout!==void 0&&Object.keys(T.defaultLayout).length===t.panels.length){n={};for(let e of t.panels){let t=T.defaultLayout[e.id];t!==void 0&&(n[e.id]=t)}}let r={disabled:!!i,element:e,id:_,mutableState:{defaultLayout:n,disableCursor:!!T.disableCursor,expandedPanelSizes:S.current.lastExpandedPanelSizes,layouts:S.current.layouts},orientation:u,panels:t.panels,resizeTargetMinimumSize:t.resizeTargetMinimumSize,separators:t.separators};D.current=r;let a=Jr(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=Vn(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=Un(_,e=>{let{defaultLayoutDeferred:t,derivedPanelConstraints:n,layout:i}=e.next;if(t||n.length===0)return;let a=r.panels.map(({id:e})=>e).join(`,`);r.mutableState.layouts[a]=i,n.forEach(t=>{if(t.collapsible){let{layout:n}=e.prev??{};if(n){let e=ar(t.collapsedSize,i[t.panelId]),a=ar(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=yr().state!==`active`;h(i),o&&g(i)});return()=>{D.current=null,a(),l()}},[i,_,g,h,u,y,T]),(0,b.useEffect)(()=>{let e=D.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,G.jsx)(ti.Provider,{value:E,children:(0,G.jsx)(`div`,{...p,className:t,"data-group":!0,"data-testid":_,id:_,ref:C,style:{height:`100%`,width:`100%`,overflow:`hidden`,...f,display:`flex`,flexDirection:u===`horizontal`?`row`:`column`,flexWrap:`nowrap`,touchAction:u===`horizontal`?`pan-y`:`pan-x`},children:e})})}ri.displayName=`Group`;function ii(e,t){return`react-resizable-panels:${[e,...t].join(`:`)}`}function ai({id:e,panelIds:t,storage:n}){let r=ii(e,[]),i=n.getItem(r);if(i)try{let e=JSON.parse(i);if(t){let n=e[t.join(`,`)];if(n&&Array.isArray(n.layout)&&t.length===n.layout.length){let e={};for(let r=0;r<t.length;r++)e[t[r]]=n.layout[r];return e}}else{let t=Object.keys(e);if(t.length===1){let n=e[t[0]];if(n&&Array.isArray(n.layout)){let e=t[0].split(`,`);if(e.length===n.layout.length){let t={};for(let r=0;r<e.length;r++)t[e[r]]=n.layout[r];return t}}}}}catch{}}function oi({debounceSaveMs:e=100,panelIds:t,storage:n=localStorage,...r}){let i=t!==void 0,a=`id`in r?r.id:r.groupId,o=ii(a,t??[]),s=(0,b.useSyncExternalStore)(si,()=>n.getItem(o),()=>n.getItem(o)),c=(0,b.useMemo)(()=>{if(s){let e=JSON.parse(s),t=Object.values(e);if(Array.from(t).every(e=>typeof e==`number`))return e}},[s]),l=(0,b.useMemo)(()=>{if(!c)return ai({id:a,panelIds:t,storage:n})},[c,a,t,n]),u=c??l,d=(0,b.useRef)(null),f=(0,b.useCallback)(()=>{let e=d.current;e&&(d.current=null,clearTimeout(e))},[]);(0,b.useLayoutEffect)(()=>()=>{f()},[f]);let p=(0,b.useCallback)(e=>{f();let t;t=i?ii(a,Object.keys(e)):ii(a,[]);try{n.setItem(t,JSON.stringify(e))}catch(e){console.error(e)}},[f,i,a,n]);return{defaultLayout:u,onLayoutChange:(0,b.useCallback)(t=>{f(),e===0?p(t):d.current=setTimeout(()=>{p(t)},e)},[f,e,p]),onLayoutChanged:p}}function si(){return function(){}}function ci(){let e=(0,b.useContext)(ti);return En(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function li(e,t){let{id:n}=ci(),r=(0,b.useRef)({collapse:Tr,expand:Tr,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Tr});(0,b.useImperativeHandle)(t,()=>r.current,[]),Zr(()=>{Object.assign(r.current,dr({groupId:n,panelId:e}))})}function ui({children:e,className:t,collapsedSize:n=`0%`,collapsible:r=!1,defaultSize:i,disabled:a,elementRef:o,groupResizeBehavior:s=`preserve-relative-size`,id:c,maxSize:l=`100%`,minSize:u=`0%`,onResize:d,panelRef:f,style:p,...m}){let h=!!c,g=Xr(c),_=ei({disabled:a}),v=(0,b.useRef)(null),y=$r(v,o),{getPanelStyles:x,id:S,orientation:C,registerPanel:w,togglePanelDisabled:T}=ci(),E=d!==null,D=Qr((e,t,n)=>{d?.(e,c,n)});Zr(()=>{let e=v.current;if(e!==null)return w({element:e,id:g,idIsStable:h,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:E?D:void 0,panelConstraints:{groupResizeBehavior:s,collapsedSize:n,collapsible:r,defaultSize:i,disabled:_.disabled,maxSize:l,minSize:u}})},[s,n,r,i,E,g,h,l,u,D,w,_]),(0,b.useEffect)(()=>{T(g,!!a)},[a,g,T]),li(g,f);let O=()=>{let e=x(S,g);if(e)return JSON.stringify(e)},k=(0,b.useSyncExternalStore)(e=>Un(S,e),O,O),A;return A=k?JSON.parse(k):i?{flexGrow:void 0,flexShrink:void 0,flexBasis:i}:{flexGrow:1},(0,G.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...di,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...A},children:(0,G.jsx)(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,...p,touchAction:C===`horizontal`?`pan-y`:`pan-x`},children:e})})}ui.displayName=`Panel`;var di={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function fi({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a,o=e[n],s=t.find(e=>e.panelId===n);if(s){let c=s.maxSize,l=s.collapsible?s.collapsedSize:s.minSize,u=[r,r+1];a=ur({layout:cr({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=ur({layout:cr({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function pi({children:e,className:t,disabled:n,elementRef:r,id:i,style:a,...o}){let s=Xr(i),c=ei({disabled:n}),[l,u]=(0,b.useState)({}),[d,f]=(0,b.useState)(`inactive`),p=(0,b.useRef)(null),m=$r(p,r),{disableCursor:h,id:g,orientation:_,registerSeparator:v,toggleSeparatorDisabled:y}=ci(),x=_===`horizontal`?`vertical`:`horizontal`;Zr(()=>{let e=p.current;if(e!==null){let t={disabled:c.disabled,element:e,id:s},n=v(t),r=br(e=>{f(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=Un(g,e=>{let{derivedPanelConstraints:n,layout:r,separatorToPanels:i}=e.next,a=i.get(t);if(a){let e=a[0],t=a.indexOf(e);u(fi({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[g,s,v,c]),(0,b.useEffect)(()=>{y(s,!!n)},[n,s,y]);let S;return n&&!h&&(S=`not-allowed`),(0,G.jsx)(`div`,{...o,"aria-controls":l.valueControls,"aria-disabled":n||void 0,"aria-orientation":x,"aria-valuemax":l.valueMax,"aria-valuemin":l.valueMin,"aria-valuenow":l.valueNow,children:e,className:t,"data-separator":n?`disabled`:d,"data-testid":s,id:s,ref:m,role:`separator`,style:{flexBasis:`auto`,cursor:S,...a,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}pi.displayName=`Separator`;var mi=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},hi=(e=>e?mi(e):mi),gi=e=>e;function _i(e,t=gi){let n=b.useSyncExternalStore(e.subscribe,b.useCallback(()=>t(e.getState()),[e,t]),b.useCallback(()=>t(e.getInitialState()),[e,t]));return b.useDebugValue(n),n}var vi=e=>{let t=hi(e),n=e=>_i(t,e);return Object.assign(n,t),n},yi=(e=>e?vi(e):vi),bi=yi()(e=>({status:`idle`,requiresAuth:!1,error:null,setStatus:t=>e({status:t}),setRequiresAuth:t=>e({requiresAuth:t}),setError:t=>e({error:t}),reset:()=>e({status:`idle`,requiresAuth:!1,error:null})})),xi=globalThis.crypto;async function Si(e){return(await xi).getRandomValues(new Uint8Array(e))}async function Ci(e){let t=``;for(;t.length<e;){let n=await Si(e-t.length);for(let e of n)e<198&&(t+=`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~`[e%66])}return t}async function wi(e){return await Ci(e)}async function Ti(e){let t=await(await xi).subtle.digest(`SHA-256`,new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,`_`).replace(/\+/g,`-`).replace(/=/g,``)}async function Ei(e){if(e||=43,e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await wi(e);return{code_verifier:t,code_challenge:await Ti(t)}}var Di=Object.freeze({status:`aborted`});function q(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.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 i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var Oi=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},ki=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},Ai={};function ji(e){return e&&Object.assign(Ai,e),Ai}function Mi(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 Ni(e,t){return typeof t==`bigint`?t.toString():t}function Pi(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function Fi(e){return e==null}function Ii(e){let t=e.startsWith(`^`)?1:0,n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Li(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}var Ri=Symbol(`evaluating`);function zi(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Ri)return r===void 0&&(r=Ri,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Bi(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Vi(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function Hi(e){return JSON.stringify(e)}function Ui(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var Wi=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Gi(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Ki=Pi(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function qi(e){if(Gi(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(Gi(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Ji(e){return qi(e)?{...e}:Array.isArray(e)?[...e]:e}var Yi=new Set([`string`,`number`,`symbol`]);function Xi(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Zi(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function Qi(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(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`?{...t,error:()=>t.error}:t}function $i(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var ea={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function ta(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 Zi(e,Vi(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 Bi(this,`shape`,e),e},checks:[]}))}function na(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 Zi(e,Vi(e._zod.def,{get shape(){let r={...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 Bi(this,`shape`,r),r},checks:[]}))}function ra(e,t){if(!qi(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 Zi(e,Vi(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Bi(this,`shape`,n),n}}))}function ia(e,t){if(!qi(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Zi(e,Vi(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Bi(this,`shape`,n),n}}))}function aa(e,t){return Zi(e,Vi(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Bi(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function oa(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 Zi(t,Vi(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...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 Bi(this,`shape`,i),i},checks:[]}))}function sa(e,t,n){return Zi(t,Vi(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...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 Bi(this,`shape`,i),i}}))}function ca(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function la(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function ua(e){return typeof e==`string`?e:e?.message}function da(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=ua(e.inst?._zod.def?.error?.(e))??ua(t?.error?.(e))??ua(n.customError?.(e))??ua(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function fa(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function pa(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var ma=(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,Ni,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},ha=q(`$ZodError`,ma),ga=q(`$ZodError`,ma,{Parent:Error});function _a(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 va(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});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(e),n}var ya=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new Oi;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>da(e,a,ji())));throw Wi(t,i?.callee),t}return o.value},ba=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>da(e,a,ji())));throw Wi(t,i?.callee),t}return o.value},xa=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Oi;return a.issues.length?{success:!1,error:new(e??ha)(a.issues.map(e=>da(e,i,ji())))}:{success:!0,data:a.value}},Sa=xa(ga),Ca=e=>async(t,n,r)=>{let i=r?Object.assign(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=>da(e,i,ji())))}:{success:!0,data:a.value}},wa=Ca(ga),Ta=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return ya(e)(t,n,i)},Ea=e=>(t,n,r)=>ya(e)(t,n,r),Da=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return ba(e)(t,n,i)},Oa=e=>async(t,n,r)=>ba(e)(t,n,r),ka=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return xa(e)(t,n,i)},Aa=e=>(t,n,r)=>xa(e)(t,n,r),ja=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Ca(e)(t,n,i)},Ma=e=>async(t,n,r)=>Ca(e)(t,n,r),Na=/^[cC][^\s-]{8,}$/,Pa=/^[0-9a-z]+$/,Fa=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ia=/^[0-9a-vA-V]{20}$/,La=/^[A-Za-z0-9]{27}$/,Ra=/^[a-zA-Z0-9_-]{21}$/,za=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ba=/^([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})$/,Va=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)$/,Ha=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ua=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Wa(){return new RegExp(Ua,`u`)}var Ga=/^(?:(?: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])$/,Ka=/^(([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}|:))$/,qa=/^((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])$/,Ja=/^(([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])$/,Ya=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Xa=/^[A-Za-z0-9_-]*$/,Za=/^\+[1-9]\d{6,14}$/,Qa=`(?:(?:\\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])))`,$a=RegExp(`^${Qa}$`);function eo(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 to(e){return RegExp(`^${eo(e)}$`)}function no(e){let t=eo({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(`^${Qa}T(?:${r})$`)}var ro=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},io=/^-?\d+$/,ao=/^-?\d+(?:\.\d+)?$/,oo=/^(?:true|false)$/i,so=/^null$/i,co=/^undefined$/i,lo=/^[^A-Z]*$/,uo=/^[^a-z]*$/,fo=q(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),po={number:`number`,bigint:`bigint`,object:`date`},mo=q(`$ZodCheckLessThan`,(e,t)=>{fo.init(e,t);let n=po[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.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})}}),ho=q(`$ZodCheckGreaterThan`,(e,t)=>{fo.init(e,t);let n=po[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.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})}}),go=q(`$ZodCheckMultipleOf`,(e,t)=>{fo.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(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):Li(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})}}),_o=q(`$ZodCheckNumberFormat`,(e,t)=>{fo.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=ea[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=io)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),vo=q(`$ZodCheckMaxLength`,(e,t)=>{var n;fo.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Fi(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=fa(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),yo=q(`$ZodCheckMinLength`,(e,t)=>{var n;fo.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Fi(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=fa(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),bo=q(`$ZodCheckLengthEquals`,(e,t)=>{var n;fo.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Fi(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=fa(r),o=i>t.length;n.issues.push({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})}}),xo=q(`$ZodCheckStringFormat`,(e,t)=>{var n,r;fo.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({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??(r.check=()=>{})}),So=q(`$ZodCheckRegex`,(e,t)=>{xo.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})}}),Co=q(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=lo,xo.init(e,t)}),wo=q(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=uo,xo.init(e,t)}),To=q(`$ZodCheckIncludes`,(e,t)=>{fo.init(e,t);let n=Xi(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??=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})}}),Eo=q(`$ZodCheckStartsWith`,(e,t)=>{fo.init(e,t);let n=RegExp(`^${Xi(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;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})}}),Do=q(`$ZodCheckEndsWith`,(e,t)=>{fo.init(e,t);let n=RegExp(`.*${Xi(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;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})}}),Oo=q(`$ZodCheckOverwrite`,(e,t)=>{fo.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),ko=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(`
|
|
12
|
+
to %O`,t.join(`,`),r,i),i}}function Lt(e,t,n){if(t.length===0)return e;let r=n?new URLSearchParams(e):e;for(let n of e.keys())t.includes(n)||r.delete(n);return r}var Rt=`__nuqs__`,zt=Tt();function Bt(e){return function(t,n){let r=new URL(location.href);r.search=pt(t),st(`[nuqs react] Updating url: %s`,r),e&&n.shallow===!1?(n.history===`push`?location.assign:location.replace).call(location,r):(n.history===`push`?history.pushState:history.replaceState).call(history,history.state,Rt,r),zt.emit(`update`,t),n.scroll===!0&&window.scrollTo({top:0})}}var Vt=(0,b.createContext)({fullPageNavigationOnShallowFalseUpdates:!1});function Ht(e){let{fullPageNavigationOnShallowFalseUpdates:t}=(0,b.useContext)(Vt),[n,r]=(0,b.useState)(()=>typeof location>`u`?new URLSearchParams:Lt(new URLSearchParams(location.search),e,!1));return(0,b.useEffect)(()=>{let t=()=>{r(It(new URLSearchParams(location.search),e,!1))},n=t=>{r(It(t,e,!0))};return zt.on(`update`,n),window.addEventListener(`popstate`,t),()=>{zt.off(`update`,n),window.removeEventListener(`popstate`,t)}},[e.join(`&`)]),{searchParams:n,updateUrl:(0,b.useMemo)(()=>Bt(t),[t])}}var Ut=gt(Ht);function Wt({children:e,fullPageNavigationOnShallowFalseUpdates:t=!1,...n}){return(0,b.createElement)(Vt.Provider,{value:{fullPageNavigationOnShallowFalseUpdates:t}},(0,b.createElement)(Ut,{...n,children:e}))}var Gt=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Kt=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),qt=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Jt=e=>{let t=qt(e);return t.charAt(0).toUpperCase()+t.slice(1)},Yt={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`},Xt=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Zt=(0,b.createContext)({}),Qt=()=>(0,b.useContext)(Zt),$t=(0,b.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=Qt()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,b.createElement)(`svg`,{ref:c,...Yt,width:t??l??Yt.width,height:t??l??Yt.height,stroke:e??f,strokeWidth:m,className:Gt(`lucide`,p,i),...!a&&!Xt(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,b.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),en=(e,t)=>{let n=(0,b.forwardRef)(({className:n,...r},i)=>(0,b.createElement)($t,{ref:i,iconNode:t,className:Gt(`lucide-${Kt(Jt(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Jt(e),n},tn=en(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),nn=en(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),rn=en(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),an=en(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),on=en(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),K=en(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),sn=en(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),cn=en(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),ln=en(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),un=en(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),dn=en(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),fn=en(`plug-zap`,[[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m18 3-4 4h6l-4 4`,key:`16psg9`}]]),pn=en(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),mn=en(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),hn=en(`trash`,[[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),gn=en(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function _n(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function vn(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function yn(e){return e/100*window.innerHeight}function bn(e){return e/100*window.innerWidth}function xn(e){switch(typeof e){case`number`:return[e,`px`];case`string`:{let t=parseFloat(e);return e.endsWith(`%`)?[t,`%`]:e.endsWith(`px`)?[t,`px`]:e.endsWith(`rem`)?[t,`rem`]:e.endsWith(`em`)?[t,`em`]:e.endsWith(`vh`)?[t,`vh`]:e.endsWith(`vw`)?[t,`vw`]:[t,`%`]}}}function Sn({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=xn(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=vn(t,i);break;case`em`:r=_n(t,i);break;case`vh`:r=yn(i);break;case`vw`:r=bn(i);break}return r}function Cn(e){return parseFloat(e.toFixed(3))}function wn({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>(e+=t===`horizontal`?n.element.offsetWidth:n.element.offsetHeight,e),0)}function Tn(e){let{panels:t}=e,n=wn({group:e});return n===0?t.map(e=>({groupResizeBehavior:e.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:e.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let{element:t,panelConstraints:r}=e,i=0;r.collapsedSize!==void 0&&(i=Cn(Sn({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=Cn(Sn({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=Cn(Sn({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=Cn(Sn({groupSize:n,panelElement:t,styleProp:r.maxSize})/n*100)),{groupResizeBehavior:r.groupResizeBehavior,collapsedSize:i,collapsible:r.collapsible===!0,defaultSize:a,disabled:r.disabled,minSize:o,maxSize:s,panelId:e.id}})}function En(e,t=`Assertion error`){if(!e)throw Error(t)}function Dn(e,t){return Array.from(t).sort(e===`horizontal`?On:kn)}function On(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function kn(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function An(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function jn(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function Mn({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=jn(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return En(i,`No rect found`),i}var Nn;function Pn(){return Nn===void 0&&(Nn=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),Nn}function Fn(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=Dn(n,Array.from(t.children).filter(An).map(e=>({element:e}))).map(({element:e})=>e),o=[],s=!1,c=!1,l=-1,u=-1,d=0,f,p=[];{let e=-1;for(let t of a)t.hasAttribute(`data-panel`)&&(e++,t.hasAttribute(`data-disabled`)||(d++,l===-1&&(l=e),u=e))}if(d>1){let t=-1;for(let d of a)if(d.hasAttribute(`data-panel`)){t++;let i=r.find(e=>e.element===d);if(i){if(f){let r=f.element.getBoundingClientRect(),a=d.getBoundingClientRect(),m;if(c){let e=n===`horizontal`?new DOMRect(r.right,r.top,0,r.height):new DOMRect(r.left,r.bottom,r.width,0),t=n===`horizontal`?new DOMRect(a.left,a.top,0,a.height):new DOMRect(a.left,a.top,a.width,0);switch(p.length){case 0:m=[e,t];break;case 1:{let i=p[0];m=[i,Mn({orientation:n,rects:[r,a],targetRect:i.element.getBoundingClientRect()})===r?t:e];break}default:m=p;break}}else m=p.length?p:[n===`horizontal`?new DOMRect(r.right,a.top,a.left-r.right,a.height):new DOMRect(a.left,r.bottom,a.width,a.top-r.bottom)];for(let n of m){let r=`width`in n?n:n.element.getBoundingClientRect(),a=Pn()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(r.width<a){let e=a-r.width;r=new DOMRect(r.x-e/2,r.y,r.width+e,r.height)}if(r.height<a){let e=a-r.height;r=new DOMRect(r.x,r.y-e/2,r.width,r.height+e)}!s&&!(t<=l||t>u)&&o.push({group:e,groupSize:wn({group:e}),panels:[f,i],separator:`width`in n?void 0:n,rect:r}),s=!1}}c=!1,f=i,p=[]}}else if(d.hasAttribute(`data-separator`)){d.ariaDisabled!==null&&(s=!0);let e=i.find(e=>e.element===d);e?p.push(e):(f=void 0,p=[])}else c=!0}return o}var In=class{#e={};addListener(e,t){let n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){r===null&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(n!==void 0){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}},Ln=new Map,Rn=new In;function zn(e){Ln=new Map(Ln),Ln.delete(e)}function Bn(e,t){for(let[t]of Ln)if(t.id===e)return t}function Vn(e,t){for(let[t,n]of Ln)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Hn(){return Ln}function Un(e,t){return Rn.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function Wn(e,t){let n=Ln.get(e);Ln=new Map(Ln),Ln.set(e,t),Rn.emit(`groupChange`,{group:e,prev:n,next:t})}function Gn(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=jn(n,a.rect);switch(e){case`horizontal`:t.x<=i.x&&(r=a,i=t);break;case`vertical`:t.y<=i.y&&(r=a,i=t);break}}return r?{distance:i,hitRegion:r}:void 0}function Kn(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function qn(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:$n(e),b:$n(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();En(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:Qn(Zn(n.a)),b:Qn(Zn(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var Jn=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Yn(e){let t=getComputedStyle(er(e)??e).display;return t===`flex`||t===`inline-flex`}function Xn(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||Yn(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||Jn.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function Zn(e){let t=e.length;for(;t--;){let n=e[t];if(En(n,`Missing node`),Xn(n))return n}return null}function Qn(e){return e&&Number(getComputedStyle(e).zIndex)||0}function $n(e){let t=[];for(;e;)t.push(e),e=er(e);return t}function er(e){let{parentNode:t}=e;return Kn(t)?t.host:t}function tr(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function nr({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!An(n)||n.contains(e)||e.contains(n))return!0;if(qn(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(tr(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function rr(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=Fn(r),a=Gn(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&nr({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function ir(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function ar(e,t,n=0){return Math.abs(Cn(e)-Cn(t))<=n}function or(e,t){return ar(e,t)?0:e>t?1:-1}function sr({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:s=100,minSize:c=0}=t;if(o&&!e)return n;if(or(r,c)<0)if(a){let e=(i+c)/2;r=or(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=Cn(r),r}function cr({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(ar(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;En(u!=null,`Invalid first pivot index`),En(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];En(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(En(n!=null,`Previous layout not found for panel index ${t}`),ar(n,i)){let t=o-n;or(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];En(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(En(n!=null,`Previous layout not found for panel index ${t}`),ar(n,o)){let t=n-i;or(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];En(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&or(i,c)<0)if(e>0){let t=c-o,n=t/2;or(i+e,c)<0&&(e=or(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;or(i-e,c)<0&&(e=or(100+e,n)>0?0:-t)}break}}{let t=e<0?1:-1,r=e<0?d:u,i=0;for(;;){let e=s[r];En(e!=null,`Previous layout not found for panel index ${r}`);let a=sr({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e;if(i+=a,r+=t,r<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?u:d;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=s[t];En(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=sr({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!ar(i,c)&&(f+=i-c,l[t]=c,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(ir(c,l))return i;{let t=e<0?d:u,r=s[t];En(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=sr({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!ar(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];En(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=sr({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(ar(i,s)||(t-=s-i,l[r]=s),ar(t,0))break;e>0?r--:r++}}}if(!ar(Object.values(l).reduce((e,t)=>t+e,0),100,.1))return i;let p=Object.keys(i);return l.reduce((e,t,n)=>(e[p[n]]=t,e),{})}function lr(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||or(e[n],t[n])!==0)return!1;return!0}function ur({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],i=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(`, `)}`);if(!ar(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];En(t!=null,`No layout data found for index ${e}`),r[e]=100/i*t}let a=0;for(let e=0;e<t.length;e++){let i=n[e];En(i!=null,`No layout data found for index ${e}`);let o=r[e];En(o!=null,`No layout data found for index ${e}`);let s=sr({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!ar(a,0))for(let e=0;e<t.length;e++){let n=r[e];En(n!=null,`No layout data found for index ${e}`);let i=n+a,o=sr({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,ar(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function dr({groupId:e,panelId:t}){let n=()=>{let t=Hn();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,groupSize:o,separatorToPanels:s}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,groupSize:o,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=e=>{let r=a();if(e===r)return;let{defaultLayoutDeferred:i,derivedPanelConstraints:o,group:s,groupSize:c,layout:l,separatorToPanels:u}=n(),d=s.panels.findIndex(e=>e.id===t),f=d===s.panels.length-1,p=ur({layout:cr({delta:f?r-e:e-r,initialLayout:l,panelConstraints:o,pivotIndices:f?[d-1,d]:[d,d+1],prevLayout:l,trigger:`imperative-api`}),panelConstraints:o});lr(l,p)||Wn(s,{defaultLayoutDeferred:i,derivedPanelConstraints:o,groupSize:c,layout:p,separatorToPanels:u})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),s=a();e&&s!==t&&(n.expandToSize=s,o(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:s}=i(),c=a();if(e&&c===t){let e=s.expandToSize??n;e===0&&(e=1),o(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&ar(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=wn({group:t});o(Cn(Sn({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function fr(e){e.defaultPrevented||rr(e,Hn()).forEach(t=>{if(t.separator&&!t.separator.disableDoubleClick){let n=t.panels.find(e=>e.panelConstraints.defaultSize!==void 0);if(n){let r=n.panelConstraints.defaultSize,i=dr({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function pr(e){let t=Hn();for(let[n]of t)if(n.separators.some(t=>t.element===e))return n;throw Error(`Could not find parent Group for separator element`)}function mr({groupId:e}){let t=()=>{let t=Hn();for(let[n,r]of t)if(n.id===e)return{group:n,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,groupSize:a,layout:o,separatorToPanels:s}=t(),c=ur({layout:e,panelConstraints:r});return n?o:(lr(o,c)||Wn(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function hr(e,t){let n=pr(e),r=Vn(n.id,!0),i=n.separators.find(t=>t.element===e);En(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);En(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=mr({groupId:n.id}).getLayout(),c=ur({layout:cr({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});lr(s,c)||Wn(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function gr(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=pr(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&hr(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&hr(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&hr(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&hr(t,-5);break;case`End`:e.preventDefault(),hr(t,100);break;case`Enter`:{e.preventDefault();let n=pr(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=Vn(n.id,!0),o=n.separators.find(e=>e.element===t);En(o,`Matching separator not found`);let s=a.get(o);En(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(En(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];hr(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=pr(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);En(r!==null,`Index not found`),n[e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0].focus({preventScroll:!0});break}case`Home`:e.preventDefault(),hr(t,-100);break}}var _r={cursorFlags:0,state:`inactive`},vr=new In;function yr(){return _r}function br(e){return vr.addListener(`change`,e)}function xr(e){let t=_r,n={..._r};n.cursorFlags=e,_r=n,vr.emit(`change`,{prev:t,next:n})}function Sr(e){let t=_r;_r=e,vr.emit(`change`,{prev:t,next:e})}function Cr(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=Hn(),n=rr(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),Sr({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var wr=e=>e,Tr=()=>{},Er=1,Dr=2,Or=4,kr=8,Ar=3,jr=12,Mr;function Nr(){return Mr===void 0&&(Mr=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(Mr=!0)),Mr}function Pr({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case`active`:case`hover`:t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case`horizontal`:r++;break;case`vertical`:i++;break}})}if(!(r===0&&i===0)){switch(n){case`active`:if(e&&Nr()){let t=(e&Er)!==0,n=(e&Dr)!==0,r=(e&Or)!==0,i=(e&kr)!==0;if(t)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}break}return Nr()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var Fr=new WeakMap;function Ir(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Fr.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=yr();switch(r.state){case`active`:case`hover`:{let e=Pr({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(e=>e.group),state:r.state}),i=`*, *:hover {cursor: ${e} !important; }`;if(t===i)return;t=i,e?n.cssRules.length===0?n.insertRule(i):n.replaceSync(i):n.cssRules.length===1&&n.deleteRule(0);break}case`inactive`:t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}Fr.set(e,{prevStyle:t,styleSheet:n})}function Lr({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:a,prevCursorFlags:o}){let s=0;n.forEach(e=>{let{group:n,groupSize:o}=e,{orientation:c,panels:l}=n,{disableCursor:u}=n.mutableState,d=0;d=a?c===`horizontal`?(t.clientX-a.x)/o*100:(t.clientY-a.y)/o*100:c===`horizontal`?t.clientX<0?-100:100:t.clientY<0?-100:100;let f=r.get(n),p=i.get(n);if(!f||!p)return;let{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:_,separatorToPanels:v}=p;if(h&&_&&v){let t=cr({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(lr(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?Er:Dr;break;case`vertical`:s|=d<0?Or:kr;break}}else Wn(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&Ar:c|=s&Ar,t.movementY===0?c|=o&jr:c|=s&jr,xr(c),Ir(e)}function Rr(e){let t=Hn(),n=yr();switch(n.state){case`active`:Lr({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function zr(e){if(e.defaultPrevented)return;let t=yr(),n=Hn();switch(t.state){case`active`:if(e.buttons===0){Sr({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=Vn(e.group.id,!0);Wn(e.group,t)});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}Lr({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=rr(e,n);r.length===0?t.state!==`inactive`&&Sr({cursorFlags:0,state:`inactive`}):Sr({cursorFlags:0,hitRegions:r,state:`hover`}),Ir(e.currentTarget);break}}}function Br(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(yr().state){case`hover`:Sr({cursorFlags:0,state:`inactive`})}}function Vr(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=yr();switch(t.state){case`active`:Sr({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(Ir(e.currentTarget),t.hitRegions.forEach(e=>{let t=Vn(e.group.id,!0);Wn(e.group,t)}),e.preventDefault())}}function Hr(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=Cn(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=Cn((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function Ur(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=wn({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:Cn(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function Wr(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function Gr({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,a=0,o=!1,s=new Map,c=[];for(let l of e.panels){let e=r[l.id]??0;switch(l.panelConstraints.groupResizeBehavior){case`preserve-pixel-size`:{o=!0;let r=Cn(e/100*n/t*100);s.set(l.id,r),i+=r;break}default:c.push(l.id),a+=e;break}}if(!o||c.length===0)return r;let l=100-i,u={...r};if(s.forEach((e,t)=>{u[t]=e}),a>0)for(let e of c)u[e]=Cn((r[e]??0)/a*l);else{let e=Cn(l/c.length);for(let t of c)u[t]=e}return u}function Kr(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}var qr=new Map;function Jr(e){let t=!0;En(e.element.ownerDocument.defaultView,`Cannot register an unmounted Group`);let n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,a=new n(n=>{for(let r of n){let{borderBoxSize:n,target:i}=r;if(i===e.element){if(t){let t=wn({group:e});if(t===0)return;let n=Vn(e.id);if(!n)return;let r=Tn(e),i=n.defaultLayoutDeferred?Hr(r):n.layout,a=ur({layout:Gr({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&lr(n.layout,a)&&Wr(n.derivedPanelConstraints,r)&&n.groupSize===t)return;Wn(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else Ur(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{En(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&a.observe(e.element)});let o=wn({group:e}),s=Tn(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(Kr(e.panels,l)||(l=void 0));let u=ur({layout:e.mutableState.layouts[c]??l??Hr(s),panelConstraints:s}),d=e.element.ownerDocument;qr.set(d,(qr.get(d)??0)+1);let f=new Map;return Fn(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),Wn(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{En(!i.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),i.add(e.id),e.element.addEventListener(`keydown`,gr)}),qr.get(d)===1&&(d.addEventListener(`dblclick`,fr,!0),d.addEventListener(`pointerdown`,Cr,!0),d.addEventListener(`pointerleave`,Rr),d.addEventListener(`pointermove`,zr),d.addEventListener(`pointerout`,Br),d.addEventListener(`pointerup`,Vr,!0)),function(){t=!1,qr.set(d,Math.max(0,(qr.get(d)??0)-1)),zn(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,gr)}),qr.get(d)||(d.removeEventListener(`dblclick`,fr,!0),d.removeEventListener(`pointerdown`,Cr,!0),d.removeEventListener(`pointerleave`,Rr),d.removeEventListener(`pointermove`,zr),d.removeEventListener(`pointerout`,Br),d.removeEventListener(`pointerup`,Vr,!0)),a.disconnect()}}function Yr(){let[e,t]=(0,b.useState)({});return[e,(0,b.useCallback)(()=>t({}),[])]}function Xr(e){let t=(0,b.useId)();return`${e??t}`}var Zr=typeof window<`u`?b.useLayoutEffect:b.useEffect;function Qr(e){let t=(0,b.useRef)(e);return Zr(()=>{t.current=e},[e]),(0,b.useCallback)((...e)=>t.current?.(...e),[t])}function $r(...e){return Qr(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function ei(e){let t=(0,b.useRef)({...e});return Zr(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var ti=(0,b.createContext)(null);function ni(e,t){let n=(0,b.useRef)({getLayout:()=>({}),setLayout:wr});(0,b.useImperativeHandle)(t,()=>n.current,[]),Zr(()=>{Object.assign(n.current,mr({groupId:e}))})}function ri({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:o,id:s,onLayoutChange:c,onLayoutChanged:l,orientation:u=`horizontal`,resizeTargetMinimumSize:d={coarse:20,fine:10},style:f,...p}){let m=(0,b.useRef)({onLayoutChange:{},onLayoutChanged:{}}),h=Qr(e=>{lr(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=Qr(e=>{lr(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=Xr(s),v=(0,b.useRef)(null),[y,x]=Yr(),S=(0,b.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),C=$r(v,a);ni(_,o);let w=Qr((e,t)=>{let r=yr(),i=Bn(e),a=Vn(e);if(a){let e=!1;switch(r.state){case`active`:e=r.hitRegions.some(e=>e.group===i);break}return{flexGrow:a.layout[t]??1,pointerEvents:e?`none`:void 0}}if(n?.[t])return{flexGrow:n?.[t]}}),T=ei({defaultLayout:n,disableCursor:r}),E=(0,b.useMemo)(()=>({get disableCursor(){return!!T.disableCursor},getPanelStyles:w,id:_,orientation:u,registerPanel:e=>{let t=S.current;return t.panels=Dn(u,[...t.panels,e]),x(),()=>{t.panels=t.panels.filter(t=>t!==e),x()}},registerSeparator:e=>{let t=S.current;return t.separators=Dn(u,[...t.separators,e]),x(),()=>{t.separators=t.separators.filter(t=>t!==e),x()}},updatePanelProps:(e,{disabled:t})=>{let n=S.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let r=Bn(_),i=Vn(_);r&&i&&Wn(r,{...i,derivedPanelConstraints:Tn(r)})},updateSeparatorProps:(e,{disabled:t,disableDoubleClick:n})=>{let r=S.current.separators.find(t=>t.id===e);r&&(r.disabled=t,r.disableDoubleClick=n)}}),[w,_,x,u,T]),D=(0,b.useRef)(null);return Zr(()=>{let e=v.current;if(e===null)return;let t=S.current,n;if(T.defaultLayout!==void 0&&Object.keys(T.defaultLayout).length===t.panels.length){n={};for(let e of t.panels){let t=T.defaultLayout[e.id];t!==void 0&&(n[e.id]=t)}}let r={disabled:!!i,element:e,id:_,mutableState:{defaultLayout:n,disableCursor:!!T.disableCursor,expandedPanelSizes:S.current.lastExpandedPanelSizes,layouts:S.current.layouts},orientation:u,panels:t.panels,resizeTargetMinimumSize:t.resizeTargetMinimumSize,separators:t.separators};D.current=r;let a=Jr(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=Vn(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=Un(_,e=>{let{defaultLayoutDeferred:t,derivedPanelConstraints:n,layout:i}=e.next;if(t||n.length===0)return;let a=r.panels.map(({id:e})=>e).join(`,`);r.mutableState.layouts[a]=i,n.forEach(t=>{if(t.collapsible){let{layout:n}=e.prev??{};if(n){let e=ar(t.collapsedSize,i[t.panelId]),a=ar(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=yr().state!==`active`;h(i),o&&g(i)});return()=>{D.current=null,a(),l()}},[i,_,g,h,u,y,T]),(0,b.useEffect)(()=>{let e=D.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,G.jsx)(ti.Provider,{value:E,children:(0,G.jsx)(`div`,{...p,className:t,"data-group":!0,"data-testid":_,id:_,ref:C,style:{height:`100%`,width:`100%`,overflow:`hidden`,...f,display:`flex`,flexDirection:u===`horizontal`?`row`:`column`,flexWrap:`nowrap`,touchAction:u===`horizontal`?`pan-y`:`pan-x`},children:e})})}ri.displayName=`Group`;function ii(e,t){return`react-resizable-panels:${[e,...t].join(`:`)}`}function ai({id:e,panelIds:t,storage:n}){let r=ii(e,[]),i=n.getItem(r);if(i)try{let e=JSON.parse(i);if(t){let n=e[t.join(`,`)];if(n&&Array.isArray(n.layout)&&t.length===n.layout.length){let e={};for(let r=0;r<t.length;r++)e[t[r]]=n.layout[r];return e}}else{let t=Object.keys(e);if(t.length===1){let n=e[t[0]];if(n&&Array.isArray(n.layout)){let e=t[0].split(`,`);if(e.length===n.layout.length){let t={};for(let r=0;r<e.length;r++)t[e[r]]=n.layout[r];return t}}}}}catch{}}function oi({debounceSaveMs:e=100,panelIds:t,storage:n=localStorage,...r}){let i=t!==void 0,a=`id`in r?r.id:r.groupId,o=ii(a,t??[]),s=(0,b.useSyncExternalStore)(si,()=>n.getItem(o),()=>n.getItem(o)),c=(0,b.useMemo)(()=>{if(s){let e=JSON.parse(s),t=Object.values(e);if(Array.from(t).every(e=>typeof e==`number`))return e}},[s]),l=(0,b.useMemo)(()=>{if(!c)return ai({id:a,panelIds:t,storage:n})},[c,a,t,n]),u=c??l,d=(0,b.useRef)(null),f=(0,b.useCallback)(()=>{let e=d.current;e&&(d.current=null,clearTimeout(e))},[]);(0,b.useLayoutEffect)(()=>()=>{f()},[f]);let p=(0,b.useCallback)(e=>{f();let t;t=i?ii(a,Object.keys(e)):ii(a,[]);try{n.setItem(t,JSON.stringify(e))}catch(e){console.error(e)}},[f,i,a,n]);return{defaultLayout:u,onLayoutChange:(0,b.useCallback)(t=>{f(),e===0?p(t):d.current=setTimeout(()=>{p(t)},e)},[f,e,p]),onLayoutChanged:p}}function si(){return function(){}}function ci(){let e=(0,b.useContext)(ti);return En(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function li(e,t){let{id:n}=ci(),r=(0,b.useRef)({collapse:Tr,expand:Tr,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Tr});(0,b.useImperativeHandle)(t,()=>r.current,[]),Zr(()=>{Object.assign(r.current,dr({groupId:n,panelId:e}))})}function ui({children:e,className:t,collapsedSize:n=`0%`,collapsible:r=!1,defaultSize:i,disabled:a,elementRef:o,groupResizeBehavior:s=`preserve-relative-size`,id:c,maxSize:l=`100%`,minSize:u=`0%`,onResize:d,panelRef:f,style:p,...m}){let h=!!c,g=Xr(c),_=ei({disabled:a}),v=(0,b.useRef)(null),y=$r(v,o),{getPanelStyles:x,id:S,orientation:C,registerPanel:w,updatePanelProps:T}=ci(),E=d!==null,D=Qr((e,t,n)=>{d?.(e,c,n)});Zr(()=>{let e=v.current;if(e!==null)return w({element:e,id:g,idIsStable:h,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:E?D:void 0,panelConstraints:{groupResizeBehavior:s,collapsedSize:n,collapsible:r,defaultSize:i,disabled:_.disabled,maxSize:l,minSize:u}})},[s,n,r,i,E,g,h,l,u,D,w,_]),(0,b.useEffect)(()=>{T(g,{disabled:a})},[a,g,T]),li(g,f);let O=()=>{let e=x(S,g);if(e)return JSON.stringify(e)},k=(0,b.useSyncExternalStore)(e=>Un(S,e),O,O),A;return A=k?JSON.parse(k):i?{flexGrow:void 0,flexShrink:void 0,flexBasis:i}:{flexGrow:1},(0,G.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...di,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...A},children:(0,G.jsx)(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,...p,touchAction:C===`horizontal`?`pan-y`:`pan-x`},children:e})})}ui.displayName=`Panel`;var di={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function fi({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a,o=e[n],s=t.find(e=>e.panelId===n);if(s){let c=s.maxSize,l=s.collapsible?s.collapsedSize:s.minSize,u=[r,r+1];a=ur({layout:cr({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=ur({layout:cr({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function pi({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=Xr(a),l=ei({disabled:n,disableDoubleClick:r}),[u,d]=(0,b.useState)({}),[f,p]=(0,b.useState)(`inactive`),m=(0,b.useRef)(null),h=$r(m,i),{disableCursor:g,id:_,orientation:v,registerSeparator:y,updateSeparatorProps:x}=ci(),S=v===`horizontal`?`vertical`:`horizontal`;Zr(()=>{let e=m.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=y(t),r=br(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=Un(_,e=>{let{derivedPanelConstraints:n,layout:r,separatorToPanels:i}=e.next,a=i.get(t);if(a){let e=a[0],t=a.indexOf(e);d(fi({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[_,c,y,l]),(0,b.useEffect)(()=>{x(c,{disabled:n,disableDoubleClick:r})},[n,r,c,x]);let C;return n&&!g&&(C=`not-allowed`),(0,G.jsx)(`div`,{...s,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":S,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":n?`disabled`:f,"data-testid":c,id:c,ref:h,role:`separator`,style:{flexBasis:`auto`,cursor:C,...o,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}pi.displayName=`Separator`;var mi=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},hi=(e=>e?mi(e):mi),gi=e=>e;function _i(e,t=gi){let n=b.useSyncExternalStore(e.subscribe,b.useCallback(()=>t(e.getState()),[e,t]),b.useCallback(()=>t(e.getInitialState()),[e,t]));return b.useDebugValue(n),n}var vi=e=>{let t=hi(e),n=e=>_i(t,e);return Object.assign(n,t),n},yi=(e=>e?vi(e):vi),bi=yi()(e=>({status:`idle`,requiresAuth:!1,error:null,setStatus:t=>e({status:t}),setRequiresAuth:t=>e({requiresAuth:t}),setError:t=>e({error:t}),reset:()=>e({status:`idle`,requiresAuth:!1,error:null})})),xi=globalThis.crypto;async function Si(e){return(await xi).getRandomValues(new Uint8Array(e))}async function Ci(e){let t=``;for(;t.length<e;){let n=await Si(e-t.length);for(let e of n)e<198&&(t+=`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~`[e%66])}return t}async function wi(e){return await Ci(e)}async function Ti(e){let t=await(await xi).subtle.digest(`SHA-256`,new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,`_`).replace(/\+/g,`-`).replace(/=/g,``)}async function Ei(e){if(e||=43,e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await wi(e);return{code_verifier:t,code_challenge:await Ti(t)}}var Di=Object.freeze({status:`aborted`});function q(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.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 i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var Oi=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},ki=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},Ai={};function ji(e){return e&&Object.assign(Ai,e),Ai}function Mi(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 Ni(e,t){return typeof t==`bigint`?t.toString():t}function Pi(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function Fi(e){return e==null}function Ii(e){let t=e.startsWith(`^`)?1:0,n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Li(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}var Ri=Symbol(`evaluating`);function zi(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Ri)return r===void 0&&(r=Ri,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Bi(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Vi(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function Hi(e){return JSON.stringify(e)}function Ui(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var Wi=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Gi(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Ki=Pi(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function qi(e){if(Gi(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(Gi(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Ji(e){return qi(e)?{...e}:Array.isArray(e)?[...e]:e}var Yi=new Set([`string`,`number`,`symbol`]);function Xi(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Zi(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function Qi(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(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`?{...t,error:()=>t.error}:t}function $i(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var ea={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function ta(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 Zi(e,Vi(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 Bi(this,`shape`,e),e},checks:[]}))}function na(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 Zi(e,Vi(e._zod.def,{get shape(){let r={...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 Bi(this,`shape`,r),r},checks:[]}))}function ra(e,t){if(!qi(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 Zi(e,Vi(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Bi(this,`shape`,n),n}}))}function ia(e,t){if(!qi(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Zi(e,Vi(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Bi(this,`shape`,n),n}}))}function aa(e,t){return Zi(e,Vi(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Bi(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function oa(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 Zi(t,Vi(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...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 Bi(this,`shape`,i),i},checks:[]}))}function sa(e,t,n){return Zi(t,Vi(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...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 Bi(this,`shape`,i),i}}))}function ca(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function la(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function ua(e){return typeof e==`string`?e:e?.message}function da(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=ua(e.inst?._zod.def?.error?.(e))??ua(t?.error?.(e))??ua(n.customError?.(e))??ua(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function fa(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function pa(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var ma=(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,Ni,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},ha=q(`$ZodError`,ma),ga=q(`$ZodError`,ma,{Parent:Error});function _a(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 va(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});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(e),n}var ya=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new Oi;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>da(e,a,ji())));throw Wi(t,i?.callee),t}return o.value},ba=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>da(e,a,ji())));throw Wi(t,i?.callee),t}return o.value},xa=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Oi;return a.issues.length?{success:!1,error:new(e??ha)(a.issues.map(e=>da(e,i,ji())))}:{success:!0,data:a.value}},Sa=xa(ga),Ca=e=>async(t,n,r)=>{let i=r?Object.assign(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=>da(e,i,ji())))}:{success:!0,data:a.value}},wa=Ca(ga),Ta=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return ya(e)(t,n,i)},Ea=e=>(t,n,r)=>ya(e)(t,n,r),Da=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return ba(e)(t,n,i)},Oa=e=>async(t,n,r)=>ba(e)(t,n,r),ka=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return xa(e)(t,n,i)},Aa=e=>(t,n,r)=>xa(e)(t,n,r),ja=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Ca(e)(t,n,i)},Ma=e=>async(t,n,r)=>Ca(e)(t,n,r),Na=/^[cC][^\s-]{8,}$/,Pa=/^[0-9a-z]+$/,Fa=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ia=/^[0-9a-vA-V]{20}$/,La=/^[A-Za-z0-9]{27}$/,Ra=/^[a-zA-Z0-9_-]{21}$/,za=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ba=/^([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})$/,Va=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)$/,Ha=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ua=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Wa(){return new RegExp(Ua,`u`)}var Ga=/^(?:(?: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])$/,Ka=/^(([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}|:))$/,qa=/^((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])$/,Ja=/^(([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])$/,Ya=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Xa=/^[A-Za-z0-9_-]*$/,Za=/^\+[1-9]\d{6,14}$/,Qa=`(?:(?:\\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])))`,$a=RegExp(`^${Qa}$`);function eo(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 to(e){return RegExp(`^${eo(e)}$`)}function no(e){let t=eo({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(`^${Qa}T(?:${r})$`)}var ro=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},io=/^-?\d+$/,ao=/^-?\d+(?:\.\d+)?$/,oo=/^(?:true|false)$/i,so=/^null$/i,co=/^undefined$/i,lo=/^[^A-Z]*$/,uo=/^[^a-z]*$/,fo=q(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),po={number:`number`,bigint:`bigint`,object:`date`},mo=q(`$ZodCheckLessThan`,(e,t)=>{fo.init(e,t);let n=po[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.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})}}),ho=q(`$ZodCheckGreaterThan`,(e,t)=>{fo.init(e,t);let n=po[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.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})}}),go=q(`$ZodCheckMultipleOf`,(e,t)=>{fo.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(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):Li(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})}}),_o=q(`$ZodCheckNumberFormat`,(e,t)=>{fo.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=ea[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=io)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),vo=q(`$ZodCheckMaxLength`,(e,t)=>{var n;fo.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Fi(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=fa(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),yo=q(`$ZodCheckMinLength`,(e,t)=>{var n;fo.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Fi(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=fa(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),bo=q(`$ZodCheckLengthEquals`,(e,t)=>{var n;fo.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Fi(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=fa(r),o=i>t.length;n.issues.push({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})}}),xo=q(`$ZodCheckStringFormat`,(e,t)=>{var n,r;fo.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({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??(r.check=()=>{})}),So=q(`$ZodCheckRegex`,(e,t)=>{xo.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})}}),Co=q(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=lo,xo.init(e,t)}),wo=q(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=uo,xo.init(e,t)}),To=q(`$ZodCheckIncludes`,(e,t)=>{fo.init(e,t);let n=Xi(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??=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})}}),Eo=q(`$ZodCheckStartsWith`,(e,t)=>{fo.init(e,t);let n=RegExp(`^${Xi(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;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})}}),Do=q(`$ZodCheckEndsWith`,(e,t)=>{fo.init(e,t);let n=RegExp(`.*${Xi(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;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})}}),Oo=q(`$ZodCheckOverwrite`,(e,t)=>{fo.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),ko=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(`
|
|
13
13
|
`).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(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
14
14
|
`))}},Ao={major:4,minor:3,patch:6},jo=q(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ao;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=ca(e),i;for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new Oi;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=ca(e,t))});else{if(e.issues.length===t)continue;r||=ca(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(ca(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new Oi;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new Oi;return o.then(e=>t(e,r,a))}return t(o,r,a)}}zi(e,`~standard`,()=>({validate:t=>{try{let n=Sa(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return wa(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Mo=q(`$ZodString`,(e,t)=>{jo.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ro(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),No=q(`$ZodStringFormat`,(e,t)=>{xo.init(e,t),Mo.init(e,t)}),Po=q(`$ZodGUID`,(e,t)=>{t.pattern??=Ba,No.init(e,t)}),Fo=q(`$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??=Va(e)}else t.pattern??=Va();No.init(e,t)}),Io=q(`$ZodEmail`,(e,t)=>{t.pattern??=Ha,No.init(e,t)}),Lo=q(`$ZodURL`,(e,t)=>{No.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.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(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.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=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Ro=q(`$ZodEmoji`,(e,t)=>{t.pattern??=Wa(),No.init(e,t)}),zo=q(`$ZodNanoID`,(e,t)=>{t.pattern??=Ra,No.init(e,t)}),Bo=q(`$ZodCUID`,(e,t)=>{t.pattern??=Na,No.init(e,t)}),Vo=q(`$ZodCUID2`,(e,t)=>{t.pattern??=Pa,No.init(e,t)}),Ho=q(`$ZodULID`,(e,t)=>{t.pattern??=Fa,No.init(e,t)}),Uo=q(`$ZodXID`,(e,t)=>{t.pattern??=Ia,No.init(e,t)}),Wo=q(`$ZodKSUID`,(e,t)=>{t.pattern??=La,No.init(e,t)}),Go=q(`$ZodISODateTime`,(e,t)=>{t.pattern??=no(t),No.init(e,t)}),Ko=q(`$ZodISODate`,(e,t)=>{t.pattern??=$a,No.init(e,t)}),qo=q(`$ZodISOTime`,(e,t)=>{t.pattern??=to(t),No.init(e,t)}),Jo=q(`$ZodISODuration`,(e,t)=>{t.pattern??=za,No.init(e,t)}),Yo=q(`$ZodIPv4`,(e,t)=>{t.pattern??=Ga,No.init(e,t),e._zod.bag.format=`ipv4`}),Xo=q(`$ZodIPv6`,(e,t)=>{t.pattern??=Ka,No.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),Zo=q(`$ZodCIDRv4`,(e,t)=>{t.pattern??=qa,No.init(e,t)}),Qo=q(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Ja,No.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{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function $o(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var es=q(`$ZodBase64`,(e,t)=>{t.pattern??=Ya,No.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{$o(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function ts(e){if(!Xa.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return $o(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var ns=q(`$ZodBase64URL`,(e,t)=>{t.pattern??=Xa,No.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{ts(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),rs=q(`$ZodE164`,(e,t)=>{t.pattern??=Za,No.init(e,t)});function is(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?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var as=q(`$ZodJWT`,(e,t)=>{No.init(e,t),e._zod.check=n=>{is(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),os=q(`$ZodNumber`,(e,t)=>{jo.init(e,t),e._zod.pattern=e._zod.bag.pattern??ao,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}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({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),ss=q(`$ZodNumberFormat`,(e,t)=>{_o.init(e,t),os.init(e,t)}),cs=q(`$ZodBoolean`,(e,t)=>{jo.init(e,t),e._zod.pattern=oo,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),ls=q(`$ZodUndefined`,(e,t)=>{jo.init(e,t),e._zod.pattern=co,e._zod.values=new Set([void 0]),e._zod.optin=`optional`,e._zod.optout=`optional`,e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`undefined`,code:`invalid_type`,input:r,inst:e}),t}}),us=q(`$ZodNull`,(e,t)=>{jo.init(e,t),e._zod.pattern=so,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}}),ds=q(`$ZodAny`,(e,t)=>{jo.init(e,t),e._zod.parse=e=>e}),fs=q(`$ZodUnknown`,(e,t)=>{jo.init(e,t),e._zod.parse=e=>e}),ps=q(`$ZodNever`,(e,t)=>{jo.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function ms(e,t,n){e.issues.length&&t.issues.push(...la(n,e.issues)),t.value[n]=e.value}var hs=q(`$ZodArray`,(e,t)=>{jo.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=>ms(t,n,e))):ms(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function gs(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...la(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function _s(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=$i(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function vs(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optout===`optional`;for(let i in t){if(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=>gs(e,n,i,t,u))):gs(a,n,i,t,u)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var ys=q(`$ZodObject`,(e,t)=>{if(jo.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,`shape`,{get:()=>{let n={...e};return Object.defineProperty(t,`shape`,{value:n}),n}})}let n=Pi(()=>_s(t));zi(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=Gi,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optout===`optional`,i=n._zod.run({value:s[e],issues:[]},o);i instanceof Promise?c.push(i.then(n=>gs(n,t,e,s,r))):gs(i,t,e,s,r)}return i?vs(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),bs=q(`$ZodObjectJIT`,(e,t)=>{ys.init(e,t);let n=e._zod.parse,r=Pi(()=>_s(t)),i=e=>{let t=new ko([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=Hi(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){let n=a[r],o=Hi(r),s=e[r]?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),s?t.write(`
|
|
15
15
|
if (${n}.issues.length) {
|
|
@@ -47,7 +47,7 @@ Error generating stack: `+e.message+`
|
|
|
47
47
|
|
|
48
48
|
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=Gi,s=!Ai.jitless,c=s&&Ki.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?vs([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function xs(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=>!ca(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=>da(e,r,ji())))}),t)}var Ss=q(`$ZodUnion`,(e,t)=>{jo.init(e,t),zi(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),zi(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),zi(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),zi(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=>Ii(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>xs(t,i,e,a)):xs(s,i,e,a)}}),Cs=q(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Ss.init(e,t);let n=e._zod.parse;zi(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=Pi(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!Gi(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,input:o,path:[t.discriminator],inst:e}),i)}}),ws=q(`$ZodIntersection`,(e,t)=>{jo.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])=>Es(e,t,n)):Es(e,i,a)}});function Ts(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(qi(e)&&qi(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Ts(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=Ts(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 Es(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){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({...i,keys:a}),ca(e))return e;let o=Ts(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Ds=q(`$ZodRecord`,(e,t)=>{jo.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!qi(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 s=new Set;for(let e of o)if(typeof e==`string`||typeof e==`number`||typeof e==`symbol`){s.add(typeof e==`number`?e.toString():e);let o=t.valueType._zod.run({value:i[e],issues:[]},r);o instanceof Promise?a.push(o.then(t=>{t.issues.length&&n.issues.push(...la(e,t.issues)),n.value[e]=t.value})):(o.issues.length&&n.issues.push(...la(e,o.issues)),n.value[e]=o.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`)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`&&ao.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=>da(e,r,ji())),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(...la(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...la(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Os=q(`$ZodEnum`,(e,t)=>{jo.init(e,t);let n=Mi(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Yi.has(typeof e)).map(e=>typeof e==`string`?Xi(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}}),ks=q(`$ZodLiteral`,(e,t)=>{if(jo.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`?Xi(e):e?Xi(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}}),As=q(`$ZodTransform`,(e,t)=>{jo.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ki(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));if(i instanceof Promise)throw new Oi;return n.value=i,n}});function js(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var Ms=q(`$ZodOptional`,(e,t)=>{jo.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,zi(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),zi(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Ii(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>js(t,e.value)):js(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Ns=q(`$ZodExactOptional`,(e,t)=>{Ms.init(e,t),zi(e._zod,`values`,()=>t.innerType._zod.values),zi(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Ps=q(`$ZodNullable`,(e,t)=>{jo.init(e,t),zi(e._zod,`optin`,()=>t.innerType._zod.optin),zi(e._zod,`optout`,()=>t.innerType._zod.optout),zi(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Ii(e.source)}|null)$`):void 0}),zi(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)}),Fs=q(`$ZodDefault`,(e,t)=>{jo.init(e,t),e._zod.optin=`optional`,zi(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=>Is(e,t)):Is(r,t)}});function Is(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Ls=q(`$ZodPrefault`,(e,t)=>{jo.init(e,t),e._zod.optin=`optional`,zi(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))}),Rs=q(`$ZodNonOptional`,(e,t)=>{jo.init(e,t),zi(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=>zs(t,e)):zs(i,e)}});function zs(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var Bs=q(`$ZodCatch`,(e,t)=>{jo.init(e,t),zi(e._zod,`optin`,()=>t.innerType._zod.optin),zi(e._zod,`optout`,()=>t.innerType._zod.optout),zi(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({...e,error:{issues:r.issues.map(e=>da(e,n,ji()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>da(e,n,ji()))},input:e.value}),e.issues=[]),e)}}),Vs=q(`$ZodPipe`,(e,t)=>{jo.init(e,t),zi(e._zod,`values`,()=>t.in._zod.values),zi(e._zod,`optin`,()=>t.in._zod.optin),zi(e._zod,`optout`,()=>t.out._zod.optout),zi(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=>Hs(e,t.in,n)):Hs(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Hs(e,t.out,n)):Hs(r,t.out,n)}});function Hs(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var Us=q(`$ZodReadonly`,(e,t)=>{jo.init(e,t),zi(e._zod,`propValues`,()=>t.innerType._zod.propValues),zi(e._zod,`values`,()=>t.innerType._zod.values),zi(e._zod,`optin`,()=>t.innerType?._zod?.optin),zi(e._zod,`optout`,()=>t.innerType?._zod?.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(Ws):Ws(r)}});function Ws(e){return e.value=Object.freeze(e.value),e}var Gs=q(`$ZodCustom`,(e,t)=>{fo.init(e,t),jo.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=>Ks(t,n,r,e));Ks(i,n,r,e)}});function Ks(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(pa(e))}}var qs,Js=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){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Ys(){return new Js}(qs=globalThis).__zod_globalRegistry??(qs.__zod_globalRegistry=Ys());var Xs=globalThis.__zod_globalRegistry;function Zs(e,t){return new e({type:`string`,...Qi(t)})}function Qs(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...Qi(t)})}function $s(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...Qi(t)})}function ec(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...Qi(t)})}function tc(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...Qi(t)})}function nc(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...Qi(t)})}function rc(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...Qi(t)})}function ic(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...Qi(t)})}function ac(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...Qi(t)})}function oc(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...Qi(t)})}function sc(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...Qi(t)})}function cc(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...Qi(t)})}function lc(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...Qi(t)})}function uc(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...Qi(t)})}function dc(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...Qi(t)})}function fc(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...Qi(t)})}function pc(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...Qi(t)})}function mc(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...Qi(t)})}function hc(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...Qi(t)})}function gc(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...Qi(t)})}function _c(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...Qi(t)})}function vc(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...Qi(t)})}function yc(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...Qi(t)})}function bc(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...Qi(t)})}function xc(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...Qi(t)})}function Sc(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...Qi(t)})}function Cc(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...Qi(t)})}function wc(e,t){return new e({type:`number`,checks:[],...Qi(t)})}function Tc(e,t){return new e({type:`number`,coerce:!0,checks:[],...Qi(t)})}function Ec(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...Qi(t)})}function Dc(e,t){return new e({type:`boolean`,...Qi(t)})}function Oc(e,t){return new e({type:`undefined`,...Qi(t)})}function kc(e,t){return new e({type:`null`,...Qi(t)})}function Ac(e){return new e({type:`any`})}function jc(e){return new e({type:`unknown`})}function Mc(e,t){return new e({type:`never`,...Qi(t)})}function Nc(e,t){return new mo({check:`less_than`,...Qi(t),value:e,inclusive:!1})}function Pc(e,t){return new mo({check:`less_than`,...Qi(t),value:e,inclusive:!0})}function Fc(e,t){return new ho({check:`greater_than`,...Qi(t),value:e,inclusive:!1})}function Ic(e,t){return new ho({check:`greater_than`,...Qi(t),value:e,inclusive:!0})}function Lc(e,t){return new go({check:`multiple_of`,...Qi(t),value:e})}function Rc(e,t){return new vo({check:`max_length`,...Qi(t),maximum:e})}function zc(e,t){return new yo({check:`min_length`,...Qi(t),minimum:e})}function Bc(e,t){return new bo({check:`length_equals`,...Qi(t),length:e})}function Vc(e,t){return new So({check:`string_format`,format:`regex`,...Qi(t),pattern:e})}function Hc(e){return new Co({check:`string_format`,format:`lowercase`,...Qi(e)})}function Uc(e){return new wo({check:`string_format`,format:`uppercase`,...Qi(e)})}function Wc(e,t){return new To({check:`string_format`,format:`includes`,...Qi(t),includes:e})}function Gc(e,t){return new Eo({check:`string_format`,format:`starts_with`,...Qi(t),prefix:e})}function Kc(e,t){return new Do({check:`string_format`,format:`ends_with`,...Qi(t),suffix:e})}function qc(e){return new Oo({check:`overwrite`,tx:e})}function Jc(e){return qc(t=>t.normalize(e))}function Yc(){return qc(e=>e.trim())}function Xc(){return qc(e=>e.toLowerCase())}function Zc(){return qc(e=>e.toUpperCase())}function Qc(){return qc(e=>Ui(e))}function $c(e,t,n){return new e({type:`array`,element:t,...Qi(n)})}function el(e,t,n){let r=Qi(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function tl(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...Qi(n)})}function nl(e){let t=rl(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(pa(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(pa(r))}},e(n.value,n)));return t}function rl(e,t){let n=new fo({check:`custom`,...Qi(t)});return n._zod.check=e,n}function il(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Xs,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function al(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,al(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&cl(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function ol(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()){let n=e.metadataRegistry.get(t[0])?.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 i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
49
49
|
|
|
50
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function sl(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:ul(t,`input`,e.processors),output:ul(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function cl(e,t){let n=t??{seen:new Set};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 cl(r.element,n);if(r.type===`set`)return cl(r.valueType,n);if(r.type===`lazy`)return cl(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 cl(r.innerType,n);if(r.type===`intersection`)return cl(r.left,n)||cl(r.right,n);if(r.type===`record`||r.type===`map`)return cl(r.keyType,n)||cl(r.valueType,n);if(r.type===`pipe`)return cl(r.in,n)||cl(r.out,n);if(r.type===`object`){for(let e in r.shape)if(cl(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(cl(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(cl(e,n))return!0;return!!(r.rest&&cl(r.rest,n))}return!1}var ll=(e,t={})=>n=>{let r=il({...n,processors:t});return al(e,r),ol(r,e),sl(r,e)},ul=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=il({...i??{},target:a,io:t,processors:n});return al(e,o),ol(o,e),sl(o,e)},dl={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},fl=(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&&(i.format=dl[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),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=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},pl=(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`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},ml=(e,t,n,r)=>{n.type=`boolean`},hl=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},gl=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Undefined cannot be represented in JSON Schema`)},_l=(e,t,n,r)=>{n.not={}},vl=(e,t,n,r)=>{let i=e._zod.def,a=Mi(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},yl=(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},bl=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},xl=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Sl=(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=al(a.element,t,{...r,path:[...r.path,`items`]})},Cl=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=al(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=al(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},wl=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>al(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Tl=(e,t,n,r)=>{let i=e._zod.def,a=al(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=al(i.right,t,{...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]]},El=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=al(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=al(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=al(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Dl=(e,t,n,r)=>{let i=e._zod.def,a=al(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`}]},Ol=(e,t,n,r)=>{let i=e._zod.def;al(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},kl=(e,t,n,r)=>{let i=e._zod.def;al(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Al=(e,t,n,r)=>{let i=e._zod.def;al(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)))},jl=(e,t,n,r)=>{let i=e._zod.def;al(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Ml=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;al(a,t,r);let o=t.seen.get(e);o.ref=a},Nl=(e,t,n,r)=>{let i=e._zod.def;al(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Pl=(e,t,n,r)=>{let i=e._zod.def;al(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Fl=q(`ZodISODateTime`,(e,t)=>{Go.init(e,t),ou.init(e,t)});function Il(e){return bc(Fl,e)}var Ll=q(`ZodISODate`,(e,t)=>{Ko.init(e,t),ou.init(e,t)});function Rl(e){return xc(Ll,e)}var zl=q(`ZodISOTime`,(e,t)=>{qo.init(e,t),ou.init(e,t)});function Bl(e){return Sc(zl,e)}var Vl=q(`ZodISODuration`,(e,t)=>{Jo.init(e,t),ou.init(e,t)});function Hl(e){return Cc(Vl,e)}var Ul=(e,t)=>{ha.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>va(e,t)},flatten:{value:t=>_a(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Ni,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Ni,2)}},isEmpty:{get(){return e.issues.length===0}}})};q(`ZodError`,Ul);var Wl=q(`ZodError`,Ul,{Parent:Error}),Gl=ya(Wl),Kl=ba(Wl),ql=xa(Wl),Jl=Ca(Wl),Yl=Ta(Wl),Xl=Ea(Wl),Zl=Da(Wl),Ql=Oa(Wl),$l=ka(Wl),eu=Aa(Wl),tu=ja(Wl),nu=Ma(Wl),ru=q(`ZodType`,(e,t)=>(jo.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:ul(e,`input`),output:ul(e,`output`)}}),e.toJSONSchema=ll(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(Vi(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>Zi(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>Gl(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>ql(e,t,n),e.parseAsync=async(t,n)=>Kl(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Jl(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Yl(e,t,n),e.decode=(t,n)=>Xl(e,t,n),e.encodeAsync=async(t,n)=>Zl(e,t,n),e.decodeAsync=async(t,n)=>Ql(e,t,n),e.safeEncode=(t,n)=>$l(e,t,n),e.safeDecode=(t,n)=>eu(e,t,n),e.safeEncodeAsync=async(t,n)=>tu(e,t,n),e.safeDecodeAsync=async(t,n)=>nu(e,t,n),e.refine=(t,n)=>e.check(Td(t,n)),e.superRefine=t=>e.check(Ed(t)),e.overwrite=t=>e.check(qc(t)),e.optional=()=>od(e),e.exactOptional=()=>cd(e),e.nullable=()=>ud(e),e.nullish=()=>od(ud(e)),e.nonoptional=t=>gd(e,t),e.array=()=>Y(e),e.or=t=>qu([e,t]),e.and=t=>Zu(e,t),e.transform=t=>bd(e,id(t)),e.default=t=>fd(e,t),e.prefault=t=>md(e,t),e.catch=t=>vd(e,t),e.pipe=t=>bd(e,t),e.readonly=()=>Sd(e),e.describe=t=>{let n=e.clone();return Xs.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return Xs.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return Xs.get(e);let n=e.clone();return Xs.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),iu=q(`_ZodString`,(e,t)=>{Mo.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fl(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(Vc(...t)),e.includes=(...t)=>e.check(Wc(...t)),e.startsWith=(...t)=>e.check(Gc(...t)),e.endsWith=(...t)=>e.check(Kc(...t)),e.min=(...t)=>e.check(zc(...t)),e.max=(...t)=>e.check(Rc(...t)),e.length=(...t)=>e.check(Bc(...t)),e.nonempty=(...t)=>e.check(zc(1,...t)),e.lowercase=t=>e.check(Hc(t)),e.uppercase=t=>e.check(Uc(t)),e.trim=()=>e.check(Yc()),e.normalize=(...t)=>e.check(Jc(...t)),e.toLowerCase=()=>e.check(Xc()),e.toUpperCase=()=>e.check(Zc()),e.slugify=()=>e.check(Qc())}),au=q(`ZodString`,(e,t)=>{Mo.init(e,t),iu.init(e,t),e.email=t=>e.check(Qs(su,t)),e.url=t=>e.check(ic(uu,t)),e.jwt=t=>e.check(yc(Eu,t)),e.emoji=t=>e.check(ac(fu,t)),e.guid=t=>e.check($s(cu,t)),e.uuid=t=>e.check(ec(lu,t)),e.uuidv4=t=>e.check(tc(lu,t)),e.uuidv6=t=>e.check(nc(lu,t)),e.uuidv7=t=>e.check(rc(lu,t)),e.nanoid=t=>e.check(oc(pu,t)),e.guid=t=>e.check($s(cu,t)),e.cuid=t=>e.check(sc(mu,t)),e.cuid2=t=>e.check(cc(hu,t)),e.ulid=t=>e.check(lc(gu,t)),e.base64=t=>e.check(gc(Cu,t)),e.base64url=t=>e.check(_c(wu,t)),e.xid=t=>e.check(uc(_u,t)),e.ksuid=t=>e.check(dc(vu,t)),e.ipv4=t=>e.check(fc(yu,t)),e.ipv6=t=>e.check(pc(bu,t)),e.cidrv4=t=>e.check(mc(xu,t)),e.cidrv6=t=>e.check(hc(Su,t)),e.e164=t=>e.check(vc(Tu,t)),e.datetime=t=>e.check(Il(t)),e.date=t=>e.check(Rl(t)),e.time=t=>e.check(Bl(t)),e.duration=t=>e.check(Hl(t))});function J(e){return Zs(au,e)}var ou=q(`ZodStringFormat`,(e,t)=>{No.init(e,t),iu.init(e,t)}),su=q(`ZodEmail`,(e,t)=>{Io.init(e,t),ou.init(e,t)}),cu=q(`ZodGUID`,(e,t)=>{Po.init(e,t),ou.init(e,t)}),lu=q(`ZodUUID`,(e,t)=>{Fo.init(e,t),ou.init(e,t)}),uu=q(`ZodURL`,(e,t)=>{Lo.init(e,t),ou.init(e,t)});function du(e){return ic(uu,e)}var fu=q(`ZodEmoji`,(e,t)=>{Ro.init(e,t),ou.init(e,t)}),pu=q(`ZodNanoID`,(e,t)=>{zo.init(e,t),ou.init(e,t)}),mu=q(`ZodCUID`,(e,t)=>{Bo.init(e,t),ou.init(e,t)}),hu=q(`ZodCUID2`,(e,t)=>{Vo.init(e,t),ou.init(e,t)}),gu=q(`ZodULID`,(e,t)=>{Ho.init(e,t),ou.init(e,t)}),_u=q(`ZodXID`,(e,t)=>{Uo.init(e,t),ou.init(e,t)}),vu=q(`ZodKSUID`,(e,t)=>{Wo.init(e,t),ou.init(e,t)}),yu=q(`ZodIPv4`,(e,t)=>{Yo.init(e,t),ou.init(e,t)}),bu=q(`ZodIPv6`,(e,t)=>{Xo.init(e,t),ou.init(e,t)}),xu=q(`ZodCIDRv4`,(e,t)=>{Zo.init(e,t),ou.init(e,t)}),Su=q(`ZodCIDRv6`,(e,t)=>{Qo.init(e,t),ou.init(e,t)}),Cu=q(`ZodBase64`,(e,t)=>{es.init(e,t),ou.init(e,t)}),wu=q(`ZodBase64URL`,(e,t)=>{ns.init(e,t),ou.init(e,t)}),Tu=q(`ZodE164`,(e,t)=>{rs.init(e,t),ou.init(e,t)}),Eu=q(`ZodJWT`,(e,t)=>{as.init(e,t),ou.init(e,t)}),Du=q(`ZodNumber`,(e,t)=>{os.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pl(e,t,n,r),e.gt=(t,n)=>e.check(Fc(t,n)),e.gte=(t,n)=>e.check(Ic(t,n)),e.min=(t,n)=>e.check(Ic(t,n)),e.lt=(t,n)=>e.check(Nc(t,n)),e.lte=(t,n)=>e.check(Pc(t,n)),e.max=(t,n)=>e.check(Pc(t,n)),e.int=t=>e.check(Au(t)),e.safe=t=>e.check(Au(t)),e.positive=t=>e.check(Fc(0,t)),e.nonnegative=t=>e.check(Ic(0,t)),e.negative=t=>e.check(Nc(0,t)),e.nonpositive=t=>e.check(Pc(0,t)),e.multipleOf=(t,n)=>e.check(Lc(t,n)),e.step=(t,n)=>e.check(Lc(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function Ou(e){return wc(Du,e)}var ku=q(`ZodNumberFormat`,(e,t)=>{ss.init(e,t),Du.init(e,t)});function Au(e){return Ec(ku,e)}var ju=q(`ZodBoolean`,(e,t)=>{cs.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ml(e,t,n,r)});function Mu(e){return Dc(ju,e)}var Nu=q(`ZodUndefined`,(e,t)=>{ls.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gl(e,t,n,r)});function Pu(e){return Oc(Nu,e)}var Fu=q(`ZodNull`,(e,t)=>{us.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hl(e,t,n,r)});function Iu(e){return kc(Fu,e)}var Lu=q(`ZodAny`,(e,t)=>{ds.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Ru(){return Ac(Lu)}var zu=q(`ZodUnknown`,(e,t)=>{fs.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Bu(){return jc(zu)}var Vu=q(`ZodNever`,(e,t)=>{ps.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_l(e,t,n,r)});function Hu(e){return Mc(Vu,e)}var Uu=q(`ZodArray`,(e,t)=>{hs.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Sl(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(zc(t,n)),e.nonempty=t=>e.check(zc(1,t)),e.max=(t,n)=>e.check(Rc(t,n)),e.length=(t,n)=>e.check(Bc(t,n)),e.unwrap=()=>e.element});function Y(e,t){return $c(Uu,e,t)}var Wu=q(`ZodObject`,(e,t)=>{bs.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Cl(e,t,n,r),zi(e,`shape`,()=>t.shape),e.keyof=()=>td(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Bu()}),e.loose=()=>e.clone({...e._zod.def,catchall:Bu()}),e.strict=()=>e.clone({...e._zod.def,catchall:Hu()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>ra(e,t),e.safeExtend=t=>ia(e,t),e.merge=t=>aa(e,t),e.pick=t=>ta(e,t),e.omit=t=>na(e,t),e.partial=(...t)=>oa(ad,e,t[0]),e.required=(...t)=>sa(hd,e,t[0])});function X(e,t){return new Wu({type:`object`,shape:e??{},...Qi(t)})}function Gu(e,t){return new Wu({type:`object`,shape:e,catchall:Bu(),...Qi(t)})}var Ku=q(`ZodUnion`,(e,t)=>{Ss.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wl(e,t,n,r),e.options=t.options});function qu(e,t){return new Ku({type:`union`,options:e,...Qi(t)})}var Ju=q(`ZodDiscriminatedUnion`,(e,t)=>{Ku.init(e,t),Cs.init(e,t)});function Yu(e,t,n){return new Ju({type:`union`,options:t,discriminator:e,...Qi(n)})}var Xu=q(`ZodIntersection`,(e,t)=>{ws.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Tl(e,t,n,r)});function Zu(e,t){return new Xu({type:`intersection`,left:e,right:t})}var Qu=q(`ZodRecord`,(e,t)=>{Ds.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>El(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function $u(e,t,n){return new Qu({type:`record`,keyType:e,valueType:t,...Qi(n)})}var ed=q(`ZodEnum`,(e,t)=>{Os.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vl(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 ed({...t,checks:[],...Qi(r),entries:i})},e.exclude=(e,r)=>{let i={...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 ed({...t,checks:[],...Qi(r),entries:i})}});function td(e,t){return new ed({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...Qi(t)})}var nd=q(`ZodLiteral`,(e,t)=>{ks.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yl(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 Z(e,t){return new nd({type:`literal`,values:Array.isArray(e)?e:[e],...Qi(t)})}var rd=q(`ZodTransform`,(e,t)=>{As.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xl(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ki(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(pa(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(pa(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function id(e){return new rd({type:`transform`,transform:e})}var ad=q(`ZodOptional`,(e,t)=>{Ms.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function od(e){return new ad({type:`optional`,innerType:e})}var sd=q(`ZodExactOptional`,(e,t)=>{Ns.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function cd(e){return new sd({type:`optional`,innerType:e})}var ld=q(`ZodNullable`,(e,t)=>{Ps.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Dl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ud(e){return new ld({type:`nullable`,innerType:e})}var dd=q(`ZodDefault`,(e,t)=>{Fs.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>kl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function fd(e,t){return new dd({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Ji(t)}})}var pd=q(`ZodPrefault`,(e,t)=>{Ls.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Al(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function md(e,t){return new pd({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Ji(t)}})}var hd=q(`ZodNonOptional`,(e,t)=>{Rs.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ol(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function gd(e,t){return new hd({type:`nonoptional`,innerType:e,...Qi(t)})}var _d=q(`ZodCatch`,(e,t)=>{Bs.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function vd(e,t){return new _d({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var yd=q(`ZodPipe`,(e,t)=>{Vs.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ml(e,t,n,r),e.in=t.in,e.out=t.out});function bd(e,t){return new yd({type:`pipe`,in:e,out:t})}var xd=q(`ZodReadonly`,(e,t)=>{Us.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Sd(e){return new xd({type:`readonly`,innerType:e})}var Cd=q(`ZodCustom`,(e,t)=>{Gs.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bl(e,t,n,r)});function wd(e,t){return el(Cd,e??(()=>!0),t)}function Td(e,t={}){return tl(Cd,e,t)}function Ed(e){return nl(e)}function Dd(e,t){return bd(id(e),t)}var Od={invalid_type:`invalid_type`,too_big:`too_big`,too_small:`too_small`,invalid_format:`invalid_format`,not_multiple_of:`not_multiple_of`,unrecognized_keys:`unrecognized_keys`,invalid_union:`invalid_union`,invalid_key:`invalid_key`,invalid_element:`invalid_element`,invalid_value:`invalid_value`,custom:`custom`},kd;(function(e){})(kd||={});function Ad(e){return Tc(Du,e)}var jd=`2025-11-25`,Md=[jd,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],Nd=`io.modelcontextprotocol/related-task`,Pd=wd(e=>e!==null&&(typeof e==`object`||typeof e==`function`)),Fd=qu([J(),Ou().int()]),Id=J();Gu({ttl:qu([Ou(),Iu()]).optional(),pollInterval:Ou().optional()});var Ld=X({ttl:Ou().optional()}),Rd=X({taskId:J()}),zd=Gu({progressToken:Fd.optional(),[Nd]:Rd.optional()}),Bd=X({_meta:zd.optional()}),Vd=Bd.extend({task:Ld.optional()}),Hd=e=>Vd.safeParse(e).success,Ud=X({method:J(),params:Bd.loose().optional()}),Wd=X({_meta:zd.optional()}),Gd=X({method:J(),params:Wd.loose().optional()}),Kd=Gu({_meta:zd.optional()}),qd=qu([J(),Ou().int()]),Jd=X({jsonrpc:Z(`2.0`),id:qd,...Ud.shape}).strict(),Yd=e=>Jd.safeParse(e).success,Xd=X({jsonrpc:Z(`2.0`),...Gd.shape}).strict(),Zd=e=>Xd.safeParse(e).success,Qd=X({jsonrpc:Z(`2.0`),id:qd,result:Kd}).strict(),$d=e=>Qd.safeParse(e).success,ef;(function(e){e[e.ConnectionClosed=-32e3]=`ConnectionClosed`,e[e.RequestTimeout=-32001]=`RequestTimeout`,e[e.ParseError=-32700]=`ParseError`,e[e.InvalidRequest=-32600]=`InvalidRequest`,e[e.MethodNotFound=-32601]=`MethodNotFound`,e[e.InvalidParams=-32602]=`InvalidParams`,e[e.InternalError=-32603]=`InternalError`,e[e.UrlElicitationRequired=-32042]=`UrlElicitationRequired`})(ef||={});var tf=X({jsonrpc:Z(`2.0`),id:qd.optional(),error:X({code:Ou().int(),message:J(),data:Bu().optional()})}).strict(),nf=e=>tf.safeParse(e).success,rf=qu([Jd,Xd,Qd,tf]);qu([Qd,tf]);var af=Kd.strict(),of=Wd.extend({requestId:qd.optional(),reason:J().optional()}),sf=Gd.extend({method:Z(`notifications/cancelled`),params:of}),cf=X({icons:Y(X({src:J(),mimeType:J().optional(),sizes:Y(J()).optional(),theme:td([`light`,`dark`]).optional()})).optional()}),lf=X({name:J(),title:J().optional()}),uf=lf.extend({...lf.shape,...cf.shape,version:J(),websiteUrl:J().optional(),description:J().optional()}),df=Dd(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Zu(X({form:Zu(X({applyDefaults:Mu().optional()}),$u(J(),Bu())).optional(),url:Pd.optional()}),$u(J(),Bu()).optional())),ff=Gu({list:Pd.optional(),cancel:Pd.optional(),requests:Gu({sampling:Gu({createMessage:Pd.optional()}).optional(),elicitation:Gu({create:Pd.optional()}).optional()}).optional()}),pf=Gu({list:Pd.optional(),cancel:Pd.optional(),requests:Gu({tools:Gu({call:Pd.optional()}).optional()}).optional()}),mf=X({experimental:$u(J(),Pd).optional(),sampling:X({context:Pd.optional(),tools:Pd.optional()}).optional(),elicitation:df.optional(),roots:X({listChanged:Mu().optional()}).optional(),tasks:ff.optional()}),hf=Bd.extend({protocolVersion:J(),capabilities:mf,clientInfo:uf}),gf=Ud.extend({method:Z(`initialize`),params:hf}),_f=X({experimental:$u(J(),Pd).optional(),logging:Pd.optional(),completions:Pd.optional(),prompts:X({listChanged:Mu().optional()}).optional(),resources:X({subscribe:Mu().optional(),listChanged:Mu().optional()}).optional(),tools:X({listChanged:Mu().optional()}).optional(),tasks:pf.optional()}),vf=Kd.extend({protocolVersion:J(),capabilities:_f,serverInfo:uf,instructions:J().optional()}),yf=Gd.extend({method:Z(`notifications/initialized`),params:Wd.optional()}),bf=e=>yf.safeParse(e).success,xf=Ud.extend({method:Z(`ping`),params:Bd.optional()}),Sf=X({progress:Ou(),total:od(Ou()),message:od(J())}),Cf=X({...Wd.shape,...Sf.shape,progressToken:Fd}),wf=Gd.extend({method:Z(`notifications/progress`),params:Cf}),Tf=Bd.extend({cursor:Id.optional()}),Ef=Ud.extend({params:Tf.optional()}),Df=Kd.extend({nextCursor:Id.optional()}),Of=td([`working`,`input_required`,`completed`,`failed`,`cancelled`]),kf=X({taskId:J(),status:Of,ttl:qu([Ou(),Iu()]),createdAt:J(),lastUpdatedAt:J(),pollInterval:od(Ou()),statusMessage:od(J())}),Af=Kd.extend({task:kf}),jf=Wd.merge(kf),Mf=Gd.extend({method:Z(`notifications/tasks/status`),params:jf}),Nf=Ud.extend({method:Z(`tasks/get`),params:Bd.extend({taskId:J()})}),Pf=Kd.merge(kf),Ff=Ud.extend({method:Z(`tasks/result`),params:Bd.extend({taskId:J()})});Kd.loose();var If=Ef.extend({method:Z(`tasks/list`)}),Lf=Df.extend({tasks:Y(kf)}),Rf=Ud.extend({method:Z(`tasks/cancel`),params:Bd.extend({taskId:J()})}),zf=Kd.merge(kf),Bf=X({uri:J(),mimeType:od(J()),_meta:$u(J(),Bu()).optional()}),Vf=Bf.extend({text:J()}),Hf=J().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),Uf=Bf.extend({blob:Hf}),Wf=td([`user`,`assistant`]),Gf=X({audience:Y(Wf).optional(),priority:Ou().min(0).max(1).optional(),lastModified:Il({offset:!0}).optional()}),Kf=X({...lf.shape,...cf.shape,uri:J(),description:od(J()),mimeType:od(J()),annotations:Gf.optional(),_meta:od(Gu({}))}),qf=X({...lf.shape,...cf.shape,uriTemplate:J(),description:od(J()),mimeType:od(J()),annotations:Gf.optional(),_meta:od(Gu({}))}),Jf=Ef.extend({method:Z(`resources/list`)}),Yf=Df.extend({resources:Y(Kf)}),Xf=Ef.extend({method:Z(`resources/templates/list`)}),Zf=Df.extend({resourceTemplates:Y(qf)}),Qf=Bd.extend({uri:J()}),$f=Qf,ep=Ud.extend({method:Z(`resources/read`),params:$f}),tp=Kd.extend({contents:Y(qu([Vf,Uf]))}),np=Gd.extend({method:Z(`notifications/resources/list_changed`),params:Wd.optional()}),rp=Qf,ip=Ud.extend({method:Z(`resources/subscribe`),params:rp}),ap=Qf,op=Ud.extend({method:Z(`resources/unsubscribe`),params:ap}),sp=Wd.extend({uri:J()}),cp=Gd.extend({method:Z(`notifications/resources/updated`),params:sp}),lp=X({name:J(),description:od(J()),required:od(Mu())}),up=X({...lf.shape,...cf.shape,description:od(J()),arguments:od(Y(lp)),_meta:od(Gu({}))}),dp=Ef.extend({method:Z(`prompts/list`)}),fp=Df.extend({prompts:Y(up)}),pp=Bd.extend({name:J(),arguments:$u(J(),J()).optional()}),mp=Ud.extend({method:Z(`prompts/get`),params:pp}),hp=X({type:Z(`text`),text:J(),annotations:Gf.optional(),_meta:$u(J(),Bu()).optional()}),gp=X({type:Z(`image`),data:Hf,mimeType:J(),annotations:Gf.optional(),_meta:$u(J(),Bu()).optional()}),_p=X({type:Z(`audio`),data:Hf,mimeType:J(),annotations:Gf.optional(),_meta:$u(J(),Bu()).optional()}),vp=X({type:Z(`tool_use`),name:J(),id:J(),input:$u(J(),Bu()),_meta:$u(J(),Bu()).optional()}),yp=X({type:Z(`resource`),resource:qu([Vf,Uf]),annotations:Gf.optional(),_meta:$u(J(),Bu()).optional()}),bp=Kf.extend({type:Z(`resource_link`)}),xp=qu([hp,gp,_p,bp,yp]),Sp=X({role:Wf,content:xp}),Cp=Kd.extend({description:J().optional(),messages:Y(Sp)}),wp=Gd.extend({method:Z(`notifications/prompts/list_changed`),params:Wd.optional()}),Tp=X({title:J().optional(),readOnlyHint:Mu().optional(),destructiveHint:Mu().optional(),idempotentHint:Mu().optional(),openWorldHint:Mu().optional()}),Ep=X({taskSupport:td([`required`,`optional`,`forbidden`]).optional()}),Dp=X({...lf.shape,...cf.shape,description:J().optional(),inputSchema:X({type:Z(`object`),properties:$u(J(),Pd).optional(),required:Y(J()).optional()}).catchall(Bu()),outputSchema:X({type:Z(`object`),properties:$u(J(),Pd).optional(),required:Y(J()).optional()}).catchall(Bu()).optional(),annotations:Tp.optional(),execution:Ep.optional(),_meta:$u(J(),Bu()).optional()}),Op=Ef.extend({method:Z(`tools/list`)}),kp=Df.extend({tools:Y(Dp)}),Ap=Kd.extend({content:Y(xp).default([]),structuredContent:$u(J(),Bu()).optional(),isError:Mu().optional()});Ap.or(Kd.extend({toolResult:Bu()}));var jp=Vd.extend({name:J(),arguments:$u(J(),Bu()).optional()}),Mp=Ud.extend({method:Z(`tools/call`),params:jp}),Np=Gd.extend({method:Z(`notifications/tools/list_changed`),params:Wd.optional()}),Pp=X({autoRefresh:Mu().default(!0),debounceMs:Ou().int().nonnegative().default(300)}),Fp=td([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),Ip=Bd.extend({level:Fp}),Lp=Ud.extend({method:Z(`logging/setLevel`),params:Ip}),Rp=Wd.extend({level:Fp,logger:J().optional(),data:Bu()}),zp=Gd.extend({method:Z(`notifications/message`),params:Rp}),Bp=X({hints:Y(X({name:J().optional()})).optional(),costPriority:Ou().min(0).max(1).optional(),speedPriority:Ou().min(0).max(1).optional(),intelligencePriority:Ou().min(0).max(1).optional()}),Vp=X({mode:td([`auto`,`required`,`none`]).optional()}),Hp=X({type:Z(`tool_result`),toolUseId:J().describe(`The unique identifier for the corresponding tool call.`),content:Y(xp).default([]),structuredContent:X({}).loose().optional(),isError:Mu().optional(),_meta:$u(J(),Bu()).optional()}),Up=Yu(`type`,[hp,gp,_p]),Wp=Yu(`type`,[hp,gp,_p,vp,Hp]),Gp=X({role:Wf,content:qu([Wp,Y(Wp)]),_meta:$u(J(),Bu()).optional()}),Kp=Vd.extend({messages:Y(Gp),modelPreferences:Bp.optional(),systemPrompt:J().optional(),includeContext:td([`none`,`thisServer`,`allServers`]).optional(),temperature:Ou().optional(),maxTokens:Ou().int(),stopSequences:Y(J()).optional(),metadata:Pd.optional(),tools:Y(Dp).optional(),toolChoice:Vp.optional()}),qp=Ud.extend({method:Z(`sampling/createMessage`),params:Kp}),Jp=Kd.extend({model:J(),stopReason:od(td([`endTurn`,`stopSequence`,`maxTokens`]).or(J())),role:Wf,content:Up}),Yp=Kd.extend({model:J(),stopReason:od(td([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(J())),role:Wf,content:qu([Wp,Y(Wp)])}),Xp=X({type:Z(`boolean`),title:J().optional(),description:J().optional(),default:Mu().optional()}),Zp=X({type:Z(`string`),title:J().optional(),description:J().optional(),minLength:Ou().optional(),maxLength:Ou().optional(),format:td([`email`,`uri`,`date`,`date-time`]).optional(),default:J().optional()}),Qp=X({type:td([`number`,`integer`]),title:J().optional(),description:J().optional(),minimum:Ou().optional(),maximum:Ou().optional(),default:Ou().optional()}),$p=X({type:Z(`string`),title:J().optional(),description:J().optional(),enum:Y(J()),default:J().optional()}),em=X({type:Z(`string`),title:J().optional(),description:J().optional(),oneOf:Y(X({const:J(),title:J()})),default:J().optional()}),eee=qu([qu([X({type:Z(`string`),title:J().optional(),description:J().optional(),enum:Y(J()),enumNames:Y(J()).optional(),default:J().optional()}),qu([$p,em]),qu([X({type:Z(`array`),title:J().optional(),description:J().optional(),minItems:Ou().optional(),maxItems:Ou().optional(),items:X({type:Z(`string`),enum:Y(J())}),default:Y(J()).optional()}),X({type:Z(`array`),title:J().optional(),description:J().optional(),minItems:Ou().optional(),maxItems:Ou().optional(),items:X({anyOf:Y(X({const:J(),title:J()}))}),default:Y(J()).optional()})])]),Xp,Zp,Qp]),tee=qu([Vd.extend({mode:Z(`form`).optional(),message:J(),requestedSchema:X({type:Z(`object`),properties:$u(J(),eee),required:Y(J()).optional()})}),Vd.extend({mode:Z(`url`),message:J(),elicitationId:J(),url:J().url()})]),tm=Ud.extend({method:Z(`elicitation/create`),params:tee}),nm=Wd.extend({elicitationId:J()}),rm=Gd.extend({method:Z(`notifications/elicitation/complete`),params:nm}),im=Kd.extend({action:td([`accept`,`decline`,`cancel`]),content:Dd(e=>e===null?void 0:e,$u(J(),qu([J(),Ou(),Mu(),Y(J())])).optional())}),am=X({type:Z(`ref/resource`),uri:J()}),om=X({type:Z(`ref/prompt`),name:J()}),sm=Bd.extend({ref:qu([om,am]),argument:X({name:J(),value:J()}),context:X({arguments:$u(J(),J()).optional()}).optional()}),cm=Ud.extend({method:Z(`completion/complete`),params:sm}),lm=Kd.extend({completion:Gu({values:Y(J()).max(100),total:od(Ou().int()),hasMore:od(Mu())})}),um=X({uri:J().startsWith(`file://`),name:J().optional(),_meta:$u(J(),Bu()).optional()}),dm=Ud.extend({method:Z(`roots/list`),params:Bd.optional()}),fm=Kd.extend({roots:Y(um)}),nee=Gd.extend({method:Z(`notifications/roots/list_changed`),params:Wd.optional()});qu([xf,gf,cm,Lp,mp,dp,Jf,Xf,ep,ip,op,Mp,Op,Nf,Ff,If,Rf]),qu([sf,wf,yf,nee,Mf]),qu([af,Jp,Yp,im,fm,Pf,Lf,Af]),qu([xf,qp,tm,dm,Nf,Ff,If,Rf]),qu([sf,wf,zp,cp,np,Np,wp,Mf,rm]),qu([af,vf,lm,Cp,fp,Yf,Zf,tp,Ap,kp,Pf,Lf,Af]);var pm=class e extends Error{constructor(e,t,n){super(`MCP error ${e}: ${t}`),this.code=e,this.data=n,this.name=`McpError`}static fromError(t,n,r){if(t===ef.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new ree(e.elicitations,n)}return new e(t,n,r)}},ree=class extends pm{constructor(e,t=`URL elicitation${e.length>1?`s`:``} required`){super(ef.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},mm=du().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:Od.custom,message:`URL must be parseable`,fatal:!0}),Di}).refine(e=>{let t=new URL(e);return t.protocol!==`javascript:`&&t.protocol!==`data:`&&t.protocol!==`vbscript:`},{message:`URL cannot use javascript:, data:, or vbscript: scheme`}),hm=Gu({resource:J().url(),authorization_servers:Y(mm).optional(),jwks_uri:J().url().optional(),scopes_supported:Y(J()).optional(),bearer_methods_supported:Y(J()).optional(),resource_signing_alg_values_supported:Y(J()).optional(),resource_name:J().optional(),resource_documentation:J().optional(),resource_policy_uri:J().url().optional(),resource_tos_uri:J().url().optional(),tls_client_certificate_bound_access_tokens:Mu().optional(),authorization_details_types_supported:Y(J()).optional(),dpop_signing_alg_values_supported:Y(J()).optional(),dpop_bound_access_tokens_required:Mu().optional()}),gm=Gu({issuer:J(),authorization_endpoint:mm,token_endpoint:mm,registration_endpoint:mm.optional(),scopes_supported:Y(J()).optional(),response_types_supported:Y(J()),response_modes_supported:Y(J()).optional(),grant_types_supported:Y(J()).optional(),token_endpoint_auth_methods_supported:Y(J()).optional(),token_endpoint_auth_signing_alg_values_supported:Y(J()).optional(),service_documentation:mm.optional(),revocation_endpoint:mm.optional(),revocation_endpoint_auth_methods_supported:Y(J()).optional(),revocation_endpoint_auth_signing_alg_values_supported:Y(J()).optional(),introspection_endpoint:J().optional(),introspection_endpoint_auth_methods_supported:Y(J()).optional(),introspection_endpoint_auth_signing_alg_values_supported:Y(J()).optional(),code_challenge_methods_supported:Y(J()).optional(),client_id_metadata_document_supported:Mu().optional()}),_m=X({...Gu({issuer:J(),authorization_endpoint:mm,token_endpoint:mm,userinfo_endpoint:mm.optional(),jwks_uri:mm,registration_endpoint:mm.optional(),scopes_supported:Y(J()).optional(),response_types_supported:Y(J()),response_modes_supported:Y(J()).optional(),grant_types_supported:Y(J()).optional(),acr_values_supported:Y(J()).optional(),subject_types_supported:Y(J()),id_token_signing_alg_values_supported:Y(J()),id_token_encryption_alg_values_supported:Y(J()).optional(),id_token_encryption_enc_values_supported:Y(J()).optional(),userinfo_signing_alg_values_supported:Y(J()).optional(),userinfo_encryption_alg_values_supported:Y(J()).optional(),userinfo_encryption_enc_values_supported:Y(J()).optional(),request_object_signing_alg_values_supported:Y(J()).optional(),request_object_encryption_alg_values_supported:Y(J()).optional(),request_object_encryption_enc_values_supported:Y(J()).optional(),token_endpoint_auth_methods_supported:Y(J()).optional(),token_endpoint_auth_signing_alg_values_supported:Y(J()).optional(),display_values_supported:Y(J()).optional(),claim_types_supported:Y(J()).optional(),claims_supported:Y(J()).optional(),service_documentation:J().optional(),claims_locales_supported:Y(J()).optional(),ui_locales_supported:Y(J()).optional(),claims_parameter_supported:Mu().optional(),request_parameter_supported:Mu().optional(),request_uri_parameter_supported:Mu().optional(),require_request_uri_registration:Mu().optional(),op_policy_uri:mm.optional(),op_tos_uri:mm.optional(),client_id_metadata_document_supported:Mu().optional()}).shape,...gm.pick({code_challenge_methods_supported:!0}).shape}),vm=X({access_token:J(),id_token:J().optional(),token_type:J(),expires_in:Ad().optional(),scope:J().optional(),refresh_token:J().optional()}).strip(),ym=X({error:J(),error_description:J().optional(),error_uri:J().optional()}),bm=mm.optional().or(Z(``).transform(()=>void 0)),xm=X({redirect_uris:Y(mm),token_endpoint_auth_method:J().optional(),grant_types:Y(J()).optional(),response_types:Y(J()).optional(),client_name:J().optional(),client_uri:mm.optional(),logo_uri:bm,scope:J().optional(),contacts:Y(J()).optional(),tos_uri:bm,policy_uri:J().optional(),jwks_uri:mm.optional(),jwks:Ru().optional(),software_id:J().optional(),software_version:J().optional(),software_statement:J().optional()}).strip(),Sm=X({client_id:J(),client_secret:J().optional(),client_id_issued_at:Ou().optional(),client_secret_expires_at:Ou().optional()}).strip(),Cm=xm.merge(Sm);X({error:J(),error_description:J().optional()}).strip(),X({token:J(),token_type_hint:J().optional()}).strip();function wm(e){let t=typeof e==`string`?new URL(e):new URL(e.href);return t.hash=``,t}function Tm({requestedResource:e,configuredResource:t}){let n=typeof e==`string`?new URL(e):new URL(e.href),r=typeof t==`string`?new URL(t):new URL(t.href);if(n.origin!==r.origin||n.pathname.length<r.pathname.length)return!1;let i=n.pathname.endsWith(`/`)?n.pathname:n.pathname+`/`,a=r.pathname.endsWith(`/`)?r.pathname:r.pathname+`/`;return i.startsWith(a)}var Em=class extends Error{constructor(e,t){super(e),this.errorUri=t,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}},Dm=class extends Em{};Dm.errorCode=`invalid_request`;var Om=class extends Em{};Om.errorCode=`invalid_client`;var km=class extends Em{};km.errorCode=`invalid_grant`;var Am=class extends Em{};Am.errorCode=`unauthorized_client`;var jm=class extends Em{};jm.errorCode=`unsupported_grant_type`;var Mm=class extends Em{};Mm.errorCode=`invalid_scope`;var Nm=class extends Em{};Nm.errorCode=`access_denied`;var Pm=class extends Em{};Pm.errorCode=`server_error`;var Fm=class extends Em{};Fm.errorCode=`temporarily_unavailable`;var Im=class extends Em{};Im.errorCode=`unsupported_response_type`;var Lm=class extends Em{};Lm.errorCode=`unsupported_token_type`;var Rm=class extends Em{};Rm.errorCode=`invalid_token`;var zm=class extends Em{};zm.errorCode=`method_not_allowed`;var Bm=class extends Em{};Bm.errorCode=`too_many_requests`;var Vm=class extends Em{};Vm.errorCode=`invalid_client_metadata`;var Hm=class extends Em{};Hm.errorCode=`insufficient_scope`;var Um=class extends Em{};Um.errorCode=`invalid_target`;var Wm={[Dm.errorCode]:Dm,[Om.errorCode]:Om,[km.errorCode]:km,[Am.errorCode]:Am,[jm.errorCode]:jm,[Mm.errorCode]:Mm,[Nm.errorCode]:Nm,[Pm.errorCode]:Pm,[Fm.errorCode]:Fm,[Im.errorCode]:Im,[Lm.errorCode]:Lm,[Rm.errorCode]:Rm,[zm.errorCode]:zm,[Bm.errorCode]:Bm,[Vm.errorCode]:Vm,[Hm.errorCode]:Hm,[Um.errorCode]:Um},Gm=class extends Error{constructor(e){super(e??`Unauthorized`)}};function Km(e){return[`client_secret_basic`,`client_secret_post`,`none`].includes(e)}var qm=`code`,Jm=`S256`;function Ym(e,t){let n=e.client_secret!==void 0;return`token_endpoint_auth_method`in e&&e.token_endpoint_auth_method&&Km(e.token_endpoint_auth_method)&&(t.length===0||t.includes(e.token_endpoint_auth_method))?e.token_endpoint_auth_method:t.length===0?n?`client_secret_basic`:`none`:n&&t.includes(`client_secret_basic`)?`client_secret_basic`:n&&t.includes(`client_secret_post`)?`client_secret_post`:t.includes(`none`)?`none`:n?`client_secret_post`:`none`}function Xm(e,t,n,r){let{client_id:i,client_secret:a}=t;switch(e){case`client_secret_basic`:Zm(i,a,n);return;case`client_secret_post`:Qm(i,a,r);return;case`none`:$m(i,r);return;default:throw Error(`Unsupported client authentication method: ${e}`)}}function Zm(e,t,n){if(!t)throw Error(`client_secret_basic authentication requires a client_secret`);let r=btoa(`${e}:${t}`);n.set(`Authorization`,`Basic ${r}`)}function Qm(e,t,n){n.set(`client_id`,e),t&&n.set(`client_secret`,t)}function $m(e,t){t.set(`client_id`,e)}async function eh(e){let t=e instanceof Response?e.status:void 0,n=e instanceof Response?await e.text():e;try{let{error:e,error_description:t,error_uri:r}=ym.parse(JSON.parse(n));return new(Wm[e]||Pm)(t||``,r)}catch(e){return new Pm(`${t?`HTTP ${t}: `:``}Invalid OAuth error response: ${e}. Raw body: ${n}`)}}async function th(e,t){try{return await nh(e,t)}catch(n){if(n instanceof Om||n instanceof Am)return await e.invalidateCredentials?.(`all`),await nh(e,t);if(n instanceof km)return await e.invalidateCredentials?.(`tokens`),await nh(e,t);throw n}}async function nh(e,{serverUrl:t,authorizationCode:n,scope:r,resourceMetadataUrl:i,fetchFn:a}){let o=await e.discoveryState?.(),s,c,l,u=i;if(!u&&o?.resourceMetadataUrl&&(u=new URL(o.resourceMetadataUrl)),o?.authorizationServerUrl){if(c=o.authorizationServerUrl,s=o.resourceMetadata,l=o.authorizationServerMetadata??await mh(c,{fetchFn:a}),!s)try{s=await sh(t,{resourceMetadataUrl:u},a)}catch{}(l!==o.authorizationServerMetadata||s!==o.resourceMetadata)&&await e.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:u?.toString(),resourceMetadata:s,authorizationServerMetadata:l})}else{let n=await hh(t,{resourceMetadataUrl:u,fetchFn:a});c=n.authorizationServerUrl,l=n.authorizationServerMetadata,s=n.resourceMetadata,await e.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:u?.toString(),resourceMetadata:s,authorizationServerMetadata:l})}let d=await ih(t,e,s),f=r||s?.scopes_supported?.join(` `)||e.clientMetadata.scope,p=await Promise.resolve(e.clientInformation());if(!p){if(n!==void 0)throw Error(`Existing OAuth client information is required when exchanging an authorization code`);let t=l?.client_id_metadata_document_supported===!0,r=e.clientMetadataUrl;if(r&&!rh(r))throw new Vm(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${r}`);if(t&&r)p={client_id:r},await e.saveClientInformation?.(p);else{if(!e.saveClientInformation)throw Error(`OAuth client information must be saveable for dynamic registration`);let t=await xh(c,{metadata:l,clientMetadata:e.clientMetadata,scope:f,fetchFn:a});await e.saveClientInformation(t),p=t}}let m=!e.redirectUrl;if(n!==void 0||m){let t=await bh(e,c,{metadata:l,resource:d,authorizationCode:n,fetchFn:a});return await e.saveTokens(t),`AUTHORIZED`}let h=await e.tokens();if(h?.refresh_token)try{let t=await yh(c,{metadata:l,clientInformation:p,refreshToken:h.refresh_token,resource:d,addClientAuthentication:e.addClientAuthentication,fetchFn:a});return await e.saveTokens(t),`AUTHORIZED`}catch(e){if(!(!(e instanceof Em)||e instanceof Pm))throw e}let g=e.state?await e.state():void 0,{authorizationUrl:_,codeVerifier:v}=await gh(c,{metadata:l,clientInformation:p,state:g,redirectUrl:e.redirectUrl,scope:f,resource:d});return await e.saveCodeVerifier(v),await e.redirectToAuthorization(_),`REDIRECT`}function rh(e){if(!e)return!1;try{let t=new URL(e);return t.protocol===`https:`&&t.pathname!==`/`}catch{return!1}}async function ih(e,t,n){let r=wm(e);if(t.validateResourceURL)return await t.validateResourceURL(r,n?.resource);if(n){if(!Tm({requestedResource:r,configuredResource:n.resource}))throw Error(`Protected resource ${n.resource} does not match expected ${r} (or origin)`);return new URL(n.resource)}}function ah(e){let t=e.headers.get(`WWW-Authenticate`);if(!t)return{};let[n,r]=t.split(` `);if(n.toLowerCase()!==`bearer`||!r)return{};let i=oh(e,`resource_metadata`)||void 0,a;if(i)try{a=new URL(i)}catch{}let o=oh(e,`scope`)||void 0,s=oh(e,`error`)||void 0;return{resourceMetadataUrl:a,scope:o,error:s}}function oh(e,t){let n=e.headers.get(`WWW-Authenticate`);if(!n)return null;let r=RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),i=n.match(r);return i?i[1]||i[2]:null}async function sh(e,t,n=fetch){let r=await fh(e,`oauth-protected-resource`,n,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!r||r.status===404)throw await r?.body?.cancel(),Error(`Resource server does not implement OAuth 2.0 Protected Resource Metadata.`);if(!r.ok)throw await r.body?.cancel(),Error(`HTTP ${r.status} trying to load well-known OAuth protected resource metadata.`);return hm.parse(await r.json())}async function ch(e,t,n=fetch){try{return await n(e,{headers:t})}catch(r){if(r instanceof TypeError)return t?ch(e,void 0,n):void 0;throw r}}function lh(e,t=``,n={}){return t.endsWith(`/`)&&(t=t.slice(0,-1)),n.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function uh(e,t,n=fetch){return await ch(e,{"MCP-Protocol-Version":t},n)}function dh(e,t){return!e||e.status>=400&&e.status<500&&t!==`/`}async function fh(e,t,n,r){let i=new URL(e),a=r?.protocolVersion??`2025-11-25`,o;if(r?.metadataUrl)o=new URL(r.metadataUrl);else{let e=lh(t,i.pathname);o=new URL(e,r?.metadataServerUrl??i),o.search=i.search}let s=await uh(o,a,n);return!r?.metadataUrl&&dh(s,i.pathname)&&(s=await uh(new URL(`/.well-known/${t}`,i),a,n)),s}function ph(e){let t=typeof e==`string`?new URL(e):e,n=t.pathname!==`/`,r=[];if(!n)return r.push({url:new URL(`/.well-known/oauth-authorization-server`,t.origin),type:`oauth`}),r.push({url:new URL(`/.well-known/openid-configuration`,t.origin),type:`oidc`}),r;let i=t.pathname;return i.endsWith(`/`)&&(i=i.slice(0,-1)),r.push({url:new URL(`/.well-known/oauth-authorization-server${i}`,t.origin),type:`oauth`}),r.push({url:new URL(`/.well-known/openid-configuration${i}`,t.origin),type:`oidc`}),r.push({url:new URL(`${i}/.well-known/openid-configuration`,t.origin),type:`oidc`}),r}async function mh(e,{fetchFn:t=fetch,protocolVersion:n=jd}={}){let r={"MCP-Protocol-Version":n,Accept:`application/json`},i=ph(e);for(let{url:e,type:n}of i){let i=await ch(e,r,t);if(i){if(!i.ok){if(await i.body?.cancel(),i.status>=400&&i.status<500)continue;throw Error(`HTTP ${i.status} trying to load ${n===`oauth`?`OAuth`:`OpenID provider`} metadata from ${e}`)}return n===`oauth`?gm.parse(await i.json()):_m.parse(await i.json())}}}async function hh(e,t){let n,r;try{n=await sh(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn),n.authorization_servers&&n.authorization_servers.length>0&&(r=n.authorization_servers[0])}catch{}r||=String(new URL(`/`,e));let i=await mh(r,{fetchFn:t?.fetchFn});return{authorizationServerUrl:r,authorizationServerMetadata:i,resourceMetadata:n}}async function gh(e,{metadata:t,clientInformation:n,redirectUrl:r,scope:i,state:a,resource:o}){let s;if(t){if(s=new URL(t.authorization_endpoint),!t.response_types_supported.includes(qm))throw Error(`Incompatible auth server: does not support response type ${qm}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(Jm))throw Error(`Incompatible auth server: does not support code challenge method ${Jm}`)}else s=new URL(`/authorize`,e);let c=await Ei(),l=c.code_verifier,u=c.code_challenge;return s.searchParams.set(`response_type`,qm),s.searchParams.set(`client_id`,n.client_id),s.searchParams.set(`code_challenge`,u),s.searchParams.set(`code_challenge_method`,Jm),s.searchParams.set(`redirect_uri`,String(r)),a&&s.searchParams.set(`state`,a),i&&s.searchParams.set(`scope`,i),i?.includes(`offline_access`)&&s.searchParams.append(`prompt`,`consent`),o&&s.searchParams.set(`resource`,o.href),{authorizationUrl:s,codeVerifier:l}}function _h(e,t,n){return new URLSearchParams({grant_type:`authorization_code`,code:e,code_verifier:t,redirect_uri:String(n)})}async function vh(e,{metadata:t,tokenRequestParams:n,clientInformation:r,addClientAuthentication:i,resource:a,fetchFn:o}){let s=t?.token_endpoint?new URL(t.token_endpoint):new URL(`/token`,e),c=new Headers({"Content-Type":`application/x-www-form-urlencoded`,Accept:`application/json`});a&&n.set(`resource`,a.href),i?await i(c,n,s,t):r&&Xm(Ym(r,t?.token_endpoint_auth_methods_supported??[]),r,c,n);let l=await(o??fetch)(s,{method:`POST`,headers:c,body:n});if(!l.ok)throw await eh(l);return vm.parse(await l.json())}async function yh(e,{metadata:t,clientInformation:n,refreshToken:r,resource:i,addClientAuthentication:a,fetchFn:o}){return{refresh_token:r,...await vh(e,{metadata:t,tokenRequestParams:new URLSearchParams({grant_type:`refresh_token`,refresh_token:r}),clientInformation:n,addClientAuthentication:a,resource:i,fetchFn:o})}}async function bh(e,t,{metadata:n,resource:r,authorizationCode:i,fetchFn:a}={}){let o=e.clientMetadata.scope,s;if(e.prepareTokenRequest&&(s=await e.prepareTokenRequest(o)),!s){if(!i)throw Error(`Either provider.prepareTokenRequest() or authorizationCode is required`);if(!e.redirectUrl)throw Error(`redirectUrl is required for authorization_code flow`);s=_h(i,await e.codeVerifier(),e.redirectUrl)}let c=await e.clientInformation();return vh(t,{metadata:n,tokenRequestParams:s,clientInformation:c??void 0,addClientAuthentication:e.addClientAuthentication,resource:r,fetchFn:a})}async function xh(e,{metadata:t,clientMetadata:n,scope:r,fetchFn:i}){let a;if(t){if(!t.registration_endpoint)throw Error(`Incompatible auth server: does not support dynamic client registration`);a=new URL(t.registration_endpoint)}else a=new URL(`/register`,e);let o=await(i??fetch)(a,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...n,...r===void 0?{}:{scope:r}})});if(!o.ok)throw await eh(o);return Cm.parse(await o.json())}var Sh=typeof global==`object`&&global&&global.Object===Object&&global,Ch=typeof self==`object`&&self&&self.Object===Object&&self,wh=Sh||Ch||Function(`return this`)(),Th=wh.Symbol,Eh=Object.prototype,Dh=Eh.hasOwnProperty,Oh=Eh.toString,kh=Th?Th.toStringTag:void 0;function Ah(e){var t=Dh.call(e,kh),n=e[kh];try{e[kh]=void 0;var r=!0}catch{}var i=Oh.call(e);return r&&(t?e[kh]=n:delete e[kh]),i}var jh=Object.prototype.toString;function Mh(e){return jh.call(e)}var Nh=`[object Null]`,Ph=`[object Undefined]`,Fh=Th?Th.toStringTag:void 0;function Ih(e){return e==null?e===void 0?Ph:Nh:Fh&&Fh in Object(e)?Ah(e):Mh(e)}function Lh(e){return typeof e==`object`&&!!e}var Rh=`[object Symbol]`;function zh(e){return typeof e==`symbol`||Lh(e)&&Ih(e)==Rh}function Bh(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var Vh=Array.isArray,Hh=1/0,Uh=Th?Th.prototype:void 0,Wh=Uh?Uh.toString:void 0;function Gh(e){if(typeof e==`string`)return e;if(Vh(e))return Bh(e,Gh)+``;if(zh(e))return Wh?Wh.call(e):``;var t=e+``;return t==`0`&&1/e==-Hh?`-0`:t}var Kh=/\s/;function qh(e){for(var t=e.length;t--&&Kh.test(e.charAt(t)););return t}var Jh=/^\s+/;function Yh(e){return e&&e.slice(0,qh(e)+1).replace(Jh,``)}function Xh(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}var Zh=NaN,Qh=/^[-+]0x[0-9a-f]+$/i,$h=/^0b[01]+$/i,eg=/^0o[0-7]+$/i,tg=parseInt;function ng(e){if(typeof e==`number`)return e;if(zh(e))return Zh;if(Xh(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=Xh(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=Yh(e);var n=$h.test(e);return n||eg.test(e)?tg(e.slice(2),n?2:8):Qh.test(e)?Zh:+e}var rg=1/0,ig=17976931348623157e292;function ag(e){return e?(e=ng(e),e===rg||e===-rg?(e<0?-1:1)*ig:e===e?e:0):e===0?e:0}function og(e){var t=ag(e),n=t%1;return t===t?n?t-n:t:0}function sg(e){return e}var cg=`[object AsyncFunction]`,lg=`[object Function]`,iee=`[object GeneratorFunction]`,aee=`[object Proxy]`;function ug(e){if(!Xh(e))return!1;var t=Ih(e);return t==lg||t==iee||t==cg||t==aee}var dg=wh[`__core-js_shared__`],fg=function(){var e=/[^.]+$/.exec(dg&&dg.keys&&dg.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function oee(e){return!!fg&&fg in e}var see=Function.prototype.toString;function pg(e){if(e!=null){try{return see.call(e)}catch{}try{return e+``}catch{}}return``}var cee=/[\\^$.*+?()[\]{}|]/g,lee=/^\[object .+?Constructor\]$/,uee=Function.prototype,dee=Object.prototype,fee=uee.toString,pee=dee.hasOwnProperty,mg=RegExp(`^`+fee.call(pee).replace(cee,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function hg(e){return!Xh(e)||oee(e)?!1:(ug(e)?mg:lee).test(pg(e))}function gg(e,t){return e?.[t]}function _g(e,t){var n=gg(e,t);return hg(n)?n:void 0}var vg=_g(wh,`WeakMap`),yg=Object.create,bg=function(){function e(){}return function(t){if(!Xh(t))return{};if(yg)return yg(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function xg(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Sg(){}function Cg(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}var wg=800,Tg=16,Eg=Date.now;function Dg(e){var t=0,n=0;return function(){var r=Eg(),i=Tg-(r-n);if(n=r,i>0){if(++t>=wg)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Og(e){return function(){return e}}var kg=function(){try{var e=_g(Object,`defineProperty`);return e({},``,{}),e}catch{}}(),Ag=Dg(kg?function(e,t){return kg(e,`toString`,{configurable:!0,enumerable:!1,value:Og(t),writable:!0})}:sg);function jg(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}function Mg(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a<i;)if(t(e[a],a,e))return a;return-1}function Ng(e){return e!==e}function Pg(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}function Fg(e,t,n){return t===t?Pg(e,t,n):Mg(e,Ng,n)}function Ig(e,t){return!!(e!=null&&e.length)&&Fg(e,t,0)>-1}var Lg=9007199254740991,Rg=/^(?:0|[1-9]\d*)$/;function zg(e,t){var n=typeof e;return t??=Lg,!!t&&(n==`number`||n!=`symbol`&&Rg.test(e))&&e>-1&&e%1==0&&e<t}function Bg(e,t,n){t==`__proto__`&&kg?kg(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Vg(e,t){return e===t||e!==e&&t!==t}var Hg=Object.prototype.hasOwnProperty;function Ug(e,t,n){var r=e[t];(!(Hg.call(e,t)&&Vg(r,n))||n===void 0&&!(t in e))&&Bg(e,t,n)}function Wg(e,t,n,r){var i=!n;n||={};for(var a=-1,o=t.length;++a<o;){var s=t[a],c=r?r(n[s],e[s],s,n,e):void 0;c===void 0&&(c=e[s]),i?Bg(n,s,c):Ug(n,s,c)}return n}var Gg=Math.max;function Kg(e,t,n){return t=Gg(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,a=Gg(r.length-t,0),o=Array(a);++i<a;)o[i]=r[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=r[i];return s[t]=n(o),xg(e,this,s)}}function qg(e,t){return Ag(Kg(e,t,sg),e+``)}var Jg=9007199254740991;function Yg(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=Jg}function Xg(e){return e!=null&&Yg(e.length)&&!ug(e)}function Zg(e,t,n){if(!Xh(n))return!1;var r=typeof t;return(r==`number`?Xg(n)&&zg(t,n.length):r==`string`&&t in n)?Vg(n[t],e):!1}function Qg(e){return qg(function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(a=e.length>3&&typeof a==`function`?(i--,a):void 0,o&&Zg(n[0],n[1],o)&&(a=i<3?void 0:a,i=1),t=Object(t);++r<i;){var s=n[r];s&&e(t,s,r,a)}return t})}var $g=Object.prototype;function e_(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||$g)}function t_(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var n_=`[object Arguments]`;function r_(e){return Lh(e)&&Ih(e)==n_}var i_=Object.prototype,a_=i_.hasOwnProperty,o_=i_.propertyIsEnumerable,s_=r_(function(){return arguments}())?r_:function(e){return Lh(e)&&a_.call(e,`callee`)&&!o_.call(e,`callee`)};function c_(){return!1}var l_=typeof exports==`object`&&exports&&!exports.nodeType&&exports,u_=l_&&typeof module==`object`&&module&&!module.nodeType&&module,d_=u_&&u_.exports===l_?wh.Buffer:void 0,f_=(d_?d_.isBuffer:void 0)||c_,p_=`[object Arguments]`,m_=`[object Array]`,h_=`[object Boolean]`,g_=`[object Date]`,__=`[object Error]`,v_=`[object Function]`,y_=`[object Map]`,b_=`[object Number]`,x_=`[object Object]`,S_=`[object RegExp]`,C_=`[object Set]`,w_=`[object String]`,T_=`[object WeakMap]`,E_=`[object ArrayBuffer]`,D_=`[object DataView]`,mee=`[object Float32Array]`,hee=`[object Float64Array]`,gee=`[object Int8Array]`,_ee=`[object Int16Array]`,vee=`[object Int32Array]`,yee=`[object Uint8Array]`,bee=`[object Uint8ClampedArray]`,xee=`[object Uint16Array]`,See=`[object Uint32Array]`,O_={};O_[mee]=O_[hee]=O_[gee]=O_[_ee]=O_[vee]=O_[yee]=O_[bee]=O_[xee]=O_[See]=!0,O_[p_]=O_[m_]=O_[E_]=O_[h_]=O_[D_]=O_[g_]=O_[__]=O_[v_]=O_[y_]=O_[b_]=O_[x_]=O_[S_]=O_[C_]=O_[w_]=O_[T_]=!1;function Cee(e){return Lh(e)&&Yg(e.length)&&!!O_[Ih(e)]}function k_(e){return function(t){return e(t)}}var A_=typeof exports==`object`&&exports&&!exports.nodeType&&exports,j_=A_&&typeof module==`object`&&module&&!module.nodeType&&module,M_=j_&&j_.exports===A_&&Sh.process,N_=function(){try{return j_&&j_.require&&j_.require(`util`).types||M_&&M_.binding&&M_.binding(`util`)}catch{}}(),P_=N_&&N_.isTypedArray,F_=P_?k_(P_):Cee,I_=Object.prototype.hasOwnProperty;function L_(e,t){var n=Vh(e),r=!n&&s_(e),i=!n&&!r&&f_(e),a=!n&&!r&&!i&&F_(e),o=n||r||i||a,s=o?t_(e.length,String):[],c=s.length;for(var l in e)(t||I_.call(e,l))&&!(o&&(l==`length`||i&&(l==`offset`||l==`parent`)||a&&(l==`buffer`||l==`byteLength`||l==`byteOffset`)||zg(l,c)))&&s.push(l);return s}function R_(e,t){return function(n){return e(t(n))}}var z_=R_(Object.keys,Object),B_=Object.prototype.hasOwnProperty;function V_(e){if(!e_(e))return z_(e);var t=[];for(var n in Object(e))B_.call(e,n)&&n!=`constructor`&&t.push(n);return t}function H_(e){return Xg(e)?L_(e):V_(e)}var U_=Object.prototype.hasOwnProperty,W_=Qg(function(e,t){if(e_(t)||Xg(t)){Wg(t,H_(t),e);return}for(var n in t)U_.call(t,n)&&Ug(e,n,t[n])});function G_(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var K_=Object.prototype.hasOwnProperty;function q_(e){if(!Xh(e))return G_(e);var t=e_(e),n=[];for(var r in e)r==`constructor`&&(t||!K_.call(e,r))||n.push(r);return n}function J_(e){return Xg(e)?L_(e,!0):q_(e)}var Y_=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,X_=/^\w*$/;function Z_(e,t){if(Vh(e))return!1;var n=typeof e;return n==`number`||n==`symbol`||n==`boolean`||e==null||zh(e)?!0:X_.test(e)||!Y_.test(e)||t!=null&&e in Object(t)}var Q_=_g(Object,`create`);function $_(){this.__data__=Q_?Q_(null):{},this.size=0}function ev(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var tv=`__lodash_hash_undefined__`,nv=Object.prototype.hasOwnProperty;function rv(e){var t=this.__data__;if(Q_){var n=t[e];return n===tv?void 0:n}return nv.call(t,e)?t[e]:void 0}var iv=Object.prototype.hasOwnProperty;function av(e){var t=this.__data__;return Q_?t[e]!==void 0:iv.call(t,e)}var ov=`__lodash_hash_undefined__`;function sv(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Q_&&t===void 0?ov:t,this}function cv(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}cv.prototype.clear=$_,cv.prototype.delete=ev,cv.prototype.get=rv,cv.prototype.has=av,cv.prototype.set=sv;function lv(){this.__data__=[],this.size=0}function uv(e,t){for(var n=e.length;n--;)if(Vg(e[n][0],t))return n;return-1}var dv=Array.prototype.splice;function fv(e){var t=this.__data__,n=uv(t,e);return n<0?!1:(n==t.length-1?t.pop():dv.call(t,n,1),--this.size,!0)}function pv(e){var t=this.__data__,n=uv(t,e);return n<0?void 0:t[n][1]}function mv(e){return uv(this.__data__,e)>-1}function hv(e,t){var n=this.__data__,r=uv(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function gv(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}gv.prototype.clear=lv,gv.prototype.delete=fv,gv.prototype.get=pv,gv.prototype.has=mv,gv.prototype.set=hv;var _v=_g(wh,`Map`);function vv(){this.size=0,this.__data__={hash:new cv,map:new(_v||gv),string:new cv}}function yv(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function bv(e,t){var n=e.__data__;return yv(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function xv(e){var t=bv(this,e).delete(e);return this.size-=t?1:0,t}function Sv(e){return bv(this,e).get(e)}function Cv(e){return bv(this,e).has(e)}function wv(e,t){var n=bv(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function Tv(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Tv.prototype.clear=vv,Tv.prototype.delete=xv,Tv.prototype.get=Sv,Tv.prototype.has=Cv,Tv.prototype.set=wv;var Ev=`Expected a function`;function Dv(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(Ev);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(Dv.Cache||Tv),n}Dv.Cache=Tv;var Ov=500;function kv(e){var t=Dv(e,function(e){return n.size===Ov&&n.clear(),e}),n=t.cache;return t}var Av=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,jv=/\\(\\)?/g,Mv=kv(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(Av,function(e,n,r,i){t.push(r?i.replace(jv,`$1`):n||e)}),t});function Nv(e){return e==null?``:Gh(e)}function Pv(e,t){return Vh(e)?e:Z_(e,t)?[e]:Mv(Nv(e))}var Fv=1/0;function Iv(e){if(typeof e==`string`||zh(e))return e;var t=e+``;return t==`0`&&1/e==-Fv?`-0`:t}function Lv(e,t){t=Pv(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[Iv(t[n++])];return n&&n==r?e:void 0}function Q(e,t,n){var r=e==null?void 0:Lv(e,t);return r===void 0?n:r}function Rv(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var zv=Th?Th.isConcatSpreadable:void 0;function Bv(e){return Vh(e)||s_(e)||!!(zv&&e&&e[zv])}function Vv(e,t,n,r,i){var a=-1,o=e.length;for(n||=Bv,i||=[];++a<o;){var s=e[a];t>0&&n(s)?t>1?Vv(s,t-1,n,r,i):Rv(i,s):r||(i[i.length]=s)}return i}function Hv(e){return e!=null&&e.length?Vv(e,1):[]}function Uv(e){return Ag(Kg(e,void 0,Hv),e+``)}var Wv=R_(Object.getPrototypeOf,Object),Gv=`[object Object]`,Kv=Function.prototype,qv=Object.prototype,Jv=Kv.toString,Yv=qv.hasOwnProperty,Xv=Jv.call(Object);function Zv(e){if(!Lh(e)||Ih(e)!=Gv)return!1;var t=Wv(e);if(t===null)return!0;var n=Yv.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&Jv.call(n)==Xv}function Qv(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(i);++r<i;)a[r]=e[r+t];return a}function $v(e,t,n,r){var i=-1,a=e==null?0:e.length;for(r&&a&&(n=e[++i]);++i<a;)n=t(n,e[i],i,e);return n}function ey(){this.__data__=new gv,this.size=0}function ty(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function ny(e){return this.__data__.get(e)}function ry(e){return this.__data__.has(e)}var iy=200;function ay(e,t){var n=this.__data__;if(n instanceof gv){var r=n.__data__;if(!_v||r.length<iy-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Tv(r)}return n.set(e,t),this.size=n.size,this}function oy(e){this.size=(this.__data__=new gv(e)).size}oy.prototype.clear=ey,oy.prototype.delete=ty,oy.prototype.get=ny,oy.prototype.has=ry,oy.prototype.set=ay;function sy(e,t){return e&&Wg(t,H_(t),e)}function cy(e,t){return e&&Wg(t,J_(t),e)}var ly=typeof exports==`object`&&exports&&!exports.nodeType&&exports,uy=ly&&typeof module==`object`&&module&&!module.nodeType&&module,dy=uy&&uy.exports===ly?wh.Buffer:void 0,fy=dy?dy.allocUnsafe:void 0;function py(e,t){if(t)return e.slice();var n=e.length,r=fy?fy(n):new e.constructor(n);return e.copy(r),r}function my(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n<r;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a}function hy(){return[]}var gy=Object.prototype.propertyIsEnumerable,_y=Object.getOwnPropertySymbols,vy=_y?function(e){return e==null?[]:(e=Object(e),my(_y(e),function(t){return gy.call(e,t)}))}:hy;function yy(e,t){return Wg(e,vy(e),t)}var by=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Rv(t,vy(e)),e=Wv(e);return t}:hy;function xy(e,t){return Wg(e,by(e),t)}function Sy(e,t,n){var r=t(e);return Vh(e)?r:Rv(r,n(e))}function Cy(e){return Sy(e,H_,vy)}function wy(e){return Sy(e,J_,by)}var Ty=_g(wh,`DataView`),Ey=_g(wh,`Promise`),Dy=_g(wh,`Set`),Oy=`[object Map]`,ky=`[object Object]`,Ay=`[object Promise]`,jy=`[object Set]`,My=`[object WeakMap]`,Ny=`[object DataView]`,Py=pg(Ty),Fy=pg(_v),Iy=pg(Ey),Ly=pg(Dy),Ry=pg(vg),zy=Ih;(Ty&&zy(new Ty(new ArrayBuffer(1)))!=Ny||_v&&zy(new _v)!=Oy||Ey&&zy(Ey.resolve())!=Ay||Dy&&zy(new Dy)!=jy||vg&&zy(new vg)!=My)&&(zy=function(e){var t=Ih(e),n=t==ky?e.constructor:void 0,r=n?pg(n):``;if(r)switch(r){case Py:return Ny;case Fy:return Oy;case Iy:return Ay;case Ly:return jy;case Ry:return My}return t});var By=zy,Vy=Object.prototype.hasOwnProperty;function Hy(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]==`string`&&Vy.call(e,`index`)&&(n.index=e.index,n.input=e.input),n}var Uy=wh.Uint8Array;function Wy(e){var t=new e.constructor(e.byteLength);return new Uy(t).set(new Uy(e)),t}function Gy(e,t){var n=t?Wy(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var Ky=/\w*$/;function qy(e){var t=new e.constructor(e.source,Ky.exec(e));return t.lastIndex=e.lastIndex,t}var Jy=Th?Th.prototype:void 0,Yy=Jy?Jy.valueOf:void 0;function Xy(e){return Yy?Object(Yy.call(e)):{}}function Zy(e,t){var n=t?Wy(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var Qy=`[object Boolean]`,$y=`[object Date]`,eb=`[object Map]`,tb=`[object Number]`,nb=`[object RegExp]`,rb=`[object Set]`,ib=`[object String]`,ab=`[object Symbol]`,ob=`[object ArrayBuffer]`,sb=`[object DataView]`,cb=`[object Float32Array]`,lb=`[object Float64Array]`,ub=`[object Int8Array]`,db=`[object Int16Array]`,fb=`[object Int32Array]`,pb=`[object Uint8Array]`,mb=`[object Uint8ClampedArray]`,hb=`[object Uint16Array]`,gb=`[object Uint32Array]`;function _b(e,t,n){var r=e.constructor;switch(t){case ob:return Wy(e);case Qy:case $y:return new r(+e);case sb:return Gy(e,n);case cb:case lb:case ub:case db:case fb:case pb:case mb:case hb:case gb:return Zy(e,n);case eb:return new r;case tb:case ib:return new r(e);case nb:return qy(e);case rb:return new r;case ab:return Xy(e)}}function vb(e){return typeof e.constructor==`function`&&!e_(e)?bg(Wv(e)):{}}var yb=`[object Map]`;function bb(e){return Lh(e)&&By(e)==yb}var xb=N_&&N_.isMap,Sb=xb?k_(xb):bb,Cb=`[object Set]`;function wb(e){return Lh(e)&&By(e)==Cb}var Tb=N_&&N_.isSet,Eb=Tb?k_(Tb):wb,Db=1,Ob=2,kb=4,Ab=`[object Arguments]`,jb=`[object Array]`,Mb=`[object Boolean]`,Nb=`[object Date]`,Pb=`[object Error]`,Fb=`[object Function]`,Ib=`[object GeneratorFunction]`,Lb=`[object Map]`,Rb=`[object Number]`,zb=`[object Object]`,Bb=`[object RegExp]`,Vb=`[object Set]`,Hb=`[object String]`,Ub=`[object Symbol]`,Wb=`[object WeakMap]`,Gb=`[object ArrayBuffer]`,Kb=`[object DataView]`,qb=`[object Float32Array]`,Jb=`[object Float64Array]`,Yb=`[object Int8Array]`,Xb=`[object Int16Array]`,Zb=`[object Int32Array]`,Qb=`[object Uint8Array]`,$b=`[object Uint8ClampedArray]`,ex=`[object Uint16Array]`,tx=`[object Uint32Array]`,nx={};nx[Ab]=nx[jb]=nx[Gb]=nx[Kb]=nx[Mb]=nx[Nb]=nx[qb]=nx[Jb]=nx[Yb]=nx[Xb]=nx[Zb]=nx[Lb]=nx[Rb]=nx[zb]=nx[Bb]=nx[Vb]=nx[Hb]=nx[Ub]=nx[Qb]=nx[$b]=nx[ex]=nx[tx]=!0,nx[Pb]=nx[Fb]=nx[Wb]=!1;function rx(e,t,n,r,i,a){var o,s=t&Db,c=t&Ob,l=t&kb;if(n&&(o=i?n(e,r,i,a):n(e)),o!==void 0)return o;if(!Xh(e))return e;var u=Vh(e);if(u){if(o=Hy(e),!s)return Cg(e,o)}else{var d=By(e),f=d==Fb||d==Ib;if(f_(e))return py(e,s);if(d==zb||d==Ab||f&&!i){if(o=c||f?{}:vb(e),!s)return c?xy(e,cy(o,e)):yy(e,sy(o,e))}else{if(!nx[d])return i?e:{};o=_b(e,d,s)}}a||=new oy;var p=a.get(e);if(p)return p;a.set(e,o),Eb(e)?e.forEach(function(r){o.add(rx(r,t,n,r,e,a))}):Sb(e)&&e.forEach(function(r,i){o.set(i,rx(r,t,n,i,e,a))});var m=u?void 0:(l?c?wy:Cy:c?J_:H_)(e);return jg(m||e,function(r,i){m&&(i=r,r=e[i]),Ug(o,i,rx(r,t,n,i,e,a))}),o}var ix=1,ax=4;function ox(e){return rx(e,ix|ax)}var sx=`__lodash_hash_undefined__`;function cx(e){return this.__data__.set(e,sx),this}function lx(e){return this.__data__.has(e)}function ux(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new Tv;++t<n;)this.add(e[t])}ux.prototype.add=ux.prototype.push=cx,ux.prototype.has=lx;function dx(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function fx(e,t){return e.has(t)}var px=1,mx=2;function hx(e,t,n,r,i,a){var o=n&px,s=e.length,c=t.length;if(s!=c&&!(o&&c>s))return!1;var l=a.get(e),u=a.get(t);if(l&&u)return l==t&&u==e;var d=-1,f=!0,p=n&mx?new ux:void 0;for(a.set(e,t),a.set(t,e);++d<s;){var m=e[d],h=t[d];if(r)var g=o?r(h,m,d,t,e,a):r(m,h,d,e,t,a);if(g!==void 0){if(g)continue;f=!1;break}if(p){if(!dx(t,function(e,t){if(!fx(p,t)&&(m===e||i(m,e,n,r,a)))return p.push(t)})){f=!1;break}}else if(!(m===h||i(m,h,n,r,a))){f=!1;break}}return a.delete(e),a.delete(t),f}function wee(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function gx(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var Tee=1,Eee=2,Dee=`[object Boolean]`,Oee=`[object Date]`,kee=`[object Error]`,Aee=`[object Map]`,jee=`[object Number]`,Mee=`[object RegExp]`,Nee=`[object Set]`,Pee=`[object String]`,Fee=`[object Symbol]`,Iee=`[object ArrayBuffer]`,Lee=`[object DataView]`,_x=Th?Th.prototype:void 0,vx=_x?_x.valueOf:void 0;function Ree(e,t,n,r,i,a,o){switch(n){case Lee:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case Iee:return!(e.byteLength!=t.byteLength||!a(new Uy(e),new Uy(t)));case Dee:case Oee:case jee:return Vg(+e,+t);case kee:return e.name==t.name&&e.message==t.message;case Mee:case Pee:return e==t+``;case Aee:var s=wee;case Nee:var c=r&Tee;if(s||=gx,e.size!=t.size&&!c)return!1;var l=o.get(e);if(l)return l==t;r|=Eee,o.set(e,t);var u=hx(s(e),s(t),r,i,a,o);return o.delete(e),u;case Fee:if(vx)return vx.call(e)==vx.call(t)}return!1}var zee=1,Bee=Object.prototype.hasOwnProperty;function Vee(e,t,n,r,i,a){var o=n&zee,s=Cy(e),c=s.length;if(c!=Cy(t).length&&!o)return!1;for(var l=c;l--;){var u=s[l];if(!(o?u in t:Bee.call(t,u)))return!1}var d=a.get(e),f=a.get(t);if(d&&f)return d==t&&f==e;var p=!0;a.set(e,t),a.set(t,e);for(var m=o;++l<c;){u=s[l];var h=e[u],g=t[u];if(r)var _=o?r(g,h,u,t,e,a):r(h,g,u,e,t,a);if(!(_===void 0?h===g||i(h,g,n,r,a):_)){p=!1;break}m||=u==`constructor`}if(p&&!m){var v=e.constructor,y=t.constructor;v!=y&&`constructor`in e&&`constructor`in t&&!(typeof v==`function`&&v instanceof v&&typeof y==`function`&&y instanceof y)&&(p=!1)}return a.delete(e),a.delete(t),p}var Hee=1,yx=`[object Arguments]`,bx=`[object Array]`,xx=`[object Object]`,Sx=Object.prototype.hasOwnProperty;function Uee(e,t,n,r,i,a){var o=Vh(e),s=Vh(t),c=o?bx:By(e),l=s?bx:By(t);c=c==yx?xx:c,l=l==yx?xx:l;var u=c==xx,d=l==xx,f=c==l;if(f&&f_(e)){if(!f_(t))return!1;o=!0,u=!1}if(f&&!u)return a||=new oy,o||F_(e)?hx(e,t,n,r,i,a):Ree(e,t,c,n,r,i,a);if(!(n&Hee)){var p=u&&Sx.call(e,`__wrapped__`),m=d&&Sx.call(t,`__wrapped__`);if(p||m){var h=p?e.value():e,g=m?t.value():t;return a||=new oy,i(h,g,n,r,a)}}return f?(a||=new oy,Vee(e,t,n,r,i,a)):!1}function Cx(e,t,n,r,i){return e===t?!0:e==null||t==null||!Lh(e)&&!Lh(t)?e!==e&&t!==t:Uee(e,t,n,r,Cx,i)}var Wee=1,Gee=2;function Kee(e,t,n,r){var i=n.length,a=i,o=!r;if(e==null)return!a;for(e=Object(e);i--;){var s=n[i];if(o&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<a;){s=n[i];var c=s[0],l=e[c],u=s[1];if(o&&s[2]){if(l===void 0&&!(c in e))return!1}else{var d=new oy;if(r)var f=r(l,u,c,e,t,d);if(!(f===void 0?Cx(u,l,Wee|Gee,r,d):f))return!1}}return!0}function wx(e){return e===e&&!Xh(e)}function qee(e){for(var t=H_(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,wx(i)]}return t}function Tx(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}function Jee(e){var t=qee(e);return t.length==1&&t[0][2]?Tx(t[0][0],t[0][1]):function(n){return n===e||Kee(n,e,t)}}function Yee(e,t){return e!=null&&t in Object(e)}function Ex(e,t,n){t=Pv(t,e);for(var r=-1,i=t.length,a=!1;++r<i;){var o=Iv(t[r]);if(!(a=e!=null&&n(e,o)))break;e=e[o]}return a||++r!=i?a:(i=e==null?0:e.length,!!i&&Yg(i)&&zg(o,i)&&(Vh(e)||s_(e)))}function Dx(e,t){return e!=null&&Ex(e,t,Yee)}var Xee=1,Zee=2;function Qee(e,t){return Z_(e)&&wx(t)?Tx(Iv(e),t):function(n){var r=Q(n,e);return r===void 0&&r===t?Dx(n,e):Cx(t,r,Xee|Zee)}}function $ee(e){return function(t){return t?.[e]}}function ete(e){return function(t){return Lv(t,e)}}function tte(e){return Z_(e)?$ee(Iv(e)):ete(e)}function Ox(e){return typeof e==`function`?e:e==null?sg:typeof e==`object`?Vh(e)?Qee(e[0],e[1]):Jee(e):tte(e)}function nte(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}var kx=nte();function Ax(e,t){return e&&kx(e,t,H_)}function jx(e,t){return function(n,r){if(n==null)return n;if(!Xg(n))return e(n,r);for(var i=n.length,a=t?i:-1,o=Object(n);(t?a--:++a<i)&&r(o[a],a,o)!==!1;);return n}}var Mx=jx(Ax);function Nx(e,t,n){(n!==void 0&&!Vg(e[t],n)||n===void 0&&!(t in e))&&Bg(e,t,n)}function Px(e){return Lh(e)&&Xg(e)}function Fx(e,t){if(!(t===`constructor`&&typeof e[t]==`function`)&&t!=`__proto__`)return e[t]}function Ix(e){return Wg(e,J_(e))}function Lx(e,t,n,r,i,a,o){var s=Fx(e,n),c=Fx(t,n),l=o.get(c);if(l){Nx(e,n,l);return}var u=a?a(s,c,n+``,e,t,o):void 0,d=u===void 0;if(d){var f=Vh(c),p=!f&&f_(c),m=!f&&!p&&F_(c);u=c,f||p||m?Vh(s)?u=s:Px(s)?u=Cg(s):p?(d=!1,u=py(c,!0)):m?(d=!1,u=Zy(c,!0)):u=[]:Zv(c)||s_(c)?(u=s,s_(s)?u=Ix(s):(!Xh(s)||ug(s))&&(u=vb(c))):d=!1}d&&(o.set(c,u),i(u,c,r,a,o),o.delete(c)),Nx(e,n,u)}function Rx(e,t,n,r,i){e!==t&&kx(t,function(a,o){if(i||=new oy,Xh(a))Lx(e,t,o,n,Rx,r,i);else{var s=r?r(Fx(e,o),a,o+``,e,t,i):void 0;s===void 0&&(s=a),Nx(e,o,s)}},J_)}function zx(e,t,n){for(var r=-1,i=e==null?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}var Bx=200;function Vx(e,t,n,r){var i=-1,a=Ig,o=!0,s=e.length,c=[],l=t.length;if(!s)return c;n&&(t=Bh(t,k_(n))),r?(a=zx,o=!1):t.length>=Bx&&(a=fx,o=!1,t=new ux(t));outer:for(;++i<s;){var u=e[i],d=n==null?u:n(u);if(u=r||u!==0?u:0,o&&d===d){for(var f=l;f--;)if(t[f]===d)continue outer;c.push(u)}else a(t,d,r)||c.push(u)}return c}var Hx=qg(function(e,t){return Px(e)?Vx(e,Vv(t,1,Px,!0)):[]});function Ux(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}function Wx(e){return typeof e==`function`?e:sg}function Gx(e,t){return(Vh(e)?jg:Mx)(e,Wx(t))}var Kx=1/0;function qx(e){return e!=null&&e.length?Vv(e,Kx):[]}var rte=Object.prototype.hasOwnProperty;function Jx(e,t){return e!=null&&rte.call(e,t)}function Yx(e,t){return e!=null&&Ex(e,t,Jx)}var Xx=`[object String]`;function Zx(e){return typeof e==`string`||!Vh(e)&&Lh(e)&&Ih(e)==Xx}function Qx(e,t){return Bh(t,function(t){return e[t]})}function $x(e){return e==null?[]:Qx(e,H_(e))}var eS=Math.max;function tS(e,t,n,r){e=Xg(e)?e:$x(e),n=n&&!r?og(n):0;var i=e.length;return n<0&&(n=eS(i+n,0)),Zx(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Fg(e,t,n)>-1}var nS=Math.min;function rS(e,t,n){for(var r=n?zx:Ig,i=e[0].length,a=e.length,o=a,s=Array(a),c=1/0,l=[];o--;){var u=e[o];o&&t&&(u=Bh(u,k_(t))),c=nS(u.length,c),s[o]=!n&&(t||i>=120&&u.length>=120)?new ux(o&&u):void 0}u=e[0];var d=-1,f=s[0];outer:for(;++d<i&&l.length<c;){var p=u[d],m=t?t(p):p;if(p=n||p!==0?p:0,!(f?fx(f,m):r(l,m,n))){for(o=a;--o;){var h=s[o];if(!(h?fx(h,m):r(e[o],m,n)))continue outer}f&&f.push(m),l.push(p)}}return l}function iS(e){return Px(e)?e:[]}var aS=qg(function(e){var t=Bh(e,iS);return t.length&&t[0]===e[0]?rS(t):[]});function oS(e,t){return t.length<2?e:Lv(e,Qv(t,0,-1))}var sS=`[object Map]`,cS=`[object Set]`,lS=Object.prototype.hasOwnProperty;function uS(e){if(e==null)return!0;if(Xg(e)&&(Vh(e)||typeof e==`string`||typeof e.splice==`function`||f_(e)||F_(e)||s_(e)))return!e.length;var t=By(e);if(t==sS||t==cS)return!e.size;if(e_(e))return!V_(e).length;for(var n in e)if(lS.call(e,n))return!1;return!0}function dS(e,t){return Cx(e,t)}function fS(e,t,n){n=typeof n==`function`?n:void 0;var r=n?n(e,t):void 0;return r===void 0?Cx(e,t,void 0,n):!!r}var pS=`[object Number]`;function mS(e){return typeof e==`number`||Lh(e)&&Ih(e)==pS}function hS(e){return e==null}function gS(e){return e===void 0}var _S=Qg(function(e,t,n){Rx(e,t,n)}),vS=Object.prototype.hasOwnProperty;function yS(e,t){t=Pv(t,e);var n=-1,r=t.length;if(!r)return!0;for(var i=e==null||typeof e!=`object`&&typeof e!=`function`;++n<r;){var a=t[n];if(typeof a==`string`){if(a===`__proto__`&&!vS.call(e,`__proto__`))return!1;if(a===`constructor`&&n+1<r&&typeof t[n+1]==`string`&&t[n+1]===`prototype`){if(i&&n===0)continue;return!1}}}var o=oS(e,t);return o==null||delete o[Iv(Ux(t))]}function bS(e){return Zv(e)?void 0:e}var xS=1,SS=2,CS=4,wS=Uv(function(e,t){var n={};if(e==null)return n;var r=!1;t=Bh(t,function(t){return t=Pv(t,e),r||=t.length>1,t}),Wg(e,wy(e),n),r&&(n=rx(n,xS|SS|CS,bS));for(var i=t.length;i--;)yS(n,t[i]);return n});function TS(e,t,n,r){if(!Xh(e))return e;t=Pv(t,e);for(var i=-1,a=t.length,o=a-1,s=e;s!=null&&++i<a;){var c=Iv(t[i]),l=n;if(c===`__proto__`||c===`constructor`||c===`prototype`)return e;if(i!=o){var u=s[c];l=r?r(u,c,s):void 0,l===void 0&&(l=Xh(u)?u:zg(t[i+1])?[]:{})}Ug(s,c,l),s=s[c]}return e}function ES(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=Lv(e,o);n(s,o)&&TS(a,Pv(o,e),s)}return a}function DS(e,t){if(e==null)return{};var n=Bh(wy(e),function(e){return[e]});return t=Ox(t),ES(e,n,function(e,n){return t(e,n[0])})}function OS(e,t){return ES(e,t,function(t,n){return Dx(e,n)})}var kS=Uv(function(e,t){return e==null?{}:OS(e,t)});function AS(e,t,n,r,i){return i(e,function(e,i,a){n=r?(r=!1,e):t(n,e,i,a)}),n}function jS(e,t,n){var r=Vh(e)?$v:AS,i=arguments.length<3;return r(e,Ox(t,4),n,i,Mx)}function MS(e,t,n){return e==null?e:TS(e,t,n)}function ite(e,t,n,r){return r=typeof r==`function`?r:void 0,e==null?e:TS(e,t,n,r)}var ate=9007199254740991,NS=4294967295,ote=Math.min;function PS(e,t){if(e=og(e),e<1||e>ate)return[];var n=NS,r=ote(e,NS);t=Wx(t),e-=NS;for(var i=t_(r,t);++n<e;)t(n);return i}function FS(e){return Vh(e)?Bh(e,Iv):zh(e)?[e]:Cg(Mv(Nv(e)))}function IS(e,t,n){var r=Vh(e),i=r||f_(e)||F_(e);if(t=Ox(t,4),n==null){var a=e&&e.constructor;n=i?r?new a:[]:Xh(e)&&ug(a)?bg(Wv(e)):{}}return(i?jg:Ax)(e,function(e,r,i){return t(n,e,r,i)}),n}var LS=Dy&&1/gx(new Dy([,-0]))[1]==1/0?function(e){return new Dy(e)}:Sg,RS=200;function zS(e,t,n){var r=-1,i=Ig,a=e.length,o=!0,s=[],c=s;if(n)o=!1,i=zx;else if(a>=RS){var l=t?null:LS(e);if(l)return gx(l);o=!1,i=fx,c=new ux}else c=t?[]:s;outer:for(;++r<a;){var u=e[r],d=t?t(u):u;if(u=n||u!==0?u:0,o&&d===d){for(var f=c.length;f--;)if(c[f]===d)continue outer;t&&c.push(d),s.push(u)}else i(c,d,n)||(c!==s&&c.push(d),s.push(u))}return s}var BS=qg(function(e){return zS(Vv(e,1,Px,!0))});function VS(e){return e&&e.length?zS(e):[]}var HS=0;function US(e){var t=++HS;return Nv(e)+t}function WS(e,t){return e==null?!0:yS(e,t)}var GS=yi()(e=>({tools:{},setToolData:(t,n)=>e(e=>qS(e,`tools.${t}`,{...e.tools[t],...n})),updateOpenaiObject:(t,n,r)=>e(e=>e.tools[t]?.openaiObject?qS(e,`tools.${t}.openaiObject.${n}`,r):e),pushOpenAiLog:(t,n)=>e(e=>{let r=e.tools[t]?.openaiLogs||[];return qS(e,`tools.${t}.openaiLogs`,[...r,{...n,id:crypto.randomUUID()}])}),setOpenInAppUrl:(t,n)=>e(e=>qS(e,`tools.${t}.openInAppUrl`,n))})),KS=e=>{let{tools:t}=GS();return t[e]},qS=(e,t,n)=>{let r=ox(e);return MS(r,t,n),r};function JS(e,t,n){try{return e(t)}catch(e){return ct("[nuqs] Error while parsing value `%s`: %O"+(n?" (for key `%s`)":``),t,e,n),null}}function YS(e){function t(t){if(t===void 0)return null;let n=``;if(Array.isArray(t)){if(t[0]===void 0)return null;n=t[0]}return typeof t==`string`&&(n=t),JS(e.parse,n)}return{type:`single`,eq:(e,t)=>e===t,...e,parseServerSide:t,withDefault(e){return{...this,defaultValue:e,parseServerSide(n){return t(n)??e}}},withOptions(e){return{...this,...e}}}}var XS=YS({parse:e=>e,serialize:String});YS({parse:e=>{let t=parseInt(e);return t==t?t:null},serialize:e=>``+Math.round(e)}),YS({parse:e=>{let t=parseInt(e);return t==t?t-1:null},serialize:e=>``+Math.round(e+1)}),YS({parse:e=>{let t=parseInt(e,16);return t==t?t:null},serialize:e=>{let t=Math.round(e).toString(16);return(t.length&1?`0`:``)+t}}),YS({parse:e=>{let t=parseFloat(e);return t==t?t:null},serialize:String}),YS({parse:e=>e.toLowerCase()===`true`,serialize:String});function ZS(e,t){return e.valueOf()===t.valueOf()}YS({parse:e=>{let t=parseInt(e);return t==t?new Date(t):null},serialize:e=>``+e.valueOf(),eq:ZS}),YS({parse:e=>{let t=new Date(e);return t.valueOf()==t.valueOf()?t:null},serialize:e=>e.toISOString(),eq:ZS}),YS({parse:e=>{let t=new Date(e.slice(0,10));return t.valueOf()==t.valueOf()?t:null},serialize:e=>e.toISOString().slice(0,10),eq:ZS});var QS=Tt(),$S={};function eC(e,t={}){let n=(0,b.useId)(),r=vt(),i=yt(),{history:a=`replace`,scroll:o=r?.scroll??!1,shallow:s=r?.shallow??!0,throttleMs:c=St.timeMs,limitUrlUpdates:l=r?.limitUrlUpdates,clearOnDefault:u=r?.clearOnDefault??!0,startTransition:d,urlKeys:f=$S}=t,p=Object.keys(e).join(`,`),m=(0,b.useMemo)(()=>Object.fromEntries(Object.keys(e).map(e=>[e,f[e]??e])),[p,JSON.stringify(f)]),h=_t(Object.values(m)),g=h.searchParams,_=(0,b.useRef)({}),v=(0,b.useMemo)(()=>Object.fromEntries(Object.keys(e).map(t=>[t,e[t].defaultValue??null])),[Object.values(e).map(({defaultValue:e})=>e).join(`,`)]),y=Pt.useQueuedQueries(Object.values(m)),[x,S]=(0,b.useState)(()=>tC(e,f,g??new URLSearchParams,y).state),C=(0,b.useRef)(x);if(st("[nuq+ %s `%s`] render - state: %O, iSP: %s",n,p,x,g),Object.keys(_.current).join(`&`)!==Object.values(m).join(`&`)){let{state:t,hasChanged:r}=tC(e,f,g,y,_.current,C.current);r&&(st("[nuq+ %s `%s`] State changed: %O",n,p,{state:t,initialSearchParams:g,queuedQueries:y,queryRef:_.current,stateRef:C.current}),C.current=t,S(t)),_.current=Object.fromEntries(Object.entries(m).map(([t,n])=>[n,e[t]?.type===`multi`?g?.getAll(n):g?.get(n)??null]))}(0,b.useEffect)(()=>{let{state:t,hasChanged:r}=tC(e,f,g,y,_.current,C.current);r&&(st("[nuq+ %s `%s`] State changed: %O",n,p,{state:t,initialSearchParams:g,queuedQueries:y,queryRef:_.current,stateRef:C.current}),C.current=t,S(t))},[Object.values(m).map(e=>`${e}=${g?.getAll(e)}`).join(`&`),JSON.stringify(y)]),(0,b.useEffect)(()=>{let t=Object.keys(e).reduce((t,r)=>(t[r]=({state:t,query:i})=>{S(a=>{let{defaultValue:o}=e[r],s=m[r],c=t??o??null,l=a[r]??o??null;return Object.is(l,c)?(st("[nuq+ %s `%s`] Cross-hook key sync %s: %O (default: %O). no change, skipping, resolved: %O",n,p,s,t,o,C.current),a):(C.current={...C.current,[r]:c},_.current[s]=i,st("[nuq+ %s `%s`] Cross-hook key sync %s: %O (default: %O). updateInternalState, resolved: %O",n,p,s,t,o,C.current),C.current)})},t),{});for(let r of Object.keys(e)){let e=m[r];st("[nuq+ %s `%s`] Subscribing to sync for `%s`",n,e,p),QS.on(e,t[r])}return()=>{for(let r of Object.keys(e)){let e=m[r];st("[nuq+ %s `%s`] Unsubscribing to sync for `%s`",n,e,p),QS.off(e,t[r])}}},[p,m]);let w=(0,b.useCallback)((t,r={})=>{let f=Object.fromEntries(Object.keys(e).map(e=>[e,null])),g=typeof t==`function`?t(nC(C.current,v))??f:t??f;st("[nuq+ %s `%s`] setState: %O",n,p,g);let _,y=0,b=!1,x=[];for(let[t,n]of Object.entries(g)){let f=e[t],p=m[t];if(!f||n===void 0)continue;(r.clearOnDefault??f.clearOnDefault??u)&&n!==null&&f.defaultValue!==void 0&&(f.eq??((e,t)=>e===t))(n,f.defaultValue)&&(n=null);let g=n===null?null:(f.serialize??String)(n);QS.emit(p,{state:n,query:g});let v={key:p,query:g,options:{history:r.history??f.history??a,shallow:r.shallow??f.shallow??s,scroll:r.scroll??f.scroll??o,startTransition:r.startTransition??f.startTransition??d}};if(r?.limitUrlUpdates?.method===`debounce`||l?.method===`debounce`||f.limitUrlUpdates?.method===`debounce`){v.options.shallow===!0&&console.warn(ft(422));let e=r?.limitUrlUpdates?.timeMs??l?.timeMs??f.limitUrlUpdates?.timeMs??St.timeMs,t=Pt.push(v,e,h,i);y<e&&(_=t,y=e)}else{let e=r?.limitUrlUpdates?.timeMs??f?.limitUrlUpdates?.timeMs??l?.timeMs??r.throttleMs??f.throttleMs??c;x.push(Pt.abort(p)),jt.push(v,e),b=!0}}let S=x.reduce((e,t)=>t(e),b?jt.flush(h,i):jt.getPendingPromise(h));return _??S},[p,a,s,o,c,l?.method,l?.timeMs,d,m,h.updateUrl,h.getSearchParamsSnapshot,h.rateLimitFactor,i,v]);return[(0,b.useMemo)(()=>nC(x,v),[x,v]),w]}function tC(e,t,n,r,i,a){let o=!1,s=Object.entries(e).reduce((e,[s,c])=>{let l=t?.[s]??s,u=r[l],d=c.type===`multi`?[]:null,f=u===void 0?(c.type===`multi`?n?.getAll(l):n?.get(l))??d:u;return i&&a&&Ft(i[l]??d,f)?(e[s]=a[s]??null,e):(o=!0,e[s]=(Ct(f)?null:JS(c.parse,f,l))??null,i&&(i[l]=f),e)},{});if(!o){let t=Object.keys(e),n=Object.keys(a??{});o=t.length!==n.length||t.some(e=>!n.includes(e))}return{state:s,hasChanged:o}}function nC(e,t){return Object.fromEntries(Object.keys(e).map(n=>[n,e[n]??t[n]??null]))}function rC(e,t={}){let{parse:n,type:r,serialize:i,eq:a,defaultValue:o,...s}=t,[{[e]:c},l]=eC({[e]:{parse:n??(e=>e),type:r,serialize:i,eq:a,defaultValue:o}},s);return[c,(0,b.useCallback)((t,n={})=>l(n=>({[e]:typeof t==`function`?t(n[e]):t}),n),[e,l])]}function iC(){return rC(`tool`,XS)}var aC=new ze,oC=`skybridge-devtools-oauth`,sC={clientInfo:`${oC}:client-info`,tokens:`${oC}:tokens`,codeVerifier:`${oC}:code-verifier`,state:`${oC}:state`},cC=class{get redirectUrl(){let e=new URL(window.location.origin+window.location.pathname);return e.searchParams.set(`oauth_callback`,`true`),e.toString()}get clientMetadata(){return{redirect_uris:[this.redirectUrl],token_endpoint_auth_method:`none`,grant_types:[`authorization_code`,`refresh_token`],response_types:[`code`],client_name:`Skybridge Devtools`,client_uri:window.location.origin}}clientInformation(){let e=localStorage.getItem(sC.clientInfo);return e?JSON.parse(e):void 0}saveClientInformation(e){localStorage.setItem(sC.clientInfo,JSON.stringify(e))}tokens(){let e=localStorage.getItem(sC.tokens);return e?JSON.parse(e):void 0}saveTokens(e){localStorage.setItem(sC.tokens,JSON.stringify(e))}state(){let e=localStorage.getItem(sC.state);if(e)return e;let t=crypto.randomUUID();return localStorage.setItem(sC.state,t),t}redirectToAuthorization(e){window.location.href=e.toString()}saveCodeVerifier(e){localStorage.setItem(sC.codeVerifier,e)}codeVerifier(){return localStorage.getItem(sC.codeVerifier)??``}invalidateCredentials(e){(e===`all`||e===`tokens`)&&localStorage.removeItem(sC.tokens),(e===`all`||e===`client`)&&localStorage.removeItem(sC.clientInfo),(e===`all`||e===`verifier`)&&(localStorage.removeItem(sC.codeVerifier),localStorage.removeItem(sC.state))}};function lC(e){return!!e._zod}function uC(e,t){return lC(e)?Sa(e,t):e.safeParse(t)}function dC(e){if(!e)return;let t;if(t=lC(e)?e._zod?.def?.shape:e.shape,t){if(typeof t==`function`)try{return t()}catch{return}return t}}function fC(e){if(lC(e)){let t=e._zod?.def;if(t){if(t.value!==void 0)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}}let t=e._def;if(t){if(t.value!==void 0)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}let n=e.value;if(n!==void 0)return n}function pC(e){return e===`completed`||e===`failed`||e===`cancelled`}function mC(e){let t=dC(e)?.method;if(!t)throw Error(`Schema is missing a method literal`);let n=fC(t);if(typeof n!=`string`)throw Error(`Schema method literal must be a string`);return n}function hC(e,t){let n=uC(e,t);if(!n.success)throw n.error;return n.data}var gC=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(sf,e=>{this._oncancel(e)}),this.setNotificationHandler(wf,e=>{this._onprogress(e)}),this.setRequestHandler(xf,e=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Nf,async(e,t)=>{let n=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!n)throw new pm(ef.InvalidParams,`Failed to retrieve task: Task not found`);return{...n}}),this.setRequestHandler(Ff,async(e,t)=>{let n=async()=>{let r=e.params.taskId;if(this._taskMessageQueue){let e;for(;e=await this._taskMessageQueue.dequeue(r,t.sessionId);){if(e.type===`response`||e.type===`error`){let t=e.message,n=t.id,r=this._requestResolvers.get(n);if(r)if(this._requestResolvers.delete(n),e.type===`response`)r(t);else{let e=t;r(new pm(e.error.code,e.error.message,e.error.data))}else{let t=e.type===`response`?`Response`:`Error`;this._onerror(Error(`${t} handler missing for request ${n}`))}continue}await this._transport?.send(e.message,{relatedRequestId:t.requestId})}}let i=await this._taskStore.getTask(r,t.sessionId);if(!i)throw new pm(ef.InvalidParams,`Task not found: ${r}`);if(!pC(i.status))return await this._waitForTaskUpdate(r,t.signal),await n();if(pC(i.status)){let e=await this._taskStore.getTaskResult(r,t.sessionId);return this._clearTaskQueue(r),{...e,_meta:{...e._meta,[Nd]:{taskId:r}}}}return await n()};return await n()}),this.setRequestHandler(If,async(e,t)=>{try{let{tasks:n,nextCursor:r}=await this._taskStore.listTasks(e.params?.cursor,t.sessionId);return{tasks:n,nextCursor:r,_meta:{}}}catch(e){throw new pm(ef.InvalidParams,`Failed to list tasks: ${e instanceof Error?e.message:String(e)}`)}}),this.setRequestHandler(Rf,async(e,t)=>{try{let n=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!n)throw new pm(ef.InvalidParams,`Task not found: ${e.params.taskId}`);if(pC(n.status))throw new pm(ef.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(e.params.taskId,`cancelled`,`Client cancelled task execution.`,t.sessionId),this._clearTaskQueue(e.params.taskId);let r=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!r)throw new pm(ef.InvalidParams,`Task not found after cancellation: ${e.params.taskId}`);return{_meta:{},...r}}catch(e){throw e instanceof pm?e:new pm(ef.InvalidRequest,`Failed to cancel task: ${e instanceof Error?e.message:String(e)}`)}}))}async _oncancel(e){e.params.requestId&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,n,r,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let n=Date.now()-t.startTime;if(t.maxTotalTimeout&&n>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),pm.fromError(ef.RequestTimeout,`Maximum total timeout exceeded`,{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:n});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw Error(`Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.`);this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=e=>{n?.(e),this._onerror(e)};let r=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{r?.(e,t),$d(e)||nf(e)?this._onresponse(e):Yd(e)?this._onrequest(e,t):Zd(e)?this._onnotification(e):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let e of this._timeoutInfo.values())clearTimeout(e.timeoutId);this._timeoutInfo.clear();for(let e of this._requestHandlerAbortControllers.values())e.abort();this._requestHandlerAbortControllers.clear();let t=pm.fromError(ef.ConnectionClosed,`Connection closed`);this._transport=void 0,this.onclose?.();for(let n of e.values())n(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){let t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;t!==void 0&&Promise.resolve().then(()=>t(e)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){let n=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,r=this._transport,i=e.params?._meta?.[Nd]?.taskId;if(n===void 0){let t={jsonrpc:`2.0`,id:e.id,error:{code:ef.MethodNotFound,message:`Method not found`}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:`error`,message:t,timestamp:Date.now()},r?.sessionId).catch(e=>this._onerror(Error(`Failed to enqueue error response: ${e}`))):r?.send(t).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(e.id,a);let o=Hd(e.params)?e.params.task:void 0,s=this._taskStore?this.requestTaskStore(e,r?.sessionId):void 0,c={signal:a.signal,sessionId:r?.sessionId,_meta:e.params?._meta,sendNotification:async t=>{if(a.signal.aborted)return;let n={relatedRequestId:e.id};i&&(n.relatedTask={taskId:i}),await this.notification(t,n)},sendRequest:async(t,n,r)=>{if(a.signal.aborted)throw new pm(ef.ConnectionClosed,`Request was cancelled`);let o={...r,relatedRequestId:e.id};i&&!o.relatedTask&&(o.relatedTask={taskId:i});let c=o.relatedTask?.taskId??i;return c&&s&&await s.updateTaskStatus(c,`input_required`),await this.request(t,n,o)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:i,taskStore:s,taskRequestedTtl:o?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{o&&this.assertTaskHandlerCapability(e.method)}).then(()=>n(e,c)).then(async t=>{if(a.signal.aborted)return;let n={result:t,jsonrpc:`2.0`,id:e.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:`response`,message:n,timestamp:Date.now()},r?.sessionId):await r?.send(n)},async t=>{if(a.signal.aborted)return;let n={jsonrpc:`2.0`,id:e.id,error:{code:Number.isSafeInteger(t.code)?t.code:ef.InternalError,message:t.message??`Internal error`,...t.data!==void 0&&{data:t.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:`error`,message:n,timestamp:Date.now()},r?.sessionId):await r?.send(n)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===a&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...n}=e.params,r=Number(t),i=this._progressHandlers.get(r);if(!i){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&a&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(e){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),a(e);return}i(n)}_onresponse(e){let t=Number(e.id),n=this._requestResolvers.get(t);if(n){this._requestResolvers.delete(t),$d(e)?n(e):n(new pm(e.error.code,e.error.message,e.error.data));return}let r=this._responseHandlers.get(t);if(r===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t);let i=!1;if($d(e)&&e.result&&typeof e.result==`object`){let n=e.result;if(n.task&&typeof n.task==`object`){let e=n.task;typeof e.taskId==`string`&&(i=!0,this._taskProgressTokens.set(e.taskId,t))}}i||this._progressHandlers.delete(t),$d(e)?r(e):r(pm.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,n){let{task:r}=n??{};if(!r){try{yield{type:`result`,result:await this.request(e,t,n)}}catch(e){yield{type:`error`,error:e instanceof pm?e:new pm(ef.InternalError,String(e))}}return}let i;try{let r=await this.request(e,Af,n);if(r.task)i=r.task.taskId,yield{type:`taskCreated`,task:r.task};else throw new pm(ef.InternalError,`Task creation did not return a task`);for(;;){let e=await this.getTask({taskId:i},n);if(yield{type:`taskStatus`,task:e},pC(e.status)){e.status===`completed`?yield{type:`result`,result:await this.getTaskResult({taskId:i},t,n)}:e.status===`failed`?yield{type:`error`,error:new pm(ef.InternalError,`Task ${i} failed`)}:e.status===`cancelled`&&(yield{type:`error`,error:new pm(ef.InternalError,`Task ${i} was cancelled`)});return}if(e.status===`input_required`){yield{type:`result`,result:await this.getTaskResult({taskId:i},t,n)};return}let r=e.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(e=>setTimeout(e,r)),n?.signal?.throwIfAborted()}}catch(e){yield{type:`error`,error:e instanceof pm?e:new pm(ef.InternalError,String(e))}}}request(e,t,n){let{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a,task:o,relatedTask:s}=n??{};return new Promise((c,l)=>{let u=e=>{l(e)};if(!this._transport){u(Error(`Not connected`));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),o&&this.assertTaskCapability(e.method)}catch(e){u(e);return}n?.signal?.throwIfAborted();let d=this._requestMessageId++,f={...e,jsonrpc:`2.0`,id:d};n?.onprogress&&(this._progressHandlers.set(d,n.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:d}}),o&&(f.params={...f.params,task:o}),s&&(f.params={...f.params,_meta:{...f.params?._meta||{},[Nd]:s}});let p=e=>{this._responseHandlers.delete(d),this._progressHandlers.delete(d),this._cleanupTimeout(d),this._transport?.send({jsonrpc:`2.0`,method:`notifications/cancelled`,params:{requestId:d,reason:String(e)}},{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))),l(e instanceof pm?e:new pm(ef.RequestTimeout,String(e)))};this._responseHandlers.set(d,e=>{if(!n?.signal?.aborted){if(e instanceof Error)return l(e);try{let n=uC(t,e.result);n.success?c(n.data):l(n.error)}catch(e){l(e)}}}),n?.signal?.addEventListener(`abort`,()=>{p(n?.signal?.reason)});let m=n?.timeout??6e4;this._setupTimeout(d,m,n?.maxTotalTimeout,()=>p(pm.fromError(ef.RequestTimeout,`Request timed out`,{timeout:m})),n?.resetTimeoutOnProgress??!1);let h=s?.taskId;h?(this._requestResolvers.set(d,e=>{let t=this._responseHandlers.get(d);t?t(e):this._onerror(Error(`Response handler missing for side-channeled request ${d}`))}),this._enqueueTaskMessage(h,{type:`request`,message:f,timestamp:Date.now()}).catch(e=>{this._cleanupTimeout(d),l(e)})):this._transport.send(f,{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a}).catch(e=>{this._cleanupTimeout(d),l(e)})})}async getTask(e,t){return this.request({method:`tasks/get`,params:e},Pf,t)}async getTaskResult(e,t,n){return this.request({method:`tasks/result`,params:e},t,n)}async listTasks(e,t){return this.request({method:`tasks/list`,params:e},Lf,t)}async cancelTask(e,t){return this.request({method:`tasks/cancel`,params:e},zf,t)}async notification(e,t){if(!this._transport)throw Error(`Not connected`);this.assertNotificationCapability(e.method);let n=t?.relatedTask?.taskId;if(n){let r={...e,jsonrpc:`2.0`,params:{...e.params,_meta:{...e.params?._meta||{},[Nd]:t.relatedTask}}};await this._enqueueTaskMessage(n,{type:`notification`,message:r,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let n={...e,jsonrpc:`2.0`};t?.relatedTask&&(n={...n,params:{...n.params,_meta:{...n.params?._meta||{},[Nd]:t.relatedTask}}}),this._transport?.send(n,t).catch(e=>this._onerror(e))});return}let r={...e,jsonrpc:`2.0`};t?.relatedTask&&(r={...r,params:{...r.params,_meta:{...r.params?._meta||{},[Nd]:t.relatedTask}}}),await this._transport.send(r,t)}setRequestHandler(e,t){let n=mC(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(n,r)=>{let i=hC(e,n);return Promise.resolve(t(i,r))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){let n=mC(e);this._notificationHandlers.set(n,n=>{let r=hC(e,n);return Promise.resolve(t(r))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let t=this._taskProgressTokens.get(e);t!==void 0&&(this._progressHandlers.delete(t),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,t,n){if(!this._taskStore||!this._taskMessageQueue)throw Error(`Cannot enqueue task message: taskStore and taskMessageQueue are not configured`);let r=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,n,r)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,t);for(let t of n)if(t.type===`request`&&Yd(t.message)){let n=t.message.id,r=this._requestResolvers.get(n);r?(r(new pm(ef.InternalError,`Task cancelled or completed`)),this._requestResolvers.delete(n)):this._onerror(Error(`Resolver missing for request ${n} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let n=this._options?.defaultTaskPollInterval??1e3;try{let t=await this._taskStore?.getTask(e);t?.pollInterval&&(n=t.pollInterval)}catch{}return new Promise((e,r)=>{if(t.aborted){r(new pm(ef.InvalidRequest,`Request cancelled`));return}let i=setTimeout(e,n);t.addEventListener(`abort`,()=>{clearTimeout(i),r(new pm(ef.InvalidRequest,`Request cancelled`))},{once:!0})})}requestTaskStore(e,t){let n=this._taskStore;if(!n)throw Error(`No task store configured`);return{createTask:async r=>{if(!e)throw Error(`No request provided`);return await n.createTask(r,e.id,{method:e.method,params:e.params},t)},getTask:async e=>{let r=await n.getTask(e,t);if(!r)throw new pm(ef.InvalidParams,`Failed to retrieve task: Task not found`);return r},storeTaskResult:async(e,r,i)=>{await n.storeTaskResult(e,r,i,t);let a=await n.getTask(e,t);if(a){let t=Mf.parse({method:`notifications/tasks/status`,params:a});await this.notification(t),pC(a.status)&&this._cleanupTaskProgressHandler(e)}},getTaskResult:e=>n.getTaskResult(e,t),updateTaskStatus:async(e,r,i)=>{let a=await n.getTask(e,t);if(!a)throw new pm(ef.InvalidParams,`Task "${e}" not found - it may have been cleaned up`);if(pC(a.status))throw new pm(ef.InvalidParams,`Cannot update task "${e}" from terminal status "${a.status}" to "${r}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(e,r,i,t);let o=await n.getTask(e,t);if(o){let t=Mf.parse({method:`notifications/tasks/status`,params:o});await this.notification(t),pC(o.status)&&this._cleanupTaskProgressHandler(e)}},listTasks:e=>n.listTasks(e,t)}}};function _C(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function vC(e,t){let n={...e};for(let e in t){let r=e,i=t[r];if(i===void 0)continue;let a=n[r];_C(a)&&_C(i)?n[r]={...a,...i}:n[r]=i}return n}var yC=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var n=class extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw Error(`CodeGen: name must be a valid identifier`);this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=n;var r=class extends t{constructor(e){super(),this._items=typeof e==`string`?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===``||e===`""`}get str(){return this._str??=this._items.reduce((e,t)=>`${e}${t}`,``)}get names(){return this._names??=this._items.reduce((e,t)=>(t instanceof n&&(e[t.str]=(e[t.str]||0)+1),e),{})}};e._Code=r,e.nil=new r(``);function i(e,...t){let n=[e[0]],i=0;for(;i<t.length;)s(n,t[i]),n.push(e[++i]);return new r(n)}e._=i;var a=new r(`+`);function o(e,...t){let n=[p(e[0])],i=0;for(;i<t.length;)n.push(a),s(n,t[i]),n.push(a,p(e[++i]));return c(n),new r(n)}e.str=o;function s(e,t){t instanceof r?e.push(...t._items):t instanceof n?e.push(t):e.push(d(t))}e.addCodeArg=s;function c(e){let t=1;for(;t<e.length-1;){if(e[t]===a){let n=l(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]=`+`}t++}}function l(e,t){if(t===`""`)return e;if(e===`""`)return t;if(typeof e==`string`)return t instanceof n||e[e.length-1]!==`"`?void 0:typeof t==`string`?t[0]===`"`?e.slice(0,-1)+t.slice(1):void 0:`${e.slice(0,-1)}${t}"`;if(typeof t==`string`&&t[0]===`"`&&!(e instanceof n))return`"${e}${t.slice(1)}`}function u(e,t){return t.emptyStr()?e:e.emptyStr()?t:o`${e}${t}`}e.strConcat=u;function d(e){return typeof e==`number`||typeof e==`boolean`||e===null?e:p(Array.isArray(e)?e.join(`,`):e)}function f(e){return new r(p(e))}e.stringify=f;function p(e){return JSON.stringify(e).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)}e.safeStringify=p;function m(t){return typeof t==`string`&&e.IDENTIFIER.test(t)?new r(`.${t}`):i`[${t}]`}e.getProperty=m;function h(t){if(typeof t==`string`&&e.IDENTIFIER.test(t))return new r(`${t}`);throw Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}e.getEsmExportName=h;function g(e){return new r(e.toString())}e.regexpCode=g})),bC=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;var t=yC(),n=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},r;(function(e){e[e.Started=0]=`Started`,e[e.Completed=1]=`Completed`})(r||(e.UsedValueState=r={})),e.varKinds={const:new t.Name(`const`),let:new t.Name(`let`),var:new t.Name(`var`)};var i=class{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){if((this._parent?._prefixes)?.has(e)||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};e.Scope=i;var a=class extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:n,itemIndex:r}){this.value=e,this.scopePath=(0,t._)`.${new t.Name(n)}[${r}]`}};e.ValueScopeName=a;var o=(0,t._)`\n`;e.ValueScope=class extends i{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?o:t.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){if(t.ref===void 0)throw Error(`CodeGen: ref must be passed in value`);let n=this.toName(e),{prefix:r}=n,i=t.key??t.ref,a=this._values[r];if(a){let e=a.get(i);if(e)return e}else a=this._values[r]=new Map;a.set(i,n);let o=this._scope[r]||(this._scope[r]=[]),s=o.length;return o[s]=t.ref,n.setValue(t,{property:r,itemIndex:s}),n}getValue(e,t){let n=this._values[e];if(n)return n.get(t)}scopeRefs(e,n=this._values){return this._reduceValues(n,n=>{if(n.scopePath===void 0)throw Error(`CodeGen: name "${n}" has no value`);return(0,t._)`${e}${n.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,e=>{if(e.value===void 0)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,n)}_reduceValues(i,a,o={},s){let c=t.nil;for(let l in i){let u=i[l];if(!u)continue;let d=o[l]=o[l]||new Map;u.forEach(i=>{if(d.has(i))return;d.set(i,r.Started);let o=a(i);if(o){let n=this.opts.es5?e.varKinds.var:e.varKinds.const;c=(0,t._)`${c}${n} ${i} = ${o};${this.opts._n}`}else if(o=s?.(i))c=(0,t._)`${c}${o}${this.opts._n}`;else throw new n(i);d.set(i,r.Completed)})}return c}}})),xC=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;var t=yC(),n=bC(),r=yC();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,`strConcat`,{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,`getProperty`,{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,`regexpCode`,{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return r.Name}});var i=bC();Object.defineProperty(e,`Scope`,{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(e,`ValueScope`,{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(e,`ValueScopeName`,{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(e,`varKinds`,{enumerable:!0,get:function(){return i.varKinds}}),e.operators={GT:new t._Code(`>`),GTE:new t._Code(`>=`),LT:new t._Code(`<`),LTE:new t._Code(`<=`),EQ:new t._Code(`===`),NEQ:new t._Code(`!==`),NOT:new t._Code(`!`),OR:new t._Code(`||`),AND:new t._Code(`&&`),ADD:new t._Code(`+`)};var a=class{optimizeNodes(){return this}optimizeNames(e,t){return this}},o=class extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let r=e?n.varKinds.var:this.varKind,i=this.rhs===void 0?``:` = ${this.rhs}`;return`${r} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&=k(this.rhs,e,t),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},s=class extends a{constructor(e,t,n){super(),this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof t.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=k(this.rhs,e,n),this}get names(){return O(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends s{constructor(e,t,n,r){super(e,n,r),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},l=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},u=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:``};`+e}},d=class extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},f=class extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=k(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},p=class extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),``)}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let n=e[t].optimizeNodes();Array.isArray(n)?e.splice(t,1,...n):n?e[t]=n:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,r=n.length;for(;r--;){let i=n[r];i.optimizeNames(e,t)||(A(e,i.names),n.splice(r,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>D(e,t.names),{})}},m=class extends p{render(e){return`{`+e._n+super.render(e)+`}`+e._n}},h=class extends p{},g=class extends m{};g.kind=`else`;var _=class e extends m{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+=`else `+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let n=this.else;if(n){let e=n.optimizeNodes();n=this.else=Array.isArray(e)?new g(e):e}if(n)return t===!1?n instanceof e?n:n.nodes:this.nodes.length?this:new e(j(t),n instanceof e?[n]:n.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(e,t){if(this.else=this.else?.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=k(this.condition,e,t),this}get names(){let e=super.names;return O(e,this.condition),this.else&&D(e,this.else.names),e}};_.kind=`if`;var v=class extends m{};v.kind=`for`;var y=class extends v{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=k(this.iteration,e,t),this}get names(){return D(super.names,this.iteration.names)}},b=class extends v{constructor(e,t,n,r){super(),this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?n.varKinds.var:this.varKind,{name:r,from:i,to:a}=this;return`for(${t} ${r}=${i}; ${r}<${a}; ${r}++)`+super.render(e)}get names(){return O(O(super.names,this.from),this.to)}},x=class extends v{constructor(e,t,n,r){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=r}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=k(this.iterable,e,t),this}get names(){return D(super.names,this.iterable.names)}},S=class extends m{constructor(e,t,n){super(),this.name=e,this.args=t,this.async=n}render(e){return`${this.async?`async `:``}function ${this.name}(${this.args})`+super.render(e)}};S.kind=`func`;var C=class extends p{render(e){return`return `+super.render(e)}};C.kind=`return`;var w=class extends m{render(e){let t=`try`+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)==null||e.optimizeNodes(),(t=this.finally)==null||t.optimizeNodes(),this}optimizeNames(e,t){var n,r;return super.optimizeNames(e,t),(n=this.catch)==null||n.optimizeNames(e,t),(r=this.finally)==null||r.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&D(e,this.catch.names),this.finally&&D(e,this.finally.names),e}},T=class extends m{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};T.kind=`catch`;var E=class extends m{render(e){return`finally`+super.render(e)}};E.kind=`finally`,e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
|
|
50
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function sl(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:ul(t,`input`,e.processors),output:ul(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function cl(e,t){let n=t??{seen:new Set};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 cl(r.element,n);if(r.type===`set`)return cl(r.valueType,n);if(r.type===`lazy`)return cl(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 cl(r.innerType,n);if(r.type===`intersection`)return cl(r.left,n)||cl(r.right,n);if(r.type===`record`||r.type===`map`)return cl(r.keyType,n)||cl(r.valueType,n);if(r.type===`pipe`)return cl(r.in,n)||cl(r.out,n);if(r.type===`object`){for(let e in r.shape)if(cl(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(cl(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(cl(e,n))return!0;return!!(r.rest&&cl(r.rest,n))}return!1}var ll=(e,t={})=>n=>{let r=il({...n,processors:t});return al(e,r),ol(r,e),sl(r,e)},ul=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=il({...i??{},target:a,io:t,processors:n});return al(e,o),ol(o,e),sl(o,e)},dl={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},fl=(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&&(i.format=dl[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),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=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},pl=(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`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},ml=(e,t,n,r)=>{n.type=`boolean`},hl=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},gl=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Undefined cannot be represented in JSON Schema`)},_l=(e,t,n,r)=>{n.not={}},vl=(e,t,n,r)=>{let i=e._zod.def,a=Mi(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},yl=(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},bl=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},xl=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Sl=(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=al(a.element,t,{...r,path:[...r.path,`items`]})},Cl=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=al(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=al(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},wl=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>al(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Tl=(e,t,n,r)=>{let i=e._zod.def,a=al(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=al(i.right,t,{...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]]},El=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=al(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=al(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=al(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Dl=(e,t,n,r)=>{let i=e._zod.def,a=al(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`}]},Ol=(e,t,n,r)=>{let i=e._zod.def;al(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},kl=(e,t,n,r)=>{let i=e._zod.def;al(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Al=(e,t,n,r)=>{let i=e._zod.def;al(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)))},jl=(e,t,n,r)=>{let i=e._zod.def;al(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Ml=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;al(a,t,r);let o=t.seen.get(e);o.ref=a},Nl=(e,t,n,r)=>{let i=e._zod.def;al(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Pl=(e,t,n,r)=>{let i=e._zod.def;al(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Fl=q(`ZodISODateTime`,(e,t)=>{Go.init(e,t),ou.init(e,t)});function Il(e){return bc(Fl,e)}var Ll=q(`ZodISODate`,(e,t)=>{Ko.init(e,t),ou.init(e,t)});function Rl(e){return xc(Ll,e)}var zl=q(`ZodISOTime`,(e,t)=>{qo.init(e,t),ou.init(e,t)});function Bl(e){return Sc(zl,e)}var Vl=q(`ZodISODuration`,(e,t)=>{Jo.init(e,t),ou.init(e,t)});function Hl(e){return Cc(Vl,e)}var Ul=(e,t)=>{ha.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>va(e,t)},flatten:{value:t=>_a(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Ni,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Ni,2)}},isEmpty:{get(){return e.issues.length===0}}})};q(`ZodError`,Ul);var Wl=q(`ZodError`,Ul,{Parent:Error}),Gl=ya(Wl),Kl=ba(Wl),ql=xa(Wl),Jl=Ca(Wl),Yl=Ta(Wl),Xl=Ea(Wl),Zl=Da(Wl),Ql=Oa(Wl),$l=ka(Wl),eu=Aa(Wl),tu=ja(Wl),nu=Ma(Wl),ru=q(`ZodType`,(e,t)=>(jo.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:ul(e,`input`),output:ul(e,`output`)}}),e.toJSONSchema=ll(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(Vi(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>Zi(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>Gl(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>ql(e,t,n),e.parseAsync=async(t,n)=>Kl(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Jl(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Yl(e,t,n),e.decode=(t,n)=>Xl(e,t,n),e.encodeAsync=async(t,n)=>Zl(e,t,n),e.decodeAsync=async(t,n)=>Ql(e,t,n),e.safeEncode=(t,n)=>$l(e,t,n),e.safeDecode=(t,n)=>eu(e,t,n),e.safeEncodeAsync=async(t,n)=>tu(e,t,n),e.safeDecodeAsync=async(t,n)=>nu(e,t,n),e.refine=(t,n)=>e.check(Td(t,n)),e.superRefine=t=>e.check(Ed(t)),e.overwrite=t=>e.check(qc(t)),e.optional=()=>od(e),e.exactOptional=()=>cd(e),e.nullable=()=>ud(e),e.nullish=()=>od(ud(e)),e.nonoptional=t=>gd(e,t),e.array=()=>Y(e),e.or=t=>qu([e,t]),e.and=t=>Zu(e,t),e.transform=t=>bd(e,id(t)),e.default=t=>fd(e,t),e.prefault=t=>md(e,t),e.catch=t=>vd(e,t),e.pipe=t=>bd(e,t),e.readonly=()=>Sd(e),e.describe=t=>{let n=e.clone();return Xs.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return Xs.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return Xs.get(e);let n=e.clone();return Xs.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),iu=q(`_ZodString`,(e,t)=>{Mo.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fl(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(Vc(...t)),e.includes=(...t)=>e.check(Wc(...t)),e.startsWith=(...t)=>e.check(Gc(...t)),e.endsWith=(...t)=>e.check(Kc(...t)),e.min=(...t)=>e.check(zc(...t)),e.max=(...t)=>e.check(Rc(...t)),e.length=(...t)=>e.check(Bc(...t)),e.nonempty=(...t)=>e.check(zc(1,...t)),e.lowercase=t=>e.check(Hc(t)),e.uppercase=t=>e.check(Uc(t)),e.trim=()=>e.check(Yc()),e.normalize=(...t)=>e.check(Jc(...t)),e.toLowerCase=()=>e.check(Xc()),e.toUpperCase=()=>e.check(Zc()),e.slugify=()=>e.check(Qc())}),au=q(`ZodString`,(e,t)=>{Mo.init(e,t),iu.init(e,t),e.email=t=>e.check(Qs(su,t)),e.url=t=>e.check(ic(uu,t)),e.jwt=t=>e.check(yc(Eu,t)),e.emoji=t=>e.check(ac(fu,t)),e.guid=t=>e.check($s(cu,t)),e.uuid=t=>e.check(ec(lu,t)),e.uuidv4=t=>e.check(tc(lu,t)),e.uuidv6=t=>e.check(nc(lu,t)),e.uuidv7=t=>e.check(rc(lu,t)),e.nanoid=t=>e.check(oc(pu,t)),e.guid=t=>e.check($s(cu,t)),e.cuid=t=>e.check(sc(mu,t)),e.cuid2=t=>e.check(cc(hu,t)),e.ulid=t=>e.check(lc(gu,t)),e.base64=t=>e.check(gc(Cu,t)),e.base64url=t=>e.check(_c(wu,t)),e.xid=t=>e.check(uc(_u,t)),e.ksuid=t=>e.check(dc(vu,t)),e.ipv4=t=>e.check(fc(yu,t)),e.ipv6=t=>e.check(pc(bu,t)),e.cidrv4=t=>e.check(mc(xu,t)),e.cidrv6=t=>e.check(hc(Su,t)),e.e164=t=>e.check(vc(Tu,t)),e.datetime=t=>e.check(Il(t)),e.date=t=>e.check(Rl(t)),e.time=t=>e.check(Bl(t)),e.duration=t=>e.check(Hl(t))});function J(e){return Zs(au,e)}var ou=q(`ZodStringFormat`,(e,t)=>{No.init(e,t),iu.init(e,t)}),su=q(`ZodEmail`,(e,t)=>{Io.init(e,t),ou.init(e,t)}),cu=q(`ZodGUID`,(e,t)=>{Po.init(e,t),ou.init(e,t)}),lu=q(`ZodUUID`,(e,t)=>{Fo.init(e,t),ou.init(e,t)}),uu=q(`ZodURL`,(e,t)=>{Lo.init(e,t),ou.init(e,t)});function du(e){return ic(uu,e)}var fu=q(`ZodEmoji`,(e,t)=>{Ro.init(e,t),ou.init(e,t)}),pu=q(`ZodNanoID`,(e,t)=>{zo.init(e,t),ou.init(e,t)}),mu=q(`ZodCUID`,(e,t)=>{Bo.init(e,t),ou.init(e,t)}),hu=q(`ZodCUID2`,(e,t)=>{Vo.init(e,t),ou.init(e,t)}),gu=q(`ZodULID`,(e,t)=>{Ho.init(e,t),ou.init(e,t)}),_u=q(`ZodXID`,(e,t)=>{Uo.init(e,t),ou.init(e,t)}),vu=q(`ZodKSUID`,(e,t)=>{Wo.init(e,t),ou.init(e,t)}),yu=q(`ZodIPv4`,(e,t)=>{Yo.init(e,t),ou.init(e,t)}),bu=q(`ZodIPv6`,(e,t)=>{Xo.init(e,t),ou.init(e,t)}),xu=q(`ZodCIDRv4`,(e,t)=>{Zo.init(e,t),ou.init(e,t)}),Su=q(`ZodCIDRv6`,(e,t)=>{Qo.init(e,t),ou.init(e,t)}),Cu=q(`ZodBase64`,(e,t)=>{es.init(e,t),ou.init(e,t)}),wu=q(`ZodBase64URL`,(e,t)=>{ns.init(e,t),ou.init(e,t)}),Tu=q(`ZodE164`,(e,t)=>{rs.init(e,t),ou.init(e,t)}),Eu=q(`ZodJWT`,(e,t)=>{as.init(e,t),ou.init(e,t)}),Du=q(`ZodNumber`,(e,t)=>{os.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pl(e,t,n,r),e.gt=(t,n)=>e.check(Fc(t,n)),e.gte=(t,n)=>e.check(Ic(t,n)),e.min=(t,n)=>e.check(Ic(t,n)),e.lt=(t,n)=>e.check(Nc(t,n)),e.lte=(t,n)=>e.check(Pc(t,n)),e.max=(t,n)=>e.check(Pc(t,n)),e.int=t=>e.check(Au(t)),e.safe=t=>e.check(Au(t)),e.positive=t=>e.check(Fc(0,t)),e.nonnegative=t=>e.check(Ic(0,t)),e.negative=t=>e.check(Nc(0,t)),e.nonpositive=t=>e.check(Pc(0,t)),e.multipleOf=(t,n)=>e.check(Lc(t,n)),e.step=(t,n)=>e.check(Lc(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function Ou(e){return wc(Du,e)}var ku=q(`ZodNumberFormat`,(e,t)=>{ss.init(e,t),Du.init(e,t)});function Au(e){return Ec(ku,e)}var ju=q(`ZodBoolean`,(e,t)=>{cs.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ml(e,t,n,r)});function Mu(e){return Dc(ju,e)}var Nu=q(`ZodUndefined`,(e,t)=>{ls.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gl(e,t,n,r)});function Pu(e){return Oc(Nu,e)}var Fu=q(`ZodNull`,(e,t)=>{us.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hl(e,t,n,r)});function Iu(e){return kc(Fu,e)}var Lu=q(`ZodAny`,(e,t)=>{ds.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Ru(){return Ac(Lu)}var zu=q(`ZodUnknown`,(e,t)=>{fs.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Bu(){return jc(zu)}var Vu=q(`ZodNever`,(e,t)=>{ps.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_l(e,t,n,r)});function Hu(e){return Mc(Vu,e)}var Uu=q(`ZodArray`,(e,t)=>{hs.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Sl(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(zc(t,n)),e.nonempty=t=>e.check(zc(1,t)),e.max=(t,n)=>e.check(Rc(t,n)),e.length=(t,n)=>e.check(Bc(t,n)),e.unwrap=()=>e.element});function Y(e,t){return $c(Uu,e,t)}var Wu=q(`ZodObject`,(e,t)=>{bs.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Cl(e,t,n,r),zi(e,`shape`,()=>t.shape),e.keyof=()=>td(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Bu()}),e.loose=()=>e.clone({...e._zod.def,catchall:Bu()}),e.strict=()=>e.clone({...e._zod.def,catchall:Hu()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>ra(e,t),e.safeExtend=t=>ia(e,t),e.merge=t=>aa(e,t),e.pick=t=>ta(e,t),e.omit=t=>na(e,t),e.partial=(...t)=>oa(ad,e,t[0]),e.required=(...t)=>sa(hd,e,t[0])});function X(e,t){return new Wu({type:`object`,shape:e??{},...Qi(t)})}function Gu(e,t){return new Wu({type:`object`,shape:e,catchall:Bu(),...Qi(t)})}var Ku=q(`ZodUnion`,(e,t)=>{Ss.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wl(e,t,n,r),e.options=t.options});function qu(e,t){return new Ku({type:`union`,options:e,...Qi(t)})}var Ju=q(`ZodDiscriminatedUnion`,(e,t)=>{Ku.init(e,t),Cs.init(e,t)});function Yu(e,t,n){return new Ju({type:`union`,options:t,discriminator:e,...Qi(n)})}var Xu=q(`ZodIntersection`,(e,t)=>{ws.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Tl(e,t,n,r)});function Zu(e,t){return new Xu({type:`intersection`,left:e,right:t})}var Qu=q(`ZodRecord`,(e,t)=>{Ds.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>El(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function $u(e,t,n){return new Qu({type:`record`,keyType:e,valueType:t,...Qi(n)})}var ed=q(`ZodEnum`,(e,t)=>{Os.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vl(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 ed({...t,checks:[],...Qi(r),entries:i})},e.exclude=(e,r)=>{let i={...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 ed({...t,checks:[],...Qi(r),entries:i})}});function td(e,t){return new ed({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...Qi(t)})}var nd=q(`ZodLiteral`,(e,t)=>{ks.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yl(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 Z(e,t){return new nd({type:`literal`,values:Array.isArray(e)?e:[e],...Qi(t)})}var rd=q(`ZodTransform`,(e,t)=>{As.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xl(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ki(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(pa(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(pa(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function id(e){return new rd({type:`transform`,transform:e})}var ad=q(`ZodOptional`,(e,t)=>{Ms.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function od(e){return new ad({type:`optional`,innerType:e})}var sd=q(`ZodExactOptional`,(e,t)=>{Ns.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function cd(e){return new sd({type:`optional`,innerType:e})}var ld=q(`ZodNullable`,(e,t)=>{Ps.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Dl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ud(e){return new ld({type:`nullable`,innerType:e})}var dd=q(`ZodDefault`,(e,t)=>{Fs.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>kl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function fd(e,t){return new dd({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Ji(t)}})}var pd=q(`ZodPrefault`,(e,t)=>{Ls.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Al(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function md(e,t){return new pd({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Ji(t)}})}var hd=q(`ZodNonOptional`,(e,t)=>{Rs.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ol(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function gd(e,t){return new hd({type:`nonoptional`,innerType:e,...Qi(t)})}var _d=q(`ZodCatch`,(e,t)=>{Bs.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function vd(e,t){return new _d({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var yd=q(`ZodPipe`,(e,t)=>{Vs.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ml(e,t,n,r),e.in=t.in,e.out=t.out});function bd(e,t){return new yd({type:`pipe`,in:e,out:t})}var xd=q(`ZodReadonly`,(e,t)=>{Us.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Sd(e){return new xd({type:`readonly`,innerType:e})}var Cd=q(`ZodCustom`,(e,t)=>{Gs.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bl(e,t,n,r)});function wd(e,t){return el(Cd,e??(()=>!0),t)}function Td(e,t={}){return tl(Cd,e,t)}function Ed(e){return nl(e)}function Dd(e,t){return bd(id(e),t)}var Od={invalid_type:`invalid_type`,too_big:`too_big`,too_small:`too_small`,invalid_format:`invalid_format`,not_multiple_of:`not_multiple_of`,unrecognized_keys:`unrecognized_keys`,invalid_union:`invalid_union`,invalid_key:`invalid_key`,invalid_element:`invalid_element`,invalid_value:`invalid_value`,custom:`custom`},kd;(function(e){})(kd||={});function Ad(e){return Tc(Du,e)}var jd=`2025-11-25`,Md=[jd,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],Nd=`io.modelcontextprotocol/related-task`,Pd=wd(e=>e!==null&&(typeof e==`object`||typeof e==`function`)),Fd=qu([J(),Ou().int()]),Id=J();Gu({ttl:Ou().optional(),pollInterval:Ou().optional()});var Ld=X({ttl:Ou().optional()}),Rd=X({taskId:J()}),zd=Gu({progressToken:Fd.optional(),[Nd]:Rd.optional()}),Bd=X({_meta:zd.optional()}),Vd=Bd.extend({task:Ld.optional()}),Hd=e=>Vd.safeParse(e).success,Ud=X({method:J(),params:Bd.loose().optional()}),Wd=X({_meta:zd.optional()}),Gd=X({method:J(),params:Wd.loose().optional()}),Kd=Gu({_meta:zd.optional()}),qd=qu([J(),Ou().int()]),Jd=X({jsonrpc:Z(`2.0`),id:qd,...Ud.shape}).strict(),Yd=e=>Jd.safeParse(e).success,Xd=X({jsonrpc:Z(`2.0`),...Gd.shape}).strict(),Zd=e=>Xd.safeParse(e).success,Qd=X({jsonrpc:Z(`2.0`),id:qd,result:Kd}).strict(),$d=e=>Qd.safeParse(e).success,ef;(function(e){e[e.ConnectionClosed=-32e3]=`ConnectionClosed`,e[e.RequestTimeout=-32001]=`RequestTimeout`,e[e.ParseError=-32700]=`ParseError`,e[e.InvalidRequest=-32600]=`InvalidRequest`,e[e.MethodNotFound=-32601]=`MethodNotFound`,e[e.InvalidParams=-32602]=`InvalidParams`,e[e.InternalError=-32603]=`InternalError`,e[e.UrlElicitationRequired=-32042]=`UrlElicitationRequired`})(ef||={});var tf=X({jsonrpc:Z(`2.0`),id:qd.optional(),error:X({code:Ou().int(),message:J(),data:Bu().optional()})}).strict(),nf=e=>tf.safeParse(e).success,rf=qu([Jd,Xd,Qd,tf]);qu([Qd,tf]);var af=Kd.strict(),of=Wd.extend({requestId:qd.optional(),reason:J().optional()}),sf=Gd.extend({method:Z(`notifications/cancelled`),params:of}),cf=X({icons:Y(X({src:J(),mimeType:J().optional(),sizes:Y(J()).optional(),theme:td([`light`,`dark`]).optional()})).optional()}),lf=X({name:J(),title:J().optional()}),uf=lf.extend({...lf.shape,...cf.shape,version:J(),websiteUrl:J().optional(),description:J().optional()}),df=Dd(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Zu(X({form:Zu(X({applyDefaults:Mu().optional()}),$u(J(),Bu())).optional(),url:Pd.optional()}),$u(J(),Bu()).optional())),ff=Gu({list:Pd.optional(),cancel:Pd.optional(),requests:Gu({sampling:Gu({createMessage:Pd.optional()}).optional(),elicitation:Gu({create:Pd.optional()}).optional()}).optional()}),pf=Gu({list:Pd.optional(),cancel:Pd.optional(),requests:Gu({tools:Gu({call:Pd.optional()}).optional()}).optional()}),mf=X({experimental:$u(J(),Pd).optional(),sampling:X({context:Pd.optional(),tools:Pd.optional()}).optional(),elicitation:df.optional(),roots:X({listChanged:Mu().optional()}).optional(),tasks:ff.optional(),extensions:$u(J(),Pd).optional()}),hf=Bd.extend({protocolVersion:J(),capabilities:mf,clientInfo:uf}),gf=Ud.extend({method:Z(`initialize`),params:hf}),_f=X({experimental:$u(J(),Pd).optional(),logging:Pd.optional(),completions:Pd.optional(),prompts:X({listChanged:Mu().optional()}).optional(),resources:X({subscribe:Mu().optional(),listChanged:Mu().optional()}).optional(),tools:X({listChanged:Mu().optional()}).optional(),tasks:pf.optional(),extensions:$u(J(),Pd).optional()}),vf=Kd.extend({protocolVersion:J(),capabilities:_f,serverInfo:uf,instructions:J().optional()}),yf=Gd.extend({method:Z(`notifications/initialized`),params:Wd.optional()}),bf=e=>yf.safeParse(e).success,xf=Ud.extend({method:Z(`ping`),params:Bd.optional()}),Sf=X({progress:Ou(),total:od(Ou()),message:od(J())}),Cf=X({...Wd.shape,...Sf.shape,progressToken:Fd}),wf=Gd.extend({method:Z(`notifications/progress`),params:Cf}),Tf=Bd.extend({cursor:Id.optional()}),Ef=Ud.extend({params:Tf.optional()}),Df=Kd.extend({nextCursor:Id.optional()}),Of=td([`working`,`input_required`,`completed`,`failed`,`cancelled`]),kf=X({taskId:J(),status:Of,ttl:qu([Ou(),Iu()]),createdAt:J(),lastUpdatedAt:J(),pollInterval:od(Ou()),statusMessage:od(J())}),Af=Kd.extend({task:kf}),jf=Wd.merge(kf),Mf=Gd.extend({method:Z(`notifications/tasks/status`),params:jf}),Nf=Ud.extend({method:Z(`tasks/get`),params:Bd.extend({taskId:J()})}),Pf=Kd.merge(kf),Ff=Ud.extend({method:Z(`tasks/result`),params:Bd.extend({taskId:J()})});Kd.loose();var If=Ef.extend({method:Z(`tasks/list`)}),Lf=Df.extend({tasks:Y(kf)}),Rf=Ud.extend({method:Z(`tasks/cancel`),params:Bd.extend({taskId:J()})}),zf=Kd.merge(kf),Bf=X({uri:J(),mimeType:od(J()),_meta:$u(J(),Bu()).optional()}),Vf=Bf.extend({text:J()}),Hf=J().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),Uf=Bf.extend({blob:Hf}),Wf=td([`user`,`assistant`]),Gf=X({audience:Y(Wf).optional(),priority:Ou().min(0).max(1).optional(),lastModified:Il({offset:!0}).optional()}),Kf=X({...lf.shape,...cf.shape,uri:J(),description:od(J()),mimeType:od(J()),size:od(Ou()),annotations:Gf.optional(),_meta:od(Gu({}))}),qf=X({...lf.shape,...cf.shape,uriTemplate:J(),description:od(J()),mimeType:od(J()),annotations:Gf.optional(),_meta:od(Gu({}))}),Jf=Ef.extend({method:Z(`resources/list`)}),Yf=Df.extend({resources:Y(Kf)}),Xf=Ef.extend({method:Z(`resources/templates/list`)}),Zf=Df.extend({resourceTemplates:Y(qf)}),Qf=Bd.extend({uri:J()}),$f=Qf,ep=Ud.extend({method:Z(`resources/read`),params:$f}),tp=Kd.extend({contents:Y(qu([Vf,Uf]))}),np=Gd.extend({method:Z(`notifications/resources/list_changed`),params:Wd.optional()}),rp=Qf,ip=Ud.extend({method:Z(`resources/subscribe`),params:rp}),ap=Qf,op=Ud.extend({method:Z(`resources/unsubscribe`),params:ap}),sp=Wd.extend({uri:J()}),cp=Gd.extend({method:Z(`notifications/resources/updated`),params:sp}),lp=X({name:J(),description:od(J()),required:od(Mu())}),up=X({...lf.shape,...cf.shape,description:od(J()),arguments:od(Y(lp)),_meta:od(Gu({}))}),dp=Ef.extend({method:Z(`prompts/list`)}),fp=Df.extend({prompts:Y(up)}),pp=Bd.extend({name:J(),arguments:$u(J(),J()).optional()}),mp=Ud.extend({method:Z(`prompts/get`),params:pp}),hp=X({type:Z(`text`),text:J(),annotations:Gf.optional(),_meta:$u(J(),Bu()).optional()}),gp=X({type:Z(`image`),data:Hf,mimeType:J(),annotations:Gf.optional(),_meta:$u(J(),Bu()).optional()}),_p=X({type:Z(`audio`),data:Hf,mimeType:J(),annotations:Gf.optional(),_meta:$u(J(),Bu()).optional()}),vp=X({type:Z(`tool_use`),name:J(),id:J(),input:$u(J(),Bu()),_meta:$u(J(),Bu()).optional()}),yp=X({type:Z(`resource`),resource:qu([Vf,Uf]),annotations:Gf.optional(),_meta:$u(J(),Bu()).optional()}),bp=Kf.extend({type:Z(`resource_link`)}),xp=qu([hp,gp,_p,bp,yp]),Sp=X({role:Wf,content:xp}),Cp=Kd.extend({description:J().optional(),messages:Y(Sp)}),wp=Gd.extend({method:Z(`notifications/prompts/list_changed`),params:Wd.optional()}),Tp=X({title:J().optional(),readOnlyHint:Mu().optional(),destructiveHint:Mu().optional(),idempotentHint:Mu().optional(),openWorldHint:Mu().optional()}),Ep=X({taskSupport:td([`required`,`optional`,`forbidden`]).optional()}),Dp=X({...lf.shape,...cf.shape,description:J().optional(),inputSchema:X({type:Z(`object`),properties:$u(J(),Pd).optional(),required:Y(J()).optional()}).catchall(Bu()),outputSchema:X({type:Z(`object`),properties:$u(J(),Pd).optional(),required:Y(J()).optional()}).catchall(Bu()).optional(),annotations:Tp.optional(),execution:Ep.optional(),_meta:$u(J(),Bu()).optional()}),Op=Ef.extend({method:Z(`tools/list`)}),kp=Df.extend({tools:Y(Dp)}),Ap=Kd.extend({content:Y(xp).default([]),structuredContent:$u(J(),Bu()).optional(),isError:Mu().optional()});Ap.or(Kd.extend({toolResult:Bu()}));var jp=Vd.extend({name:J(),arguments:$u(J(),Bu()).optional()}),Mp=Ud.extend({method:Z(`tools/call`),params:jp}),Np=Gd.extend({method:Z(`notifications/tools/list_changed`),params:Wd.optional()}),Pp=X({autoRefresh:Mu().default(!0),debounceMs:Ou().int().nonnegative().default(300)}),Fp=td([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),Ip=Bd.extend({level:Fp}),Lp=Ud.extend({method:Z(`logging/setLevel`),params:Ip}),Rp=Wd.extend({level:Fp,logger:J().optional(),data:Bu()}),zp=Gd.extend({method:Z(`notifications/message`),params:Rp}),Bp=X({hints:Y(X({name:J().optional()})).optional(),costPriority:Ou().min(0).max(1).optional(),speedPriority:Ou().min(0).max(1).optional(),intelligencePriority:Ou().min(0).max(1).optional()}),Vp=X({mode:td([`auto`,`required`,`none`]).optional()}),Hp=X({type:Z(`tool_result`),toolUseId:J().describe(`The unique identifier for the corresponding tool call.`),content:Y(xp).default([]),structuredContent:X({}).loose().optional(),isError:Mu().optional(),_meta:$u(J(),Bu()).optional()}),Up=Yu(`type`,[hp,gp,_p]),Wp=Yu(`type`,[hp,gp,_p,vp,Hp]),Gp=X({role:Wf,content:qu([Wp,Y(Wp)]),_meta:$u(J(),Bu()).optional()}),Kp=Vd.extend({messages:Y(Gp),modelPreferences:Bp.optional(),systemPrompt:J().optional(),includeContext:td([`none`,`thisServer`,`allServers`]).optional(),temperature:Ou().optional(),maxTokens:Ou().int(),stopSequences:Y(J()).optional(),metadata:Pd.optional(),tools:Y(Dp).optional(),toolChoice:Vp.optional()}),qp=Ud.extend({method:Z(`sampling/createMessage`),params:Kp}),Jp=Kd.extend({model:J(),stopReason:od(td([`endTurn`,`stopSequence`,`maxTokens`]).or(J())),role:Wf,content:Up}),Yp=Kd.extend({model:J(),stopReason:od(td([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(J())),role:Wf,content:qu([Wp,Y(Wp)])}),Xp=X({type:Z(`boolean`),title:J().optional(),description:J().optional(),default:Mu().optional()}),Zp=X({type:Z(`string`),title:J().optional(),description:J().optional(),minLength:Ou().optional(),maxLength:Ou().optional(),format:td([`email`,`uri`,`date`,`date-time`]).optional(),default:J().optional()}),Qp=X({type:td([`number`,`integer`]),title:J().optional(),description:J().optional(),minimum:Ou().optional(),maximum:Ou().optional(),default:Ou().optional()}),$p=X({type:Z(`string`),title:J().optional(),description:J().optional(),enum:Y(J()),default:J().optional()}),em=X({type:Z(`string`),title:J().optional(),description:J().optional(),oneOf:Y(X({const:J(),title:J()})),default:J().optional()}),eee=qu([qu([X({type:Z(`string`),title:J().optional(),description:J().optional(),enum:Y(J()),enumNames:Y(J()).optional(),default:J().optional()}),qu([$p,em]),qu([X({type:Z(`array`),title:J().optional(),description:J().optional(),minItems:Ou().optional(),maxItems:Ou().optional(),items:X({type:Z(`string`),enum:Y(J())}),default:Y(J()).optional()}),X({type:Z(`array`),title:J().optional(),description:J().optional(),minItems:Ou().optional(),maxItems:Ou().optional(),items:X({anyOf:Y(X({const:J(),title:J()}))}),default:Y(J()).optional()})])]),Xp,Zp,Qp]),tee=qu([Vd.extend({mode:Z(`form`).optional(),message:J(),requestedSchema:X({type:Z(`object`),properties:$u(J(),eee),required:Y(J()).optional()})}),Vd.extend({mode:Z(`url`),message:J(),elicitationId:J(),url:J().url()})]),tm=Ud.extend({method:Z(`elicitation/create`),params:tee}),nm=Wd.extend({elicitationId:J()}),rm=Gd.extend({method:Z(`notifications/elicitation/complete`),params:nm}),im=Kd.extend({action:td([`accept`,`decline`,`cancel`]),content:Dd(e=>e===null?void 0:e,$u(J(),qu([J(),Ou(),Mu(),Y(J())])).optional())}),am=X({type:Z(`ref/resource`),uri:J()}),om=X({type:Z(`ref/prompt`),name:J()}),sm=Bd.extend({ref:qu([om,am]),argument:X({name:J(),value:J()}),context:X({arguments:$u(J(),J()).optional()}).optional()}),cm=Ud.extend({method:Z(`completion/complete`),params:sm}),lm=Kd.extend({completion:Gu({values:Y(J()).max(100),total:od(Ou().int()),hasMore:od(Mu())})}),um=X({uri:J().startsWith(`file://`),name:J().optional(),_meta:$u(J(),Bu()).optional()}),dm=Ud.extend({method:Z(`roots/list`),params:Bd.optional()}),fm=Kd.extend({roots:Y(um)}),nee=Gd.extend({method:Z(`notifications/roots/list_changed`),params:Wd.optional()});qu([xf,gf,cm,Lp,mp,dp,Jf,Xf,ep,ip,op,Mp,Op,Nf,Ff,If,Rf]),qu([sf,wf,yf,nee,Mf]),qu([af,Jp,Yp,im,fm,Pf,Lf,Af]),qu([xf,qp,tm,dm,Nf,Ff,If,Rf]),qu([sf,wf,zp,cp,np,Np,wp,Mf,rm]),qu([af,vf,lm,Cp,fp,Yf,Zf,tp,Ap,kp,Pf,Lf,Af]);var pm=class e extends Error{constructor(e,t,n){super(`MCP error ${e}: ${t}`),this.code=e,this.data=n,this.name=`McpError`}static fromError(t,n,r){if(t===ef.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new ree(e.elicitations,n)}return new e(t,n,r)}},ree=class extends pm{constructor(e,t=`URL elicitation${e.length>1?`s`:``} required`){super(ef.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},mm=du().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:Od.custom,message:`URL must be parseable`,fatal:!0}),Di}).refine(e=>{let t=new URL(e);return t.protocol!==`javascript:`&&t.protocol!==`data:`&&t.protocol!==`vbscript:`},{message:`URL cannot use javascript:, data:, or vbscript: scheme`}),hm=Gu({resource:J().url(),authorization_servers:Y(mm).optional(),jwks_uri:J().url().optional(),scopes_supported:Y(J()).optional(),bearer_methods_supported:Y(J()).optional(),resource_signing_alg_values_supported:Y(J()).optional(),resource_name:J().optional(),resource_documentation:J().optional(),resource_policy_uri:J().url().optional(),resource_tos_uri:J().url().optional(),tls_client_certificate_bound_access_tokens:Mu().optional(),authorization_details_types_supported:Y(J()).optional(),dpop_signing_alg_values_supported:Y(J()).optional(),dpop_bound_access_tokens_required:Mu().optional()}),gm=Gu({issuer:J(),authorization_endpoint:mm,token_endpoint:mm,registration_endpoint:mm.optional(),scopes_supported:Y(J()).optional(),response_types_supported:Y(J()),response_modes_supported:Y(J()).optional(),grant_types_supported:Y(J()).optional(),token_endpoint_auth_methods_supported:Y(J()).optional(),token_endpoint_auth_signing_alg_values_supported:Y(J()).optional(),service_documentation:mm.optional(),revocation_endpoint:mm.optional(),revocation_endpoint_auth_methods_supported:Y(J()).optional(),revocation_endpoint_auth_signing_alg_values_supported:Y(J()).optional(),introspection_endpoint:J().optional(),introspection_endpoint_auth_methods_supported:Y(J()).optional(),introspection_endpoint_auth_signing_alg_values_supported:Y(J()).optional(),code_challenge_methods_supported:Y(J()).optional(),client_id_metadata_document_supported:Mu().optional()}),_m=X({...Gu({issuer:J(),authorization_endpoint:mm,token_endpoint:mm,userinfo_endpoint:mm.optional(),jwks_uri:mm,registration_endpoint:mm.optional(),scopes_supported:Y(J()).optional(),response_types_supported:Y(J()),response_modes_supported:Y(J()).optional(),grant_types_supported:Y(J()).optional(),acr_values_supported:Y(J()).optional(),subject_types_supported:Y(J()),id_token_signing_alg_values_supported:Y(J()),id_token_encryption_alg_values_supported:Y(J()).optional(),id_token_encryption_enc_values_supported:Y(J()).optional(),userinfo_signing_alg_values_supported:Y(J()).optional(),userinfo_encryption_alg_values_supported:Y(J()).optional(),userinfo_encryption_enc_values_supported:Y(J()).optional(),request_object_signing_alg_values_supported:Y(J()).optional(),request_object_encryption_alg_values_supported:Y(J()).optional(),request_object_encryption_enc_values_supported:Y(J()).optional(),token_endpoint_auth_methods_supported:Y(J()).optional(),token_endpoint_auth_signing_alg_values_supported:Y(J()).optional(),display_values_supported:Y(J()).optional(),claim_types_supported:Y(J()).optional(),claims_supported:Y(J()).optional(),service_documentation:J().optional(),claims_locales_supported:Y(J()).optional(),ui_locales_supported:Y(J()).optional(),claims_parameter_supported:Mu().optional(),request_parameter_supported:Mu().optional(),request_uri_parameter_supported:Mu().optional(),require_request_uri_registration:Mu().optional(),op_policy_uri:mm.optional(),op_tos_uri:mm.optional(),client_id_metadata_document_supported:Mu().optional()}).shape,...gm.pick({code_challenge_methods_supported:!0}).shape}),vm=X({access_token:J(),id_token:J().optional(),token_type:J(),expires_in:Ad().optional(),scope:J().optional(),refresh_token:J().optional()}).strip(),ym=X({error:J(),error_description:J().optional(),error_uri:J().optional()}),bm=mm.optional().or(Z(``).transform(()=>void 0)),xm=X({redirect_uris:Y(mm),token_endpoint_auth_method:J().optional(),grant_types:Y(J()).optional(),response_types:Y(J()).optional(),client_name:J().optional(),client_uri:mm.optional(),logo_uri:bm,scope:J().optional(),contacts:Y(J()).optional(),tos_uri:bm,policy_uri:J().optional(),jwks_uri:mm.optional(),jwks:Ru().optional(),software_id:J().optional(),software_version:J().optional(),software_statement:J().optional()}).strip(),Sm=X({client_id:J(),client_secret:J().optional(),client_id_issued_at:Ou().optional(),client_secret_expires_at:Ou().optional()}).strip(),Cm=xm.merge(Sm);X({error:J(),error_description:J().optional()}).strip(),X({token:J(),token_type_hint:J().optional()}).strip();function wm(e){let t=typeof e==`string`?new URL(e):new URL(e.href);return t.hash=``,t}function Tm({requestedResource:e,configuredResource:t}){let n=typeof e==`string`?new URL(e):new URL(e.href),r=typeof t==`string`?new URL(t):new URL(t.href);if(n.origin!==r.origin||n.pathname.length<r.pathname.length)return!1;let i=n.pathname.endsWith(`/`)?n.pathname:n.pathname+`/`,a=r.pathname.endsWith(`/`)?r.pathname:r.pathname+`/`;return i.startsWith(a)}var Em=class extends Error{constructor(e,t){super(e),this.errorUri=t,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}},Dm=class extends Em{};Dm.errorCode=`invalid_request`;var Om=class extends Em{};Om.errorCode=`invalid_client`;var km=class extends Em{};km.errorCode=`invalid_grant`;var Am=class extends Em{};Am.errorCode=`unauthorized_client`;var jm=class extends Em{};jm.errorCode=`unsupported_grant_type`;var Mm=class extends Em{};Mm.errorCode=`invalid_scope`;var Nm=class extends Em{};Nm.errorCode=`access_denied`;var Pm=class extends Em{};Pm.errorCode=`server_error`;var Fm=class extends Em{};Fm.errorCode=`temporarily_unavailable`;var Im=class extends Em{};Im.errorCode=`unsupported_response_type`;var Lm=class extends Em{};Lm.errorCode=`unsupported_token_type`;var Rm=class extends Em{};Rm.errorCode=`invalid_token`;var zm=class extends Em{};zm.errorCode=`method_not_allowed`;var Bm=class extends Em{};Bm.errorCode=`too_many_requests`;var Vm=class extends Em{};Vm.errorCode=`invalid_client_metadata`;var Hm=class extends Em{};Hm.errorCode=`insufficient_scope`;var Um=class extends Em{};Um.errorCode=`invalid_target`;var Wm={[Dm.errorCode]:Dm,[Om.errorCode]:Om,[km.errorCode]:km,[Am.errorCode]:Am,[jm.errorCode]:jm,[Mm.errorCode]:Mm,[Nm.errorCode]:Nm,[Pm.errorCode]:Pm,[Fm.errorCode]:Fm,[Im.errorCode]:Im,[Lm.errorCode]:Lm,[Rm.errorCode]:Rm,[zm.errorCode]:zm,[Bm.errorCode]:Bm,[Vm.errorCode]:Vm,[Hm.errorCode]:Hm,[Um.errorCode]:Um},Gm=class extends Error{constructor(e){super(e??`Unauthorized`)}};function Km(e){return[`client_secret_basic`,`client_secret_post`,`none`].includes(e)}var qm=`code`,Jm=`S256`;function Ym(e,t){let n=e.client_secret!==void 0;return`token_endpoint_auth_method`in e&&e.token_endpoint_auth_method&&Km(e.token_endpoint_auth_method)&&(t.length===0||t.includes(e.token_endpoint_auth_method))?e.token_endpoint_auth_method:t.length===0?n?`client_secret_basic`:`none`:n&&t.includes(`client_secret_basic`)?`client_secret_basic`:n&&t.includes(`client_secret_post`)?`client_secret_post`:t.includes(`none`)?`none`:n?`client_secret_post`:`none`}function Xm(e,t,n,r){let{client_id:i,client_secret:a}=t;switch(e){case`client_secret_basic`:Zm(i,a,n);return;case`client_secret_post`:Qm(i,a,r);return;case`none`:$m(i,r);return;default:throw Error(`Unsupported client authentication method: ${e}`)}}function Zm(e,t,n){if(!t)throw Error(`client_secret_basic authentication requires a client_secret`);let r=btoa(`${e}:${t}`);n.set(`Authorization`,`Basic ${r}`)}function Qm(e,t,n){n.set(`client_id`,e),t&&n.set(`client_secret`,t)}function $m(e,t){t.set(`client_id`,e)}async function eh(e){let t=e instanceof Response?e.status:void 0,n=e instanceof Response?await e.text():e;try{let{error:e,error_description:t,error_uri:r}=ym.parse(JSON.parse(n));return new(Wm[e]||Pm)(t||``,r)}catch(e){return new Pm(`${t?`HTTP ${t}: `:``}Invalid OAuth error response: ${e}. Raw body: ${n}`)}}async function th(e,t){try{return await nh(e,t)}catch(n){if(n instanceof Om||n instanceof Am)return await e.invalidateCredentials?.(`all`),await nh(e,t);if(n instanceof km)return await e.invalidateCredentials?.(`tokens`),await nh(e,t);throw n}}async function nh(e,{serverUrl:t,authorizationCode:n,scope:r,resourceMetadataUrl:i,fetchFn:a}){let o=await e.discoveryState?.(),s,c,l,u=i;if(!u&&o?.resourceMetadataUrl&&(u=new URL(o.resourceMetadataUrl)),o?.authorizationServerUrl){if(c=o.authorizationServerUrl,s=o.resourceMetadata,l=o.authorizationServerMetadata??await mh(c,{fetchFn:a}),!s)try{s=await sh(t,{resourceMetadataUrl:u},a)}catch{}(l!==o.authorizationServerMetadata||s!==o.resourceMetadata)&&await e.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:u?.toString(),resourceMetadata:s,authorizationServerMetadata:l})}else{let n=await hh(t,{resourceMetadataUrl:u,fetchFn:a});c=n.authorizationServerUrl,l=n.authorizationServerMetadata,s=n.resourceMetadata,await e.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:u?.toString(),resourceMetadata:s,authorizationServerMetadata:l})}let d=await ih(t,e,s),f=r||s?.scopes_supported?.join(` `)||e.clientMetadata.scope,p=await Promise.resolve(e.clientInformation());if(!p){if(n!==void 0)throw Error(`Existing OAuth client information is required when exchanging an authorization code`);let t=l?.client_id_metadata_document_supported===!0,r=e.clientMetadataUrl;if(r&&!rh(r))throw new Vm(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${r}`);if(t&&r)p={client_id:r},await e.saveClientInformation?.(p);else{if(!e.saveClientInformation)throw Error(`OAuth client information must be saveable for dynamic registration`);let t=await xh(c,{metadata:l,clientMetadata:e.clientMetadata,scope:f,fetchFn:a});await e.saveClientInformation(t),p=t}}let m=!e.redirectUrl;if(n!==void 0||m){let t=await bh(e,c,{metadata:l,resource:d,authorizationCode:n,fetchFn:a});return await e.saveTokens(t),`AUTHORIZED`}let h=await e.tokens();if(h?.refresh_token)try{let t=await yh(c,{metadata:l,clientInformation:p,refreshToken:h.refresh_token,resource:d,addClientAuthentication:e.addClientAuthentication,fetchFn:a});return await e.saveTokens(t),`AUTHORIZED`}catch(e){if(!(!(e instanceof Em)||e instanceof Pm))throw e}let g=e.state?await e.state():void 0,{authorizationUrl:_,codeVerifier:v}=await gh(c,{metadata:l,clientInformation:p,state:g,redirectUrl:e.redirectUrl,scope:f,resource:d});return await e.saveCodeVerifier(v),await e.redirectToAuthorization(_),`REDIRECT`}function rh(e){if(!e)return!1;try{let t=new URL(e);return t.protocol===`https:`&&t.pathname!==`/`}catch{return!1}}async function ih(e,t,n){let r=wm(e);if(t.validateResourceURL)return await t.validateResourceURL(r,n?.resource);if(n){if(!Tm({requestedResource:r,configuredResource:n.resource}))throw Error(`Protected resource ${n.resource} does not match expected ${r} (or origin)`);return new URL(n.resource)}}function ah(e){let t=e.headers.get(`WWW-Authenticate`);if(!t)return{};let[n,r]=t.split(` `);if(n.toLowerCase()!==`bearer`||!r)return{};let i=oh(e,`resource_metadata`)||void 0,a;if(i)try{a=new URL(i)}catch{}let o=oh(e,`scope`)||void 0,s=oh(e,`error`)||void 0;return{resourceMetadataUrl:a,scope:o,error:s}}function oh(e,t){let n=e.headers.get(`WWW-Authenticate`);if(!n)return null;let r=RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),i=n.match(r);return i?i[1]||i[2]:null}async function sh(e,t,n=fetch){let r=await fh(e,`oauth-protected-resource`,n,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!r||r.status===404)throw await r?.body?.cancel(),Error(`Resource server does not implement OAuth 2.0 Protected Resource Metadata.`);if(!r.ok)throw await r.body?.cancel(),Error(`HTTP ${r.status} trying to load well-known OAuth protected resource metadata.`);return hm.parse(await r.json())}async function ch(e,t,n=fetch){try{return await n(e,{headers:t})}catch(r){if(r instanceof TypeError)return t?ch(e,void 0,n):void 0;throw r}}function lh(e,t=``,n={}){return t.endsWith(`/`)&&(t=t.slice(0,-1)),n.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function uh(e,t,n=fetch){return await ch(e,{"MCP-Protocol-Version":t},n)}function dh(e,t){return!e||e.status>=400&&e.status<500&&t!==`/`}async function fh(e,t,n,r){let i=new URL(e),a=r?.protocolVersion??`2025-11-25`,o;if(r?.metadataUrl)o=new URL(r.metadataUrl);else{let e=lh(t,i.pathname);o=new URL(e,r?.metadataServerUrl??i),o.search=i.search}let s=await uh(o,a,n);return!r?.metadataUrl&&dh(s,i.pathname)&&(s=await uh(new URL(`/.well-known/${t}`,i),a,n)),s}function ph(e){let t=typeof e==`string`?new URL(e):e,n=t.pathname!==`/`,r=[];if(!n)return r.push({url:new URL(`/.well-known/oauth-authorization-server`,t.origin),type:`oauth`}),r.push({url:new URL(`/.well-known/openid-configuration`,t.origin),type:`oidc`}),r;let i=t.pathname;return i.endsWith(`/`)&&(i=i.slice(0,-1)),r.push({url:new URL(`/.well-known/oauth-authorization-server${i}`,t.origin),type:`oauth`}),r.push({url:new URL(`/.well-known/openid-configuration${i}`,t.origin),type:`oidc`}),r.push({url:new URL(`${i}/.well-known/openid-configuration`,t.origin),type:`oidc`}),r}async function mh(e,{fetchFn:t=fetch,protocolVersion:n=jd}={}){let r={"MCP-Protocol-Version":n,Accept:`application/json`},i=ph(e);for(let{url:e,type:n}of i){let i=await ch(e,r,t);if(i){if(!i.ok){if(await i.body?.cancel(),i.status>=400&&i.status<500)continue;throw Error(`HTTP ${i.status} trying to load ${n===`oauth`?`OAuth`:`OpenID provider`} metadata from ${e}`)}return n===`oauth`?gm.parse(await i.json()):_m.parse(await i.json())}}}async function hh(e,t){let n,r;try{n=await sh(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn),n.authorization_servers&&n.authorization_servers.length>0&&(r=n.authorization_servers[0])}catch{}r||=String(new URL(`/`,e));let i=await mh(r,{fetchFn:t?.fetchFn});return{authorizationServerUrl:r,authorizationServerMetadata:i,resourceMetadata:n}}async function gh(e,{metadata:t,clientInformation:n,redirectUrl:r,scope:i,state:a,resource:o}){let s;if(t){if(s=new URL(t.authorization_endpoint),!t.response_types_supported.includes(qm))throw Error(`Incompatible auth server: does not support response type ${qm}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(Jm))throw Error(`Incompatible auth server: does not support code challenge method ${Jm}`)}else s=new URL(`/authorize`,e);let c=await Ei(),l=c.code_verifier,u=c.code_challenge;return s.searchParams.set(`response_type`,qm),s.searchParams.set(`client_id`,n.client_id),s.searchParams.set(`code_challenge`,u),s.searchParams.set(`code_challenge_method`,Jm),s.searchParams.set(`redirect_uri`,String(r)),a&&s.searchParams.set(`state`,a),i&&s.searchParams.set(`scope`,i),i?.includes(`offline_access`)&&s.searchParams.append(`prompt`,`consent`),o&&s.searchParams.set(`resource`,o.href),{authorizationUrl:s,codeVerifier:l}}function _h(e,t,n){return new URLSearchParams({grant_type:`authorization_code`,code:e,code_verifier:t,redirect_uri:String(n)})}async function vh(e,{metadata:t,tokenRequestParams:n,clientInformation:r,addClientAuthentication:i,resource:a,fetchFn:o}){let s=t?.token_endpoint?new URL(t.token_endpoint):new URL(`/token`,e),c=new Headers({"Content-Type":`application/x-www-form-urlencoded`,Accept:`application/json`});a&&n.set(`resource`,a.href),i?await i(c,n,s,t):r&&Xm(Ym(r,t?.token_endpoint_auth_methods_supported??[]),r,c,n);let l=await(o??fetch)(s,{method:`POST`,headers:c,body:n});if(!l.ok)throw await eh(l);return vm.parse(await l.json())}async function yh(e,{metadata:t,clientInformation:n,refreshToken:r,resource:i,addClientAuthentication:a,fetchFn:o}){return{refresh_token:r,...await vh(e,{metadata:t,tokenRequestParams:new URLSearchParams({grant_type:`refresh_token`,refresh_token:r}),clientInformation:n,addClientAuthentication:a,resource:i,fetchFn:o})}}async function bh(e,t,{metadata:n,resource:r,authorizationCode:i,fetchFn:a}={}){let o=e.clientMetadata.scope,s;if(e.prepareTokenRequest&&(s=await e.prepareTokenRequest(o)),!s){if(!i)throw Error(`Either provider.prepareTokenRequest() or authorizationCode is required`);if(!e.redirectUrl)throw Error(`redirectUrl is required for authorization_code flow`);s=_h(i,await e.codeVerifier(),e.redirectUrl)}let c=await e.clientInformation();return vh(t,{metadata:n,tokenRequestParams:s,clientInformation:c??void 0,addClientAuthentication:e.addClientAuthentication,resource:r,fetchFn:a})}async function xh(e,{metadata:t,clientMetadata:n,scope:r,fetchFn:i}){let a;if(t){if(!t.registration_endpoint)throw Error(`Incompatible auth server: does not support dynamic client registration`);a=new URL(t.registration_endpoint)}else a=new URL(`/register`,e);let o=await(i??fetch)(a,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...n,...r===void 0?{}:{scope:r}})});if(!o.ok)throw await eh(o);return Cm.parse(await o.json())}var Sh=typeof global==`object`&&global&&global.Object===Object&&global,Ch=typeof self==`object`&&self&&self.Object===Object&&self,wh=Sh||Ch||Function(`return this`)(),Th=wh.Symbol,Eh=Object.prototype,Dh=Eh.hasOwnProperty,Oh=Eh.toString,kh=Th?Th.toStringTag:void 0;function Ah(e){var t=Dh.call(e,kh),n=e[kh];try{e[kh]=void 0;var r=!0}catch{}var i=Oh.call(e);return r&&(t?e[kh]=n:delete e[kh]),i}var jh=Object.prototype.toString;function Mh(e){return jh.call(e)}var Nh=`[object Null]`,Ph=`[object Undefined]`,Fh=Th?Th.toStringTag:void 0;function Ih(e){return e==null?e===void 0?Ph:Nh:Fh&&Fh in Object(e)?Ah(e):Mh(e)}function Lh(e){return typeof e==`object`&&!!e}var Rh=`[object Symbol]`;function zh(e){return typeof e==`symbol`||Lh(e)&&Ih(e)==Rh}function Bh(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var Vh=Array.isArray,Hh=1/0,Uh=Th?Th.prototype:void 0,Wh=Uh?Uh.toString:void 0;function Gh(e){if(typeof e==`string`)return e;if(Vh(e))return Bh(e,Gh)+``;if(zh(e))return Wh?Wh.call(e):``;var t=e+``;return t==`0`&&1/e==-Hh?`-0`:t}var Kh=/\s/;function qh(e){for(var t=e.length;t--&&Kh.test(e.charAt(t)););return t}var Jh=/^\s+/;function Yh(e){return e&&e.slice(0,qh(e)+1).replace(Jh,``)}function Xh(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}var Zh=NaN,Qh=/^[-+]0x[0-9a-f]+$/i,$h=/^0b[01]+$/i,eg=/^0o[0-7]+$/i,tg=parseInt;function ng(e){if(typeof e==`number`)return e;if(zh(e))return Zh;if(Xh(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=Xh(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=Yh(e);var n=$h.test(e);return n||eg.test(e)?tg(e.slice(2),n?2:8):Qh.test(e)?Zh:+e}var rg=1/0,ig=17976931348623157e292;function ag(e){return e?(e=ng(e),e===rg||e===-rg?(e<0?-1:1)*ig:e===e?e:0):e===0?e:0}function og(e){var t=ag(e),n=t%1;return t===t?n?t-n:t:0}function sg(e){return e}var cg=`[object AsyncFunction]`,lg=`[object Function]`,iee=`[object GeneratorFunction]`,aee=`[object Proxy]`;function ug(e){if(!Xh(e))return!1;var t=Ih(e);return t==lg||t==iee||t==cg||t==aee}var dg=wh[`__core-js_shared__`],fg=function(){var e=/[^.]+$/.exec(dg&&dg.keys&&dg.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function oee(e){return!!fg&&fg in e}var see=Function.prototype.toString;function pg(e){if(e!=null){try{return see.call(e)}catch{}try{return e+``}catch{}}return``}var cee=/[\\^$.*+?()[\]{}|]/g,lee=/^\[object .+?Constructor\]$/,uee=Function.prototype,dee=Object.prototype,fee=uee.toString,pee=dee.hasOwnProperty,mg=RegExp(`^`+fee.call(pee).replace(cee,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function hg(e){return!Xh(e)||oee(e)?!1:(ug(e)?mg:lee).test(pg(e))}function gg(e,t){return e?.[t]}function _g(e,t){var n=gg(e,t);return hg(n)?n:void 0}var vg=_g(wh,`WeakMap`),yg=Object.create,bg=function(){function e(){}return function(t){if(!Xh(t))return{};if(yg)return yg(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function xg(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Sg(){}function Cg(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}var wg=800,Tg=16,Eg=Date.now;function Dg(e){var t=0,n=0;return function(){var r=Eg(),i=Tg-(r-n);if(n=r,i>0){if(++t>=wg)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Og(e){return function(){return e}}var kg=function(){try{var e=_g(Object,`defineProperty`);return e({},``,{}),e}catch{}}(),Ag=Dg(kg?function(e,t){return kg(e,`toString`,{configurable:!0,enumerable:!1,value:Og(t),writable:!0})}:sg);function jg(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}function Mg(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a<i;)if(t(e[a],a,e))return a;return-1}function Ng(e){return e!==e}function Pg(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}function Fg(e,t,n){return t===t?Pg(e,t,n):Mg(e,Ng,n)}function Ig(e,t){return!!(e!=null&&e.length)&&Fg(e,t,0)>-1}var Lg=9007199254740991,Rg=/^(?:0|[1-9]\d*)$/;function zg(e,t){var n=typeof e;return t??=Lg,!!t&&(n==`number`||n!=`symbol`&&Rg.test(e))&&e>-1&&e%1==0&&e<t}function Bg(e,t,n){t==`__proto__`&&kg?kg(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Vg(e,t){return e===t||e!==e&&t!==t}var Hg=Object.prototype.hasOwnProperty;function Ug(e,t,n){var r=e[t];(!(Hg.call(e,t)&&Vg(r,n))||n===void 0&&!(t in e))&&Bg(e,t,n)}function Wg(e,t,n,r){var i=!n;n||={};for(var a=-1,o=t.length;++a<o;){var s=t[a],c=r?r(n[s],e[s],s,n,e):void 0;c===void 0&&(c=e[s]),i?Bg(n,s,c):Ug(n,s,c)}return n}var Gg=Math.max;function Kg(e,t,n){return t=Gg(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,a=Gg(r.length-t,0),o=Array(a);++i<a;)o[i]=r[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=r[i];return s[t]=n(o),xg(e,this,s)}}function qg(e,t){return Ag(Kg(e,t,sg),e+``)}var Jg=9007199254740991;function Yg(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=Jg}function Xg(e){return e!=null&&Yg(e.length)&&!ug(e)}function Zg(e,t,n){if(!Xh(n))return!1;var r=typeof t;return(r==`number`?Xg(n)&&zg(t,n.length):r==`string`&&t in n)?Vg(n[t],e):!1}function Qg(e){return qg(function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(a=e.length>3&&typeof a==`function`?(i--,a):void 0,o&&Zg(n[0],n[1],o)&&(a=i<3?void 0:a,i=1),t=Object(t);++r<i;){var s=n[r];s&&e(t,s,r,a)}return t})}var $g=Object.prototype;function e_(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||$g)}function t_(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var n_=`[object Arguments]`;function r_(e){return Lh(e)&&Ih(e)==n_}var i_=Object.prototype,a_=i_.hasOwnProperty,o_=i_.propertyIsEnumerable,s_=r_(function(){return arguments}())?r_:function(e){return Lh(e)&&a_.call(e,`callee`)&&!o_.call(e,`callee`)};function c_(){return!1}var l_=typeof exports==`object`&&exports&&!exports.nodeType&&exports,u_=l_&&typeof module==`object`&&module&&!module.nodeType&&module,d_=u_&&u_.exports===l_?wh.Buffer:void 0,f_=(d_?d_.isBuffer:void 0)||c_,p_=`[object Arguments]`,m_=`[object Array]`,h_=`[object Boolean]`,g_=`[object Date]`,__=`[object Error]`,v_=`[object Function]`,y_=`[object Map]`,b_=`[object Number]`,x_=`[object Object]`,S_=`[object RegExp]`,C_=`[object Set]`,w_=`[object String]`,T_=`[object WeakMap]`,E_=`[object ArrayBuffer]`,D_=`[object DataView]`,mee=`[object Float32Array]`,hee=`[object Float64Array]`,gee=`[object Int8Array]`,_ee=`[object Int16Array]`,vee=`[object Int32Array]`,yee=`[object Uint8Array]`,bee=`[object Uint8ClampedArray]`,xee=`[object Uint16Array]`,See=`[object Uint32Array]`,O_={};O_[mee]=O_[hee]=O_[gee]=O_[_ee]=O_[vee]=O_[yee]=O_[bee]=O_[xee]=O_[See]=!0,O_[p_]=O_[m_]=O_[E_]=O_[h_]=O_[D_]=O_[g_]=O_[__]=O_[v_]=O_[y_]=O_[b_]=O_[x_]=O_[S_]=O_[C_]=O_[w_]=O_[T_]=!1;function Cee(e){return Lh(e)&&Yg(e.length)&&!!O_[Ih(e)]}function k_(e){return function(t){return e(t)}}var A_=typeof exports==`object`&&exports&&!exports.nodeType&&exports,j_=A_&&typeof module==`object`&&module&&!module.nodeType&&module,M_=j_&&j_.exports===A_&&Sh.process,N_=function(){try{return j_&&j_.require&&j_.require(`util`).types||M_&&M_.binding&&M_.binding(`util`)}catch{}}(),P_=N_&&N_.isTypedArray,F_=P_?k_(P_):Cee,I_=Object.prototype.hasOwnProperty;function L_(e,t){var n=Vh(e),r=!n&&s_(e),i=!n&&!r&&f_(e),a=!n&&!r&&!i&&F_(e),o=n||r||i||a,s=o?t_(e.length,String):[],c=s.length;for(var l in e)(t||I_.call(e,l))&&!(o&&(l==`length`||i&&(l==`offset`||l==`parent`)||a&&(l==`buffer`||l==`byteLength`||l==`byteOffset`)||zg(l,c)))&&s.push(l);return s}function R_(e,t){return function(n){return e(t(n))}}var z_=R_(Object.keys,Object),B_=Object.prototype.hasOwnProperty;function V_(e){if(!e_(e))return z_(e);var t=[];for(var n in Object(e))B_.call(e,n)&&n!=`constructor`&&t.push(n);return t}function H_(e){return Xg(e)?L_(e):V_(e)}var U_=Object.prototype.hasOwnProperty,W_=Qg(function(e,t){if(e_(t)||Xg(t)){Wg(t,H_(t),e);return}for(var n in t)U_.call(t,n)&&Ug(e,n,t[n])});function G_(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var K_=Object.prototype.hasOwnProperty;function q_(e){if(!Xh(e))return G_(e);var t=e_(e),n=[];for(var r in e)r==`constructor`&&(t||!K_.call(e,r))||n.push(r);return n}function J_(e){return Xg(e)?L_(e,!0):q_(e)}var Y_=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,X_=/^\w*$/;function Z_(e,t){if(Vh(e))return!1;var n=typeof e;return n==`number`||n==`symbol`||n==`boolean`||e==null||zh(e)?!0:X_.test(e)||!Y_.test(e)||t!=null&&e in Object(t)}var Q_=_g(Object,`create`);function $_(){this.__data__=Q_?Q_(null):{},this.size=0}function ev(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var tv=`__lodash_hash_undefined__`,nv=Object.prototype.hasOwnProperty;function rv(e){var t=this.__data__;if(Q_){var n=t[e];return n===tv?void 0:n}return nv.call(t,e)?t[e]:void 0}var iv=Object.prototype.hasOwnProperty;function av(e){var t=this.__data__;return Q_?t[e]!==void 0:iv.call(t,e)}var ov=`__lodash_hash_undefined__`;function sv(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Q_&&t===void 0?ov:t,this}function cv(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}cv.prototype.clear=$_,cv.prototype.delete=ev,cv.prototype.get=rv,cv.prototype.has=av,cv.prototype.set=sv;function lv(){this.__data__=[],this.size=0}function uv(e,t){for(var n=e.length;n--;)if(Vg(e[n][0],t))return n;return-1}var dv=Array.prototype.splice;function fv(e){var t=this.__data__,n=uv(t,e);return n<0?!1:(n==t.length-1?t.pop():dv.call(t,n,1),--this.size,!0)}function pv(e){var t=this.__data__,n=uv(t,e);return n<0?void 0:t[n][1]}function mv(e){return uv(this.__data__,e)>-1}function hv(e,t){var n=this.__data__,r=uv(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function gv(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}gv.prototype.clear=lv,gv.prototype.delete=fv,gv.prototype.get=pv,gv.prototype.has=mv,gv.prototype.set=hv;var _v=_g(wh,`Map`);function vv(){this.size=0,this.__data__={hash:new cv,map:new(_v||gv),string:new cv}}function yv(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function bv(e,t){var n=e.__data__;return yv(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function xv(e){var t=bv(this,e).delete(e);return this.size-=t?1:0,t}function Sv(e){return bv(this,e).get(e)}function Cv(e){return bv(this,e).has(e)}function wv(e,t){var n=bv(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function Tv(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Tv.prototype.clear=vv,Tv.prototype.delete=xv,Tv.prototype.get=Sv,Tv.prototype.has=Cv,Tv.prototype.set=wv;var Ev=`Expected a function`;function Dv(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(Ev);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(Dv.Cache||Tv),n}Dv.Cache=Tv;var Ov=500;function kv(e){var t=Dv(e,function(e){return n.size===Ov&&n.clear(),e}),n=t.cache;return t}var Av=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,jv=/\\(\\)?/g,Mv=kv(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(Av,function(e,n,r,i){t.push(r?i.replace(jv,`$1`):n||e)}),t});function Nv(e){return e==null?``:Gh(e)}function Pv(e,t){return Vh(e)?e:Z_(e,t)?[e]:Mv(Nv(e))}var Fv=1/0;function Iv(e){if(typeof e==`string`||zh(e))return e;var t=e+``;return t==`0`&&1/e==-Fv?`-0`:t}function Lv(e,t){t=Pv(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[Iv(t[n++])];return n&&n==r?e:void 0}function Q(e,t,n){var r=e==null?void 0:Lv(e,t);return r===void 0?n:r}function Rv(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var zv=Th?Th.isConcatSpreadable:void 0;function Bv(e){return Vh(e)||s_(e)||!!(zv&&e&&e[zv])}function Vv(e,t,n,r,i){var a=-1,o=e.length;for(n||=Bv,i||=[];++a<o;){var s=e[a];t>0&&n(s)?t>1?Vv(s,t-1,n,r,i):Rv(i,s):r||(i[i.length]=s)}return i}function Hv(e){return e!=null&&e.length?Vv(e,1):[]}function Uv(e){return Ag(Kg(e,void 0,Hv),e+``)}var Wv=R_(Object.getPrototypeOf,Object),Gv=`[object Object]`,Kv=Function.prototype,qv=Object.prototype,Jv=Kv.toString,Yv=qv.hasOwnProperty,Xv=Jv.call(Object);function Zv(e){if(!Lh(e)||Ih(e)!=Gv)return!1;var t=Wv(e);if(t===null)return!0;var n=Yv.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&Jv.call(n)==Xv}function Qv(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(i);++r<i;)a[r]=e[r+t];return a}function $v(e,t,n,r){var i=-1,a=e==null?0:e.length;for(r&&a&&(n=e[++i]);++i<a;)n=t(n,e[i],i,e);return n}function ey(){this.__data__=new gv,this.size=0}function ty(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function ny(e){return this.__data__.get(e)}function ry(e){return this.__data__.has(e)}var iy=200;function ay(e,t){var n=this.__data__;if(n instanceof gv){var r=n.__data__;if(!_v||r.length<iy-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Tv(r)}return n.set(e,t),this.size=n.size,this}function oy(e){this.size=(this.__data__=new gv(e)).size}oy.prototype.clear=ey,oy.prototype.delete=ty,oy.prototype.get=ny,oy.prototype.has=ry,oy.prototype.set=ay;function sy(e,t){return e&&Wg(t,H_(t),e)}function cy(e,t){return e&&Wg(t,J_(t),e)}var ly=typeof exports==`object`&&exports&&!exports.nodeType&&exports,uy=ly&&typeof module==`object`&&module&&!module.nodeType&&module,dy=uy&&uy.exports===ly?wh.Buffer:void 0,fy=dy?dy.allocUnsafe:void 0;function py(e,t){if(t)return e.slice();var n=e.length,r=fy?fy(n):new e.constructor(n);return e.copy(r),r}function my(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n<r;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a}function hy(){return[]}var gy=Object.prototype.propertyIsEnumerable,_y=Object.getOwnPropertySymbols,vy=_y?function(e){return e==null?[]:(e=Object(e),my(_y(e),function(t){return gy.call(e,t)}))}:hy;function yy(e,t){return Wg(e,vy(e),t)}var by=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Rv(t,vy(e)),e=Wv(e);return t}:hy;function xy(e,t){return Wg(e,by(e),t)}function Sy(e,t,n){var r=t(e);return Vh(e)?r:Rv(r,n(e))}function Cy(e){return Sy(e,H_,vy)}function wy(e){return Sy(e,J_,by)}var Ty=_g(wh,`DataView`),Ey=_g(wh,`Promise`),Dy=_g(wh,`Set`),Oy=`[object Map]`,ky=`[object Object]`,Ay=`[object Promise]`,jy=`[object Set]`,My=`[object WeakMap]`,Ny=`[object DataView]`,Py=pg(Ty),Fy=pg(_v),Iy=pg(Ey),Ly=pg(Dy),Ry=pg(vg),zy=Ih;(Ty&&zy(new Ty(new ArrayBuffer(1)))!=Ny||_v&&zy(new _v)!=Oy||Ey&&zy(Ey.resolve())!=Ay||Dy&&zy(new Dy)!=jy||vg&&zy(new vg)!=My)&&(zy=function(e){var t=Ih(e),n=t==ky?e.constructor:void 0,r=n?pg(n):``;if(r)switch(r){case Py:return Ny;case Fy:return Oy;case Iy:return Ay;case Ly:return jy;case Ry:return My}return t});var By=zy,Vy=Object.prototype.hasOwnProperty;function Hy(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]==`string`&&Vy.call(e,`index`)&&(n.index=e.index,n.input=e.input),n}var Uy=wh.Uint8Array;function Wy(e){var t=new e.constructor(e.byteLength);return new Uy(t).set(new Uy(e)),t}function Gy(e,t){var n=t?Wy(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var Ky=/\w*$/;function qy(e){var t=new e.constructor(e.source,Ky.exec(e));return t.lastIndex=e.lastIndex,t}var Jy=Th?Th.prototype:void 0,Yy=Jy?Jy.valueOf:void 0;function Xy(e){return Yy?Object(Yy.call(e)):{}}function Zy(e,t){var n=t?Wy(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var Qy=`[object Boolean]`,$y=`[object Date]`,eb=`[object Map]`,tb=`[object Number]`,nb=`[object RegExp]`,rb=`[object Set]`,ib=`[object String]`,ab=`[object Symbol]`,ob=`[object ArrayBuffer]`,sb=`[object DataView]`,cb=`[object Float32Array]`,lb=`[object Float64Array]`,ub=`[object Int8Array]`,db=`[object Int16Array]`,fb=`[object Int32Array]`,pb=`[object Uint8Array]`,mb=`[object Uint8ClampedArray]`,hb=`[object Uint16Array]`,gb=`[object Uint32Array]`;function _b(e,t,n){var r=e.constructor;switch(t){case ob:return Wy(e);case Qy:case $y:return new r(+e);case sb:return Gy(e,n);case cb:case lb:case ub:case db:case fb:case pb:case mb:case hb:case gb:return Zy(e,n);case eb:return new r;case tb:case ib:return new r(e);case nb:return qy(e);case rb:return new r;case ab:return Xy(e)}}function vb(e){return typeof e.constructor==`function`&&!e_(e)?bg(Wv(e)):{}}var yb=`[object Map]`;function bb(e){return Lh(e)&&By(e)==yb}var xb=N_&&N_.isMap,Sb=xb?k_(xb):bb,Cb=`[object Set]`;function wb(e){return Lh(e)&&By(e)==Cb}var Tb=N_&&N_.isSet,Eb=Tb?k_(Tb):wb,Db=1,Ob=2,kb=4,Ab=`[object Arguments]`,jb=`[object Array]`,Mb=`[object Boolean]`,Nb=`[object Date]`,Pb=`[object Error]`,Fb=`[object Function]`,Ib=`[object GeneratorFunction]`,Lb=`[object Map]`,Rb=`[object Number]`,zb=`[object Object]`,Bb=`[object RegExp]`,Vb=`[object Set]`,Hb=`[object String]`,Ub=`[object Symbol]`,Wb=`[object WeakMap]`,Gb=`[object ArrayBuffer]`,Kb=`[object DataView]`,qb=`[object Float32Array]`,Jb=`[object Float64Array]`,Yb=`[object Int8Array]`,Xb=`[object Int16Array]`,Zb=`[object Int32Array]`,Qb=`[object Uint8Array]`,$b=`[object Uint8ClampedArray]`,ex=`[object Uint16Array]`,tx=`[object Uint32Array]`,nx={};nx[Ab]=nx[jb]=nx[Gb]=nx[Kb]=nx[Mb]=nx[Nb]=nx[qb]=nx[Jb]=nx[Yb]=nx[Xb]=nx[Zb]=nx[Lb]=nx[Rb]=nx[zb]=nx[Bb]=nx[Vb]=nx[Hb]=nx[Ub]=nx[Qb]=nx[$b]=nx[ex]=nx[tx]=!0,nx[Pb]=nx[Fb]=nx[Wb]=!1;function rx(e,t,n,r,i,a){var o,s=t&Db,c=t&Ob,l=t&kb;if(n&&(o=i?n(e,r,i,a):n(e)),o!==void 0)return o;if(!Xh(e))return e;var u=Vh(e);if(u){if(o=Hy(e),!s)return Cg(e,o)}else{var d=By(e),f=d==Fb||d==Ib;if(f_(e))return py(e,s);if(d==zb||d==Ab||f&&!i){if(o=c||f?{}:vb(e),!s)return c?xy(e,cy(o,e)):yy(e,sy(o,e))}else{if(!nx[d])return i?e:{};o=_b(e,d,s)}}a||=new oy;var p=a.get(e);if(p)return p;a.set(e,o),Eb(e)?e.forEach(function(r){o.add(rx(r,t,n,r,e,a))}):Sb(e)&&e.forEach(function(r,i){o.set(i,rx(r,t,n,i,e,a))});var m=u?void 0:(l?c?wy:Cy:c?J_:H_)(e);return jg(m||e,function(r,i){m&&(i=r,r=e[i]),Ug(o,i,rx(r,t,n,i,e,a))}),o}var ix=1,ax=4;function ox(e){return rx(e,ix|ax)}var sx=`__lodash_hash_undefined__`;function cx(e){return this.__data__.set(e,sx),this}function lx(e){return this.__data__.has(e)}function ux(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new Tv;++t<n;)this.add(e[t])}ux.prototype.add=ux.prototype.push=cx,ux.prototype.has=lx;function dx(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function fx(e,t){return e.has(t)}var px=1,mx=2;function hx(e,t,n,r,i,a){var o=n&px,s=e.length,c=t.length;if(s!=c&&!(o&&c>s))return!1;var l=a.get(e),u=a.get(t);if(l&&u)return l==t&&u==e;var d=-1,f=!0,p=n&mx?new ux:void 0;for(a.set(e,t),a.set(t,e);++d<s;){var m=e[d],h=t[d];if(r)var g=o?r(h,m,d,t,e,a):r(m,h,d,e,t,a);if(g!==void 0){if(g)continue;f=!1;break}if(p){if(!dx(t,function(e,t){if(!fx(p,t)&&(m===e||i(m,e,n,r,a)))return p.push(t)})){f=!1;break}}else if(!(m===h||i(m,h,n,r,a))){f=!1;break}}return a.delete(e),a.delete(t),f}function wee(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function gx(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var Tee=1,Eee=2,Dee=`[object Boolean]`,Oee=`[object Date]`,kee=`[object Error]`,Aee=`[object Map]`,jee=`[object Number]`,Mee=`[object RegExp]`,Nee=`[object Set]`,Pee=`[object String]`,Fee=`[object Symbol]`,Iee=`[object ArrayBuffer]`,Lee=`[object DataView]`,_x=Th?Th.prototype:void 0,vx=_x?_x.valueOf:void 0;function Ree(e,t,n,r,i,a,o){switch(n){case Lee:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case Iee:return!(e.byteLength!=t.byteLength||!a(new Uy(e),new Uy(t)));case Dee:case Oee:case jee:return Vg(+e,+t);case kee:return e.name==t.name&&e.message==t.message;case Mee:case Pee:return e==t+``;case Aee:var s=wee;case Nee:var c=r&Tee;if(s||=gx,e.size!=t.size&&!c)return!1;var l=o.get(e);if(l)return l==t;r|=Eee,o.set(e,t);var u=hx(s(e),s(t),r,i,a,o);return o.delete(e),u;case Fee:if(vx)return vx.call(e)==vx.call(t)}return!1}var zee=1,Bee=Object.prototype.hasOwnProperty;function Vee(e,t,n,r,i,a){var o=n&zee,s=Cy(e),c=s.length;if(c!=Cy(t).length&&!o)return!1;for(var l=c;l--;){var u=s[l];if(!(o?u in t:Bee.call(t,u)))return!1}var d=a.get(e),f=a.get(t);if(d&&f)return d==t&&f==e;var p=!0;a.set(e,t),a.set(t,e);for(var m=o;++l<c;){u=s[l];var h=e[u],g=t[u];if(r)var _=o?r(g,h,u,t,e,a):r(h,g,u,e,t,a);if(!(_===void 0?h===g||i(h,g,n,r,a):_)){p=!1;break}m||=u==`constructor`}if(p&&!m){var v=e.constructor,y=t.constructor;v!=y&&`constructor`in e&&`constructor`in t&&!(typeof v==`function`&&v instanceof v&&typeof y==`function`&&y instanceof y)&&(p=!1)}return a.delete(e),a.delete(t),p}var Hee=1,yx=`[object Arguments]`,bx=`[object Array]`,xx=`[object Object]`,Sx=Object.prototype.hasOwnProperty;function Uee(e,t,n,r,i,a){var o=Vh(e),s=Vh(t),c=o?bx:By(e),l=s?bx:By(t);c=c==yx?xx:c,l=l==yx?xx:l;var u=c==xx,d=l==xx,f=c==l;if(f&&f_(e)){if(!f_(t))return!1;o=!0,u=!1}if(f&&!u)return a||=new oy,o||F_(e)?hx(e,t,n,r,i,a):Ree(e,t,c,n,r,i,a);if(!(n&Hee)){var p=u&&Sx.call(e,`__wrapped__`),m=d&&Sx.call(t,`__wrapped__`);if(p||m){var h=p?e.value():e,g=m?t.value():t;return a||=new oy,i(h,g,n,r,a)}}return f?(a||=new oy,Vee(e,t,n,r,i,a)):!1}function Cx(e,t,n,r,i){return e===t?!0:e==null||t==null||!Lh(e)&&!Lh(t)?e!==e&&t!==t:Uee(e,t,n,r,Cx,i)}var Wee=1,Gee=2;function Kee(e,t,n,r){var i=n.length,a=i,o=!r;if(e==null)return!a;for(e=Object(e);i--;){var s=n[i];if(o&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<a;){s=n[i];var c=s[0],l=e[c],u=s[1];if(o&&s[2]){if(l===void 0&&!(c in e))return!1}else{var d=new oy;if(r)var f=r(l,u,c,e,t,d);if(!(f===void 0?Cx(u,l,Wee|Gee,r,d):f))return!1}}return!0}function wx(e){return e===e&&!Xh(e)}function qee(e){for(var t=H_(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,wx(i)]}return t}function Tx(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}function Jee(e){var t=qee(e);return t.length==1&&t[0][2]?Tx(t[0][0],t[0][1]):function(n){return n===e||Kee(n,e,t)}}function Yee(e,t){return e!=null&&t in Object(e)}function Ex(e,t,n){t=Pv(t,e);for(var r=-1,i=t.length,a=!1;++r<i;){var o=Iv(t[r]);if(!(a=e!=null&&n(e,o)))break;e=e[o]}return a||++r!=i?a:(i=e==null?0:e.length,!!i&&Yg(i)&&zg(o,i)&&(Vh(e)||s_(e)))}function Dx(e,t){return e!=null&&Ex(e,t,Yee)}var Xee=1,Zee=2;function Qee(e,t){return Z_(e)&&wx(t)?Tx(Iv(e),t):function(n){var r=Q(n,e);return r===void 0&&r===t?Dx(n,e):Cx(t,r,Xee|Zee)}}function $ee(e){return function(t){return t?.[e]}}function ete(e){return function(t){return Lv(t,e)}}function tte(e){return Z_(e)?$ee(Iv(e)):ete(e)}function Ox(e){return typeof e==`function`?e:e==null?sg:typeof e==`object`?Vh(e)?Qee(e[0],e[1]):Jee(e):tte(e)}function nte(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}var kx=nte();function Ax(e,t){return e&&kx(e,t,H_)}function jx(e,t){return function(n,r){if(n==null)return n;if(!Xg(n))return e(n,r);for(var i=n.length,a=t?i:-1,o=Object(n);(t?a--:++a<i)&&r(o[a],a,o)!==!1;);return n}}var Mx=jx(Ax);function Nx(e,t,n){(n!==void 0&&!Vg(e[t],n)||n===void 0&&!(t in e))&&Bg(e,t,n)}function Px(e){return Lh(e)&&Xg(e)}function Fx(e,t){if(!(t===`constructor`&&typeof e[t]==`function`)&&t!=`__proto__`)return e[t]}function Ix(e){return Wg(e,J_(e))}function Lx(e,t,n,r,i,a,o){var s=Fx(e,n),c=Fx(t,n),l=o.get(c);if(l){Nx(e,n,l);return}var u=a?a(s,c,n+``,e,t,o):void 0,d=u===void 0;if(d){var f=Vh(c),p=!f&&f_(c),m=!f&&!p&&F_(c);u=c,f||p||m?Vh(s)?u=s:Px(s)?u=Cg(s):p?(d=!1,u=py(c,!0)):m?(d=!1,u=Zy(c,!0)):u=[]:Zv(c)||s_(c)?(u=s,s_(s)?u=Ix(s):(!Xh(s)||ug(s))&&(u=vb(c))):d=!1}d&&(o.set(c,u),i(u,c,r,a,o),o.delete(c)),Nx(e,n,u)}function Rx(e,t,n,r,i){e!==t&&kx(t,function(a,o){if(i||=new oy,Xh(a))Lx(e,t,o,n,Rx,r,i);else{var s=r?r(Fx(e,o),a,o+``,e,t,i):void 0;s===void 0&&(s=a),Nx(e,o,s)}},J_)}function zx(e,t,n){for(var r=-1,i=e==null?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}var Bx=200;function Vx(e,t,n,r){var i=-1,a=Ig,o=!0,s=e.length,c=[],l=t.length;if(!s)return c;n&&(t=Bh(t,k_(n))),r?(a=zx,o=!1):t.length>=Bx&&(a=fx,o=!1,t=new ux(t));outer:for(;++i<s;){var u=e[i],d=n==null?u:n(u);if(u=r||u!==0?u:0,o&&d===d){for(var f=l;f--;)if(t[f]===d)continue outer;c.push(u)}else a(t,d,r)||c.push(u)}return c}var Hx=qg(function(e,t){return Px(e)?Vx(e,Vv(t,1,Px,!0)):[]});function Ux(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}function Wx(e){return typeof e==`function`?e:sg}function Gx(e,t){return(Vh(e)?jg:Mx)(e,Wx(t))}var Kx=1/0;function qx(e){return e!=null&&e.length?Vv(e,Kx):[]}var rte=Object.prototype.hasOwnProperty;function Jx(e,t){return e!=null&&rte.call(e,t)}function Yx(e,t){return e!=null&&Ex(e,t,Jx)}var Xx=`[object String]`;function Zx(e){return typeof e==`string`||!Vh(e)&&Lh(e)&&Ih(e)==Xx}function Qx(e,t){return Bh(t,function(t){return e[t]})}function $x(e){return e==null?[]:Qx(e,H_(e))}var eS=Math.max;function tS(e,t,n,r){e=Xg(e)?e:$x(e),n=n&&!r?og(n):0;var i=e.length;return n<0&&(n=eS(i+n,0)),Zx(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Fg(e,t,n)>-1}var nS=Math.min;function rS(e,t,n){for(var r=n?zx:Ig,i=e[0].length,a=e.length,o=a,s=Array(a),c=1/0,l=[];o--;){var u=e[o];o&&t&&(u=Bh(u,k_(t))),c=nS(u.length,c),s[o]=!n&&(t||i>=120&&u.length>=120)?new ux(o&&u):void 0}u=e[0];var d=-1,f=s[0];outer:for(;++d<i&&l.length<c;){var p=u[d],m=t?t(p):p;if(p=n||p!==0?p:0,!(f?fx(f,m):r(l,m,n))){for(o=a;--o;){var h=s[o];if(!(h?fx(h,m):r(e[o],m,n)))continue outer}f&&f.push(m),l.push(p)}}return l}function iS(e){return Px(e)?e:[]}var aS=qg(function(e){var t=Bh(e,iS);return t.length&&t[0]===e[0]?rS(t):[]});function oS(e,t){return t.length<2?e:Lv(e,Qv(t,0,-1))}var sS=`[object Map]`,cS=`[object Set]`,lS=Object.prototype.hasOwnProperty;function uS(e){if(e==null)return!0;if(Xg(e)&&(Vh(e)||typeof e==`string`||typeof e.splice==`function`||f_(e)||F_(e)||s_(e)))return!e.length;var t=By(e);if(t==sS||t==cS)return!e.size;if(e_(e))return!V_(e).length;for(var n in e)if(lS.call(e,n))return!1;return!0}function dS(e,t){return Cx(e,t)}function fS(e,t,n){n=typeof n==`function`?n:void 0;var r=n?n(e,t):void 0;return r===void 0?Cx(e,t,void 0,n):!!r}var pS=`[object Number]`;function mS(e){return typeof e==`number`||Lh(e)&&Ih(e)==pS}function hS(e){return e==null}function gS(e){return e===void 0}var _S=Qg(function(e,t,n){Rx(e,t,n)}),vS=Object.prototype.hasOwnProperty;function yS(e,t){t=Pv(t,e);var n=-1,r=t.length;if(!r)return!0;for(var i=e==null||typeof e!=`object`&&typeof e!=`function`;++n<r;){var a=t[n];if(typeof a==`string`){if(a===`__proto__`&&!vS.call(e,`__proto__`))return!1;if(a===`constructor`&&n+1<r&&typeof t[n+1]==`string`&&t[n+1]===`prototype`){if(i&&n===0)continue;return!1}}}var o=oS(e,t);return o==null||delete o[Iv(Ux(t))]}function bS(e){return Zv(e)?void 0:e}var xS=1,SS=2,CS=4,wS=Uv(function(e,t){var n={};if(e==null)return n;var r=!1;t=Bh(t,function(t){return t=Pv(t,e),r||=t.length>1,t}),Wg(e,wy(e),n),r&&(n=rx(n,xS|SS|CS,bS));for(var i=t.length;i--;)yS(n,t[i]);return n});function TS(e,t,n,r){if(!Xh(e))return e;t=Pv(t,e);for(var i=-1,a=t.length,o=a-1,s=e;s!=null&&++i<a;){var c=Iv(t[i]),l=n;if(c===`__proto__`||c===`constructor`||c===`prototype`)return e;if(i!=o){var u=s[c];l=r?r(u,c,s):void 0,l===void 0&&(l=Xh(u)?u:zg(t[i+1])?[]:{})}Ug(s,c,l),s=s[c]}return e}function ES(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=Lv(e,o);n(s,o)&&TS(a,Pv(o,e),s)}return a}function DS(e,t){if(e==null)return{};var n=Bh(wy(e),function(e){return[e]});return t=Ox(t),ES(e,n,function(e,n){return t(e,n[0])})}function OS(e,t){return ES(e,t,function(t,n){return Dx(e,n)})}var kS=Uv(function(e,t){return e==null?{}:OS(e,t)});function AS(e,t,n,r,i){return i(e,function(e,i,a){n=r?(r=!1,e):t(n,e,i,a)}),n}function jS(e,t,n){var r=Vh(e)?$v:AS,i=arguments.length<3;return r(e,Ox(t,4),n,i,Mx)}function MS(e,t,n){return e==null?e:TS(e,t,n)}function ite(e,t,n,r){return r=typeof r==`function`?r:void 0,e==null?e:TS(e,t,n,r)}var ate=9007199254740991,NS=4294967295,ote=Math.min;function PS(e,t){if(e=og(e),e<1||e>ate)return[];var n=NS,r=ote(e,NS);t=Wx(t),e-=NS;for(var i=t_(r,t);++n<e;)t(n);return i}function FS(e){return Vh(e)?Bh(e,Iv):zh(e)?[e]:Cg(Mv(Nv(e)))}function IS(e,t,n){var r=Vh(e),i=r||f_(e)||F_(e);if(t=Ox(t,4),n==null){var a=e&&e.constructor;n=i?r?new a:[]:Xh(e)&&ug(a)?bg(Wv(e)):{}}return(i?jg:Ax)(e,function(e,r,i){return t(n,e,r,i)}),n}var LS=Dy&&1/gx(new Dy([,-0]))[1]==1/0?function(e){return new Dy(e)}:Sg,RS=200;function zS(e,t,n){var r=-1,i=Ig,a=e.length,o=!0,s=[],c=s;if(n)o=!1,i=zx;else if(a>=RS){var l=t?null:LS(e);if(l)return gx(l);o=!1,i=fx,c=new ux}else c=t?[]:s;outer:for(;++r<a;){var u=e[r],d=t?t(u):u;if(u=n||u!==0?u:0,o&&d===d){for(var f=c.length;f--;)if(c[f]===d)continue outer;t&&c.push(d),s.push(u)}else i(c,d,n)||(c!==s&&c.push(d),s.push(u))}return s}var BS=qg(function(e){return zS(Vv(e,1,Px,!0))});function VS(e){return e&&e.length?zS(e):[]}var HS=0;function US(e){var t=++HS;return Nv(e)+t}function WS(e,t){return e==null?!0:yS(e,t)}var GS=yi()(e=>({tools:{},setToolData:(t,n)=>e(e=>qS(e,`tools.${t}`,{...e.tools[t],...n})),updateOpenaiObject:(t,n,r)=>e(e=>e.tools[t]?.openaiObject?qS(e,`tools.${t}.openaiObject.${n}`,r):e),pushOpenAiLog:(t,n)=>e(e=>{let r=e.tools[t]?.openaiLogs||[];return qS(e,`tools.${t}.openaiLogs`,[...r,{...n,id:crypto.randomUUID()}])}),setOpenInAppUrl:(t,n)=>e(e=>qS(e,`tools.${t}.openInAppUrl`,n))})),KS=e=>{let{tools:t}=GS();return t[e]},qS=(e,t,n)=>{let r=ox(e);return MS(r,t,n),r};function JS(e,t,n){try{return e(t)}catch(e){return ct("[nuqs] Error while parsing value `%s`: %O"+(n?" (for key `%s`)":``),t,e,n),null}}function YS(e){function t(t){if(t===void 0)return null;let n=``;if(Array.isArray(t)){if(t[0]===void 0)return null;n=t[0]}return typeof t==`string`&&(n=t),JS(e.parse,n)}return{type:`single`,eq:(e,t)=>e===t,...e,parseServerSide:t,withDefault(e){return{...this,defaultValue:e,parseServerSide(n){return t(n)??e}}},withOptions(e){return{...this,...e}}}}var XS=YS({parse:e=>e,serialize:String});YS({parse:e=>{let t=parseInt(e);return t==t?t:null},serialize:e=>``+Math.round(e)}),YS({parse:e=>{let t=parseInt(e);return t==t?t-1:null},serialize:e=>``+Math.round(e+1)}),YS({parse:e=>{let t=parseInt(e,16);return t==t?t:null},serialize:e=>{let t=Math.round(e).toString(16);return(t.length&1?`0`:``)+t}}),YS({parse:e=>{let t=parseFloat(e);return t==t?t:null},serialize:String}),YS({parse:e=>e.toLowerCase()===`true`,serialize:String});function ZS(e,t){return e.valueOf()===t.valueOf()}YS({parse:e=>{let t=parseInt(e);return t==t?new Date(t):null},serialize:e=>``+e.valueOf(),eq:ZS}),YS({parse:e=>{let t=new Date(e);return t.valueOf()==t.valueOf()?t:null},serialize:e=>e.toISOString(),eq:ZS}),YS({parse:e=>{let t=new Date(e.slice(0,10));return t.valueOf()==t.valueOf()?t:null},serialize:e=>e.toISOString().slice(0,10),eq:ZS});var QS=Tt(),$S={};function eC(e,t={}){let n=(0,b.useId)(),r=vt(),i=yt(),{history:a=`replace`,scroll:o=r?.scroll??!1,shallow:s=r?.shallow??!0,throttleMs:c=St.timeMs,limitUrlUpdates:l=r?.limitUrlUpdates,clearOnDefault:u=r?.clearOnDefault??!0,startTransition:d,urlKeys:f=$S}=t,p=Object.keys(e).join(`,`),m=(0,b.useMemo)(()=>Object.fromEntries(Object.keys(e).map(e=>[e,f[e]??e])),[p,JSON.stringify(f)]),h=_t(Object.values(m)),g=h.searchParams,_=(0,b.useRef)({}),v=(0,b.useMemo)(()=>Object.fromEntries(Object.keys(e).map(t=>[t,e[t].defaultValue??null])),[Object.values(e).map(({defaultValue:e})=>e).join(`,`)]),y=Pt.useQueuedQueries(Object.values(m)),[x,S]=(0,b.useState)(()=>tC(e,f,g??new URLSearchParams,y).state),C=(0,b.useRef)(x);if(st("[nuq+ %s `%s`] render - state: %O, iSP: %s",n,p,x,g),Object.keys(_.current).join(`&`)!==Object.values(m).join(`&`)){let{state:t,hasChanged:r}=tC(e,f,g,y,_.current,C.current);r&&(st("[nuq+ %s `%s`] State changed: %O",n,p,{state:t,initialSearchParams:g,queuedQueries:y,queryRef:_.current,stateRef:C.current}),C.current=t,S(t)),_.current=Object.fromEntries(Object.entries(m).map(([t,n])=>[n,e[t]?.type===`multi`?g?.getAll(n):g?.get(n)??null]))}(0,b.useEffect)(()=>{let{state:t,hasChanged:r}=tC(e,f,g,y,_.current,C.current);r&&(st("[nuq+ %s `%s`] State changed: %O",n,p,{state:t,initialSearchParams:g,queuedQueries:y,queryRef:_.current,stateRef:C.current}),C.current=t,S(t))},[Object.values(m).map(e=>`${e}=${g?.getAll(e)}`).join(`&`),JSON.stringify(y)]),(0,b.useEffect)(()=>{let t=Object.keys(e).reduce((t,r)=>(t[r]=({state:t,query:i})=>{S(a=>{let{defaultValue:o}=e[r],s=m[r],c=t??o??null,l=a[r]??o??null;return Object.is(l,c)?(st("[nuq+ %s `%s`] Cross-hook key sync %s: %O (default: %O). no change, skipping, resolved: %O",n,p,s,t,o,C.current),a):(C.current={...C.current,[r]:c},_.current[s]=i,st("[nuq+ %s `%s`] Cross-hook key sync %s: %O (default: %O). updateInternalState, resolved: %O",n,p,s,t,o,C.current),C.current)})},t),{});for(let r of Object.keys(e)){let e=m[r];st("[nuq+ %s `%s`] Subscribing to sync for `%s`",n,e,p),QS.on(e,t[r])}return()=>{for(let r of Object.keys(e)){let e=m[r];st("[nuq+ %s `%s`] Unsubscribing to sync for `%s`",n,e,p),QS.off(e,t[r])}}},[p,m]);let w=(0,b.useCallback)((t,r={})=>{let f=Object.fromEntries(Object.keys(e).map(e=>[e,null])),g=typeof t==`function`?t(nC(C.current,v))??f:t??f;st("[nuq+ %s `%s`] setState: %O",n,p,g);let _,y=0,b=!1,x=[];for(let[t,n]of Object.entries(g)){let f=e[t],p=m[t];if(!f||n===void 0)continue;(r.clearOnDefault??f.clearOnDefault??u)&&n!==null&&f.defaultValue!==void 0&&(f.eq??((e,t)=>e===t))(n,f.defaultValue)&&(n=null);let g=n===null?null:(f.serialize??String)(n);QS.emit(p,{state:n,query:g});let v={key:p,query:g,options:{history:r.history??f.history??a,shallow:r.shallow??f.shallow??s,scroll:r.scroll??f.scroll??o,startTransition:r.startTransition??f.startTransition??d}};if(r?.limitUrlUpdates?.method===`debounce`||l?.method===`debounce`||f.limitUrlUpdates?.method===`debounce`){v.options.shallow===!0&&console.warn(ft(422));let e=r?.limitUrlUpdates?.timeMs??l?.timeMs??f.limitUrlUpdates?.timeMs??St.timeMs,t=Pt.push(v,e,h,i);y<e&&(_=t,y=e)}else{let e=r?.limitUrlUpdates?.timeMs??f?.limitUrlUpdates?.timeMs??l?.timeMs??r.throttleMs??f.throttleMs??c;x.push(Pt.abort(p)),jt.push(v,e),b=!0}}let S=x.reduce((e,t)=>t(e),b?jt.flush(h,i):jt.getPendingPromise(h));return _??S},[p,a,s,o,c,l?.method,l?.timeMs,d,m,h.updateUrl,h.getSearchParamsSnapshot,h.rateLimitFactor,i,v]);return[(0,b.useMemo)(()=>nC(x,v),[x,v]),w]}function tC(e,t,n,r,i,a){let o=!1,s=Object.entries(e).reduce((e,[s,c])=>{let l=t?.[s]??s,u=r[l],d=c.type===`multi`?[]:null,f=u===void 0?(c.type===`multi`?n?.getAll(l):n?.get(l))??d:u;return i&&a&&Ft(i[l]??d,f)?(e[s]=a[s]??null,e):(o=!0,e[s]=(Ct(f)?null:JS(c.parse,f,l))??null,i&&(i[l]=f),e)},{});if(!o){let t=Object.keys(e),n=Object.keys(a??{});o=t.length!==n.length||t.some(e=>!n.includes(e))}return{state:s,hasChanged:o}}function nC(e,t){return Object.fromEntries(Object.keys(e).map(n=>[n,e[n]??t[n]??null]))}function rC(e,t={}){let{parse:n,type:r,serialize:i,eq:a,defaultValue:o,...s}=t,[{[e]:c},l]=eC({[e]:{parse:n??(e=>e),type:r,serialize:i,eq:a,defaultValue:o}},s);return[c,(0,b.useCallback)((t,n={})=>l(n=>({[e]:typeof t==`function`?t(n[e]):t}),n),[e,l])]}function iC(){return rC(`tool`,XS)}var aC=new ze,oC=`skybridge-devtools-oauth`,sC={clientInfo:`${oC}:client-info`,tokens:`${oC}:tokens`,codeVerifier:`${oC}:code-verifier`,state:`${oC}:state`},cC=class{get redirectUrl(){let e=new URL(window.location.origin+window.location.pathname);return e.searchParams.set(`oauth_callback`,`true`),e.toString()}get clientMetadata(){return{redirect_uris:[this.redirectUrl],token_endpoint_auth_method:`none`,grant_types:[`authorization_code`,`refresh_token`],response_types:[`code`],client_name:`Skybridge Devtools`,client_uri:window.location.origin}}clientInformation(){let e=localStorage.getItem(sC.clientInfo);return e?JSON.parse(e):void 0}saveClientInformation(e){localStorage.setItem(sC.clientInfo,JSON.stringify(e))}tokens(){let e=localStorage.getItem(sC.tokens);return e?JSON.parse(e):void 0}saveTokens(e){localStorage.setItem(sC.tokens,JSON.stringify(e))}state(){let e=localStorage.getItem(sC.state);if(e)return e;let t=crypto.randomUUID();return localStorage.setItem(sC.state,t),t}redirectToAuthorization(e){window.location.href=e.toString()}saveCodeVerifier(e){localStorage.setItem(sC.codeVerifier,e)}codeVerifier(){return localStorage.getItem(sC.codeVerifier)??``}invalidateCredentials(e){(e===`all`||e===`tokens`)&&localStorage.removeItem(sC.tokens),(e===`all`||e===`client`)&&localStorage.removeItem(sC.clientInfo),(e===`all`||e===`verifier`)&&(localStorage.removeItem(sC.codeVerifier),localStorage.removeItem(sC.state))}};function lC(e){return!!e._zod}function uC(e,t){return lC(e)?Sa(e,t):e.safeParse(t)}function dC(e){if(!e)return;let t;if(t=lC(e)?e._zod?.def?.shape:e.shape,t){if(typeof t==`function`)try{return t()}catch{return}return t}}function fC(e){if(lC(e)){let t=e._zod?.def;if(t){if(t.value!==void 0)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}}let t=e._def;if(t){if(t.value!==void 0)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}let n=e.value;if(n!==void 0)return n}function pC(e){return e===`completed`||e===`failed`||e===`cancelled`}function mC(e){let t=dC(e)?.method;if(!t)throw Error(`Schema is missing a method literal`);let n=fC(t);if(typeof n!=`string`)throw Error(`Schema method literal must be a string`);return n}function hC(e,t){let n=uC(e,t);if(!n.success)throw n.error;return n.data}var gC=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(sf,e=>{this._oncancel(e)}),this.setNotificationHandler(wf,e=>{this._onprogress(e)}),this.setRequestHandler(xf,e=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Nf,async(e,t)=>{let n=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!n)throw new pm(ef.InvalidParams,`Failed to retrieve task: Task not found`);return{...n}}),this.setRequestHandler(Ff,async(e,t)=>{let n=async()=>{let r=e.params.taskId;if(this._taskMessageQueue){let e;for(;e=await this._taskMessageQueue.dequeue(r,t.sessionId);){if(e.type===`response`||e.type===`error`){let t=e.message,n=t.id,r=this._requestResolvers.get(n);if(r)if(this._requestResolvers.delete(n),e.type===`response`)r(t);else{let e=t;r(new pm(e.error.code,e.error.message,e.error.data))}else{let t=e.type===`response`?`Response`:`Error`;this._onerror(Error(`${t} handler missing for request ${n}`))}continue}await this._transport?.send(e.message,{relatedRequestId:t.requestId})}}let i=await this._taskStore.getTask(r,t.sessionId);if(!i)throw new pm(ef.InvalidParams,`Task not found: ${r}`);if(!pC(i.status))return await this._waitForTaskUpdate(r,t.signal),await n();if(pC(i.status)){let e=await this._taskStore.getTaskResult(r,t.sessionId);return this._clearTaskQueue(r),{...e,_meta:{...e._meta,[Nd]:{taskId:r}}}}return await n()};return await n()}),this.setRequestHandler(If,async(e,t)=>{try{let{tasks:n,nextCursor:r}=await this._taskStore.listTasks(e.params?.cursor,t.sessionId);return{tasks:n,nextCursor:r,_meta:{}}}catch(e){throw new pm(ef.InvalidParams,`Failed to list tasks: ${e instanceof Error?e.message:String(e)}`)}}),this.setRequestHandler(Rf,async(e,t)=>{try{let n=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!n)throw new pm(ef.InvalidParams,`Task not found: ${e.params.taskId}`);if(pC(n.status))throw new pm(ef.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(e.params.taskId,`cancelled`,`Client cancelled task execution.`,t.sessionId),this._clearTaskQueue(e.params.taskId);let r=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!r)throw new pm(ef.InvalidParams,`Task not found after cancellation: ${e.params.taskId}`);return{_meta:{},...r}}catch(e){throw e instanceof pm?e:new pm(ef.InvalidRequest,`Failed to cancel task: ${e instanceof Error?e.message:String(e)}`)}}))}async _oncancel(e){e.params.requestId&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,n,r,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let n=Date.now()-t.startTime;if(t.maxTotalTimeout&&n>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),pm.fromError(ef.RequestTimeout,`Maximum total timeout exceeded`,{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:n});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw Error(`Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.`);this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=e=>{n?.(e),this._onerror(e)};let r=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{r?.(e,t),$d(e)||nf(e)?this._onresponse(e):Yd(e)?this._onrequest(e,t):Zd(e)?this._onnotification(e):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let e of this._timeoutInfo.values())clearTimeout(e.timeoutId);this._timeoutInfo.clear();for(let e of this._requestHandlerAbortControllers.values())e.abort();this._requestHandlerAbortControllers.clear();let t=pm.fromError(ef.ConnectionClosed,`Connection closed`);this._transport=void 0,this.onclose?.();for(let n of e.values())n(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){let t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;t!==void 0&&Promise.resolve().then(()=>t(e)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){let n=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,r=this._transport,i=e.params?._meta?.[Nd]?.taskId;if(n===void 0){let t={jsonrpc:`2.0`,id:e.id,error:{code:ef.MethodNotFound,message:`Method not found`}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:`error`,message:t,timestamp:Date.now()},r?.sessionId).catch(e=>this._onerror(Error(`Failed to enqueue error response: ${e}`))):r?.send(t).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(e.id,a);let o=Hd(e.params)?e.params.task:void 0,s=this._taskStore?this.requestTaskStore(e,r?.sessionId):void 0,c={signal:a.signal,sessionId:r?.sessionId,_meta:e.params?._meta,sendNotification:async t=>{if(a.signal.aborted)return;let n={relatedRequestId:e.id};i&&(n.relatedTask={taskId:i}),await this.notification(t,n)},sendRequest:async(t,n,r)=>{if(a.signal.aborted)throw new pm(ef.ConnectionClosed,`Request was cancelled`);let o={...r,relatedRequestId:e.id};i&&!o.relatedTask&&(o.relatedTask={taskId:i});let c=o.relatedTask?.taskId??i;return c&&s&&await s.updateTaskStatus(c,`input_required`),await this.request(t,n,o)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:i,taskStore:s,taskRequestedTtl:o?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{o&&this.assertTaskHandlerCapability(e.method)}).then(()=>n(e,c)).then(async t=>{if(a.signal.aborted)return;let n={result:t,jsonrpc:`2.0`,id:e.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:`response`,message:n,timestamp:Date.now()},r?.sessionId):await r?.send(n)},async t=>{if(a.signal.aborted)return;let n={jsonrpc:`2.0`,id:e.id,error:{code:Number.isSafeInteger(t.code)?t.code:ef.InternalError,message:t.message??`Internal error`,...t.data!==void 0&&{data:t.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:`error`,message:n,timestamp:Date.now()},r?.sessionId):await r?.send(n)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===a&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...n}=e.params,r=Number(t),i=this._progressHandlers.get(r);if(!i){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&a&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(e){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),a(e);return}i(n)}_onresponse(e){let t=Number(e.id),n=this._requestResolvers.get(t);if(n){this._requestResolvers.delete(t),$d(e)?n(e):n(new pm(e.error.code,e.error.message,e.error.data));return}let r=this._responseHandlers.get(t);if(r===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t);let i=!1;if($d(e)&&e.result&&typeof e.result==`object`){let n=e.result;if(n.task&&typeof n.task==`object`){let e=n.task;typeof e.taskId==`string`&&(i=!0,this._taskProgressTokens.set(e.taskId,t))}}i||this._progressHandlers.delete(t),$d(e)?r(e):r(pm.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,n){let{task:r}=n??{};if(!r){try{yield{type:`result`,result:await this.request(e,t,n)}}catch(e){yield{type:`error`,error:e instanceof pm?e:new pm(ef.InternalError,String(e))}}return}let i;try{let r=await this.request(e,Af,n);if(r.task)i=r.task.taskId,yield{type:`taskCreated`,task:r.task};else throw new pm(ef.InternalError,`Task creation did not return a task`);for(;;){let e=await this.getTask({taskId:i},n);if(yield{type:`taskStatus`,task:e},pC(e.status)){e.status===`completed`?yield{type:`result`,result:await this.getTaskResult({taskId:i},t,n)}:e.status===`failed`?yield{type:`error`,error:new pm(ef.InternalError,`Task ${i} failed`)}:e.status===`cancelled`&&(yield{type:`error`,error:new pm(ef.InternalError,`Task ${i} was cancelled`)});return}if(e.status===`input_required`){yield{type:`result`,result:await this.getTaskResult({taskId:i},t,n)};return}let r=e.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(e=>setTimeout(e,r)),n?.signal?.throwIfAborted()}}catch(e){yield{type:`error`,error:e instanceof pm?e:new pm(ef.InternalError,String(e))}}}request(e,t,n){let{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a,task:o,relatedTask:s}=n??{};return new Promise((c,l)=>{let u=e=>{l(e)};if(!this._transport){u(Error(`Not connected`));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),o&&this.assertTaskCapability(e.method)}catch(e){u(e);return}n?.signal?.throwIfAborted();let d=this._requestMessageId++,f={...e,jsonrpc:`2.0`,id:d};n?.onprogress&&(this._progressHandlers.set(d,n.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:d}}),o&&(f.params={...f.params,task:o}),s&&(f.params={...f.params,_meta:{...f.params?._meta||{},[Nd]:s}});let p=e=>{this._responseHandlers.delete(d),this._progressHandlers.delete(d),this._cleanupTimeout(d),this._transport?.send({jsonrpc:`2.0`,method:`notifications/cancelled`,params:{requestId:d,reason:String(e)}},{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))),l(e instanceof pm?e:new pm(ef.RequestTimeout,String(e)))};this._responseHandlers.set(d,e=>{if(!n?.signal?.aborted){if(e instanceof Error)return l(e);try{let n=uC(t,e.result);n.success?c(n.data):l(n.error)}catch(e){l(e)}}}),n?.signal?.addEventListener(`abort`,()=>{p(n?.signal?.reason)});let m=n?.timeout??6e4;this._setupTimeout(d,m,n?.maxTotalTimeout,()=>p(pm.fromError(ef.RequestTimeout,`Request timed out`,{timeout:m})),n?.resetTimeoutOnProgress??!1);let h=s?.taskId;h?(this._requestResolvers.set(d,e=>{let t=this._responseHandlers.get(d);t?t(e):this._onerror(Error(`Response handler missing for side-channeled request ${d}`))}),this._enqueueTaskMessage(h,{type:`request`,message:f,timestamp:Date.now()}).catch(e=>{this._cleanupTimeout(d),l(e)})):this._transport.send(f,{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a}).catch(e=>{this._cleanupTimeout(d),l(e)})})}async getTask(e,t){return this.request({method:`tasks/get`,params:e},Pf,t)}async getTaskResult(e,t,n){return this.request({method:`tasks/result`,params:e},t,n)}async listTasks(e,t){return this.request({method:`tasks/list`,params:e},Lf,t)}async cancelTask(e,t){return this.request({method:`tasks/cancel`,params:e},zf,t)}async notification(e,t){if(!this._transport)throw Error(`Not connected`);this.assertNotificationCapability(e.method);let n=t?.relatedTask?.taskId;if(n){let r={...e,jsonrpc:`2.0`,params:{...e.params,_meta:{...e.params?._meta||{},[Nd]:t.relatedTask}}};await this._enqueueTaskMessage(n,{type:`notification`,message:r,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let n={...e,jsonrpc:`2.0`};t?.relatedTask&&(n={...n,params:{...n.params,_meta:{...n.params?._meta||{},[Nd]:t.relatedTask}}}),this._transport?.send(n,t).catch(e=>this._onerror(e))});return}let r={...e,jsonrpc:`2.0`};t?.relatedTask&&(r={...r,params:{...r.params,_meta:{...r.params?._meta||{},[Nd]:t.relatedTask}}}),await this._transport.send(r,t)}setRequestHandler(e,t){let n=mC(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(n,r)=>{let i=hC(e,n);return Promise.resolve(t(i,r))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){let n=mC(e);this._notificationHandlers.set(n,n=>{let r=hC(e,n);return Promise.resolve(t(r))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let t=this._taskProgressTokens.get(e);t!==void 0&&(this._progressHandlers.delete(t),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,t,n){if(!this._taskStore||!this._taskMessageQueue)throw Error(`Cannot enqueue task message: taskStore and taskMessageQueue are not configured`);let r=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,n,r)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,t);for(let t of n)if(t.type===`request`&&Yd(t.message)){let n=t.message.id,r=this._requestResolvers.get(n);r?(r(new pm(ef.InternalError,`Task cancelled or completed`)),this._requestResolvers.delete(n)):this._onerror(Error(`Resolver missing for request ${n} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let n=this._options?.defaultTaskPollInterval??1e3;try{let t=await this._taskStore?.getTask(e);t?.pollInterval&&(n=t.pollInterval)}catch{}return new Promise((e,r)=>{if(t.aborted){r(new pm(ef.InvalidRequest,`Request cancelled`));return}let i=setTimeout(e,n);t.addEventListener(`abort`,()=>{clearTimeout(i),r(new pm(ef.InvalidRequest,`Request cancelled`))},{once:!0})})}requestTaskStore(e,t){let n=this._taskStore;if(!n)throw Error(`No task store configured`);return{createTask:async r=>{if(!e)throw Error(`No request provided`);return await n.createTask(r,e.id,{method:e.method,params:e.params},t)},getTask:async e=>{let r=await n.getTask(e,t);if(!r)throw new pm(ef.InvalidParams,`Failed to retrieve task: Task not found`);return r},storeTaskResult:async(e,r,i)=>{await n.storeTaskResult(e,r,i,t);let a=await n.getTask(e,t);if(a){let t=Mf.parse({method:`notifications/tasks/status`,params:a});await this.notification(t),pC(a.status)&&this._cleanupTaskProgressHandler(e)}},getTaskResult:e=>n.getTaskResult(e,t),updateTaskStatus:async(e,r,i)=>{let a=await n.getTask(e,t);if(!a)throw new pm(ef.InvalidParams,`Task "${e}" not found - it may have been cleaned up`);if(pC(a.status))throw new pm(ef.InvalidParams,`Cannot update task "${e}" from terminal status "${a.status}" to "${r}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(e,r,i,t);let o=await n.getTask(e,t);if(o){let t=Mf.parse({method:`notifications/tasks/status`,params:o});await this.notification(t),pC(o.status)&&this._cleanupTaskProgressHandler(e)}},listTasks:e=>n.listTasks(e,t)}}};function _C(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function vC(e,t){let n={...e};for(let e in t){let r=e,i=t[r];if(i===void 0)continue;let a=n[r];_C(a)&&_C(i)?n[r]={...a,...i}:n[r]=i}return n}var yC=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var n=class extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw Error(`CodeGen: name must be a valid identifier`);this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=n;var r=class extends t{constructor(e){super(),this._items=typeof e==`string`?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===``||e===`""`}get str(){return this._str??=this._items.reduce((e,t)=>`${e}${t}`,``)}get names(){return this._names??=this._items.reduce((e,t)=>(t instanceof n&&(e[t.str]=(e[t.str]||0)+1),e),{})}};e._Code=r,e.nil=new r(``);function i(e,...t){let n=[e[0]],i=0;for(;i<t.length;)s(n,t[i]),n.push(e[++i]);return new r(n)}e._=i;var a=new r(`+`);function o(e,...t){let n=[p(e[0])],i=0;for(;i<t.length;)n.push(a),s(n,t[i]),n.push(a,p(e[++i]));return c(n),new r(n)}e.str=o;function s(e,t){t instanceof r?e.push(...t._items):t instanceof n?e.push(t):e.push(d(t))}e.addCodeArg=s;function c(e){let t=1;for(;t<e.length-1;){if(e[t]===a){let n=l(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]=`+`}t++}}function l(e,t){if(t===`""`)return e;if(e===`""`)return t;if(typeof e==`string`)return t instanceof n||e[e.length-1]!==`"`?void 0:typeof t==`string`?t[0]===`"`?e.slice(0,-1)+t.slice(1):void 0:`${e.slice(0,-1)}${t}"`;if(typeof t==`string`&&t[0]===`"`&&!(e instanceof n))return`"${e}${t.slice(1)}`}function u(e,t){return t.emptyStr()?e:e.emptyStr()?t:o`${e}${t}`}e.strConcat=u;function d(e){return typeof e==`number`||typeof e==`boolean`||e===null?e:p(Array.isArray(e)?e.join(`,`):e)}function f(e){return new r(p(e))}e.stringify=f;function p(e){return JSON.stringify(e).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)}e.safeStringify=p;function m(t){return typeof t==`string`&&e.IDENTIFIER.test(t)?new r(`.${t}`):i`[${t}]`}e.getProperty=m;function h(t){if(typeof t==`string`&&e.IDENTIFIER.test(t))return new r(`${t}`);throw Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}e.getEsmExportName=h;function g(e){return new r(e.toString())}e.regexpCode=g})),bC=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;var t=yC(),n=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},r;(function(e){e[e.Started=0]=`Started`,e[e.Completed=1]=`Completed`})(r||(e.UsedValueState=r={})),e.varKinds={const:new t.Name(`const`),let:new t.Name(`let`),var:new t.Name(`var`)};var i=class{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){if((this._parent?._prefixes)?.has(e)||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};e.Scope=i;var a=class extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:n,itemIndex:r}){this.value=e,this.scopePath=(0,t._)`.${new t.Name(n)}[${r}]`}};e.ValueScopeName=a;var o=(0,t._)`\n`;e.ValueScope=class extends i{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?o:t.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){if(t.ref===void 0)throw Error(`CodeGen: ref must be passed in value`);let n=this.toName(e),{prefix:r}=n,i=t.key??t.ref,a=this._values[r];if(a){let e=a.get(i);if(e)return e}else a=this._values[r]=new Map;a.set(i,n);let o=this._scope[r]||(this._scope[r]=[]),s=o.length;return o[s]=t.ref,n.setValue(t,{property:r,itemIndex:s}),n}getValue(e,t){let n=this._values[e];if(n)return n.get(t)}scopeRefs(e,n=this._values){return this._reduceValues(n,n=>{if(n.scopePath===void 0)throw Error(`CodeGen: name "${n}" has no value`);return(0,t._)`${e}${n.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,e=>{if(e.value===void 0)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,n)}_reduceValues(i,a,o={},s){let c=t.nil;for(let l in i){let u=i[l];if(!u)continue;let d=o[l]=o[l]||new Map;u.forEach(i=>{if(d.has(i))return;d.set(i,r.Started);let o=a(i);if(o){let n=this.opts.es5?e.varKinds.var:e.varKinds.const;c=(0,t._)`${c}${n} ${i} = ${o};${this.opts._n}`}else if(o=s?.(i))c=(0,t._)`${c}${o}${this.opts._n}`;else throw new n(i);d.set(i,r.Completed)})}return c}}})),xC=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;var t=yC(),n=bC(),r=yC();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,`strConcat`,{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,`getProperty`,{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,`regexpCode`,{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return r.Name}});var i=bC();Object.defineProperty(e,`Scope`,{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(e,`ValueScope`,{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(e,`ValueScopeName`,{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(e,`varKinds`,{enumerable:!0,get:function(){return i.varKinds}}),e.operators={GT:new t._Code(`>`),GTE:new t._Code(`>=`),LT:new t._Code(`<`),LTE:new t._Code(`<=`),EQ:new t._Code(`===`),NEQ:new t._Code(`!==`),NOT:new t._Code(`!`),OR:new t._Code(`||`),AND:new t._Code(`&&`),ADD:new t._Code(`+`)};var a=class{optimizeNodes(){return this}optimizeNames(e,t){return this}},o=class extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let r=e?n.varKinds.var:this.varKind,i=this.rhs===void 0?``:` = ${this.rhs}`;return`${r} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&=k(this.rhs,e,t),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},s=class extends a{constructor(e,t,n){super(),this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof t.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=k(this.rhs,e,n),this}get names(){return O(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends s{constructor(e,t,n,r){super(e,n,r),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},l=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},u=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:``};`+e}},d=class extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},f=class extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=k(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},p=class extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),``)}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let n=e[t].optimizeNodes();Array.isArray(n)?e.splice(t,1,...n):n?e[t]=n:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,r=n.length;for(;r--;){let i=n[r];i.optimizeNames(e,t)||(A(e,i.names),n.splice(r,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>D(e,t.names),{})}},m=class extends p{render(e){return`{`+e._n+super.render(e)+`}`+e._n}},h=class extends p{},g=class extends m{};g.kind=`else`;var _=class e extends m{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+=`else `+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let n=this.else;if(n){let e=n.optimizeNodes();n=this.else=Array.isArray(e)?new g(e):e}if(n)return t===!1?n instanceof e?n:n.nodes:this.nodes.length?this:new e(j(t),n instanceof e?[n]:n.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(e,t){if(this.else=this.else?.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=k(this.condition,e,t),this}get names(){let e=super.names;return O(e,this.condition),this.else&&D(e,this.else.names),e}};_.kind=`if`;var v=class extends m{};v.kind=`for`;var y=class extends v{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=k(this.iteration,e,t),this}get names(){return D(super.names,this.iteration.names)}},b=class extends v{constructor(e,t,n,r){super(),this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?n.varKinds.var:this.varKind,{name:r,from:i,to:a}=this;return`for(${t} ${r}=${i}; ${r}<${a}; ${r}++)`+super.render(e)}get names(){return O(O(super.names,this.from),this.to)}},x=class extends v{constructor(e,t,n,r){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=r}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=k(this.iterable,e,t),this}get names(){return D(super.names,this.iterable.names)}},S=class extends m{constructor(e,t,n){super(),this.name=e,this.args=t,this.async=n}render(e){return`${this.async?`async `:``}function ${this.name}(${this.args})`+super.render(e)}};S.kind=`func`;var C=class extends p{render(e){return`return `+super.render(e)}};C.kind=`return`;var w=class extends m{render(e){let t=`try`+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)==null||e.optimizeNodes(),(t=this.finally)==null||t.optimizeNodes(),this}optimizeNames(e,t){var n,r;return super.optimizeNames(e,t),(n=this.catch)==null||n.optimizeNames(e,t),(r=this.finally)==null||r.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&D(e,this.catch.names),this.finally&&D(e,this.finally.names),e}},T=class extends m{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};T.kind=`catch`;var E=class extends m{render(e){return`finally`+super.render(e)}};E.kind=`finally`,e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
|
|
51
51
|
`:``},this._extScope=e,this._scope=new n.Scope({parent:e}),this._nodes=[new h]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,n,r){let i=this._scope.toName(t);return n!==void 0&&r&&(this._constants[i.str]=n),this._leafNode(new o(e,i,n)),i}const(e,t,r){return this._def(n.varKinds.const,e,t,r)}let(e,t,r){return this._def(n.varKinds.let,e,t,r)}var(e,t,r){return this._def(n.varKinds.var,e,t,r)}assign(e,t,n){return this._leafNode(new s(e,t,n))}add(t,n){return this._leafNode(new c(t,e.operators.ADD,n))}code(e){return typeof e==`function`?e():e!==t.nil&&this._leafNode(new f(e)),this}object(...e){let n=[`{`];for(let[r,i]of e)n.length>1&&n.push(`,`),n.push(r),(r!==i||this.opts.es5)&&(n.push(`:`),(0,t.addCodeArg)(n,i));return n.push(`}`),new t._Code(n)}if(e,t,n){if(this._blockNode(new _(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)throw Error(`CodeGen: "else" body without "then" body`);return this}elseIf(e){return this._elseNode(new _(e))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(_,g)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new y(e),t)}forRange(e,t,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.let){let o=this._scope.toName(e);return this._for(new b(a,o,t,r),()=>i(o))}forOf(e,r,i,a=n.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let e=r instanceof t.Name?r:this.var(`_arr`,r);return this.forRange(`_i`,0,(0,t._)`${e}.length`,n=>{this.var(o,(0,t._)`${e}[${n}]`),i(o)})}return this._for(new x(`of`,a,o,r),()=>i(o))}forIn(e,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,t._)`Object.keys(${r})`,i);let o=this._scope.toName(e);return this._for(new x(`in`,a,o,r),()=>i(o))}endFor(){return this._endBlockNode(v)}label(e){return this._leafNode(new l(e))}break(e){return this._leafNode(new u(e))}return(e){let t=new C;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error(`CodeGen: "return" should have one node`);return this._endBlockNode(C)}try(e,t,n){if(!t&&!n)throw Error(`CodeGen: "try" without "catch" and "finally"`);let r=new w;if(this._blockNode(r),this.code(e),t){let e=this.name(`e`);this._currNode=r.catch=new T(e),t(e)}return n&&(this._currNode=r.finally=new E,this.code(n)),this._endBlockNode(T,E)}throw(e){return this._leafNode(new d(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error(`CodeGen: not in self-balancing block`);let n=this._nodes.length-t;if(n<0||e!==void 0&&n!==e)throw Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=t,this}func(e,n=t.nil,r,i){return this._blockNode(new S(e,n,r)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(S)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let n=this._currNode;if(n instanceof e||t&&n instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof _))throw Error(`CodeGen: "else" without "if"`);return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}};function D(e,t){for(let n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function O(e,n){return n instanceof t._CodeOrName?D(e,n.names):e}function k(e,n,r){if(e instanceof t.Name)return i(e);if(!a(e))return e;return new t._Code(e._items.reduce((e,n)=>(n instanceof t.Name&&(n=i(n)),n instanceof t._Code?e.push(...n._items):e.push(n),e),[]));function i(e){let t=r[e.str];return t===void 0||n[e.str]!==1?e:(delete n[e.str],t)}function a(e){return e instanceof t._Code&&e._items.some(e=>e instanceof t.Name&&n[e.str]===1&&r[e.str]!==void 0)}}function A(e,t){for(let n in t)e[n]=(e[n]||0)-(t[n]||0)}function j(e){return typeof e==`boolean`||typeof e==`number`||e===null?!e:(0,t._)`!${L(e)}`}e.not=j;var M=I(e.operators.AND);function N(...e){return e.reduce(M)}e.and=N;var P=I(e.operators.OR);function F(...e){return e.reduce(P)}e.or=F;function I(e){return(n,r)=>n===t.nil?r:r===t.nil?n:(0,t._)`${L(n)} ${e} ${L(r)}`}function L(e){return e instanceof t.Name?e:(0,t._)`(${e})`}})),SC=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;var t=xC(),n=yC();function r(e){let t={};for(let n of e)t[n]=!0;return t}e.toHash=r;function i(e,t){return typeof t==`boolean`?t:Object.keys(t).length===0?!0:(a(e,t),!o(t,e.self.RULES.all))}e.alwaysValidSchema=i;function a(e,t=e.schema){let{opts:n,self:r}=e;if(!n.strictSchema||typeof t==`boolean`)return;let i=r.RULES.keywords;for(let n in t)i[n]||x(e,`unknown keyword: "${n}"`)}e.checkUnknownRules=a;function o(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(t[n])return!0;return!1}e.schemaHasRules=o;function s(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(n!==`$ref`&&t.all[n])return!0;return!1}e.schemaHasRulesButRef=s;function c({topSchemaRef:e,schemaPath:n},r,i,a){if(!a){if(typeof r==`number`||typeof r==`boolean`)return r;if(typeof r==`string`)return(0,t._)`${r}`}return(0,t._)`${e}${n}${(0,t.getProperty)(i)}`}e.schemaRefOrVal=c;function l(e){return f(decodeURIComponent(e))}e.unescapeFragment=l;function u(e){return encodeURIComponent(d(e))}e.escapeFragment=u;function d(e){return typeof e==`number`?`${e}`:e.replace(/~/g,`~0`).replace(/\//g,`~1`)}e.escapeJsonPointer=d;function f(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}e.unescapeJsonPointer=f;function p(e,t){if(Array.isArray(e))for(let n of e)t(n);else t(e)}e.eachItem=p;function m({mergeNames:e,mergeToName:n,mergeValues:r,resultToName:i}){return(a,o,s,c)=>{let l=s===void 0?o:s instanceof t.Name?(o instanceof t.Name?e(a,o,s):n(a,o,s),s):o instanceof t.Name?(n(a,s,o),o):r(o,s);return c===t.Name&&!(l instanceof t.Name)?i(a,l):l}}e.mergeEvaluated={props:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>{e.if((0,t._)`${n} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,t._)`${r} || {}`).code((0,t._)`Object.assign(${r}, ${n})`))}),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>{n===!0?e.assign(r,!0):(e.assign(r,(0,t._)`${r} || {}`),g(e,r,n))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:h}),items:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>e.assign(r,(0,t._)`${n} === true ? true : ${r} > ${n} ? ${r} : ${n}`)),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>e.assign(r,n===!0?!0:(0,t._)`${r} > ${n} ? ${r} : ${n}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var(`items`,t)})};function h(e,n){if(n===!0)return e.var(`props`,!0);let r=e.var(`props`,(0,t._)`{}`);return n!==void 0&&g(e,r,n),r}e.evaluatedPropsToName=h;function g(e,n,r){Object.keys(r).forEach(r=>e.assign((0,t._)`${n}${(0,t.getProperty)(r)}`,!0))}e.setEvaluated=g;var _={};function v(e,t){return e.scopeValue(`func`,{ref:t,code:_[t.code]||(_[t.code]=new n._Code(t.code))})}e.useFunc=v;var y;(function(e){e[e.Num=0]=`Num`,e[e.Str=1]=`Str`})(y||(e.Type=y={}));function b(e,n,r){if(e instanceof t.Name){let i=n===y.Num;return r?i?(0,t._)`"[" + ${e} + "]"`:(0,t._)`"['" + ${e} + "']"`:i?(0,t._)`"/" + ${e}`:(0,t._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,t.getProperty)(e).toString():`/`+d(e)}e.getErrorPath=b;function x(e,t,n=e.opts.strictSchema){if(n){if(t=`strict mode: ${t}`,n===!0)throw Error(t);e.self.logger.warn(t)}}e.checkStrictMode=x})),CC=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=xC();e.default={data:new t.Name(`data`),valCxt:new t.Name(`valCxt`),instancePath:new t.Name(`instancePath`),parentData:new t.Name(`parentData`),parentDataProperty:new t.Name(`parentDataProperty`),rootData:new t.Name(`rootData`),dynamicAnchors:new t.Name(`dynamicAnchors`),vErrors:new t.Name(`vErrors`),errors:new t.Name(`errors`),this:new t.Name(`this`),self:new t.Name(`self`),scope:new t.Name(`scope`),json:new t.Name(`json`),jsonPos:new t.Name(`jsonPos`),jsonLen:new t.Name(`jsonLen`),jsonPart:new t.Name(`jsonPart`)}})),wC=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;var t=xC(),n=SC(),r=CC();e.keywordError={message:({keyword:e})=>(0,t.str)`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:n})=>n?(0,t.str)`"${e}" keyword must be ${n} ($data)`:(0,t.str)`"${e}" keyword is invalid ($data)`};function i(n,r=e.keywordError,i,a){let{it:o}=n,{gen:s,compositeRule:u,allErrors:f}=o,p=d(n,r,i);a??(u||f)?c(s,p):l(o,(0,t._)`[${p}]`)}e.reportError=i;function a(t,n=e.keywordError,i){let{it:a}=t,{gen:o,compositeRule:s,allErrors:u}=a;c(o,d(t,n,i)),s||u||l(a,r.default.vErrors)}e.reportExtraError=a;function o(e,n){e.assign(r.default.errors,n),e.if((0,t._)`${r.default.vErrors} !== null`,()=>e.if(n,()=>e.assign((0,t._)`${r.default.vErrors}.length`,n),()=>e.assign(r.default.vErrors,null)))}e.resetErrorsCount=o;function s({gen:e,keyword:n,schemaValue:i,data:a,errsCount:o,it:s}){if(o===void 0)throw Error(`ajv implementation error`);let c=e.name(`err`);e.forRange(`i`,o,r.default.errors,o=>{e.const(c,(0,t._)`${r.default.vErrors}[${o}]`),e.if((0,t._)`${c}.instancePath === undefined`,()=>e.assign((0,t._)`${c}.instancePath`,(0,t.strConcat)(r.default.instancePath,s.errorPath))),e.assign((0,t._)`${c}.schemaPath`,(0,t.str)`${s.errSchemaPath}/${n}`),s.opts.verbose&&(e.assign((0,t._)`${c}.schema`,i),e.assign((0,t._)`${c}.data`,a))})}e.extendErrors=s;function c(e,n){let i=e.const(`err`,n);e.if((0,t._)`${r.default.vErrors} === null`,()=>e.assign(r.default.vErrors,(0,t._)`[${i}]`),(0,t._)`${r.default.vErrors}.push(${i})`),e.code((0,t._)`${r.default.errors}++`)}function l(e,n){let{gen:r,validateName:i,schemaEnv:a}=e;a.$async?r.throw((0,t._)`new ${e.ValidationError}(${n})`):(r.assign((0,t._)`${i}.errors`,n),r.return(!1))}var u={keyword:new t.Name(`keyword`),schemaPath:new t.Name(`schemaPath`),params:new t.Name(`params`),propertyName:new t.Name(`propertyName`),message:new t.Name(`message`),schema:new t.Name(`schema`),parentSchema:new t.Name(`parentSchema`)};function d(e,n,r){let{createErrors:i}=e.it;return i===!1?(0,t._)`{}`:f(e,n,r)}function f(e,t,n={}){let{gen:r,it:i}=e,a=[p(i,n),m(e,n)];return h(e,t,a),r.object(...a)}function p({errorPath:e},{instancePath:i}){let a=i?(0,t.str)`${e}${(0,n.getErrorPath)(i,n.Type.Str)}`:e;return[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,a)]}function m({keyword:e,it:{errSchemaPath:r}},{schemaPath:i,parentSchema:a}){let o=a?r:(0,t.str)`${r}/${e}`;return i&&(o=(0,t.str)`${o}${(0,n.getErrorPath)(i,n.Type.Str)}`),[u.schemaPath,o]}function h(e,{params:n,message:i},a){let{keyword:o,data:s,schemaValue:c,it:l}=e,{opts:d,propertyName:f,topSchemaRef:p,schemaPath:m}=l;a.push([u.keyword,o],[u.params,typeof n==`function`?n(e):n||(0,t._)`{}`]),d.messages&&a.push([u.message,typeof i==`function`?i(e):i]),d.verbose&&a.push([u.schema,c],[u.parentSchema,(0,t._)`${p}${m}`],[r.default.data,s]),f&&a.push([u.propertyName,f])}})),TC=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;var t=wC(),n=xC(),r=CC(),i={message:`boolean schema is false`};function a(e){let{gen:t,schema:i,validateName:a}=e;i===!1?s(e,!1):typeof i==`object`&&i.$async===!0?t.return(r.default.data):(t.assign((0,n._)`${a}.errors`,null),t.return(!0))}e.topBoolOrEmptySchema=a;function o(e,t){let{gen:n,schema:r}=e;r===!1?(n.var(t,!1),s(e)):n.var(t,!0)}e.boolOrEmptySchema=o;function s(e,n){let{gen:r,data:a}=e,o={gen:r,keyword:`false schema`,data:a,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,t.reportError)(o,i,void 0,n)}})),EC=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getRules=e.isJSONType=void 0;var t=new Set([`string`,`number`,`integer`,`boolean`,`null`,`object`,`array`]);function n(e){return typeof e==`string`&&t.has(e)}e.isJSONType=n;function r(){let e={number:{type:`number`,rules:[]},string:{type:`string`,rules:[]},array:{type:`array`,rules:[]},object:{type:`object`,rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=r})),DC=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:e,self:t},r){let i=t.RULES.types[r];return i&&i!==!0&&n(e,i)}e.schemaHasRulesForType=t;function n(e,t){return t.rules.some(t=>r(e,t))}e.shouldUseGroup=n;function r(e,t){return e[t.keyword]!==void 0||t.definition.implements?.some(t=>e[t]!==void 0)}e.shouldUseRule=r})),OC=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;var t=EC(),n=DC(),r=wC(),i=xC(),a=SC(),o;(function(e){e[e.Correct=0]=`Correct`,e[e.Wrong=1]=`Wrong`})(o||(e.DataType=o={}));function s(e){let t=c(e.type);if(t.includes(`null`)){if(e.nullable===!1)throw Error(`type: null contradicts nullable: false`)}else{if(!t.length&&e.nullable!==void 0)throw Error(`"nullable" cannot be used without "type"`);e.nullable===!0&&t.push(`null`)}return t}e.getSchemaTypes=s;function c(e){let n=Array.isArray(e)?e:e?[e]:[];if(n.every(t.isJSONType))return n;throw Error(`type must be JSONType or JSONType[]: `+n.join(`,`))}e.getJSONTypes=c;function l(e,t){let{gen:r,data:i,opts:a}=e,s=d(t,a.coerceTypes),c=t.length>0&&!(s.length===0&&t.length===1&&(0,n.schemaHasRulesForType)(e,t[0]));if(c){let n=h(t,i,a.strictNumbers,o.Wrong);r.if(n,()=>{s.length?f(e,t,s):_(e)})}return c}e.coerceAndCheckDataType=l;var u=new Set([`string`,`number`,`integer`,`boolean`,`null`]);function d(e,t){return t?e.filter(e=>u.has(e)||t===`array`&&e===`array`):[]}function f(e,t,n){let{gen:r,data:a,opts:o}=e,s=r.let(`dataType`,(0,i._)`typeof ${a}`),c=r.let(`coerced`,(0,i._)`undefined`);o.coerceTypes===`array`&&r.if((0,i._)`${s} == 'object' && Array.isArray(${a}) && ${a}.length == 1`,()=>r.assign(a,(0,i._)`${a}[0]`).assign(s,(0,i._)`typeof ${a}`).if(h(t,a,o.strictNumbers),()=>r.assign(c,a))),r.if((0,i._)`${c} !== undefined`);for(let e of n)(u.has(e)||e===`array`&&o.coerceTypes===`array`)&&l(e);r.else(),_(e),r.endIf(),r.if((0,i._)`${c} !== undefined`,()=>{r.assign(a,c),p(e,c)});function l(e){switch(e){case`string`:r.elseIf((0,i._)`${s} == "number" || ${s} == "boolean"`).assign(c,(0,i._)`"" + ${a}`).elseIf((0,i._)`${a} === null`).assign(c,(0,i._)`""`);return;case`number`:r.elseIf((0,i._)`${s} == "boolean" || ${a} === null
|
|
52
52
|
|| (${s} == "string" && ${a} && ${a} == +${a})`).assign(c,(0,i._)`+${a}`);return;case`integer`:r.elseIf((0,i._)`${s} === "boolean" || ${a} === null
|
|
53
53
|
|| (${s} === "string" && ${a} && ${a} == +${a} && !(${a} % 1))`).assign(c,(0,i._)`+${a}`);return;case`boolean`:r.elseIf((0,i._)`${a} === "false" || ${a} === 0 || ${a} === null`).assign(c,!1).elseIf((0,i._)`${a} === "true" || ${a} === 1`).assign(c,!0);return;case`null`:r.elseIf((0,i._)`${a} === "" || ${a} === 0 || ${a} === false`),r.assign(c,null);return;case`array`:r.elseIf((0,i._)`${s} === "string" || ${s} === "number"
|